/* ============================================================
   ChargeNaturalist — new chrome
   Map-first layout: header → toolbar → full-bleed map → footer.
   Station panel slides in over the map. Sidebar is gone; filters
   live in chips above the map. Naturalist-leaning palette;
   iNat colors for the dots.
   ============================================================ */

:root {
  --bg: #faf8f1;
  --bg-elev: #ffffff;
  --bg-panel: #f3efe2;
  --ink: #1f2519;
  --ink-soft: #4a5240;
  --ink-faint: #606857;  /* darkened from #7a8270 to clear WCAG AA 4.5:1 on --bg/--bg-panel */
  --line: #d8d3c1;
  --line-soft: #ebe7d8;
  --accent: #2d3a1f;
  --accent-soft: #5b7237;
  --accent-bright: #a8d96b;
  --warning: #c6791e;
  --charger: #e85a3a;

  --inat-plants: #73AC13;
  --inat-inverts: #FF4500;
  --inat-verts: #1E90FF;
  --inat-fungi: #FF1493;
  --inat-other: #691776;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(31, 37, 25, 0.08), 0 2px 6px rgba(31, 37, 25, 0.06);
  --shadow-md: 0 2px 6px rgba(31, 37, 25, 0.10), 0 8px 20px rgba(31, 37, 25, 0.08);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Courier New", monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
body.page-about { display: block; }

a { color: var(--accent-soft); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Header ---------- */

.app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  z-index: 500;
  position: relative;
  flex: 0 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; flex: 0 0 auto; }
.brand:hover { text-decoration: none; }
.brand-icon { display: inline-flex; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 700; font-size: 17px; color: var(--accent); }
.brand-tag { font-size: 11px; color: var(--ink-faint); margin-top: 2px; }

.search { flex: 1 1 420px; max-width: 520px; position: relative; }
.search input[type="search"] {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--bg); font-size: 14px; color: var(--ink);
}
.search input[type="search"]:focus {
  outline: none; border-color: var(--accent-soft);
  background: var(--bg-elev);
  box-shadow: 0 0 0 3px rgba(91, 114, 55, 0.15);
}

.search-suggestions {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin: 0; padding: 4px 0; list-style: none;
  max-height: 320px; overflow-y: auto;
  box-shadow: var(--shadow-md); z-index: 1000;
}
.search-suggestions li { padding: 8px 14px; cursor: pointer; font-size: 14px; }
.search-suggestions li:hover, .search-suggestions li.active { background: var(--line-soft); }
.search-suggestions li .sub { display: block; font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.search-suggestions li.search-msg { cursor: default; color: var(--ink-soft); font-style: italic; }
.search-suggestions li.search-msg:hover { background: none; }

.header-nav { display: flex; gap: 14px; flex: 0 0 auto; align-items: center; }
.header-nav a, .header-nav .nav-btn { font-size: 14px; color: var(--ink-soft); }
.header-nav a:hover, .header-nav .nav-btn:hover { color: var(--accent); }
.nav-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

/* ---------- Toolbar (filter chips + map controls) ---------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  z-index: 480;
  flex: 0 0 auto;
}

.vibe-filters { display: flex; gap: 6px; flex-wrap: wrap; flex: 1 1 auto; }
.vibe-filter {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.vibe-filter:hover { border-color: var(--accent-soft); color: var(--accent); }
.vibe-filter.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.toolbar-right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.toolbar-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--ink-soft);
  cursor: pointer;
}
.toolbar-toggle input { accent-color: var(--accent); }

.units-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-elev);
}
.units-btn {
  border: none;
  background: transparent;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
}
.units-btn:hover { color: var(--accent); }
.units-btn[aria-pressed="true"] {
  background: var(--accent);
  color: white;
}
.units-btn[aria-pressed="true"]:hover { color: white; }

.dropdown { position: relative; }
.dropdown-trigger {
  border: 1px solid var(--line); background: var(--bg-elev);
  border-radius: var(--radius-sm);
  padding: 6px 12px; font-size: 13px; color: var(--ink);
  display: inline-flex; align-items: center; gap: 5px;
}
.dropdown-trigger:hover { border-color: var(--accent-soft); }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 4px);
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  padding: 4px 0; list-style: none; margin: 0;
  min-width: 140px; z-index: 600;
}
.dropdown-menu li { padding: 0; }
.dropdown-menu label {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; font-size: 13px; cursor: pointer;
}
.dropdown-menu label:hover { background: var(--line-soft); }

.icon-btn {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 6px 8px;
  color: var(--ink-soft);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { border-color: var(--accent-soft); color: var(--accent); }

/* ---------- Map area ---------- */

.map-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 480px;
  min-width: 0;
  overflow: hidden;
}

