/* River flood outlook — England & Wales
   ------------------------------------------------------------------
   House palette: blues / greys / black. Amber and red are RESERVED for
   status and never used decoratively. Colour encodes state, never
   identity; size never encodes catchment area.
   Light is the base; dark redefines tokens only.
   ------------------------------------------------------------------ */

:root {
  color-scheme: light;

  /* surfaces + text */
  --paper:      #f6f6f3;
  --surface:    #ffffff;
  --surface-2:  #efefeb;
  --surface-3:  #e6e6e0;
  --ink:        #111214;
  --ink-2:      #4c5057;
  --ink-3:      #6b7079;
  --line:       #e2e2db;
  --line-2:     #cdcdc4;

  /* status — the only colours that carry meaning */
  --st-none:    #8b9198;
  --st-blue:    #2f6fd0;
  --st-amber:   #b8830c;
  --st-red:     #bd3038;
  --st-blue-soft:  rgba(47, 111, 208, 0.12);
  --st-amber-soft: rgba(184, 131, 12, 0.14);
  --st-red-soft:   rgba(189, 48, 56, 0.12);

  /* Two states that are NOT "low risk" and must not borrow the quiet grey. */
  --st-unknown:      #5d636b;
  --st-unknown-soft: rgba(93, 99, 107, 0.12);
  --st-passed:       #5f6b78;
  --st-passed-soft:  rgba(95, 107, 120, 0.12);

  /* map chrome */
  --map-land:     #f4f4ef;
  --map-water:    #e4e5e2;
  --map-river:    #b9c9d8;
  --map-boundary: #dcdcd4;
  --map-label:    #6e737a;
  --map-halo:     #f6f6f3;

  /* chart chrome */
  --gridline:   #e6e6df;
  --baseline:   #c6c6bc;
  --band:       rgba(47, 111, 208, 0.16);
  --band-edge:  rgba(47, 111, 208, 0.42);
  --ref-line:   #b6bcc4;
  --series:     #2f6fd0;
  --observed:   #2b3038;
  /* catalogue analogues: historical, never status, never the forecast blue */
  --analogue:      #6a7380;
  --analogue-band: rgba(106, 115, 128, 0.18);
  --analogue-edge: rgba(106, 115, 128, 0.38);

  --focus:      #2f6fd0;
  --shadow:     0 1px 2px rgba(17, 18, 20, 0.05), 0 8px 24px rgba(17, 18, 20, 0.08);
  --ctrl-icon-filter: none;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --r-sm: 5px;
  --r-md: 9px;
  --r-lg: 14px;

  --header-h: 50px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper:      #0e0f11;
    --surface:    #16181b;
    --surface-2:  #1e2126;
    --surface-3:  #272b31;
    --ink:        #f3f4f5;
    --ink-2:      #b6bac0;
    --ink-3:      #868b93;
    --line:       #262a2f;
    --line-2:     #363b42;

    --st-none:    #838a93;
    --st-blue:    #5b9bef;
    --st-amber:   #e9b845;
    --st-red:     #ef6f76;
    --st-blue-soft:  rgba(91, 155, 239, 0.16);
    --st-amber-soft: rgba(233, 184, 69, 0.16);
    --st-red-soft:   rgba(239, 111, 118, 0.16);

    --st-unknown:      #9aa1aa;
    --st-unknown-soft: rgba(154, 161, 170, 0.16);
    --st-passed:       #7d8b99;
    --st-passed-soft:  rgba(125, 139, 153, 0.16);

    --map-land:     #1b1f24;
    --map-water:    #0d0f11;
    --map-river:    #47637a;
    --map-boundary: #23272c;
    --map-label:    #7e848c;
    --map-halo:     #0e0f11;

    --gridline:   #24272c;
    --baseline:   #363b42;
    --band:       rgba(91, 155, 239, 0.34);
    --band-edge:  rgba(91, 155, 239, 0.62);
    --ref-line:   #4a525b;
    --series:     #5b9bef;
    --observed:   #c9ced5;
    --analogue:      #9aa3ad;
    --analogue-band: rgba(154, 163, 173, 0.22);
    --analogue-edge: rgba(154, 163, 173, 0.5);

    --focus:      #5b9bef;
    --shadow:     0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.45);
    --ctrl-icon-filter: invert(1) brightness(0.9);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper:      #0e0f11;
  --surface:    #16181b;
  --surface-2:  #1e2126;
  --surface-3:  #272b31;
  --ink:        #f3f4f5;
  --ink-2:      #b6bac0;
  --ink-3:      #868b93;
  --line:       #262a2f;
  --line-2:     #363b42;

  --st-none:    #838a93;
  --st-blue:    #5b9bef;
  --st-amber:   #e9b845;
  --st-red:     #ef6f76;
  --st-blue-soft:  rgba(91, 155, 239, 0.16);
  --st-amber-soft: rgba(233, 184, 69, 0.16);
  --st-red-soft:   rgba(239, 111, 118, 0.16);

  --st-unknown:      #9aa1aa;
  --st-unknown-soft: rgba(154, 161, 170, 0.16);
  --st-passed:       #7d8b99;
  --st-passed-soft:  rgba(125, 139, 153, 0.16);

  --map-land:     #1b1f24;
  --map-water:    #0d0f11;
  --map-river:    #47637a;
  --map-boundary: #23272c;
  --map-label:    #7e848c;
  --map-halo:     #0e0f11;

  --gridline:   #24272c;
  --baseline:   #363b42;
  --band:       rgba(91, 155, 239, 0.34);
  --band-edge:  rgba(91, 155, 239, 0.62);
  --ref-line:   #4a525b;
  --series:     #5b9bef;
  --observed:   #c9ced5;
  --analogue:      #9aa3ad;
  --analogue-band: rgba(154, 163, 173, 0.22);
  --analogue-edge: rgba(154, 163, 173, 0.5);

  --focus:      #5b9bef;
  --shadow:     0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.45);
  --ctrl-icon-filter: invert(1) brightness(0.9);
}

