/* Trout Streams — "survey bureau field instrument".
   Warm paper + spruce ink + ledger numerals: USGS quad meets river journal.
   Data-vis colors (score palette, ownership) are calibrated with the map JS —
   never restyle those. JS-coupled selectors (dual-range, range-pill, map-panel,
   chips, popup-*) keep their names; only their look changes. */

/* ---- type ---- */
@font-face {
  font-family: "Fraunces";
  src: url("/assets/fraunces-600-700-2a0ad122.woff2") format("woff2");
  font-weight: 600 700;
  font-display: swap;
}
@font-face {
  font-family: "Plex Sans";
  src: url("/assets/plex-sans-400-47f20dbf.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Plex Sans";
  src: url("/assets/plex-sans-500-0c85c75a.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Plex Sans";
  src: url("/assets/plex-sans-600-4379d411.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("/assets/plex-mono-400-d13bb5b4.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("/assets/plex-mono-500-deab9c2b.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  --paper: #f3efe3;
  --paper-deep: #ebe5d3;
  --card: #fbf9f1;
  --ink: #26302a;
  --muted: #6e7568;
  --line: #ddd4bd;
  --hairline: #e9e2cf;
  --pine: #1d2b23;
  --pine-soft: #29392f;
  --accent: #2f6f4f;
  --river: #2f6191;
  --ember: #c2410c;
  --brass: #d9c176;
  --brass-ink: #8a6d1f;
  --warning-bg: #f7edd1;
  --warning-ink: #6d5410;
  --shadow-paper: 0 1px 2px rgba(31, 42, 36, 0.07), 0 1px 1px rgba(31, 42, 36, 0.04);
  --shadow-lift: 0 6px 18px rgba(31, 42, 36, 0.14);
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Plex Sans", -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Plex Mono", ui-monospace, "SF Mono", monospace;
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--paper);
  /* faint topographic contours, printed onto the paper */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='560' height='560' viewBox='0 0 560 560'%3E%3Cg fill='none' stroke='%232f6f4f' stroke-opacity='0.05' stroke-width='1.1'%3E%3Cpath d='M70 140c50-52 132-58 178-16s34 108-12 142-128 34-166-6-38-86-0-120z'/%3E%3Cpath d='M92 156c40-40 104-46 140-12s26 84-10 110-100 27-130-4-30-68 0-94z'/%3E%3Cpath d='M116 174c28-28 72-32 98-8s18 58-8 76-70 19-91-3-21-47 1-65z'/%3E%3Cpath d='M388 402c44-36 110-32 142 6s18 92-24 118-108 22-138-12-20-80 20-112z'/%3E%3Cpath d='M406 418c32-26 80-23 104 5s12 66-18 85-79 16-100-9-14-58 14-81z'/%3E%3Cpath d='M426 436c22-18 54-16 70 4s8 44-13 57-53 10-67-7-8-39 10-54z'/%3E%3Cpath d='M420 60c30-22 74-18 96 8s10 62-18 78-72 14-92-8-16-56 14-78z'/%3E%3Cpath d='M60 430c24-20 62-18 80 4s10 52-14 66-60 12-76-6-14-46 10-64z'/%3E%3C/g%3E%3C/svg%3E");
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

::selection { background: #d6e5db; }

:focus-visible {
  outline: 2px solid var(--river);
  outline-offset: 2px;
  border-radius: 2px;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--pine);
}
h1 { font-size: 30px; margin: 0 0 14px; }
h1 small { color: var(--muted); font-family: var(--font-body); font-weight: 400; font-size: 15px; letter-spacing: 0; }
h1 small b { font-family: var(--font-mono); font-weight: 500; color: var(--ink); }
h2 { font-size: 20px; margin: 26px 0 10px; }
a { color: var(--river); text-decoration-color: color-mix(in srgb, var(--river) 36%, transparent); text-underline-offset: 2px; transition: color 0.12s; }
a:hover { color: #1f4a74; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--paper-deep);
  border: 1px solid var(--hairline);
  padding: 1px 5px;
  border-radius: var(--r-sm);
}

/* ---- nav: the ranger-station sign ---- */
.topnav {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 18px;
  height: 50px;
  background: var(--pine);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.08));
  color: #e8ede9;
  position: relative;
  z-index: 20;
  border-bottom: 2px solid var(--brass);
}
.topnav a {
  color: #adbcae;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.12s, border-color 0.12s;
}
.topnav a.active, .topnav a:hover { color: #fff; border-bottom-color: var(--brass); }
/* The mark is one path painted with currentColor, so it takes the nav's ink. */
.topnav .brand {
  display: flex;
  align-items: center;
  color: #f2eee1;
  padding: 0;
  border-bottom: 0;
  margin-right: 8px;
  transition: color 0.12s, opacity 0.12s;
}
.topnav .brand:hover { color: #fff; border-bottom-color: transparent; }
.brand-wordmark { display: block; height: 19px; width: auto; }
.brand-icon { display: none; height: 21px; width: auto; }
.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-user {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #adbcae;
  white-space: nowrap;
}
.nav-user::before { content: "▪ "; color: var(--brass); }
.nav-signout-form { margin: 0; }
.nav-signout {
  white-space: nowrap;
  background: none;
  border: 1px solid rgba(217, 193, 118, 0.4);
  border-radius: var(--r-sm);
  color: #adbcae;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 5px 10px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.nav-signout:hover { color: #fff; border-color: var(--brass); background: rgba(217, 193, 118, 0.12); }
.nav-warning {
  font-size: 12px;
  color: var(--brass);
  cursor: help;
  font-style: italic;
}

.flash {
  padding: 8px 18px;
  background: #e0eee5;
  color: #1d5b38;
  border-bottom: 1px solid #c3ddcd;
  font-size: 14px;
}

.flash-alert { background: #f7e3d6; color: #8a3309; border-bottom-color: #e6c3ac; }

/* ---- sign in: a permit counter, not a product page ---- */
.auth-page {
  display: flex;
  justify-content: center;
  padding: 68px 22px 64px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--brass);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-paper);
  padding: 28px 30px 26px;
}
.auth-card h1 { font-size: 25px; margin-bottom: 6px; }
.auth-lede { color: var(--muted); font-size: 13.5px; margin: 0 0 20px; }
.auth-form { display: grid; gap: 6px; }
.auth-form label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.auth-form label + input { margin-bottom: 12px; }
.auth-form input[type="email"], .auth-form input[type="password"] {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 15px;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  width: 100%;
}
.auth-form input[type="email"]:focus, .auth-form input[type="password"]:focus {
  border-color: var(--accent);
  background: #fff;
}
.auth-form input[type="submit"] {
  margin-top: 6px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 11px 18px;
  transition: background 0.12s;
}
.auth-form input[type="submit"]:hover { background: #285f43; }
.auth-form input[type="submit"]:active { transform: translateY(1px); }
.auth-aside { margin: 18px 0 0; font-size: 13px; text-align: center; }

/* ---- map page ---- */
.map-page { overflow: hidden; }
body.map-page { height: 100dvh; display: flex; flex-direction: column; }
.map-page .map-wrap { flex: 1; height: auto; min-height: 0; }
.map-wrap { position: relative; height: calc(100vh - 50px); }
#map { position: absolute; inset: 0; }
.empty-map {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
}
.empty-map h2 { font-size: 24px; }

.map-panel {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 224px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lift);
  padding: 12px 14px;
  font-size: 13px;
  z-index: 10;
  /* Never run off the bottom of a short window — scroll the panel instead. */
  max-height: calc(100% - 28px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* Rules go on top of each following section, not under each one — a hidden
   trailing section (the ownership legend) would otherwise leave a stray divider
   and a band of dead space at the foot of the panel. */
.panel-section + .panel-section { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--hairline); }
.panel-section strong {
  display: block;
  margin-bottom: 5px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--brass-ink);
}
.panel-section label { display: block; cursor: pointer; padding: 1px 0; }
.panel-section input[type="radio"], .panel-section input[type="checkbox"] { accent-color: var(--accent); }
.panel-section select {
  display: block;
  width: 100%;
  margin-top: 5px;
  height: 28px;
  padding: 0 26px 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background-color: var(--paper);
  background-position: right 8px center;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 12px;
  cursor: pointer;
}
.panel-section select:focus { border-color: var(--accent); outline: 0; }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend i { width: 18px; height: 4px; border-radius: 2px; display: inline-block; }
.legend em { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; font-style: italic; }

/* Live GPS, top-centre of the map: the fix (tap to copy the coords for onX) and
   a one-tap pin of the selected feature where you are standing. */
.gps-bar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 8px;
  max-width: calc(100% - 28px);
}
.gps-fix, .gps-log {
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: var(--shadow-lift);
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.gps-fix { font-family: var(--font-mono); min-width: 0; }
.gps-log {
  flex: none;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  color: var(--accent);
  font-family: var(--font-body);
  font-weight: 600;
}
.gps-fix:active, .gps-log:active { background: var(--paper-deep); }
.gps-log:disabled { opacity: 0.6; cursor: default; }

/* Photo picker in the annotations panel — the input itself is never shown.
   Scoped to .panel-section so it outranks the panel's own block-label rule,
   which would otherwise flatten the padding to `1px 0`. */
.panel-section .photo-pick {
  display: inline-block;
  margin-top: 6px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper);
  font-size: 12px;
  cursor: pointer;
}
.panel-section .photo-pick:hover { border-color: var(--accent); color: var(--accent); }
.panel-section .photo-pick input { display: none; }
.photo-status:not(:empty) { display: block; margin-top: 5px; }

/* Field photo inside an annotation popup. */
.popup-photo {
  display: block;
  width: 100%;
  max-height: 180px;
  margin: 6px 0;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
}

.popup-facts { font-size: 12px; margin: 4px 0; border-collapse: collapse; }
.popup-facts td { padding: 1px 8px 1px 0; }
.popup-facts td:last-child { font-family: var(--font-mono); }
.popup-delete {
  margin-top: 8px;
  padding: 3px 10px;
  border: 1px solid #e0b3aa;
  border-radius: var(--r-sm);
  background: #fdf1ef;
  color: #a13c2e;
  font-size: 12px;
  font-family: var(--font-body);
  cursor: pointer;
}
.popup-delete:hover { background: #f9dcd7; }
.popup-warning { background: var(--warning-bg); color: var(--warning-ink); padding: 3px 8px; border-radius: var(--r-sm); font-size: 12px; margin: 4px 0; }
.popup-reasons { margin: 4px 0; font-size: 12px; color: #92400e; }

/* MapLibre chrome, tuned to the paper */
.maplibregl-popup-content {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lift);
  padding: 10px 13px;
  line-height: 1.45;
}
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--card); }
.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: var(--card); }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--card); }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--card); }
.maplibregl-ctrl-group { border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-paper); }