#map { position: absolute; inset: 0; background: #cfd5c2; }

/* Top-RIGHT: stays clear of Leaflet's zoom buttons (top-left) and the
   floating legend (bottom-left). Solid background + dark border ring
   so light text stays readable over bright sand / snow satellite tiles. */
.map-status {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #ffffff;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 0, 0, 0.15);
  font-size: 12px;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  pointer-events: none;
  z-index: 400;
  white-space: nowrap;
  max-width: calc(100% - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-status:empty { display: none; }
.map-status.error {
  color: #8a2a2a;
  border-left: 3px solid var(--warning);
  font-weight: 500;
}
.map-status.info { color: var(--accent); }

/* Legend floats over the map bottom-left. Solid background + ring for
   contrast over bright satellite tiles. */
.map-legend {
  position: absolute;
  bottom: 24px;
  left: 12px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: var(--radius-md);
  padding: 10px 12px 8px;
  font-size: 12px;
  z-index: 401;
  box-shadow: var(--shadow-sm);
  max-width: 220px;
}
.map-legend h4 {
  margin: 0 0 6px 0;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  font-weight: 600;
}
.map-legend ul { margin: 0; padding: 0; list-style: none; }
.map-legend li {
  display: block;
  padding: 0;
}
.map-legend .legend-sep {
  margin-top: 4px; padding-top: 4px;
  border-top: 1px solid var(--line-soft);
}
.legend-toggle {
  background: none;
  border: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 6px;
  margin: -3px -6px;
  border-radius: 4px;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  transition: background 0.12s, color 0.12s, opacity 0.12s;
}
.legend-toggle:hover { background: var(--line-soft); }
.legend-toggle[aria-pressed="false"] {
  color: var(--ink-faint);
  text-decoration: line-through;
  opacity: 0.6;
}
.legend-toggle[aria-pressed="false"] .dot,
.legend-toggle[aria-pressed="false"] .charger-pin {
  filter: grayscale(1);
  opacity: 0.5;
}

.dot {
  display: inline-block;
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 1.5px solid white;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
  flex: 0 0 auto;
}
.dot-plants { background: var(--inat-plants); }
.dot-inverts { background: var(--inat-inverts); }
.dot-verts { background: var(--inat-verts); }
.dot-fungi { background: var(--inat-fungi); }
.dot-other { background: var(--inat-other); }

.charger-pin {
  display: inline-block;
  width: 11px; height: 14px;
  background: var(--charger);
  border: 1.5px solid white;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
  flex: 0 0 auto;
}

/* ---------- Charger marker pin ---------- */

.cn-charger-marker {
  width: 30px; height: 38px;
  position: relative;
  cursor: pointer;
}
.cn-charger-marker svg { display: block; }
.cn-vibe-badge {
  position: absolute;
  top: -4px; right: -6px;
  font-size: 12px;
  background: #fff;
  padding: 1px 4px;
  border-radius: 8px;
  min-width: 18px;
  text-align: center;
  border: 1.5px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  line-height: 1.2;
}
.cn-vibe-badge.pending {
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 600;
  background: var(--bg-panel);
}

/* ---------- Amenity markers + legend chip ---------- */

.cn-amenity-marker {
  background: none;
  border: none;
}
.cn-amenity-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  background: white;
  border-radius: 50%;
  font-size: 13px;
  line-height: 1;
  border: 2px solid #777;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.cn-amenity-icon[data-group="food"] { border-color: #d4773e; }
.cn-amenity-icon[data-group="restrooms"] { border-color: #3d5a80; }
.cn-amenity-icon[data-group="convenience"] { border-color: #d4a548; }

.amenity-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px; height: 14px;
  font-size: 11px;
  line-height: 1;
}

/* ---------- Station panel (slides in over the map) ---------- */

.station-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 100%);
  background: var(--bg-elev);
  border-left: 1px solid var(--line);
  box-shadow: -4px 0 20px rgba(31, 37, 25, 0.10);
  overflow-y: auto;
  z-index: 500;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.station-panel.open { transform: translateX(0); }

.panel-close {
  position: sticky;
  top: 8px;
  margin: 8px 12px 0 auto;
  display: block;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--line);
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-soft);
  z-index: 10;
}
.panel-close:hover { background: var(--ink); color: white; border-color: var(--ink); }