/* ---------- reset-ish ---------- */

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

html, body { height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, h4, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }

a { color: var(--ink); text-decoration-color: var(--line-2); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

:where(a, button, input, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.skip-link:focus { left: 8px; top: 8px; }

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

/* ---------- header ---------- */

.site-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand .brand-mark {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink-3);
}
.brand h1 { font-size: 14.5px; font-weight: 600; }

.header-spacer { flex: 1 1 auto; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 23px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-3);
  font-size: 11.5px;
  white-space: nowrap;
}
.chip-exp { cursor: help; }
.chip-exp::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--ink-3);
  opacity: 0.7;
}

.header-link {
  font-size: 12.5px;
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
}
.header-link:hover { color: var(--ink); text-decoration: underline; }

.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  color: var(--ink-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; }

/* ---------- headline strip ---------- */

.headline {
  padding: 13px 16px 11px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.headline-inner { max-width: 1500px; margin: 0 auto; }

.verdict {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(19px, 3vw, 25px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
}
.verdict-mark {
  flex: 0 0 auto;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--st-none);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--st-none) 18%, transparent);
}
.verdict[data-sev="1"] .verdict-mark { background: var(--st-blue); box-shadow: 0 0 0 4px var(--st-blue-soft); }
.verdict[data-sev="2"] .verdict-mark { background: var(--st-amber); box-shadow: 0 0 0 4px var(--st-amber-soft); }
.verdict[data-sev="3"] .verdict-mark { background: var(--st-red); box-shadow: 0 0 0 4px var(--st-red-soft); }

.verdict-sub {
  margin-top: 4px;
  max-width: 78ch;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.45;
}
.verdict-why {
  margin-top: 3px;
  max-width: 78ch;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.45;
}

.headline-more { margin: 0; }
.headline-more > summary {
  display: none;
  list-style: none;
  cursor: pointer;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ink-3);
  width: max-content;
}
.headline-more > summary::-webkit-details-marker { display: none; }
.headline-more > summary::after { content: " ▾"; }
.headline-more[open] > summary::after { content: " ▴"; }

