:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --ink: #14202e;
  --ink-2: #3d4a5a;
  --muted: #667383;
  --line: #e2ded6;
  --accent: #0f6e6a;
  --accent-ink: #0b5451;
  --accent-soft: #e2f1ef;
  --gold: #a86b12;
  --supports: #1f7a4d; --supports-bg: #e5f4ec;
  --mixed: #8a5a00; --mixed-bg: #fbf0da;
  --challenges: #a1352b; --challenges-bg: #fbe7e4;
  --foundational: #3b4f86; --foundational-bg: #e8ecf8;
  --radius: 10px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d141d; --surface: #131c28; --surface-2: #192433; --ink: #e8edf3; --ink-2: #c1cad6; --muted: #8e9aab;
    --line: #26334449; --accent: #4fc1b8; --accent-ink: #7fd6cf; --accent-soft: #143534; --gold: #e0a84a;
    --supports: #6fd49d; --supports-bg: #133224; --mixed: #f0c064; --mixed-bg: #33280f;
    --challenges: #f08b80; --challenges-bg: #3a1a17; --foundational: #9fb2ef; --foundational-bg: #1c2544;
    color-scheme: dark;
  }
  :root { --line: #263344; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--sans); }
a { color: var(--accent-ink); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); font-weight: 700; }
h2 { font-size: clamp(1.45rem, 2.6vw, 1.9rem); font-weight: 600; margin-top: 1.6em; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0 0 1em; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }
pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 14px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }

/* header */
.site-header { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 92%, transparent); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(8px); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--ink); color: var(--bg); font-family: var(--serif); font-size: 1.25rem; font-weight: 700; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 1.05rem; }
.brand-text span { font-size: .75rem; color: var(--muted); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--ink-2); padding: 8px 12px; border-radius: 8px; font-size: .95rem; font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--accent-ink); background: var(--accent-soft); }

/* page heads */
.page-head { padding: 48px 20px 16px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 600; color: var(--accent-ink); margin-bottom: .6em; }
.lede { font-size: 1.15rem; color: var(--ink-2); max-width: 68ch; }
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: 1em; }
.crumbs a { color: var(--muted); }

/* hero */
.hero { padding-top: 64px; padding-bottom: 40px; }
.hero h1 { max-width: 18ch; }
.hero .lede { font-size: 1.25rem; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.btn { display: inline-block; padding: 11px 18px; border-radius: 8px; text-decoration: none; font-weight: 600; border: 1px solid var(--ink); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn-ghost { color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 28px 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat b { display: block; font-family: var(--serif); font-size: 2rem; line-height: 1; }
.stat span { color: var(--muted); font-size: .88rem; }

/* sections */
.section { padding: 32px 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel h3 { margin-top: 0; }
.panel p:last-child { margin-bottom: 0; }

/* eras diagram */
.eras { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: stretch; gap: 10px; margin: 20px 0; }
.era { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: var(--surface); }
.era small { display: block; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 4px; }
.era b { font-family: var(--serif); font-size: 1.3rem; display: block; }
.era p { font-size: .92rem; color: var(--ink-2); margin: 6px 0 0; }
.era.now { border-color: var(--accent); background: var(--accent-soft); }
.arrow { display: grid; place-items: center; color: var(--muted); font-size: 1.4rem; }

/* chain */
.chain { display: flex; gap: 0; margin: 20px 0; flex-wrap: wrap; }
.chain .step { flex: 1 1 0; min-width: 150px; padding: 16px 18px 16px 26px; background: var(--surface); border: 1px solid var(--line); position: relative; }
.chain .step:first-child { border-radius: var(--radius) 0 0 var(--radius); padding-left: 18px; }
.chain .step:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.chain .step b { display: block; font-family: var(--serif); font-size: 1.15rem; }
.chain .step span { font-size: .88rem; color: var(--ink-2); }
.chain .step + .step { border-left: none; }
.chain .step:not(:last-child)::after { content: "→"; position: absolute; right: -9px; top: 50%; transform: translateY(-50%); background: var(--bg); color: var(--accent-ink); font-weight: 700; z-index: 1; padding: 0 1px; }

/* cards */
.cards { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; }
.card h3 { font-size: 1.08rem; margin: 8px 0 4px; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--accent-ink); text-decoration: underline; }
.card p { font-size: .94rem; color: var(--ink-2); }
.card .byline { font-size: .85rem; color: var(--muted); margin-bottom: .6em; }
.card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card .chips { margin-top: auto; }
.meta { color: var(--muted); font-size: .82rem; }
.code { font: 600 .8rem ui-monospace, Menlo, monospace; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; }

.badge { font-size: .74rem; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.stance-supports { color: var(--supports); background: var(--supports-bg); }
.stance-mixed { color: var(--mixed); background: var(--mixed-bg); }
.stance-challenges { color: var(--challenges); background: var(--challenges-bg); }
.stance-foundational { color: var(--foundational); background: var(--foundational-bg); }
.ev-strong { color: var(--supports); background: var(--supports-bg); }
.ev-moderate { color: var(--foundational); background: var(--foundational-bg); }
.ev-emerging { color: var(--mixed); background: var(--mixed-bg); }
.ev-contested { color: var(--challenges); background: var(--challenges-bg); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: .78rem; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; background: var(--bg); }
a.chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.chip-tactic { border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); }
.chip-chain { font-style: italic; }

/* filters */
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; padding-bottom: 48px; }
.filters { position: sticky; top: 84px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.filters label { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-2); margin: 12px 0 4px; }
.filters label:first-child { margin-top: 0; }
.filters input, .filters select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--ink); font: inherit; font-size: .92rem; }
.filters .btn { width: 100%; margin-top: 14px; text-align: center; font-size: .92rem; padding: 9px; cursor: pointer; font-family: inherit; }
.filters .reset { display: block; text-align: center; font-size: .85rem; margin-top: 8px; }
.results-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.results-head p { margin: 0; color: var(--muted); font-size: .92rem; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--ink-2); font-size: .9rem; font-weight: 500; }
.tabs a[aria-current="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.empty { padding: 32px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* evidence map */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--ink-2); background: var(--surface-2); font-size: .82rem; }
tr:last-child td { border-bottom: none; }
td.num { text-align: center; font-variant-numeric: tabular-nums; }
.heat a { display: inline-block; min-width: 34px; padding: 3px 8px; border-radius: 6px; text-decoration: none; font-weight: 600; }
.bar-stack { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-2); margin: 10px 0 6px; }
.bar-stack span { display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }

