:root {
  --bg: #0c1420;
  --panel: #131d2c;
  --panel-2: #182437;
  --ink: #eef3f7;
  --ink-soft: #a6b6c4;
  --line: #263346;
  --ice: #7fc4ee;
  --coral: #ff8f66;
  --coral-soft: #3a2a24;
  --focus: #7fc4ee;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 10px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f8fb;
    --panel: #ffffff;
    --panel-2: #eef4f8;
    --ink: #14202b;
    --ink-soft: #3d4f5c;
    --line: #c3d5df;
    --ice: #175073;
    --coral: #8a3a1f;
    --coral-soft: #f6d3c6;
    --focus: #175073;
  }
}

:root[data-theme="light"] {
  --bg: #f3f8fb;
  --panel: #ffffff;
  --panel-2: #eef4f8;
  --ink: #14202b;
  --ink-soft: #3d4f5c;
  --line: #c3d5df;
  --ice: #175073;
  --coral: #8a3a1f;
  --coral-soft: #f6d3c6;
  --focus: #1d5c86;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.6;
  font-size: 1.0625rem;
}

body, .reflex-panel, .fact-strip div, .evidence-table th, .evidence-table td, .callout, .theme-toggle, button {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, fill 0.2s ease, stroke 0.2s ease;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; color: var(--ink); line-height: 1.15; }
a { color: var(--ice); }
a:hover { color: var(--coral); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

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

.site-header {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1.1rem 1.5rem; max-width: 920px; margin: 0 auto; font-family: var(--sans);
}
.brand { font-weight: 700; text-decoration: none; color: var(--ink); }
.site-nav { display: flex; gap: 1rem; align-items: center; font-size: 0.9rem; flex-wrap: wrap; }
.site-nav a { text-decoration: none; color: var(--ink-soft); }
.language-link { border: 1px solid var(--line); border-radius: 6px; padding: 0.15rem 0.5rem; }
.language-link.is-current { background: var(--panel-2); color: var(--ink); font-weight: 700; }
.theme-toggle {
  font-family: var(--sans); font-size: 0.85rem; padding: 0.3rem 0.7rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink-soft); cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); }

main { max-width: 920px; margin: 0 auto; padding: 0 1.5rem 4rem; }

.hero { padding: 1.5rem 0 2.5rem; }
.kicker { font-family: var(--sans); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.78rem; color: var(--coral); margin: 0 0 0.6rem; }
.hero h1 { font-size: clamp(2.1rem, 5.4vw, 3.2rem); margin: 0 0 0.9rem; }
.dek { font-size: 1.2rem; margin: 0 0 0.9rem; max-width: 46ch; }
.lede { color: var(--ink-soft); max-width: 48ch; }

.fact-strip {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; margin: 1.5rem 0 2.5rem; font-family: var(--sans);
}
.fact-strip div { background: var(--panel); padding: 1rem 1.1rem; }
.fact-strip strong { display: block; font-size: 1.5rem; color: var(--ink); }
.fact-strip span { font-size: 0.85rem; color: var(--ink-soft); }

.reflex-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1.25rem 1.4rem 1.5rem; font-family: var(--sans); }
.reflex-controls { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.9rem; }
.reflex-controls button {
  font-family: var(--sans); font-size: 0.95rem; padding: 0.5rem 1rem; border-radius: 999px;
  border: 1.5px solid var(--ice); background: var(--panel); color: var(--ink); cursor: pointer;
}
.reflex-controls button[aria-pressed="true"] { background: var(--ice); color: var(--bg); }
.reflex-readout { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.reflex-readout div strong { display: block; font-size: 1.6rem; }
.reflex-readout div span { font-size: 0.82rem; color: var(--ink-soft); }
.reflex-svg { width: 100%; height: auto; display: block; }
.reflex-caption { font-size: 0.85rem; color: var(--ink-soft); margin-top: 0.5rem; }

.chart-axis { stroke: var(--line); }
.chart-axis-label { fill: var(--ink-soft); font-family: var(--sans); }
.chart-bar-a { fill: var(--ice); }
.chart-bar-b { fill: var(--coral); }
.chart-value-label { fill: var(--ink); font-family: var(--sans); font-weight: 700; }
.chart-bar-label { fill: var(--ink-soft); font-family: var(--sans); }
.chart-wave-line { fill: none; stroke: var(--coral); stroke-width: 3; stroke-linecap: round; }
.chart-pain-window { fill: var(--coral); opacity: 0.15; }
.chart-pain-label { fill: var(--coral); font-family: var(--sans); font-weight: 700; }

.article-flow { max-width: 66ch; margin: 0 auto; }
.story-section { padding: 2.2rem 0; border-top: 1px solid var(--line); }
.section-tag { font-family: var(--sans); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.78rem; color: var(--coral); margin: 0 0 0.4rem; }
.story-section h2 { font-size: 1.5rem; margin: 0 0 0.8rem; }
.story-section p { margin: 0 0 1rem; }

.evidence-table-wrap { overflow-x: auto; margin: 1.2rem 0; }
.evidence-table { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: 0.95rem; }
.evidence-table caption { text-align: left; font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 0.4rem; }
.evidence-table th, .evidence-table td { padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--line); text-align: left; color: var(--ink); }
.evidence-table thead th { color: var(--ink-soft); font-weight: 600; }
.evidence-table .is-highlight td, .evidence-table .is-highlight th { background: var(--coral-soft); font-weight: 700; }

.callout { border-left: 4px solid var(--coral); background: var(--panel); padding: 0.9rem 1.1rem; border-radius: 0 8px 8px 0; margin: 1.3rem 0; }
.callout strong { display: block; margin-bottom: 0.3rem; font-family: var(--sans); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--coral); }
.callout p { margin: 0; }

.limits-list { padding-left: 1.2rem; }
.limits-list li { margin-bottom: 0.6rem; }

.source-list { font-family: var(--sans); font-size: 0.92rem; padding-left: 1.2rem; }
.source-list li { margin-bottom: 0.6rem; }

.site-footer { font-family: var(--sans); font-size: 0.85rem; color: var(--ink-soft); text-align: center; padding: 2rem 1.5rem 3rem; }
.site-footer a { color: var(--ink-soft); }

@media (max-width: 640px) {
  .fact-strip { grid-template-columns: 1fr; }
  .reflex-readout { gap: 1rem; }
  main { padding: 0 1.1rem 3rem; }
}