.facts {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px 18px;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}
/* nowrap on the item, not the row: a value can never orphan from its label,
   and the row still wraps cleanly at any width */
.facts li {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}
.facts .fact-k {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.facts .fact-v {
  font-size: 12.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

/* ---------- layout ---------- */

.site-header, .headline, .site-footer { flex: 0 0 auto; }

.layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
  gap: 0;
  min-height: 0;
}

@media (min-width: 861px) {
  body { height: 100dvh; overflow: hidden; }
}

.map-column {
  position: relative;
  min-height: 320px;
  border-right: 1px solid var(--line);
  background: var(--map-land);
}

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

.map-overlay {
  position: absolute;
  z-index: 5;
  pointer-events: none;
}
.map-overlay > * { pointer-events: auto; }

.map-top-left { top: 10px; left: 10px; right: 56px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.map-top-left .chips { width: 100%; }

/* search */
.search-wrap { position: relative; width: min(300px, 100%); }
.search-input-wrap {
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
}
.search-input-wrap svg { width: 15px; height: 15px; color: var(--ink-3); flex: 0 0 auto; }
.search-wrap input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0; outline: 0; background: none;
  font: inherit; font-size: 14px; color: var(--ink);
}
.search-wrap input::placeholder { color: var(--ink-3); }
.search-wrap input:focus-visible { outline: none; }
.search-input-wrap:focus-within { border-color: var(--focus); box-shadow: var(--shadow), 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }

#search-results {
  position: absolute; top: 42px; left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  overflow: hidden;
  max-height: 320px; overflow-y: auto;
}
#search-results:empty { display: none; }
#search-results button {
  display: block; width: 100%; text-align: left;
  padding: 8px 12px; font-size: 13.5px;
  border-bottom: 1px solid var(--line);
}
#search-results button:last-child { border-bottom: 0; }
#search-results button:hover, #search-results button.active { background: var(--surface-2); }
#search-results .muted { color: var(--ink-3); }

