:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1c1b19;
  --muted: #6b675f;
  --line: #e4e0d8;
  --accent: #1f4e8c;
  --accent-soft: #e8eef7;
  --banner: #fff4d6;
  --banner-text: #5a4300;
  --up: #2f6b3a;
  --down: #9a2f24;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141414;
    --surface: #1c1c1c;
    --text: #ece9e3;
    --muted: #a19c92;
    --line: #2f2e2b;
    --accent: #7fa8e0;
    --accent-soft: #1d2836;
    --banner: #2e2610;
    --banner-text: #f0d68a;
    --up: #7cc08a;
    --down: #e88a7e;
  }
}
:root[data-theme="dark"] {
  --bg: #141414; --surface: #1c1c1c; --text: #ece9e3; --muted: #a19c92; --line: #2f2e2b;
  --accent: #7fa8e0; --accent-soft: #1d2836; --banner: #2e2610; --banner-text: #f0d68a;
  --up: #7cc08a; --down: #e88a7e;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; font-weight: 600; }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); margin: 0.2em 0 0.4em; letter-spacing: -0.01em; }
h2 { font-size: 1.6rem; margin: 0 0 0.6em; }
h3 { font-size: 1.2rem; margin: 1.6em 0 0.3em; }
.muted { color: var(--muted); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.section { padding: 40px 16px; }

/* header */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.header-inner { 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(--text); font-family: var(--serif); font-weight: 700; font-size: 1.15rem; }
.brand-mark { width: 22px; height: 22px; border: 2px solid var(--text); border-radius: 50%; position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--accent); }
.nav { display: flex; gap: 20px; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: 0.95rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); }

.pilot-banner { background: var(--banner); color: var(--banner-text); font-size: 0.9rem; padding: 10px 0; }

/* hero */
.hero { padding: 56px 0 24px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.78rem; color: var(--muted); font-weight: 600; margin: 0; }
.eyebrow a { color: inherit; }
.lede { font-family: var(--serif); font-size: 1.25rem; max-width: 46em; color: var(--text); margin: 0; }

/* heatmap table */
.section-head { margin-bottom: 16px; }
.section-head p { max-width: 50em; margin: 0; }
.heat-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.heat { border-collapse: separate; border-spacing: 2px; margin-right: 90px; font-variant-numeric: tabular-nums; }
.heat th, .heat td { padding: 0; }
.heat thead th { vertical-align: bottom; font-weight: 500; font-size: 0.8rem; color: var(--muted); padding: 8px 4px; text-align: left; }
.heat .h-cat { height: 120px; width: 48px; min-width: 48px; position: relative; }
.heat .h-cat span { position: absolute; bottom: 10px; left: 50%; transform-origin: left bottom; transform: rotate(-55deg); white-space: nowrap; }
.heat .h-num { text-align: center; }
.heat .rank { color: var(--muted); text-align: center; width: 28px; }
.heat .country { text-align: left; font-weight: 500; white-space: nowrap; padding: 0 12px 0 4px; position: sticky; left: 0; background: var(--surface); }
.heat .country a { color: var(--text); text-decoration: none; }
.heat .country a:hover { color: var(--accent); text-decoration: underline; }
.heat .num { text-align: center; width: 64px; }
.heat .mean { font-weight: 700; font-size: 1.05rem; }
.heat .weak { color: var(--muted); border-right: 1px solid var(--line); }
.heat .cell {
  text-align: center; height: 38px; border-radius: 3px; font-size: 0.88rem;
  background: color-mix(in srgb, var(--accent) calc(var(--s) * 5.5%), transparent);
}
.heat tbody tr:hover .country, .heat tbody tr:hover .rank { color: var(--accent); }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; }
.card h3 { margin: 0 0 0.4em; }
.card p { margin: 0; color: var(--muted); }
.more { font-weight: 600; }