.panel-body { padding: 0 20px 24px; }

.panel-body h2 {
  margin: -22px 0 4px 0;
  font-size: 22px;
  line-height: 1.2;
  color: var(--accent);
  padding-right: 36px; /* keep clear of close button */
}
.station-address {
  font-size: 13px; color: var(--ink-soft);
  margin: 0 0 8px 0;
}

.vibes-loading {
  margin: 8px 0 6px 0;
  font-size: 14px;
  color: var(--ink-soft);
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 8px;
}
.vibes-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 0 0 10px 0;
}
.vibe-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-panel);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink);
}
.vibe-emoji { font-size: 15px; line-height: 1; }

.station-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px 0; }
.station-meta .chip {
  background: var(--line-soft);
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 12px;
}
.station-meta .chip.operator { background: var(--accent); color: white; }
.station-meta:empty { display: none; }

.panel-section { margin: 18px 0; }
.panel-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin: 0 0 10px 0;
  font-weight: 700;
}

/* ---------- Photo grid (what to look for) ---------- */

.species-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.species-card-big {
  text-align: center;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.species-card-big:hover { text-decoration: none; }
.species-card-big:hover .species-photo { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.species-photo {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 3px solid white;
  outline: 1px solid var(--line);
  background: var(--line-soft);
  transition: transform 0.15s, box-shadow 0.15s;
}
.species-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.species-name { display: flex; flex-direction: column; gap: 1px; line-height: 1.2; }
.species-name .common { font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.species-name .sci { font-style: italic; font-size: 10px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.species-name .count { font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint); }

/* ---------- Walk plan ---------- */

.walk-plan { margin-bottom: 4px; }
.walk-line {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg-panel);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; gap: 10px;
}
.walk-arrow { font-size: 18px; color: var(--charger); line-height: 1; }
.empty-note { font-size: 13px; color: var(--ink-faint); margin: 0 0 8px 0; }

/* ---------- Radius slider ---------- */

.radius-section { margin-top: 8px; }
.radius-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  font-weight: 700;
  margin-bottom: 6px;
}
.radius-label output {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
#radius-slider {
  width: 100%;
  accent-color: var(--charger);
  margin: 0;
}
.radius-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 2px;
}
.link-btn {
  background: none;
  border: none;
  padding: 4px 0;
  font-size: 12px;
  color: var(--accent-soft);
  cursor: pointer;
  font-family: inherit;
}
.link-btn:hover { color: var(--accent); text-decoration: underline; }
.radius-hint { font-variant-numeric: tabular-nums; }
/* ---------- Seasonal toggle ("this time of year") ---------- */

.season-toggle {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  line-height: 1.35;
}
.season-toggle input { accent-color: var(--charger); margin-top: 2px; flex: 0 0 auto; }
.season-window {
  display: block;
  font-size: 11px;
  color: var(--ink-faint);
}

/* ---------- Observation click-popup ---------- */

.obs-popup-wrap .leaflet-popup-content { margin: 0; }
.obs-popup-wrap .leaflet-popup-content-wrapper { padding: 0; border-radius: var(--radius-md); overflow: hidden; }
.obs-popup {
  display: flex;
  gap: 10px;
  padding: 10px;
  font-size: 13px;
  color: var(--ink);
  min-width: 220px;
  align-items: flex-start;
}
.obs-popup.loading, .obs-popup.empty, .obs-popup.error {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--ink-soft);
  text-align: center;
}
.obs-popup.loading .spinner { margin-right: 8px; }
.obs-popup.error { color: var(--warning); }
.obs-photo {
  flex: 0 0 64px;
  display: block;
  width: 64px; height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2.5px solid white;
  outline: 1px solid var(--line);
}
.obs-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.obs-body { flex: 1 1 auto; min-width: 0; }
.obs-common {
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.2;
  display: block;
}
.obs-common:hover { color: var(--accent); text-decoration: underline; }
.obs-sci {
  font-style: italic;
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 1px;
}
.obs-meta {
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 6px;
}
.obs-meta a { color: var(--accent-soft); }
.obs-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: var(--ink-faint);
}
.obs-dist { font-family: var(--font-mono); }
.obs-more { color: var(--accent-soft); }

