/*
 * Intero public site. The Intero visual grammar: warm = measured, cool band = estimate, hatched grey = declined.
 * Archivo (display), Source Serif 4 (body), IBM Plex Mono (data), each with a system fallback.
 * Colour names a ROLE, not a hue. No inline styles anywhere (CSP style-src has no 'unsafe-inline').
 */
:root {
  --font-display: 'Archivo', ui-sans-serif, system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'Source Serif 4', ui-serif, Georgia, 'Times New Roman', serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --measured: #C4441A;
  --measured-ink: #A8380F;
  --estimate: #2A6496;
  --estimate-soft: #2A649633;
  --refused: #8a8a8a;
  --refused-soft: #8a8a8a33;

  --bg: #faf8f4;
  --bg-raised: #ffffff;
  --ink: #1c1a16;
  --ink-soft: #5b5648;
  --border: #ddd6c8;
  --link: #22557f;
  --focus: #2A6496;
  --placeholder-bg: #fff2c2;
  --placeholder-ink: #5a4500;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --measured: #E0612F;
    --measured-ink: #F08A5D;
    --estimate: #6fb2e0;
    --estimate-soft: #6fb2e040;
    --refused: #9a9a9a;
    --refused-soft: #9a9a9a40;
    --bg: #161512;
    --bg-raised: #201e1a;
    --ink: #f1ede4;
    --ink-soft: #b8b1a1;
    --border: #3a362c;
    --link: #8cc4ea;
    --focus: #8cc4ea;
    --placeholder-bg: #4a3b00;
    --placeholder-ink: #ffe38a;
  }
}
:root[data-theme="dark"] {
  --measured: #E0612F;
  --measured-ink: #F08A5D;
  --estimate: #6fb2e0;
  --estimate-soft: #6fb2e040;
  --refused: #9a9a9a;
  --refused-soft: #9a9a9a40;
  --bg: #161512;
  --bg-raised: #201e1a;
  --ink: #f1ede4;
  --ink-soft: #b8b1a1;
  --border: #3a362c;
  --link: #8cc4ea;
  --focus: #8cc4ea;
  --placeholder-bg: #4a3b00;
  --placeholder-ink: #ffe38a;
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: light dark; -webkit-text-size-adjust: 100%; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}
.wrap { max-width: 46rem; margin: 0 auto; padding-inline: 16px; }
img, svg { max-width: 100%; height: auto; }

h1, h2, h3, .brand, .eyebrow, .stage-name, .button, summary { font-family: var(--font-display); }
h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); line-height: 1.15; font-weight: 800; letter-spacing: 0.005em; margin: 1.5rem 0 1rem; }
h2 { font-size: 1.3rem; line-height: 1.25; font-weight: 700; margin: 2.5rem 0 0.75rem; }
h3 { font-size: 1.05rem; font-weight: 700; margin: 1.5rem 0 0.5rem; }
p, ul, ol, dl { margin: 0 0 1rem; }
code, var, pre, .t-val, .t-tick { font-family: var(--font-mono); }
code { font-size: 0.88em; background: var(--refused-soft); padding: 0.05em 0.3em; border-radius: 3px; }
var { font-style: italic; font-size: 0.9em; color: var(--estimate); }

a { color: var(--link); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
main:focus { outline: none; }

.skip { position: absolute; left: 16px; top: -100px; background: var(--bg-raised); color: var(--ink); padding: 8px 12px; border: 2px solid var(--focus); z-index: 10; }
.skip:focus { top: 8px; }

.site-header { border-bottom: 1px solid var(--border); background: var(--bg); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 14px 6px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.3rem; letter-spacing: 0.02em; }
.brand img { border-radius: 6px; }
.theme-toggle { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-soft); background: transparent; border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; min-height: 36px; cursor: pointer; }
.site-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 0 0 10px; margin: 0; }
.site-nav a { font-family: var(--font-display); font-size: 0.95rem; color: var(--ink-soft); text-decoration: none; display: inline-block; padding: 6px 0; }
.site-nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--measured); }
.site-nav a:hover { color: var(--ink); }

main { padding-block: 8px 48px; }
.lede { font-size: 1.15rem; color: var(--ink); }
.eyebrow { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-soft); margin: 2rem 0 0; }
.hero h1 { font-size: clamp(1.75rem, 6.5vw, 2.7rem); }
.accent { color: var(--estimate); }
.provenance, .unit-note, .meta { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-soft); }

.button { display: inline-block; background: var(--ink); color: var(--bg); text-decoration: none; font-weight: 700; padding: 10px 16px; border-radius: 8px; min-height: 44px; margin: 0 8px 8px 0; }
.button.secondary { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.button:hover { text-decoration: underline; }

.panel { background: var(--bg-raised); border: 1px solid var(--border); border-radius: 12px; padding: 4px 18px 8px; margin: 2rem 0; }
.panel h2 { margin-top: 1rem; }
.note { border-left: 3px solid var(--refused); padding-left: 12px; color: var(--ink-soft); }
.placeholder { background: var(--placeholder-bg); color: var(--placeholder-ink); padding: 0 0.3em; border-radius: 3px; font-family: var(--font-mono); font-size: 0.9em; }

.cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 12px; }
.cards li { background: var(--bg-raised); border: 1px solid var(--border); border-top: 3px solid var(--estimate); border-radius: 10px; padding: 4px 16px 6px; }
.cards h3 { margin-top: 0.75rem; }
.laws { padding-left: 1.4rem; }
.laws li { margin-bottom: 0.6rem; }
.laws li::marker { font-family: var(--font-mono); color: var(--measured-ink); font-weight: 600; }

