/* Theme tokens: the one source of colour for page and charts (app.js reads them). Categorical c1–c6: Okabe–Ito. */
:root {
  --bg: #ffffff; --surface: #f4f5f7; --text: #111827; --text-2: #374151; --muted: #6b7280;
  --border: #e5e7eb; --context: #b6bcc6; --accent: #0072b2; --negative: #b91c1c;
  --c1: #0072b2; --c2: #e69f00; --c3: #009e73; --c4: #cc79a7; --c5: #56b4e9; --c6: #d55e00;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b1220; --surface: #161f33; --text: #f1f5f9; --text-2: #cbd5e1; --muted: #94a3b8;
    --border: #2a3650; --context: #4b5872; --accent: #56b4e9; --negative: #f87171; --c1: #56b4e9; --c5: #0072b2; }
}

* { box-sizing: border-box; }
html { scroll-padding-top: 64px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--surface); padding: 1px 5px; border-radius: 3px; font-size: .88em; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }

.top { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--border); }
.top .wrap { display: flex; gap: 24px; align-items: center; height: 48px; overflow-x: auto; white-space: nowrap; }
.brand { font-weight: 700; color: var(--text); }
nav { display: flex; gap: 16px; font-size: .9em; }
nav a { color: var(--text-2); }

.hero { padding: 48px 0 32px; }
h1 { font-size: clamp(1.5rem, 4vw, 2.3rem); line-height: 1.2; margin: 0 0 12px; max-width: 42ch; }
.lede { color: var(--text-2); font-size: 1.08em; max-width: 72ch; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-top: 24px; }
.facts div { border-top: 2px solid var(--text); padding-top: 8px; }
.facts b { display: block; font-size: 1.9em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.facts span { color: var(--muted); font-size: .9em; }

section { padding: 32px 0; border-top: 1px solid var(--border); }
h2 { font-size: 1.3em; line-height: 1.3; margin: 0 0 8px; max-width: 64ch; }
.note { color: var(--muted); font-size: .92em; max-width: 80ch; }
.row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 12px 0; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg button { background: var(--bg); color: var(--text-2); border: 0; padding: 5px 12px; font: inherit; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--accent); color: var(--bg); font-weight: 600; }
.chart { min-height: 340px; }

.table-wrap { overflow-x: auto; }
#scenario-table { min-width: 850px; }
#severity-table { min-width: 650px; }
#cuts-table, #pv-table { min-width: 850px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; }
th { color: var(--muted); font-size: .85em; font-weight: 600; }
.num { text-align: right; }
footer { padding: 32px 16px 48px; }

/* Project additions */
.ctl { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; margin: 12px 0; font-size: .92em; }
.ctl label { color: var(--muted); margin-right: 6px; }
.reset { background: none; border: 1px solid var(--border); border-radius: 6px; color: var(--text-2); padding: 5px 12px; font: inherit; cursor: pointer; }
input[type=search] { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 5px 10px; font: inherit; min-width: 200px; }
.tag { display: inline-block; font-size: .78em; padding: 0 6px; border-radius: 4px; border: 1px solid var(--border); color: var(--text-2); margin-left: 4px; }
.tag.imputed { border-color: var(--c2); }
.tag.trade { border-color: var(--c4); }
.verdict { font-weight: 600; }
.verdict.killed { color: var(--negative); }
td.wrap { white-space: normal; max-width: 46ch; }
.sticky-ctl { position: sticky; top: 48px; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--border); padding: 6px 0; }