/* country */
.country-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.stats { display: flex; gap: 32px; margin: 0; }
.stats dt { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.stats dd { margin: 0; font-family: var(--serif); font-size: 1.6rem; font-weight: 600; }
.stats .big { font-size: 2.6rem; color: var(--accent); line-height: 1.1; }
.bars { list-style: none; padding: 0; margin: 0; max-width: 760px; }
.bars li { display: grid; grid-template-columns: minmax(120px, 210px) 1fr 40px; align-items: center; gap: 12px; padding: 5px 0; }
.bar-label { font-size: 0.95rem; }
.bar-track { height: 14px; background: var(--accent-soft); border-radius: 7px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 7px; }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 32px; }
.notes { padding-left: 1.2em; margin: 0; }
.notes li { margin-bottom: 0.5em; }
.notes.up li::marker { content: "+  "; color: var(--up); font-weight: 700; }
.notes.down li::marker { content: "−  "; color: var(--down); font-weight: 700; }
.vig { border-top: 1px solid var(--line); padding: 10px 0; }
.vig:last-of-type { border-bottom: 1px solid var(--line); }
.vig summary { cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-weight: 500; }
.vig ol { list-style: none; padding: 8px 0 4px; margin: 0; }
.vig li, .vlist li { margin-bottom: 0.4em; }
.pill { font-variant-numeric: tabular-nums; padding: 2px 10px; border-radius: 999px; font-size: 0.88rem; background: color-mix(in srgb, var(--accent) calc(var(--s) * 5.5%), transparent); }
.vid { display: inline-block; min-width: 2.4em; font-size: 0.78rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }

/* prose */
.prose { max-width: 760px; }
.prose li { margin-bottom: 0.6em; }
.vlist { list-style: none; padding: 0; }
.formula { font-family: var(--serif); font-size: 1.3rem; text-align: center; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.scale { border-collapse: collapse; width: 100%; margin: 16px 0 24px; font-size: 0.95rem; }
.scale th, .scale td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.scale td:first-child { font-weight: 700; width: 64px; font-variant-numeric: tabular-nums; }

/* footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 24px 0 40px; font-size: 0.9rem; }
.footer-inner p { margin: 0.2em 0; }

@media (max-width: 600px) {
  .section { padding: 28px 16px; }
  .hero { padding: 36px 0 12px; }
  .lede { font-size: 1.1rem; }
  .stats { gap: 20px; }
  .bars li { grid-template-columns: 110px 1fr 34px; gap: 8px; }
  .bar-label { font-size: 0.85rem; }
}

/* vignette-level detail */
.heat .cell a { display: block; line-height: 38px; color: var(--text); text-decoration: none; }
.heat .cell a:hover { outline: 2px solid var(--accent); border-radius: 3px; }
a.bar-label { color: var(--text); text-decoration: none; }
a.bar-label:hover { color: var(--accent); text-decoration: underline; }
.cat-block { margin-top: 32px; scroll-margin-top: 16px; }
.cat-head { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid var(--text); padding-bottom: 6px; }
.cat-head h3 { margin: 0; }
.coding { border-bottom: 1px solid var(--line); padding: 16px 0; }
.coding p { margin: 0.5em 0 0; max-width: 60em; }
.coding-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.coding-title { font-weight: 600; color: var(--text); text-decoration: none; margin-right: auto; }
.coding-title:hover { color: var(--accent); text-decoration: underline; }
a.vid { text-decoration: none; }
.mini { display: flex; gap: 14px; margin: 0; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.mini div { display: flex; gap: 4px; align-items: baseline; }
.mini dt { color: var(--muted); }
.mini dd { margin: 0; font-weight: 600; }
.scenario { color: var(--muted); font-style: italic; }
.sources { font-size: 0.85rem; color: var(--muted); }
.sources a { color: var(--muted); }
.question { font-family: var(--serif); font-size: 1.2rem; }
.table-scroll { overflow-x: auto; }
.cmp { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
.cmp th, .cmp td { text-align: left; vertical-align: top; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.cmp thead th { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.cmp tbody th { white-space: nowrap; font-weight: 600; }
.cmp tbody th a { color: var(--text); }
.cmp .n { text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cmp td:last-child { min-width: 320px; }
.cmp .sources { margin-top: 4px; }
@media (max-width: 600px) { .mini { width: 100%; } }