/* Sensor Court illustration */
.court-figure { margin: 1rem 0; }
.court { display: block; width: 100%; font-family: var(--font-mono); }
.court .t-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; fill: var(--ink); }
.court .t-flag { font-size: 10.5px; letter-spacing: 0.06em; fill: var(--ink-soft); }
.court .t-label { font-family: var(--font-display); font-size: 14px; fill: var(--ink-soft); }
.court .t-strong { fill: var(--ink); font-weight: 700; }
.court .t-val { font-size: 13.5px; fill: var(--ink); }
.court .t-note { font-size: 12.5px; fill: var(--ink-soft); }
.court .t-tick { font-size: 12px; fill: var(--ink-soft); }
.court .whisker { stroke: var(--measured); stroke-width: 2.5; stroke-linecap: round; }
.court .whisker.overruled { stroke-dasharray: 4 4; opacity: 0.7; }
.court .dot-measured { fill: var(--measured); }
.court .dot-overruled { fill: var(--bg-raised); stroke: var(--measured); stroke-width: 2.5; }
.court .band-estimate { fill: var(--estimate-soft); stroke: var(--estimate); stroke-width: 1.5; }
.court .verdict-line { stroke: var(--estimate); stroke-width: 3; }
.court .axis { stroke: var(--border); stroke-width: 1.5; }
.court .hatch-line { stroke: var(--refused); }
.court .band-refused { fill: url(#hatch); stroke: var(--refused); stroke-width: 1.5; }
.court-figure figcaption { display: flex; flex-wrap: wrap; gap: 6px 16px; font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-soft); margin-top: 8px; }
.court-figure .figure-note { flex-basis: 100%; font-weight: 500; color: var(--ink); }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.swatch.measured { background: var(--measured); }
.swatch.estimate { background: var(--estimate-soft); border: 1.5px solid var(--estimate); }
.swatch.refused { border: 1px solid var(--refused); background: repeating-linear-gradient(45deg, var(--refused), var(--refused) 2px, transparent 2px, transparent 5px); }

/* How it works */
.pipeline { list-style: none; padding: 0; margin: 1.5rem 0; }
.stage { position: relative; border-left: 3px solid var(--estimate); padding: 0 0 0.5rem 18px; margin-left: 6px; }
.stage::before { content: ''; position: absolute; left: -8px; top: 0.35rem; width: 13px; height: 13px; border-radius: 50%; background: var(--measured); }
.stage h2 { margin-top: 0.1rem; }
.stage-name { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-soft); margin: 0; }
.steps { padding-left: 1.3rem; }

/* Methodology */
.toc ol { padding-left: 1.4rem; columns: 2 16rem; column-gap: 2rem; font-family: var(--font-display); font-size: 0.95rem; }
.metric-def { border: 1px solid var(--border); border-left: 4px solid var(--measured); border-radius: 10px; background: var(--bg-raised); padding: 2px 16px 8px; margin-bottom: 14px; }
.metric-def h3 { margin-top: 0.8rem; }
.metric-def .short { font-family: var(--font-mono); font-weight: 400; font-size: 0.8rem; color: var(--ink-soft); margin-left: 6px; }
.def-grid { display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; gap: 4px 14px; font-size: 0.95rem; }
.def-grid dt { color: var(--ink-soft); font-family: var(--font-display); font-size: 0.85rem; padding-top: 0.15em; }
.def-grid dd { margin: 0; }
@media (max-width: 520px) {
  .def-grid { grid-template-columns: 1fr; gap: 0; }
  .def-grid dd { margin-bottom: 8px; }
}
pre.formula { background: var(--bg-raised); border: 1px solid var(--border); border-left: 3px solid var(--estimate); border-radius: 6px; padding: 10px 12px; overflow-x: auto; font-size: 0.85rem; line-height: 1.5; }
pre.formula code { background: none; padding: 0; font-size: inherit; }
.table-scroll { overflow-x: auto; margin: 0 0 1rem; border: 1px solid var(--border); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; vertical-align: top; padding: 7px 10px; border-bottom: 1px solid var(--border); }
thead th { font-family: var(--font-display); background: var(--refused-soft); }
table.reasons th[scope="row"] { white-space: nowrap; font-weight: 400; }
section[id] { scroll-margin-top: 12px; }

/* Glossary */
.glossary > div { border-bottom: 1px solid var(--border); padding: 10px 0; }
.glossary dt { font-family: var(--font-display); font-weight: 700; }
.glossary dd { margin: 2px 0 0; }

/* Privacy */
.draft-banner { border: 2px dashed var(--measured); background: var(--bg-raised); border-radius: 10px; padding: 10px 16px 0; margin: 0 0 1.5rem; }

/* Support */
.faq details { border-bottom: 1px solid var(--border); padding: 4px 0; }
.faq summary { cursor: pointer; font-weight: 700; padding: 8px 0; min-height: 44px; }
.faq details p { margin-top: 0.25rem; }

.site-footer { border-top: 1px solid var(--border); padding-block: 20px 32px; font-size: 0.9rem; color: var(--ink-soft); }
.footer-links { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media print {
  .site-nav, .theme-toggle, .skip { display: none; }
}