/* ---------- Panel actions + collapsible details ---------- */

.panel-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  margin: 16px 0;
}
.btn {
  display: block;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--ink);
  text-align: center;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}
.btn:hover { background: var(--accent); color: white; border-color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-soft); border-color: var(--accent-soft); }

.charger-details {
  margin-top: 18px;
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
  font-size: 13px;
  color: var(--ink-soft);
}
.charger-details summary {
  cursor: pointer;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  font-weight: 600;
  list-style: none;
}
.charger-details summary::-webkit-details-marker { display: none; }
.charger-details summary::before { content: "▸ "; }
.charger-details[open] summary::before { content: "▾ "; }
.charger-details-body { padding-top: 8px; }
.kv-list { margin: 0; padding: 0; list-style: none; }
.kv-list li { padding: 2px 0; }
.kv-label { margin: 8px 0 2px 0; font-size: 12px; color: var(--ink-faint); }
.plugs { margin: 0; padding-left: 18px; }

/* ---------- Loading + errors ---------- */

.score-loading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  color: var(--ink-faint);
  font-size: 13px;
}
.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-box {
  background: #fbeede;
  border: 1px solid var(--warning);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin: 8px 0;
}

/* ---------- Route planner panel ---------- */

.route-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 100%);
  background: var(--bg-elev);
  border-left: 1px solid var(--line);
  box-shadow: -4px 0 20px rgba(31, 37, 25, 0.10);
  overflow-y: auto;
  z-index: 510;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.route-panel.open { transform: translateX(0); }

.route-panel-body { padding: 8px 20px 24px; }
.route-panel-body h2 {
  margin: 0 0 4px 0;
  font-size: 22px;
  color: var(--accent);
  padding-right: 36px;
}
.route-intro {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 14px 0;
}
.route-field {
  display: block;
  margin-bottom: 10px;
  position: relative;
}
.route-field > span {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin-bottom: 4px;
  font-weight: 600;
}
.route-field input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--bg);
}
.route-field input:focus {
  outline: none;
  border-color: var(--accent-soft);
  background: var(--bg-elev);
}
.route-status {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 10px 0;
}
.route-results { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.route-result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 12px;
  background: var(--bg-panel);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.route-result:hover { border-color: var(--accent-soft); background: var(--bg-elev); }
.route-result-name { font-weight: 600; color: var(--ink); font-size: 14px; }
.route-result-meta {
  font-size: 12px;
  color: var(--ink-faint);
  display: flex;
  gap: 10px;
  width: 100%;
  justify-content: space-between;
}
.route-result-vibes { color: var(--accent-soft); font-style: italic; }
.route-note { font-size: 11px; color: var(--ink-faint); margin-top: 14px; }

/* ---------- Contact dialog ---------- */

.contact-dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  background: var(--bg-elev);
  max-width: 480px;
  width: calc(100% - 32px);
  box-shadow: 0 8px 40px rgba(31, 37, 25, 0.25);
}
.contact-dialog::backdrop { background: rgba(31, 37, 25, 0.35); }
.contact-dialog form { padding: 24px; position: relative; }
.contact-dialog h2 {
  margin: 0 0 4px 0;
  font-size: 22px;
  color: var(--accent);
  padding-right: 36px;
}
.dialog-intro {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 16px 0;
}
.dialog-close {
  position: absolute;
  top: 12px; right: 14px;
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-soft);
}
.dialog-close:hover { background: var(--ink); color: white; }
.dialog-field { display: block; margin-bottom: 10px; }
.dialog-field > span {
  display: block;
  font-size: 12px;
  color: var(--ink-faint);
  margin-bottom: 4px;
  font-weight: 600;
}
.dialog-field input,
.dialog-field select,
.dialog-field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  resize: vertical;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

/* Inline send status under the contact form. */
.dialog-status {
  margin: 10px 0 0 0;
  font-size: 13px;
  min-height: 1.2em;
  color: var(--ink-soft);
}
.dialog-status.success { color: var(--accent-soft); font-weight: 600; }
.dialog-status.error { color: var(--warning); }