/* detail */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; padding-bottom: 56px; align-items: start; }
.detail aside .panel + .panel { margin-top: 14px; }
.facts { margin: 0; }
.facts div { display: grid; grid-template-columns: 110px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.facts div:last-child { border-bottom: none; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.finding { font-family: var(--serif); font-size: 1.3rem; line-height: 1.45; border-left: 3px solid var(--accent); padding: 4px 0 4px 18px; margin: 18px 0 24px; }
.note { font-size: .88rem; color: var(--muted); }
.rel { font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.rel-supports { color: var(--supports); } .rel-challenges { color: var(--challenges); } .rel-context { color: var(--foundational); }
.linklist { list-style: none; padding: 0; margin: 0; }
.linklist li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.linklist li:last-child { border-bottom: none; }
.linklist a { font-weight: 600; }
.copy { position: relative; }

/* forms */
form.submit { display: grid; gap: 14px; max-width: 640px; }
form.submit label { font-weight: 600; font-size: .9rem; display: block; margin-bottom: 4px; }
form.submit input, form.submit select, form.submit textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--surface); color: var(--ink); }
form.submit textarea { min-height: 120px; }
form.submit .hint { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.hp { position: absolute; left: -9999px; }
.callout { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: var(--radius); padding: 16px 18px; }

/* footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 32px 0 40px; background: var(--surface-2); font-size: .9rem; color: var(--ink-2); }
.foot { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.foot > div:first-child { max-width: 520px; }
.foot-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); }
.foot-brand .mark { width: 26px; height: 26px; font-size: 1rem; }
.foot-links { display: grid; grid-template-columns: repeat(2, auto); gap: 8px 28px; align-content: start; }

@media (max-width: 900px) {
  .layout, .detail { grid-template-columns: 1fr; }
  .filters { position: static; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .eras { grid-template-columns: 1fr; }
  .arrow { transform: rotate(90deg); padding: 2px 0; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .page-head { padding: 32px 16px 8px; }
  .cards, .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hero { padding-top: 40px; padding-bottom: 24px; }
  .chain { flex-direction: column; }
  .chain .step, .chain .step:first-child, .chain .step:last-child { border-radius: 0; padding-left: 18px; border-left: 1px solid var(--line); }
  .chain .step:first-child { border-radius: var(--radius) var(--radius) 0 0; }
  .chain .step:last-child { border-radius: 0 0 var(--radius) var(--radius); }
  .chain .step + .step { border-top: none; }
  .chain .step:not(:last-child)::after { content: "↓"; right: auto; left: 50%; top: auto; bottom: -12px; transform: translateX(-50%); }
  .bar { padding-top: 8px; }
  .nav { width: 100%; justify-content: space-between; gap: 0; padding-bottom: 6px; }
  .nav a { white-space: nowrap; padding: 6px 7px; font-size: .88rem; }
  .facts div { grid-template-columns: 90px 1fr; }
}

.section > h2:first-child { margin-top: 0; }
details.filters > summary { display: none; }
@media (max-width: 900px) {
  details.filters > summary { display: block; cursor: pointer; font-weight: 600; list-style: none; }
  details.filters > summary::after { content: " ▾"; color: var(--muted); }
  details.filters[open] > summary { margin-bottom: 10px; }
}