/* region chips */
.chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.chips::-webkit-scrollbar { display: none; }
.chip-btn { flex: 0 0 auto; }
.chip-btn {
  height: 30px; padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  white-space: nowrap;
  box-shadow: var(--shadow);
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.chip-btn:hover { background: var(--surface-2); color: var(--ink); }
.chip-btn[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.chip-btn.chip-geo { display: inline-flex; align-items: center; gap: 6px; }
.chip-btn svg { width: 13px; height: 13px; }

/* legend */
.legend > summary { display: none; }

.legend {
  position: absolute;
  left: 10px; bottom: 10px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  font-size: 11.5px;
  color: var(--ink-2);
  max-width: min(330px, calc(100% - 20px));
}
.legend-title {
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.legend-row { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.legend-dot.ring { box-shadow: 0 0 0 2.5px color-mix(in srgb, currentColor 30%, transparent); }
.legend-dot.hollow { background: transparent; border: 1.5px solid var(--st-unknown); }
.legend-item[hidden] { display: none; }
.legend-ramp {
  height: 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.legend-ramp-labels { display: flex; justify-content: space-between; color: var(--ink-3); font-size: 10.5px; }
.legend-sep { height: 1px; background: var(--line); margin: 1px 0; }

.rain-transport {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
}
.rain-transport[hidden] { display: none; }
.rain-days {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.rain-play,
.rain-day {
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
}
.rain-play { min-width: 44px; padding: 0 9px; }
.rain-play:hover,
.rain-day:hover { background: var(--surface-2); color: var(--ink); }
.rain-play[aria-pressed="true"],
.rain-day[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.rain-day.is-past { opacity: 0.55; }
.rain-day.is-past[aria-pressed="true"],
.rain-day.is-now[aria-pressed="true"] { opacity: 1; }

/* map tooltip */
.map-tip {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, calc(-100% - 12px));
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  font-size: 12.5px;
  color: var(--ink-2);
  max-width: 240px;
  transition: opacity 100ms ease;
}
.map-tip strong { color: var(--ink); display: block; font-weight: 600; }
.map-tip .tip-status { display: inline-flex; align-items: center; gap: 5px; margin-top: 3px; }
.map-tip .tip-dot { width: 7px; height: 7px; border-radius: 50%; }

/* ---------- side column ---------- */

.side-column {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  overflow: hidden;
}

.side-head {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.side-head h2 { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.side-head p { margin-top: 3px; font-size: 12.5px; color: var(--ink-3); }
.watch-key {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 14px;
  margin-top: 7px !important;
  padding-top: 7px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
}
.watch-key span { display: inline-flex; gap: 5px; white-space: nowrap; }
.watch-key b { color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.watch-key[hidden] { display: none; }

.watch-list { flex: 1 1 auto; overflow-y: auto; padding: 6px 0 20px; }

.watch-sep {
  padding: 10px 16px 5px;
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.watch-row { width: 100%; text-align: left; display: block; padding: 10px 16px 12px; border-bottom: 1px solid var(--line); }
.watch-row:hover { background: var(--surface-2); }
.watch-row.is-active { background: var(--surface-2); }

.watch-line1 { display: flex; align-items: baseline; gap: 8px; }
.watch-bar, .watch-meta, .watch-reason { display: block; }
.watch-rank {
  flex: 0 0 auto;
  width: 17px;
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.watch-name { flex: 1 1 auto; min-width: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.watch-place { display: block; font-size: 12px; font-weight: 400; color: var(--ink-3); }
.watch-pct { flex: 0 0 auto; min-width: 72px; font-size: 13.5px; font-variant-numeric: tabular-nums; color: var(--ink); text-align: right; }
.watch-na { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: normal; }
.watch-ratio { display: block; color: var(--ink); line-height: 1.15; }
.watch-ratio-of {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: var(--ink-3);
  font-variant-numeric: normal;
  white-space: nowrap;
}

.watch-bar {
  margin: 7px 0 0 25px;
  max-width: 190px;
  height: 5px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.watch-bar span { display: block; height: 100%; border-radius: 999px; }

.watch-meta { margin: 6px 0 0 25px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.watch-reason {
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tag {
  font-size: 10.5px;
  letter-spacing: 0.02em;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--ink-3);
}
.watch-chance {
  font-size: 11.5px;
  color: var(--ink-2);
  white-space: nowrap;
}

.tag-status { border-color: transparent; }
.tag-status[data-sev="0"] { background: var(--surface-3); color: var(--ink-3); }
.tag-status[data-sev="1"] { background: var(--st-blue-soft); color: var(--ink-2); }
.tag-status[data-sev="2"] { background: var(--st-amber-soft); color: var(--ink-2); }
.tag-status[data-sev="3"] { background: var(--st-red-soft); color: var(--ink-2); }
.tag-status[data-kind="unknown"] { background: var(--st-unknown-soft); color: var(--ink-2); }
.tag-status[data-kind="passed"]  { background: var(--st-passed-soft); color: var(--ink-2); }

.watch-reason { margin: 6px 0 0 25px; font-size: 12.5px; color: var(--ink-2); }

.side-foot {
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-3);
  background: var(--surface);
}
.side-foot a { color: var(--ink-2); }

/* ---------- detail ---------- */

.detail {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 200ms ease, visibility 200ms;
}
.detail.open { transform: none; visibility: visible; }

.detail-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px 10px 8px;
  border-bottom: 1px solid var(--line);
}
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 9px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--ink-2);
}
.back-btn:hover { background: var(--surface-2); color: var(--ink); }
.back-btn svg { width: 14px; height: 14px; }

.detail-body { flex: 1 1 auto; overflow-y: auto; padding: 16px; }

.detail-title { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.detail-sub { margin-top: 2px; font-size: 13px; color: var(--ink-3); }

/* ---------- detail: status line + fact table ---------- */

.detail-status {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 12px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.detail-status {
  flex-wrap: wrap;
  row-gap: 2px;
}
.detail-status .dot {
  flex: 0 0 auto;
  width: 9px; height: 9px;
  border-radius: 50%;
  transform: translateY(-1px);
}
.detail-status .status-word { flex: 0 0 auto; }
.detail-status .status-clause {
  flex: 1 1 100%;
  padding-left: 17px;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--ink-2);
}
.detail-status[data-sev="1"] { background: var(--st-blue-soft); }
.detail-status[data-sev="2"] { background: var(--st-amber-soft); }
.detail-status[data-sev="3"] { background: var(--st-red-soft); }
.detail-status[data-kind="unknown"] { background: var(--st-unknown-soft); }
.detail-status[data-kind="passed"]  { background: var(--st-passed-soft); }

.detail-reason {
  margin-top: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-2);
}

.fact-table {
  margin-top: 14px;
  border-top: 1px solid var(--line);
}
.fact-row {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.fact-label {
  font-size: 12.5px;
  color: var(--ink-3);
}
.fact-value {
  font-size: 14.5px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.fact-aside {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: normal;
}
.fact-none { color: var(--ink-3); font-weight: 400; }

.detail-section { margin-top: 20px; }
.detail-section h3 {
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.sentence { font-size: 13.5px; color: var(--ink-2); }
.sentence + .sentence { margin-top: 6px; }
.sentence strong { color: var(--ink); font-weight: 600; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; }

.chart-wrap { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-svg text { fill: var(--ink-3); font-family: var(--font); }
.chart-svg .t-strong { fill: var(--ink); }
.chart-svg .gridline { stroke: var(--gridline); }
.chart-svg .baseline { stroke: var(--baseline); }
.chart-svg .t-series { fill: var(--series); }
.chart-svg .t-ref { fill: var(--ink-3); }

.chart-caption {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-3);
}

.prob-row { display: grid; grid-template-columns: 54px 50px 1fr 66px; gap: 9px; align-items: center; font-size: 12.5px; }
.prob-level { color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.prob-row + .prob-row { margin-top: 6px; }
.prob-label { color: var(--ink-2); }
.prob-track { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.prob-fill { display: block; height: 100%; border-radius: 999px; }
.prob-pct { text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; font-size: 12px; }

.note {
  margin-top: 8px;
  padding: 9px 11px;
  border-left: 2px solid var(--line-2);
  background: var(--surface-2);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 12px;
  color: var(--ink-3);
}

.caveat {
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-3);
}
.caveat > summary {
  cursor: pointer;
  list-style: none;
  padding: 7px 10px 7px 24px;
  position: relative;
  border-left: 2px solid var(--line-2);
  background: var(--surface-2);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--ink-2);
  line-height: 1.4;
}
.caveat > summary::-webkit-details-marker { display: none; }
.caveat > summary::before {
  content: "?";
  position: absolute;
  left: 9px; top: 7px;
  width: 12px; height: 12px;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  font-size: 9px;
  line-height: 11px;
  text-align: center;
  color: var(--ink-3);
}
.caveat[open] > summary::before { content: "\2212"; }
.caveat > summary:hover { background: var(--surface-3); }
.caveat > p {
  margin: 0;
  padding: 8px 10px 9px 24px;
  border-left: 2px solid var(--line-2);
  line-height: 1.5;
}

.tooltip {
  position: absolute;
  transform: translate(-50%, -140%);
  z-index: 3;
  padding: 4px 7px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow);
  font-size: 11.5px;
  color: var(--ink-2);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 100ms ease;
}
/* opens downward: the ladder chart sits directly under the fact table, so a
   tooltip drawn upward lands on top of the row above it */
.tooltip-below { transform: translate(-50%, 6px); }

/* ---------- about page ---------- */

.about-content {
  max-width: 72ch;
  margin: 0 auto;
  padding: 32px 20px 64px;
}
.about-content h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; margin-top: 28px; }
.about-content h2:first-child { margin-top: 0; }
.about-content p { margin-top: 10px; color: var(--ink-2); font-size: 14.5px; }
.about-content ul { margin-top: 10px; }
.about-content li { position: relative; padding-left: 18px; margin-top: 6px; color: var(--ink-2); font-size: 14.5px; }
.about-content li::before {
  content: ""; position: absolute; left: 4px; top: 9px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--line-2);
}
.about-content table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13.5px; }
.about-content th {
  text-align: left; font-weight: 600; font-size: 11px;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3);
  border-bottom: 1px solid var(--line-2); padding: 0 12px 6px 0;
}
.about-content td { padding: 7px 12px 7px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: top; }
/* row headers sit in the body, so they take body padding, not the column-header rule */
.about-content tbody th {
  padding: 7px 12px 7px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  white-space: nowrap;
  width: 1%;
}
.table-scroll { overflow-x: auto; }

.site-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-3);
  background: var(--surface);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}
.site-footer a { color: var(--ink-2); }

/* ---------- states ---------- */

.empty {
  padding: 26px 16px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
}

.loading-shimmer {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-3);
}

/* ---------- maplibre overrides ---------- */

.maplibregl-ctrl-group {
  background: var(--surface) !important;
  border: 1px solid var(--line-2) !important;
  box-shadow: var(--shadow) !important;
  border-radius: var(--r-md) !important;
  overflow: hidden;
}
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line) !important; }
.maplibregl-ctrl-group button span { filter: var(--ctrl-icon-filter, none); }
.maplibregl-ctrl-attrib {
  background: color-mix(in srgb, var(--surface) 84%, transparent) !important;
  color: var(--ink-3) !important;
  font-size: 10.5px !important;
  border-radius: var(--r-sm) 0 0 0;
}
.maplibregl-ctrl-attrib a { color: var(--ink-2) !important; }
.maplibregl-canvas:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0, 1fr) 320px; }
}

