/* After the Plume — design tokens ported from the Lovable baseline (src/styles.css at c42c5e8d). */
:root {
  --background: oklch(0.975 0.006 85);
  --foreground: oklch(0.2 0.01 60);
  --card: oklch(0.99 0.004 85);
  --primary: oklch(0.25 0.02 250);
  --primary-foreground: oklch(0.98 0.005 85);
  --secondary: oklch(0.93 0.008 85);
  --muted: oklch(0.94 0.007 85);
  --muted-foreground: oklch(0.45 0.012 60);
  --accent: oklch(0.52 0.13 40);
  --warning: oklch(0.72 0.13 75);
  --nodata: oklch(0.6 0.01 60);
  --observed: oklch(0.42 0.12 250);
  --predicted: oklch(0.55 0.15 40);
  --border: oklch(0.82 0.01 70);
  --ring: oklch(0.52 0.13 40);
  --font-serif: "Source Serif 4", Georgia, serif;
  --font-sans: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--background); color: var(--foreground); font: 16px/1.5 var(--font-sans); overflow-wrap: break-word; }
h1, h2, h3, h4, h5 { font-family: var(--font-serif); line-height: 1.2; margin: 1.2em 0 0.4em; }
h1 { font-size: clamp(1.75rem, 4vw, 2.4rem); margin-top: 0.3em; }
h2 { font-size: 1.35rem; } h3 { font-size: 1.15rem; } h4 { font-size: 1.05rem; } h5 { font-size: 0.95rem; font-family: var(--font-sans); }
a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
code, .hash { font-family: var(--font-mono); font-size: 0.85em; }
.wrap { max-width: 1440px; margin: 0 auto; padding: 0 16px; }
.wrap-anywhere { overflow-wrap: anywhere; word-break: break-word; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--card); padding: 8px 12px; z-index: 2000; }
.skip-link:focus { left: 8px; }
html:not(.js) .js-only { display: none !important; }
html.js .js-hide { display: none; }
.kicker { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted-foreground); margin: 0.2em 0; }
.meta { font-size: 0.8rem; color: var(--muted-foreground); }
.meta.strong { font-weight: 600; color: var(--foreground); }
.note { font-size: 0.85rem; color: var(--muted-foreground); }
.warn { color: oklch(0.45 0.13 40); }
.hatch { background-image: repeating-linear-gradient(45deg, transparent 0 6px, color-mix(in oklab, var(--nodata) 25%, transparent) 6px 7px); }
.callout { border: 1px solid var(--nodata); padding: 10px 12px; font-size: 0.9rem; }
.panel { border: 1px solid var(--border); background: var(--card); padding: 16px; margin: 16px 0; min-width: 0; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.badge { display: inline-block; border: 1px solid var(--border); padding: 0 6px; font: 600 0.68rem var(--font-mono); text-transform: uppercase; text-decoration: none; letter-spacing: 0.04em; }
.badge-archived { border-color: var(--observed); color: var(--observed); }
.badge-blocked, .badge-fetch_failed, .badge-http_error { border-color: var(--accent); color: var(--accent); }
.program-tag { display: inline-block; font: 600 0.7rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; border: 1px solid var(--observed); color: var(--observed); padding: 1px 6px; vertical-align: middle; }
.program-event { border-color: var(--accent); color: var(--accent); }
.section-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border-bottom: 2px solid var(--foreground); padding-bottom: 4px; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--border); background: var(--card); padding: 6px 12px; min-height: 44px; }
button[aria-pressed="true"] { background: var(--foreground); color: var(--background); border-color: var(--foreground); }
.button-ghost { background: transparent; }
.icon-button { min-width: 44px; }

/* Header */
.safety-banner { margin: 0; background: var(--primary); color: var(--primary-foreground); font-size: 0.75rem; text-align: center; padding: 6px 16px; }
.site-header { background: var(--card); border-bottom: 1px solid var(--border); }
.masthead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 24px; padding-top: 12px; padding-bottom: 12px; }
.brand { text-decoration: none; display: grid; min-width: 0; }
.brand-name { font: 700 clamp(1.5rem, 3vw, 2rem)/1.1 var(--font-serif); }
.brand-sub { font-size: 0.75rem; color: var(--muted-foreground); }
nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; }
nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 10px; text-decoration: none; border: 1px solid transparent; font-size: 0.9rem; }
nav a:hover { border-color: var(--border); color: inherit; }
nav a[aria-current="page"] { background: var(--foreground); color: var(--background); }
.nav-toggle { display: none; }
.release-bar { background: var(--muted); border-top: 1px solid var(--border); font-size: 0.8rem; }
.release-bar-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding-top: 6px; padding-bottom: 6px; }
.release-bar p { margin: 0; }
.release-picker { display: flex; align-items: center; gap: 6px; }
.release-picker select { min-height: 36px; border: 1px solid var(--border); background: var(--card); padding: 2px 6px; max-width: 70vw; }
.fixture-banner { margin: 0; background: var(--warning); color: var(--foreground); text-align: center; padding: 8px 16px; font-size: 0.9rem; }
@media (max-width: 760px) {
  html.js .nav-toggle { display: inline-flex; align-items: center; }
  html.js nav ul { display: none; position: absolute; right: 16px; left: 16px; background: var(--card); border: 1px solid var(--border); flex-direction: column; padding: 4px; z-index: 1500; }
  html.js nav ul.open { display: flex; }
  nav { position: relative; }
}

