html,
body {
  height: 100%;
  margin: 0;
}

#map {
  height: 100%;
}

.banner {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000; /* above Leaflet panes (max ~800) and controls */
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #c0392b;
  color: #fff;
  font-family: system-ui, sans-serif;
  font-size: 14px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.banner.hidden {
  display: none;
}

.banner button {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

/* Segmented base-layer toggle (top-right map control) */
.layer-toggle {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
}

.layer-toggle-button {
  border: none;
  background: transparent;
  padding: 4px 10px;
  font: inherit;
  font-size: 13px;
  border-radius: 4px;
  cursor: pointer;
}

.layer-toggle-button:hover {
  background: #eee;
}

.layer-toggle-button.active {
  background: #2b6cb0;
  color: #fff;
}

/* Sightings overlay: standing attribution note (bottom-right, above zoom) */
.attrib {
  position: absolute;
  bottom: 4px;
  right: 8px;
  z-index: 1000;
  max-width: 60%;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 4px;
  font-family: system-ui, sans-serif;
  font-size: 11px;
  color: #1a2530;
  line-height: 1.3;
}

.attrib a { color: #2b6cb0; }
.sp-degraded { color: #c0392b; }

/* Acoustic marker (age-tinted SVG horn) */
.sighting-acoustic { line-height: 0; }

/* Detail popup */
.sighting-popup { font-family: system-ui, sans-serif; font-size: 12px; color: #1a2530; }
.sighting-popup .sp-species { font-weight: 700; font-size: 13px; }
.sighting-popup .sp-sub { color: #557; margin: 2px 0; }
.sighting-popup .sp-meta { margin: 1px 0; }
.sighting-popup .sp-photo { display: block; width: 100%; max-width: 220px; height: 140px; object-fit: cover; border-radius: 4px; margin: 6px 0; }
.sighting-popup .sp-note { margin: 4px 0; font-style: italic; }
.sighting-popup .sp-attrib { margin-top: 5px; padding-top: 5px; border-top: 1px solid #eee; }
.sighting-popup .sp-license { margin-top: 3px; color: #889; font-size: 10px; }
.sighting-popup .sp-corrob { margin-top: 6px; font-size: 12px; color: #2c7a7b; }
.sp-photo-credit { margin-top: 3px; font-size: 10px; line-height: 1.3; color: #666; }

/* Source filter (bottom-left map control) */
.source-filter {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: system-ui, sans-serif;
  font-size: 12px;
  color: #1a2530;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
}

.source-filter-title { font-weight: 700; margin-bottom: 4px; }
.source-filter-row { display: block; cursor: pointer; }

/* Sighting age legend (bottom-left map control) */
.age-legend {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: system-ui, sans-serif;
  font-size: 11px;
  color: #1a2530;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
}

.age-legend-title { font-weight: 700; margin-bottom: 5px; }
.age-legend-ramp { display: flex; }
.age-legend-item { display: flex; flex-direction: column; align-items: center; width: 32px; }
.age-legend-swatch { width: 15px; height: 15px; border-radius: 50%; }
.age-legend-label { margin-top: 3px; color: #557; }
.age-legend-types { margin-top: 6px; padding-top: 5px; border-top: 1px solid #eee; color: #557; }

/* Popups near the locked top edge open downward instead of clipping.
   The layer re-anchors the popup with `top`; here the tip flips to the top
   edge and points up toward the marker. */
.leaflet-popup.popup-flip-down { margin-bottom: 0; }
.leaflet-popup.popup-flip-down .leaflet-popup-content-wrapper { margin-top: 12px; }
.leaflet-popup.popup-flip-down .leaflet-popup-tip-container {
  top: 0;
  bottom: auto;
  transform: rotate(180deg);
}
/* Leaflet anchors the close "x" at the popup's top:0; the flipped wrapper
   starts 12px lower, so move the button down with it. */
.leaflet-popup.popup-flip-down a.leaflet-popup-close-button { top: 12px; }

/* Popup nudged horizontally to stay in view (left/right edge): drop the tip,
   which would no longer line up with the marker. */
.leaflet-popup.popup-no-tip .leaflet-popup-tip-container { display: none; }
