/* Tokens (light theme only). */
:root {
  color-scheme: light;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --surface-0: #f4f4f1;
  --surface-1: #fcfcfb;
  --surface-2: #efeeea;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #6b6a66;
  --line: #dddcd7;
  --grid: #e8e7e3;
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --accent-wash: #e3eefb;
  --warn-bg: #fff4d6; --warn-ink: #6b4a00;
  --obs: #0b0b0b;
  --noaa: #0b0b0b;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
  --div-neg: #256abf; --div-mid: #f0efec; --div-pos: #e34948;
  --seq-lo: #cde2fb; --seq-hi: #0d366b;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--surface-0); color: var(--text-primary); font: 14px/1.45 var(--font); }
h1 { font-size: 1.35rem; margin: 0; letter-spacing: -.01em; }
h3 { font-size: .95rem; margin: 0 0 .5rem; }
h4 { font-size: .85rem; margin: 1rem 0 .4rem; color: var(--text-secondary); }
code { font: .85em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: .05em .35em; border-radius: 4px; }
.muted { color: var(--text-muted); font-weight: 400; }
.sub { margin: .15rem 0 0; color: var(--text-secondary); font-size: .85rem; }
.hint { margin: 0 0 .6rem; color: var(--text-secondary); font-size: .82rem; max-width: 80ch; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 16px .6rem; }
.banner { max-width: 1468px; margin: .25rem auto; padding: .7rem 1rem; border-radius: 8px; background: var(--warn-bg); color: var(--warn-ink); }
.banner code { background: transparent; }

.controls { position: static; z-index: 20; display: flex; flex-wrap: wrap; gap: .9rem 1.6rem; align-items: flex-start;
  padding: .7rem 16px; background: var(--surface-1); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ctl { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.ctl.grow { flex: 1 1 360px; }
.ctl > label, .lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); font-weight: 600; }
.row { display: flex; gap: .5rem; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.actions { margin-top: 1rem; }

input[type="search"], input[type="date"], select {
  font: inherit; color: var(--text-primary); background: var(--surface-1); border: 1px solid var(--line);
  border-radius: 6px; padding: .35rem .5rem; min-height: 32px; }
input[type="search"] { width: 170px; }
#station { max-width: 280px; }
select:focus-visible, input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label.inl { display: inline-flex; gap: .4rem; align-items: center; color: var(--text-secondary); }

button { font: inherit; cursor: pointer; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-1); color: var(--text-primary); padding: .35rem .8rem; min-height: 32px; }
button.sm { min-height: 28px; padding: .15rem .6rem; font-size: .82rem; }
button.ghost:hover { background: var(--surface-2); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; padding: .45rem 1.4rem; }
button.primary:hover { filter: brightness(1.08); }
button.primary.stale { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
button:disabled { opacity: .5; cursor: progress; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg label { display: block; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: .32rem .75rem; cursor: pointer; font-size: .85rem; color: var(--text-secondary); background: var(--surface-1); border-right: 1px solid var(--line); }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--accent-wash); color: var(--text-primary); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.seg.small span { padding: .22rem .6rem; font-size: .8rem; }

.chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .18rem .55rem; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-1); color: var(--text-secondary); font-size: .8rem; min-height: 28px; }
.chip i { width: 14px; height: 3px; border-radius: 2px; background: transparent; display: inline-block; }
.chip[aria-pressed="true"] { color: var(--text-primary); border-color: var(--text-muted); font-weight: 600; }
.chip.off { opacity: .5; }

.tabs { display: flex; gap: .2rem; padding: .6rem 16px 0; max-width: 1500px; margin: 0 auto; overflow-x: auto; }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 6px 6px 0 0; background: transparent; padding: .55rem 1rem; color: var(--text-secondary); white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--text-primary); font-weight: 600; border-bottom-color: var(--accent); background: var(--surface-1); }
.tabs button:hover { background: var(--surface-1); }

main { max-width: 1500px; margin: 0 auto; padding: .6rem 16px 3rem; }
.tab[hidden] { display: none; }
.card { background: var(--surface-1); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.1rem; margin-bottom: 1rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 2rem; }
.grid2.wide { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 1rem; }
.grid2.wide > .card { margin-bottom: 0; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } .grid2.wide { grid-template-columns: 1fr; } }

.check { display: flex; gap: .5rem; align-items: center; margin: .25rem 0; color: var(--text-secondary); }
.group { margin: .7rem 0; }
.group .gh { display: flex; align-items: center; gap: .6rem; margin-bottom: .3rem; font-weight: 600; font-size: .85rem; }
.group .gh .muted { font-weight: 400; font-size: .8rem; }
.cgrid { display: flex; flex-wrap: wrap; gap: .15rem .2rem; }
.cgrid label { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .5rem .12rem .35rem; border-radius: 6px; border: 1px solid transparent; color: var(--text-secondary); cursor: pointer; font-size: .84rem; }
.cgrid label:hover { background: var(--surface-2); }
.cgrid label:has(input:checked) { background: var(--accent-wash); color: var(--text-primary); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

.plot { width: 100%; min-height: 360px; transition: opacity .15s; }
.plot.tall { min-height: 640px; }
.plot.map { min-height: 520px; }
.plot.busy { opacity: .5; }

.tablewrap { overflow-x: auto; }
table.num { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: .84rem; }
table.num th, table.num td { padding: .32rem .6rem; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.num th:first-child, table.num td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface-1); }
table.num thead th { background: var(--surface-2); font-weight: 600; color: var(--text-secondary); position: sticky; top: 0; }
table.num thead th:first-child { background: var(--surface-2); z-index: 1; }
table.num td.best { font-weight: 700; color: var(--text-primary); background: var(--accent-wash); }
table.num td.na { color: var(--text-muted); }
table.num th.sep, table.num td.sep { border-left: 2px solid var(--line); }
table.num tbody tr:hover td { background: var(--surface-2); }
table.num tbody tr:hover td.best { background: var(--accent-wash); }
table.num tr.click { cursor: pointer; }

.stats { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin: .4rem 0 .6rem; }
.stat b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: .75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }

.prose { max-width: 90ch; }
.prose h3 { margin-top: 1.4rem; font-size: 1rem; }
.prose h3:first-child { margin-top: 0; }
.prose li { margin: .25rem 0; }
.prose table { border-collapse: collapse; margin: .6rem 0; font-size: .85rem; }
.prose td, .prose th { border-bottom: 1px solid var(--line); padding: .3rem .8rem .3rem 0; text-align: left; vertical-align: top; }
.pass { color: var(--s6); font-weight: 600; }
.failtxt { color: var(--s8); font-weight: 600; }

.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--line); border-radius: 6px; padding: .3rem .5rem; font-size: .8rem; box-shadow: 0 2px 8px rgba(0,0,0,.2); max-width: 340px; }
.warnline { color: var(--warn-ink); background: var(--warn-bg); padding: .45rem .7rem; border-radius: 6px; margin: .4rem 0; font-size: .84rem; }
.plot .js-plotly-plot .plotly .modebar { right: 6px; }

@media (min-width: 1100px) and (min-height: 780px) { .controls { position: sticky; top: 0; } }

.rangenote { font-size: .78rem; color: var(--text-secondary); max-width: 34ch; }
.rangenote.warn { color: var(--warn-ink); background: var(--warn-bg); padding: .2rem .5rem; border-radius: 6px; }
