/* ---------------------------------------------------------------------------
   Lake Erie walleye migration — styles
   Palette slots come from the validated categorical set:
     series-1 blue   = western basin cohort (LEWAE)
     series-2 orange = eastern basin cohort (ELEWE)
   Basin bands use a validated single-hue ordinal blue ramp.
--------------------------------------------------------------------------- */

:root {
  color-scheme: light;

  --surface-0: #f4f3f0;
  --surface-1: #fcfcfb;
  --surface-2: #eceae5;
  --border: #d9d6cf;

  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #7d7b75;

  --series-1: #2a78d6;
  --series-2: #eb6834;

  --basin-w: #86b6ef;
  --basin-c: #2a78d6;
  --basin-e: #104281;
  --basin-o: #9b9a94;

  --water: #dbe9f8;
  --water-line: #adc7e4;
  --station: #5b6672;

  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 8px 24px rgba(0, 0, 0, .06);
  --radius: 10px;
  --maxw: 1180px;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;

    --surface-0: #0e1116;
    --surface-1: #14181d;
    --surface-2: #1c222a;
    --border: #2b323c;

    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #8e8d85;

    --series-1: #3987e5;
    --series-2: #d95926;

    --basin-w: #b7d3f6;
    --basin-c: #5598e7;
    --basin-e: #184f95;
    --basin-o: #6a6a64;

    --water: #1e3a57;
    --water-line: #35608a;
    --station: #cfe0f2;

    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 30px rgba(0, 0, 0, .4);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #0e1116;
  --surface-1: #14181d;
  --surface-2: #1c222a;
  --border: #2b323c;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #8e8d85;
  --series-1: #3987e5;
  --series-2: #d95926;
  --basin-w: #b7d3f6;
  --basin-c: #5598e7;
  --basin-e: #184f95;
  --basin-o: #6a6a64;
  --water: #1e3a57;
  --water-line: #35608a;
  --station: #cfe0f2;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 30px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text-primary);
  font: 16px/1.65 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 730px; margin-left: 0; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 650; letter-spacing: -.015em; }
h1 { font-size: clamp(2.1rem, 5.4vw, 3.7rem); letter-spacing: -.03em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.06rem; }
p { margin: 0 0 1.1em; color: var(--text-secondary); }
a { color: var(--series-1); }

.eyebrow {
  font-size: .74rem; font-weight: 700; letter-spacing: .13em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 1rem;
}

/* ---- theme toggle ---- */
.theme-toggle {
  position: fixed; top: 16px; right: 16px; z-index: 60;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface-1);
  color: var(--text-secondary); cursor: pointer; font-size: 15px;
  display: grid; place-items: center; box-shadow: var(--shadow);
}
.theme-toggle:hover { color: var(--text-primary); }

/* ---- hero ---- */
.hero { padding: 84px 0 40px; }
.hero .lede {
  font-size: clamp(1.06rem, 2vw, 1.24rem); color: var(--text-secondary);
  max-width: 60ch; margin-bottom: 2rem;
}
.hero-figs { display: flex; flex-wrap: wrap; gap: 40px; margin-top: 2rem; }
.fig .n {
  font-size: clamp(1.7rem, 4vw, 2.5rem); font-weight: 680;
  letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1;
}
.fig .l { font-size: .82rem; color: var(--text-muted); margin-top: 2px; }

section { padding: 56px 0; }
section.tight { padding: 32px 0; }

/* ---- cards ---- */
.card {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 20px 22px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 18px 16px; }
.tile .n { font-size: 1.75rem; font-weight: 660; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.tile .l { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }
.tile .d { font-size: .84rem; color: var(--text-secondary); margin-top: 8px; }

/* ---- legend ---- */
.legend { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; font-size: .85rem; color: var(--text-secondary); }
.legend .key { display: inline-flex; align-items: center; gap: 7px; }
.swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.swatch.line { height: 3px; width: 18px; border-radius: 2px; }

/* ---- controls ---- */
.controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-bottom: 14px; }
button.ui {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary);
  border-radius: 8px; padding: 7px 14px; font: inherit; font-size: .87rem; cursor: pointer;
}
button.ui:hover { border-color: var(--text-muted); }
button.ui[aria-pressed="true"] { background: var(--series-1); border-color: var(--series-1); color: #fff; }
button.ui.play { min-width: 84px; font-variant-numeric: tabular-nums; }

.scrub { flex: 1 1 260px; display: flex; align-items: center; gap: 12px; min-width: 220px; }
input[type=range] { flex: 1; accent-color: var(--series-1); height: 22px; }
.weeklabel {
  font-variant-numeric: tabular-nums; font-size: .87rem; color: var(--text-primary);
  min-width: 108px; font-weight: 600;
}

.toggles { display: flex; gap: 8px; }
.toggle {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 999px; padding: 5px 13px 5px 10px; font-size: .85rem; color: var(--text-secondary);
}
.toggle input { display: none; }
.toggle .swatch { opacity: .28; transition: opacity .15s; }
.toggle[data-on="1"] { color: var(--text-primary); border-color: var(--text-muted); }
.toggle[data-on="1"] .swatch { opacity: 1; }

/* ---- map ---- */
.mapwrap { position: relative; }
canvas.map { display: block; width: 100%; height: auto; border-radius: var(--radius); background: var(--surface-1); }
.maphint { font-size: .78rem; color: var(--text-muted); margin-top: 10px; }

/* ---- charts ---- */
.chartwrap { position: relative; }
svg.chart { display: block; width: 100%; height: auto; overflow: visible; }
svg.chart text { fill: var(--text-muted); font-size: 11px; }
svg.chart .axis line, svg.chart .axis path { stroke: var(--border); }
svg.chart .grid line { stroke: var(--border); opacity: .55; }
svg.chart .lbl { fill: var(--text-secondary); font-size: 11.5px; font-weight: 600; }

.tooltip {
  position: absolute; pointer-events: none; z-index: 20; opacity: 0;
  transition: opacity .1s; background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px;
  font-size: .82rem; box-shadow: var(--shadow); min-width: 130px;
}
.tooltip .t { font-weight: 650; margin-bottom: 5px; }
.tooltip .r { display: flex; align-items: center; gap: 7px; justify-content: space-between; }
.tooltip .r span:last-child { font-variant-numeric: tabular-nums; color: var(--text-secondary); }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 20px; }