/* Honeypot: visually removed but still in the DOM for bots to trip on.
   Not display:none (some bots skip those) — pushed off-screen instead. */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Footer ---------- */

.app-footer {
  flex: 0 0 auto;
  padding: 6px 16px;
  font-size: 11px;
  color: var(--ink-faint);
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
  text-align: center;
}
.app-footer p { margin: 2px 0; }
.app-footer a { color: var(--ink-soft); }
.footer-credit { font-size: 12px; color: var(--ink-soft); }
.footer-credit a {
  color: var(--accent-soft);
  font-weight: 600;
}
.footer-credit a:hover { color: var(--accent); }

/* ---------- About page ---------- */

.page-about { background: var(--bg); }
.prose {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  font-size: 16px;
  line-height: 1.65;
}
.prose h1 { font-size: 32px; color: var(--accent); margin: 0 0 18px; }
.prose h2 { font-size: 22px; color: var(--accent); margin: 32px 0 10px; }
.prose blockquote {
  border-left: 3px solid var(--accent-bright);
  margin: 18px 0; padding: 4px 16px;
  color: var(--ink-soft); font-style: italic;
}
.prose ul { padding-left: 24px; }
.prose ul.taxon-key { list-style: none; padding-left: 0; }
.prose ul.taxon-key li {
  padding: 8px 0; display: flex; gap: 12px; align-items: flex-start;
}
.prose ul.taxon-key li .dot { margin-top: 6px; }
.prose .byline {
  font-size: 14px;
  color: var(--ink-faint);
  margin: -10px 0 24px 0;
  font-style: italic;
}

/* ---------- Donate button (About page) ---------- */

.donate-cta {
  margin: 14px 0 18px 0;
}
.btn-donate {
  display: inline-block;
  padding: 12px 22px;
  background: #009cde; /* PayPal blue */
  color: white;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  box-shadow: 0 2px 6px rgba(0, 156, 222, 0.25);
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
}
.btn-donate:hover {
  background: #0070ba;
  color: white;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 156, 222, 0.35);
}

/* ---------- Mobile ---------- */

@media (max-width: 800px) {
  .app-header { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .brand-tag { display: none; }
  .search { flex: 1 1 100%; order: 3; max-width: none; }

  .toolbar { flex-wrap: wrap; padding: 6px 12px; }
  .vibe-filters { order: 2; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .toolbar-right { order: 1; width: 100%; justify-content: flex-end; }

  /* WCAG-ish 44 px minimum touch targets */
  .vibe-filter,
  .units-btn,
  .icon-btn,
  .nav-btn,
  .panel-close,
  .dialog-close,
  .legend-toggle,
  .dropdown-trigger {
    min-height: 44px;
  }
  .icon-btn,
  .panel-close,
  .dialog-close { min-width: 44px; }
  .vibe-filter { padding: 8px 14px; }

  .station-panel,
  .route-panel {
    width: 100%;
    top: auto;
    height: min(75vh, 600px);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    border-left: none;
    border-top: 1px solid var(--line);
    transform: translateY(100%);
    box-shadow: 0 -4px 20px rgba(31, 37, 25, 0.15);
  }
  .station-panel.open,
  .route-panel.open { transform: translateY(0); }

  /* Legend stays visible but shrinks */
  .map-legend {
    bottom: 12px;
    left: 8px;
    padding: 6px 8px;
    font-size: 11px;
    max-width: 160px;
  }
  .map-legend h4 { font-size: 9px; }
  .species-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 500px) {
  /* Keep nav visible — just shrink the labels */
  .header-nav { gap: 8px; }
  .header-nav a,
  .header-nav .nav-btn { font-size: 12px; }
  .brand-name { font-size: 15px; }
  .vibe-filter { font-size: 12px; padding: 8px 10px; }
  /* Compact units toggle on phones */
  .units-btn { padding: 4px 8px; font-size: 11px; }
}

/* ---------- Reduced motion ----------
   Honor the OS "reduce motion" setting: near-instant transitions and no
   looping animation (the loading spinner included). Leaflet pan/zoom
   animation is disabled separately in JS (see map.js prefersReducedMotion). */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