@media (max-width: 860px) {
  body { font-size: 15px; }
  .site-header { gap: 10px; padding: 0 12px; }
  .brand .brand-mark { display: none; }
  .chip-exp span { display: none; }
  .chip-exp::after { content: "Experimental"; }

  .headline { padding: 12px 14px 10px; }
  .facts { gap: 7px 14px; margin-top: 8px; padding-top: 8px; }
  .verdict-sub { font-size: 13.5px; }

  .layout {
    grid-template-columns: 1fr;
    /* stack, and never let the grid shrink under the page footer */
    flex: 1 0 auto;
    min-height: auto;
    height: auto;
  }
  .map-column {
    height: 58dvh;
    min-height: 340px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .side-column { overflow: visible; }
  .watch-list { overflow: visible; }

  .map-top-left { right: 52px; flex-direction: column; gap: 6px; }
  .search-wrap { width: 100%; }

  /* headline: keep the one message, fold the rest away */
  .headline-more > summary { display: block; }
  .headline-more:not([open]) .facts,
  .headline-more:not([open]) .verdict-why { display: none; }

  /* legend collapses to a key button */
  .legend { font-size: 11px; padding: 8px 10px; gap: 6px; }
  .legend > summary {
    display: block;
    list-style: none;
    cursor: pointer;
    font-size: 11px;
    color: var(--ink-2);
    width: max-content;
  }
  .legend > summary::-webkit-details-marker { display: none; }
  .legend > summary::after { content: " ▴"; }
  .legend:not([open]) > summary::after { content: " ▾"; }
  .legend:not([open]) > div { display: none; }
  .legend .legend-row { flex-direction: column; gap: 3px; }

  /* detail becomes a bottom sheet */
  .detail {
    position: fixed;
    inset: auto 0 0 0;
    height: 86dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-top: 1px solid var(--line-2);
    box-shadow: var(--shadow);
    transform: translateY(100%);
  }
  .detail.open { transform: none; }
  .detail::before {
    content: "";
    position: absolute; top: 7px; left: 50%;
    transform: translateX(-50%);
    width: 34px; height: 4px;
    border-radius: 999px;
    background: var(--line-2);
  }
  .detail-head { padding-top: 16px; }
}

@media (max-width: 480px) {
  .verdict { font-size: 20px; }
  .chips { gap: 5px; }
  .chip-btn { height: 28px; padding: 0 9px; font-size: 12px; }
}

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