/* ---- track picker ---- */
.tracklist { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.trackbtn {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-secondary);
  border-radius: 8px; padding: 7px 12px; font: inherit; font-size: .82rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.trackbtn[aria-pressed="true"] { border-color: var(--text-muted); color: var(--text-primary); background: var(--surface-1); }
.trackmeta { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; margin-top: 16px; }
.trackmeta .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.trackmeta .v { font-size: .95rem; font-weight: 600; margin-top: 1px; }

.callout {
  border-left: 3px solid var(--series-2); background: var(--surface-1);
  border-radius: 0 var(--radius) var(--radius) 0; padding: 16px 20px; margin: 22px 0;
}
.callout p:last-child { margin-bottom: 0; }

/* ---- table view ---- */
details.tablewrap { margin-top: 16px; }
details.tablewrap summary { cursor: pointer; font-size: .84rem; color: var(--text-secondary); }
table { border-collapse: collapse; width: 100%; margin-top: 12px; font-size: .82rem; }
th, td { text-align: right; padding: 5px 9px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--text-muted); font-weight: 600; }
.scrollx { overflow-x: auto; }

footer { border-top: 1px solid var(--border); padding: 40px 0 64px; color: var(--text-muted); font-size: .85rem; }
footer p { color: var(--text-muted); }
footer a { color: var(--text-secondary); }

.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (max-width: 700px) {
  .hero { padding: 60px 0 28px; }
  .hero-figs { gap: 26px; }
  .wrap { padding: 0 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---- passphrase gate (pre-publication only) ---- */
.gate {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center; padding: 24px;
  background: var(--surface-0);
}
.gate[hidden] { display: none; }
.gate-card {
  width: 100%; max-width: 420px;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 28px 28px 24px;
}
.gate-card h2 { font-size: 1.5rem; margin-bottom: .6em; }
.gate-card p { font-size: .9rem; margin-bottom: 1.4em; }
.gate-card input {
  width: 100%; font: inherit; font-size: .95rem;
  padding: 10px 13px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-primary);
}
.gate-card input:focus { outline: 2px solid var(--series-1); outline-offset: 1px; }
/* outranks `button.ui`, which is element+class and would otherwise win */
button.ui.gate-btn {
  width: 100%; margin-top: 12px; padding: 10px 14px;
  background: var(--series-1); border-color: var(--series-1); color: #fff;
  font-weight: 600;
}
button.ui.gate-btn:hover { border-color: var(--series-1); filter: brightness(1.08); }
button.ui.gate-btn:disabled { opacity: .65; cursor: default; filter: none; }
.gate-msg { min-height: 1.3em; margin-top: 10px; font-size: .84rem; color: var(--series-2); }

/* ---- era selector, speed, receiver readout ---- */
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented button {
  border: 0; background: var(--surface-2); color: var(--text-secondary);
  font: inherit; font-size: .85rem; padding: 7px 14px; cursor: pointer;
}
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button[aria-pressed="true"] { background: var(--series-1); color: #fff; font-weight: 600; }
.speedwrap { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--text-secondary); }
.speedwrap select { padding: 6px 10px; }
.recvnote { font-size: .82rem; color: var(--text-muted); }
.recvnote span { color: var(--text-secondary); font-variant-numeric: tabular-nums; font-weight: 600; }
.gate-diag {
  margin-top: 12px; padding: 9px 11px; border-radius: 6px;
  background: var(--surface-2); color: var(--text-muted);
  font-size: .72rem; line-height: 1.5; white-space: pre-wrap; word-break: break-all;
}
body.gated { overflow: hidden; }


/* ---- exhibit photographs ---- */
.photos { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; margin: 0 0 1.4em; }
.photos:empty { display: none; }
.photo { margin: 0; }
.photo img { width: 100%; height: auto; display: block; border-radius: var(--radius); border: 1px solid var(--border); }
.photo figcaption { margin-top: 8px; font-size: .82rem; color: var(--text-muted); line-height: 1.45; }

/* ---- GLATOS QR in the footer ---- */
.qrfoot { display: flex; align-items: center; gap: 16px; margin: 22px 0; }
.qrfoot img { width: 96px; height: 96px; background: #fff; padding: 6px; border-radius: 8px; flex: none; }
.qrfoot div { font-size: .88rem; color: var(--text-secondary); line-height: 1.5; }
.qrfoot strong { color: var(--text-primary); }