main { padding-top: 12px; padding-bottom: 32px; display: block; }
main:focus { outline: none; }
.site-footer { border-top: 1px solid var(--border); background: var(--card); font-size: 0.75rem; color: var(--muted-foreground); padding: 16px 0; }

/* Map & Monitoring */
.status { border-left: 3px solid var(--primary); padding-left: 12px; margin: 8px 0 16px; }
.status h2 { margin: 0; font-size: 1.1rem; font-family: var(--font-sans); }
.status p { margin: 2px 0; font-size: 0.9rem; }
.filters { display: grid; gap: 10px; grid-template-columns: 1.4fr 1fr 1fr 1fr auto; align-items: end; border-block: 1px solid var(--border); padding: 8px 0; margin: 8px 0; }
.filters label { display: grid; gap: 4px; font-size: 0.75rem; font-weight: 500; min-width: 0; }
.filters input, .filters select { min-height: 40px; border: 1px solid var(--border); background: var(--background); padding: 4px 8px; width: 100%; min-width: 0; }
@media (max-width: 900px) { .filters { grid-template-columns: 1fr 1fr; } .filters label:first-child { grid-column: 1 / -1; } }
@media (max-width: 480px) { .filters { grid-template-columns: 1fr; } }
.filters-toggle { display: none; }
@media (max-width: 900px) { html.js .filters-toggle { display: inline-flex; align-items: center; gap: 4px; margin: 8px 0; } html.js .filters:not(.open) { display: none; } }
.view-toggle { display: none; }
.explorer { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; }
.station-list { min-width: 0; border-block: 1px solid var(--border); max-height: 740px; display: flex; flex-direction: column; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.list-head h3 { margin: 8px 0; font-family: var(--font-sans); }
.count { font: 0.85rem var(--font-mono); }
#station-ul { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
#station-ul li { border-top: 1px solid var(--border); }
#station-ul li[hidden] { display: none; }
.station-link { display: grid; gap: 2px; padding: 10px 8px; text-decoration: none; }
.station-link:hover, .station-link[aria-current="true"] { background: var(--secondary); color: inherit; }
.station-name { font: 700 1rem var(--font-serif); }
.station-meta { font-size: 0.75rem; color: var(--muted-foreground); }
.station-pollutants { font-size: 0.75rem; }
.map-wrap { position: relative; min-width: 0; }
.map { height: 740px; border: 1px solid var(--border); background: var(--muted); }
.map-fallback { padding: 16px; font-size: 0.9rem; }
.map.map-failed { height: auto; }
@media (max-width: 1023px) {
  .explorer { grid-template-columns: minmax(0, 1fr); }
  html.js .view-toggle { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 8px; }
  html.js .explorer[data-view="map"] .station-list { display: none; }
  html.js .explorer[data-view="list"] .map-wrap { display: none; }
  .map { height: 65vh; min-height: 360px; }
  .station-list { max-height: none; }
}
.legend { font-size: 0.75rem; display: flex; flex-wrap: wrap; gap: 4px 12px; border-bottom: 1px solid var(--border); padding: 8px 0; }
.lg { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font: 600 9px var(--font-mono); vertical-align: middle; border: 2px solid var(--observed); }
.lg-lead { background: var(--accent); border-color: var(--accent); color: var(--background); }
.lg-site { background: var(--observed); color: var(--background); }
.lg-hist { background: var(--card); color: var(--observed); }
.lg-cluster { background: var(--card); border-color: var(--foreground); }
.particle-note { position: sticky; bottom: 12px; z-index: 1000; display: flex; align-items: center; gap: 12px; border: 1px solid var(--border); background: var(--card); padding: 6px 12px; margin: 12px 0; font-size: 0.9rem; }
.particle-note p { margin: 0; flex: 1; }
.particle-note[hidden] { display: none; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 16px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.items { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.item { border: 1px solid var(--border); background: var(--card); padding: 12px; }
.item h3, .item h4 { margin: 0.2em 0; }
.superseded { opacity: 0.75; }
.cites { list-style: none; padding: 0; margin: 4px 0; font-size: 0.85rem; display: grid; gap: 4px; }
.role { font-size: 0.75rem; color: var(--muted-foreground); }
.kv { display: grid; grid-template-columns: minmax(7em, auto) minmax(0, 1fr); gap: 2px 12px; font-size: 0.85rem; margin: 8px 0; }
.kv dt { color: var(--muted-foreground); }
.kv dd { margin: 0; }
.table-scroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.table-scroll.tall { max-height: 360px; overflow-y: auto; }
table.evidence { border-collapse: collapse; width: 100%; font-size: 0.8rem; }
table.evidence th, table.evidence td { border-top: 1px solid var(--border); padding: 6px 8px; text-align: left; vertical-align: top; }
table.evidence thead th { position: sticky; top: 0; background: var(--card); border-top: 0; border-bottom: 2px solid var(--foreground); }
table.evidence .cites { font-size: 0.75rem; }
.num { font-family: var(--font-mono); white-space: nowrap; }
.big { font-size: 1.6rem; margin: 0; }
.big span { font-size: 0.8rem; }
.qual { font-family: var(--font-mono); font-size: 0.75rem; color: var(--accent); }
blockquote { margin: 4px 0; padding-left: 8px; border-left: 2px solid var(--border); font-size: 0.8rem; color: var(--muted-foreground); }
details > summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.method summary h3 { display: inline; margin: 0; }
.limitations { font-size: 0.8rem; }
.sources-list { list-style: none; padding: 0; display: grid; gap: 12px; }
.source { border-top: 1px solid var(--border); padding-top: 8px; }
.source h3 { margin: 0.2em 0; }
.timeline { list-style: none; margin: 16px 0; padding: 0 0 0 16px; border-left: 1px solid var(--foreground); }
.tl-item { position: relative; border: 1px solid var(--border); background: var(--card); padding: 12px 16px; margin-bottom: 16px; }
.tl-item::before { content: ""; position: absolute; left: -22px; top: 20px; width: 10px; height: 10px; background: var(--foreground); }
.tl-item h2 { margin: 0.2em 0; font-size: 1.15rem; }
.tl-item:target, tr:target, .item:target { outline: 3px solid var(--warning); }
.secondary h2 { color: var(--muted-foreground); font-size: 1rem; font-family: var(--font-sans); }
.downloads { border-top: 1px solid var(--border); margin-top: 12px; }
.downloads h3 { font-family: var(--font-sans); font-size: 1rem; }
.chart { width: 100%; min-height: 0; }
.chart.ready { min-height: 180px; margin: 8px 0; }

/* Leaflet markers */
.leaflet-container { font-family: var(--font-sans); background: var(--muted); }
.ring-label { font-family: var(--font-mono); font-size: 10px; color: var(--foreground); background: var(--card); border: 1px solid var(--border); padding: 0 3px; white-space: nowrap; box-shadow: none; }
.station-marker { display: grid; place-items: center; border: 2px solid var(--observed); background: var(--observed); color: var(--background); border-radius: 50%; font: 600 11px var(--font-mono); box-sizing: border-box; }
.station-lead { border-color: var(--accent); background: var(--accent); }
.station-historical { background: var(--card); color: var(--observed); }
.station-lead.station-historical { color: var(--accent); }
.station-selected { outline: 3px solid var(--foreground); outline-offset: 3px; }
.station-cluster { display: grid; place-items: center; border: 2px solid var(--foreground); background: var(--card); color: var(--foreground); border-radius: 50%; font: 600 12px var(--font-mono); box-sizing: border-box; }
.station-marker > span, .station-cluster > span { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; line-height: 1; }
.leaflet-marker-icon:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; }

/* Station details panel: overlays the map on desktop, bottom sheet on small screens. */
.station-panel { position: absolute; inset: 0 0 0 auto; width: min(480px, calc(100% - 40px)); z-index: 1100; overflow-y: auto; overscroll-behavior: contain; background: var(--card); border: 1px solid var(--border); }
.station-panel header { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; background: var(--card); border-bottom: 1px solid var(--border); padding: 12px 16px; }
.station-panel header h2 { margin: 0; font-size: 1.25rem; }
.station-panel .body { padding: 12px 16px; }
.panel-backdrop { display: none; }
@media (max-width: 1023px) {
  .station-panel { position: fixed; inset: auto 0 0 0; width: 100%; max-height: 72dvh; z-index: 1201; padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 16px rgb(0 0 0 / 0.15); }
  .panel-backdrop { display: block; position: fixed; inset: 0; background: rgb(0 0 0 / 0.2); z-index: 1200; }
  .particle-note { position: relative; bottom: auto; }
}
.u-legend { font-size: 0.75rem; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
.stale { border-left: 3px solid var(--warning); background: color-mix(in oklab, var(--warning) 15%, var(--card)); padding: 8px 12px; font-size: 0.85rem; margin: 8px 0; }