/* ---- page scaffold ---- */
.page { max-width: 1100px; margin: 0 auto; padding: 28px 22px 64px; }

/* ---- form furniture, shared by the filter bar and the review journal ---- */
.field { display: grid; gap: 5px; min-width: 0; }
.field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--brass-ink);
}
.field-label b {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--ink);
}
.text-input, .select-input, .textarea-input {
  width: 100%;
  padding: 0 11px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background-color: var(--card);
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--ink);
  box-shadow: inset 0 1px 2px rgba(31, 42, 36, 0.045);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.textarea-input { height: auto; padding: 8px 11px; line-height: 1.45; resize: vertical; }
.text-input:hover, .select-input:hover, .textarea-input:hover { border-color: #cbbfa2; }
.text-input:focus, .select-input:focus, .textarea-input:focus {
  border-color: var(--accent);
  box-shadow: inset 0 1px 2px rgba(31, 42, 36, 0.045), 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
  outline: 0;
}
.text-input::placeholder, .textarea-input::placeholder { color: #9aa093; }
/* One chevron everywhere, with room to breathe — the native one crowds the edge. */
.select-input, .panel-section select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='7' viewBox='0 0 11 7'%3E%3Cpath d='M1.2 1.2 5.5 5.5 9.8 1.2' fill='none' stroke='%236e7568' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.12s;
}
.toggle:hover { color: var(--ink); }
.toggle input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.btn-primary {
  height: 34px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.12s, transform 0.08s;
}
.btn-primary:hover { background: #285f43; }
.btn-primary:active { transform: translateY(1px); }

/* ---- the filter bar: a survey form header, not a loose row of controls ---- */
.filters {
  margin-bottom: 18px;
  padding: 14px 16px 13px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-paper);
}
.filter-fields {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr 1.05fr 1.05fr;
  gap: 16px 20px;
  align-items: start;
}
.filter-fields .field { gap: 11px; }
/* The scale row hangs straight off the rail, and label + 21px + half a rail puts
   that rail on the 34px inputs' centre line. */
.filter-fields .field-range { gap: 0; }
.filters .dual-range { margin-top: 21px; }
.filter-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 11px;
  border-top: 1px solid var(--hairline);
}
.filter-actions .btn-primary { margin-left: auto; }
@media (max-width: 980px) { .filter-fields { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .filter-fields { grid-template-columns: 1fr; } }

/* ---- the ledger (streams table) ---- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.stream-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-paper);
}
.stream-table th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-weight: 600;
  color: var(--brass-ink);
  padding: 10px 12px 8px;
  border-bottom: 2px solid var(--line);
  background: var(--paper-deep);
}
.stream-table td { padding: 8px 12px; border-bottom: 1px solid var(--hairline); }
.stream-table td:nth-child(n+4) { font-family: var(--font-mono); font-size: 13.5px; white-space: nowrap; }
.stream-table th { white-space: nowrap; }
.stream-table tr:last-child td { border-bottom: 0; }
.stream-table tbody tr { transition: background 0.1s; }
.stream-table tbody tr:hover td { background: #f3f6ee; }
.stream-table a { font-weight: 500; text-decoration: none; }
.stream-table a:hover { text-decoration: underline; }

.score-badge {
  display: inline-block;
  min-width: 36px;
  text-align: center;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  color: #fff;
  font-weight: 500;
  font-family: var(--font-mono);
  font-size: 14px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 1px 2px rgba(31, 42, 36, 0.18);
}

/* ---- stamps (chips) ---- */
.chip {
  display: inline-block;
  background: #e2ede6;
  color: #1d5b38;
  border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
  border-radius: var(--r-sm);
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 4px 4px 0;
}
.chip-protected, .chip-private { background: #f9e4e0; color: #93362a; }
.chip-nps, .chip-park { background: #ebe4f8; color: #5b3fa8; }
.chip-blm { background: #f6ecd8; color: #7c5a1e; }
.chip-fws { background: #ddedf2; color: #21606f; }
.chip-state { background: #dfeaf3; color: #2d5f86; }
.chip-other_public { background: #e9e9e4; color: #55604f; }
.chip-wilderness { background: #d9ecdf; color: #17512f; }
.chip-morphology { background: #e6e9f5; color: #3f51a5; }
.chip-experimental { background: #fef3c7; color: #92400e; }
.mini-chip {
  display: inline-block;
  background: #dcefe4;
  color: #1d5b38;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 0 5px;
  margin-left: 4px;
}
.mini-private { background: #f9e4e0; color: #93362a; }
.mini-photo { background: #f3e9cd; color: var(--brass-ink); letter-spacing: 0.02em; }

/* Field photos on a stream page: thumbnails that open the full frame. */
.photo-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
  margin: 10px 0 20px;
}
.photo-strip figure { margin: 0; min-width: 0; }
.photo-strip img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper-deep);
  box-shadow: var(--shadow-paper);
}
.photo-strip figcaption { margin-top: 5px; font-size: 11.5px; line-height: 1.35; }
.photo-strip figcaption b { font-weight: 600; }

/* ---- stream detail ---- */
.stream-hero { margin-bottom: 22px; }
/* Badge, name and stamps share one centre line — baseline alignment across a
   30px serif, a mono badge and 11px chips never lines up optically. */
.hero-title { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; }
.hero-title h1 { margin: 0; line-height: 1.15; }
.hero-title .score-badge { font-size: 17px; min-width: 46px; padding: 5px 9px; border-radius: var(--r-md); }
.hero-badges { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.hero-badges .chip { margin: 0; }
.hero-stats {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  margin: 14px 0 0;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-paper);
  overflow: hidden;
}
.hero-stats div {
  display: grid;
  gap: 2px;
  padding: 12px 20px;
  border-right: 1px solid var(--hairline);
  animation: rise 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}
.hero-stats div:nth-child(2) { animation-delay: 0.05s; }
.hero-stats div:nth-child(3) { animation-delay: 0.1s; }
.hero-stats div:nth-child(4) { animation-delay: 0.15s; }
.hero-stats div:nth-child(5) { animation-delay: 0.2s; }
.hero-stats div:last-child { border-right: 0; }
.hero-stats dt {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: var(--brass-ink);
}
.hero-stats dd { margin: 0; font-size: 19px; font-weight: 500; font-family: var(--font-mono); color: var(--pine); }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
}

/* ---- map caption: legend above the rule, coordinates and hand-offs below ----
   Two bands instead of one run-on line of middots — the symbols mean something
   different from the numbers, and the brass labels match the fact tables. */
.map-caption { margin-top: 10px; }
.map-key {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 16px;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.map-key span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.map-key .key-note { white-space: normal; }
/* An even dash pattern that reads like the route's line-dasharray — a `dashed`
   border renders one stubby dash plus one long one at this width. */
.key-line {
  width: 21px;
  height: 2.5px;
  border-radius: 1px;
  background: repeating-linear-gradient(90deg, var(--ember) 0 5px, transparent 5px 8px);
  flex: none;
}
.key-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ember); flex: none; }
.key-dot-manual { background: #15803d; }
.key-dot-drop { background: #0d9488; }

.map-meta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px 14px;
  align-items: baseline;
  margin: 9px 0 0;
  padding-top: 9px;
  /* --line, not --hairline: this rule sits on paper, not on a card */
  border-top: 1px solid var(--line);
}
.map-meta dt {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass-ink);
  white-space: nowrap;
}
.map-meta dd {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px 14px;
  margin: 0;
  font-size: 13.5px;
}
.map-meta a { text-decoration: none; white-space: nowrap; }
.map-meta a:hover { text-decoration: underline; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 860px) { .detail-grid { grid-template-columns: 1fr; } }
.minimap-wrap { position: relative; }
#minimap { height: 430px; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-paper); }
.detail-grid.expanded { grid-template-columns: 1fr; }
.detail-grid.expanded #minimap { height: 74vh; }

.minimap-basemaps {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  display: flex;
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-lift);
  border: 1px solid var(--line);
}
.minimap-basemaps button {
  border: 0;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-body);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.minimap-basemaps button + button { border-left: 1px solid var(--hairline); }
.minimap-basemaps button:hover { color: var(--pine); }
.minimap-basemaps button.active { background: var(--accent); color: #fff; }

.reach-card {
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  font-size: 13.5px;
  box-shadow: var(--shadow-paper);
}
.reach-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.reach-stats { display: flex; gap: 13px; flex-wrap: wrap; margin-top: 6px; }
.reach-stats b { font-family: var(--font-mono); font-weight: 500; }
.reach-reasons { margin-top: 6px; }

/* ---- why this score ---- */
.subscore { display: flex; align-items: center; gap: 10px; margin: 7px 0; }
.subscore-label { width: 92px; font-size: 13px; color: var(--muted); }
.subscore-track { flex: 1; height: 7px; background: var(--paper-deep); border: 1px solid var(--hairline); border-radius: 4px; overflow: hidden; }
.subscore-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #4d8a68);
  border-radius: 3px;
  transform-origin: left;
  animation: grow 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}
.subscore:nth-of-type(2) .subscore-fill { animation-delay: 0.07s; }
.subscore:nth-of-type(3) .subscore-fill { animation-delay: 0.14s; }
.subscore:nth-of-type(4) .subscore-fill { animation-delay: 0.21s; }
.subscore-value { width: 42px; text-align: right; font-family: var(--font-mono); font-size: 13px; }

@keyframes grow {
  from { transform: scaleX(0); }
}

.limiting-factors {
  margin: 12px 0 4px;
  padding: 9px 14px;
  background: var(--warning-bg);
  border: 1px solid #ead9a8;
  border-left: 3px solid #d9a13b;
  border-radius: var(--r-sm);
}
.limiting-factors strong { color: var(--warning-ink); }
.limiting-factors ul { margin: 4px 0 0; padding-left: 18px; }
.limiting-factors li { color: var(--warning-ink); }

.warning {
  background: var(--warning-bg);
  color: var(--warning-ink);
  border: 1px solid #ead9a8;
  border-left: 3px solid #d9a13b;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  margin-top: 8px;
  font-size: 14px;
}

.facts {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-paper);
  overflow: hidden;
}
.facts th {
  text-align: left;
  color: var(--brass-ink);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 12px;
  width: 40%;
  vertical-align: top;
  border-bottom: 1px solid var(--hairline);
}
.facts td { padding: 8px 12px; border-bottom: 1px solid var(--hairline); font-size: 14px; }
.facts tr:last-child th, .facts tr:last-child td { border-bottom: 0; }

/* ---- review journal: a signed entry slip ---- */
.review-form {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--brass);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-paper);
}
.review-form .field-verdict { max-width: 260px; }
.review-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.review-signed { margin: 0; font-size: 12px; color: var(--muted); }
.review-signed b { font-weight: 600; color: var(--ink); }
.review-form .btn-primary { margin-left: auto; }

.review-log { margin: 16px 0 0; display: grid; gap: 10px; }
.review {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--verdict, var(--brass));
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 9px 14px;
  box-shadow: var(--shadow-paper);
}
.review-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.review-verdict {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--verdict, var(--brass-ink));
}
.review-by { font-size: 12px; color: var(--muted); }
.review-by time { font-family: var(--font-mono); }
.review p { margin: 5px 0 0; font-size: 14px; }
.review-confirmed { --verdict: #1d5b38; }
.review-promising { --verdict: #2f6f4f; }
.review-pressured { --verdict: #b45309; }
.review-poor_habitat { --verdict: #93362a; }
.review-no_natives { --verdict: #93362a; }
.review-unsure { --verdict: #6e7568; }

/* ---- methodology ---- */
.methodology-sources th { width: 20%; }
.curves-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.curve-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-paper);
  padding: 12px 14px;
  overflow-x: auto;
}
.curve-card h3 { margin: 0 0 6px; font-size: 15px; }
.curve-desc { margin: 0 0 8px; line-height: 1.45; font-size: 13.5px; }
.curve-table { border-collapse: collapse; font-size: 12.5px; font-family: var(--font-mono); }
.curve-table td { padding: 2px 9px; border-bottom: 1px solid var(--hairline); text-align: right; }
.curve-table tr:last-child td { border-bottom: 0; }

/* ---- imagery compare ---- */

.panel-section a.small { display: inline-block; margin-top: 4px; }

/* ---- range sliders ----
   Two stacked inputs, thumbs only. Both inputs are painted fully transparent:
   the rail, the selected span and the value pills all position off --lo/--hi
   (unitless fractions, set in JS). Painting the track on the inputs themselves
   buried the lower thumb under the upper input's track.

   A thumb's centre travels from thumb/2 to width - thumb/2, so everything that
   has to sit on a handle is inset by the same half thumb. */
.range-row { margin: 3px 0 9px; }
.range-row:last-child { margin-bottom: 0; }
.range-label { display: block; font-size: 12px; line-height: 1.35; color: var(--muted); }
.dual-range {
  --lo: 0;
  --hi: 1;
  --thumb: 16px;
  position: relative;
  height: 18px;
  margin-top: 20px; /* clears the value pills, which float above the rail */
}
.dual-range::before, .dual-range::after {
  content: "";
  position: absolute;
  top: 50%;
  height: 5px;
  margin-top: -2.5px;
  border-radius: 3px;
  pointer-events: none;
  z-index: 0;
}
.dual-range::before {
  left: 0;
  right: 0;
  background: var(--paper-deep);
  box-shadow: inset 0 0 0 1px var(--line);
}
.dual-range::after {
  left: calc(var(--thumb) / 2 + var(--lo) * (100% - var(--thumb)));
  right: calc(var(--thumb) / 2 + (1 - var(--hi)) * (100% - var(--thumb)));
  background: var(--accent);
}
.range-pill {
  position: absolute;
  bottom: calc(50% + 9px);
  left: 0;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fdfbf4;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 15px;
  white-space: nowrap;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  z-index: 2;
  margin-bottom: 2px;
}
.range-bounds {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted);
}
.dual-range input[type="range"] {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  height: 18px;
  margin: 0;
  padding: 0;
  z-index: 1;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
  background: none;
}
.dual-range input[type="range"]::-webkit-slider-runnable-track { height: 100%; background: none; border: 0; }
.dual-range input[type="range"]::-moz-range-track { height: 100%; background: none; border: 0; }
/* Ring thumbs: a paper core inside a spruce collar reads as a handle you grab,
   and stays legible where the two of them meet. */
.dual-range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  box-sizing: border-box;
  width: var(--thumb);
  height: var(--thumb);
  margin-top: calc((18px - var(--thumb)) / 2); /* WebKit tops the thumb to the track */
  border-radius: 50%;
  background: var(--card);
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 2px var(--card), 0 1px 3px rgba(31, 42, 36, 0.3);
  cursor: grab;
  transition: box-shadow 0.12s;
}
.dual-range input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  box-sizing: border-box;
  width: var(--thumb);
  height: var(--thumb);
  border-radius: 50%;
  background: var(--card);
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 2px var(--card), 0 1px 3px rgba(31, 42, 36, 0.3);
  cursor: grab;
}
.dual-range input[type="range"]:hover::-webkit-slider-thumb,
.dual-range input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 2px var(--card), 0 1px 3px rgba(31, 42, 36, 0.3), 0 0 0 6px color-mix(in srgb, var(--accent) 22%, transparent);
}
.dual-range input[type="range"]:active::-webkit-slider-thumb { cursor: grabbing; }
.dual-range input[type="range"]:focus-visible { outline: 0; }

/* ---- mobile ---- */
.map-panel-toggle { display: none; }

/* The wordmark needs ~250px; below that the fly carries the brand alone. */
@media (max-width: 1180px) {
  .nav-warning { display: none; }
}

@media (max-width: 900px) {
  .brand-wordmark { display: none; }
  .brand-icon { display: block; }
}

@media (max-width: 700px) {
  .topnav { flex-wrap: wrap; row-gap: 2px; padding: 8px 12px; height: auto; }
  .nav-warning { display: none; }
  .nav-right { gap: 10px; }
  .nav-user { display: none; }
  .auth-page { padding: 36px 14px 48px; }
  /* 16px inputs keep iOS from zooming the page on focus */
  .auth-form input[type="email"], .auth-form input[type="password"] { font-size: 16px; }
  .page { padding: 18px 12px 48px; }
  h1 { font-size: 25px; }
  .table-scroll { margin: 0 -12px; padding: 0 12px; }
  /* 16px inputs keep iOS from zooming the page on focus */
  .text-input, .select-input, .textarea-input { font-size: 16px; }
  .filters { padding: 12px 13px; }
  .hero-stats div { padding: 10px 14px; }

  /* The side panel becomes a dismissible bottom sheet behind a round toggle. */
  .map-panel {
    display: none;
    top: auto; left: 10px; right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    width: auto; max-height: 46dvh; overflow-y: auto;
  }
  .map-panel.open { display: block; }
  .map-panel-toggle {
    display: grid; place-content: center;
    position: absolute; left: 12px;
    bottom: calc(40px + env(safe-area-inset-bottom));
    z-index: 11; width: 46px; height: 46px; border-radius: 50%;
    border: 1px solid var(--line); background: var(--card);
    font-size: 20px; box-shadow: var(--shadow-lift); cursor: pointer;
  }
  .detail-grid.expanded #minimap, #minimap { height: 60vh; }
}

@media (pointer: coarse) {
  .btn-primary, .text-input, .select-input, .minimap-basemaps button { min-height: 40px; }
  .panel-section label { padding: 3px 0; }
  .dual-range { --thumb: 20px; }
  /* Map chrome — the locate button gets pressed with cold, wet hands. */
  .maplibregl-map .maplibregl-ctrl-group button { width: 40px; height: 40px; }
  .gps-fix, .gps-log { padding: 8px 15px; font-size: 13px; }
  .panel-section .photo-pick { padding: 8px 13px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
