/* ---------- tokens ---------- */
:root {
  color-scheme: light;
  --paper: #f6efe1;
  --paper-deep: #ece0c9;
  --surface: #fffaf0;
  --ink: #201a12;
  --ink-soft: #453b2c;
  --ink-muted: #4d4230;
  --rule: #ddc9a3;
  --rule-strong: #c2a876;
  --accent: #24406e;
  --accent-text: #1d3660;
  --on-accent: #f7f1e2;
  --gold: #6b4408;
  --gold-text: #6b4408;
  --verdict-true: #285f48;
  --verdict-false: #8f3320;
  --shadow: 0 1px 2px rgba(32,26,18,.1), 0 8px 24px rgba(32,26,18,.1);
  --display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --bar: 2.75rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #171310;
    --paper-deep: #1f1a14;
    --surface: #241f18;
    --ink: #f2e9d8;
    --ink-soft: #ddd0b8;
    --ink-muted: #bfaf94;
    --rule: #3c3225;
    --rule-strong: #5c4d36;
    --accent: #8fb0e0;
    --accent-text: #8fb0e0;
    --on-accent: #12141b;
    --gold: #e6bd6c;
    --gold-text: #e6bd6c;
    --verdict-true: #6fae8e;
    --verdict-false: #d98a72;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #171310;
  --paper-deep: #1f1a14;
  --surface: #241f18;
  --ink: #f2e9d8;
  --ink-soft: #ddd0b8;
  --ink-muted: #bfaf94;
  --rule: #3c3225;
  --rule-strong: #5c4d36;
  --accent: #8fb0e0;
  --accent-text: #8fb0e0;
  --on-accent: #12141b;
  --gold: #e6bd6c;
  --gold-text: #e6bd6c;
  --verdict-true: #6fae8e;
  --verdict-false: #d98a72;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
html, body { overflow-x: clip; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--serif); font-size: 1.125rem; line-height: 1.62;
  font-optical-sizing: auto; text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
em { font-style: italic; }
blockquote { margin: 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; color: var(--ink); text-wrap: balance; }
section { scroll-margin-top: calc(var(--bar) + .6rem); }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 44rem; margin: 0 auto; padding-inline: var(--gutter); }
.wrap-wide { max-width: 62rem; margin: 0 auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--ink); color: var(--paper); padding: .5rem .8rem; border-radius: 4px; }
.skip:focus { left: .8rem; top: .8rem; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: .55rem;
  min-height: var(--bar); padding: .3rem var(--gutter);
  padding-top: calc(.3rem + env(safe-area-inset-top, 0px));
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: saturate(1.3) blur(10px); -webkit-backdrop-filter: saturate(1.3) blur(10px);
  border-bottom: 1px solid var(--rule); font-family: var(--sans); font-size: .78rem;
}
.topbar .home { font-weight: 650; color: var(--ink-soft); text-decoration: none; flex: none; padding-block: .35rem; }
.topbar .spacer { flex: 1; }
.topnav {
  display: flex; gap: .1rem; overflow-x: auto; scrollbar-width: none; min-width: 0; margin-left: .25rem;
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 1.6rem), transparent 100%);
}
.topnav::-webkit-scrollbar { display: none; }
.topnav a { padding: .25rem .55rem; border-radius: 999px; text-decoration: none; color: var(--ink-muted); white-space: nowrap; }
.topnav a:hover { color: var(--accent-text); background: var(--paper-deep); }
.topnav a[aria-current="true"] { color: var(--ink); background: var(--paper-deep); font-weight: 650; }
.chip {
  display: inline-flex; align-items: center; padding: .22rem .6rem; border-radius: 999px; flex: none;
  border: 1px solid var(--ink-muted); color: var(--ink-soft); text-decoration: none; background: var(--surface);
}
.chip:hover { border-color: var(--accent); color: var(--accent-text); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 1.95rem; height: 1.95rem; padding: 0; border-radius: 999px; cursor: pointer;
  color: var(--ink-muted); background: var(--surface); border: 1px solid var(--ink-muted);
}
.icon-btn:hover { color: var(--accent-text); border-color: var(--accent); }
.icon-btn svg { display: block; }
.icon-btn svg[hidden] { display: none; }
@media (max-width: 34rem) {
  .topbar { gap: .35rem; }
  .topbar .home { max-width: 5.6rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topnav a { padding: .25rem .4rem; }
}

/* ---------- reading rail ---------- */
.rail { display: none; position: fixed; top: 50%; right: 1.1rem; transform: translateY(-50%); flex-direction: column; align-items: flex-end; gap: .5rem; z-index: 30; }
@media (min-width: 88rem) { .rail { display: flex; } }
.rail-dot { position: relative; display: flex; align-items: center; justify-content: flex-end; width: 14px; padding: .15rem 0; text-decoration: none; }
.rail-dot .dot { display: block; width: 6px; height: 6px; border-radius: 50%; background: var(--rule-strong); transition: background-color .15s, transform .15s; }
.rail-dot:hover .dot, .rail-dot:focus-visible .dot { background: var(--ink-soft); }
.rail-dot.active .dot { background: var(--accent); transform: scale(1.5); }
.rail-label {
  position: absolute; right: 100%; top: 50%; margin-top: -.85rem; margin-right: .5rem;
  font-family: var(--sans); font-size: .75rem; line-height: 1.2; color: var(--ink-soft); white-space: nowrap;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: .25rem .55rem; box-shadow: var(--shadow);
  opacity: 0; transform: translateX(6px); pointer-events: none; transition: opacity .12s, transform .12s;
}
.rail-dot:hover .rail-label, .rail-dot:focus-visible .rail-label { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .rail-dot .dot, .rail-label { transition: none; } }
@media print { .rail, .topbar { display: none; } }

/* ---------- hero ---------- */
.hero { position: relative; display: grid; gap: 2rem; max-width: 72rem; margin: 0 auto; padding: clamp(1.6rem, 5vw, 3rem) var(--gutter) 2.5rem; }
@media (min-width: 62rem) {
  .hero { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: center; }
}
.kicker { font-family: var(--sans); font-size: .76rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-text); margin: 0 0 .9rem; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); line-height: 1.05; letter-spacing: -.015em; margin: 0 0 1.1rem; font-weight: 620; font-variation-settings: "SOFT" 30, "WONK" 0; }
.deck { font-size: clamp(1.08rem, 1.7vw, 1.26rem); line-height: 1.52; color: var(--ink-soft); margin: 0 0 1.1rem; }
.byline { font-family: var(--sans); font-size: .82rem; color: var(--ink-muted); margin: 0 0 1.4rem; }
.hero-facts { list-style: none; margin: 0; padding: 1rem 0 0; border-top: 1px solid var(--rule); display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.hero-facts dt, .hf-label { font-family: var(--sans); font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); }
.hero-facts dd, .hf-value { margin: .15rem 0 0; font-family: var(--display); font-size: 1.02rem; font-weight: 600; line-height: 1.3; }
.hero-portrait { position: relative; }
.hero-portrait figure { margin: 0; }
.hero-portrait img { border-radius: 4px; box-shadow: var(--shadow); }
.hero-portrait figcaption { margin-top: .6rem; }

/* ---------- figures & captions ---------- */
figure { margin: 2.4rem 0; }
figure img { border-radius: 4px; box-shadow: var(--shadow); margin: 0 auto; }
figcaption { font-family: var(--sans); font-size: .82rem; line-height: 1.5; color: var(--ink-muted); margin-top: .65rem; max-width: 44rem; }
figcaption .credit { display: block; margin-top: .2rem; font-size: .76rem; }
.figure-pair { display: grid; gap: 1.4rem; margin: 2.4rem 0; }
@media (min-width: 46rem) { .figure-pair { grid-template-columns: 1fr 1fr; align-items: start; } }
.figure-pair figure { margin: 0; }

/* ---------- article body ---------- */
main { padding-bottom: 4rem; }
.chapter { padding: 3.2rem 0; border-top: 1px solid var(--rule); }
.chapter:first-of-type { border-top: none; padding-top: 1rem; }
.ch-kicker { display: flex; align-items: baseline; gap: .6rem; margin: 0 0 .3rem; }
.ch-num { font-family: var(--display); font-weight: 700; font-size: .85rem; letter-spacing: .18em; color: var(--gold-text); }
.ch-dates { font-family: var(--sans); font-size: .82rem; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.chapter h2 { font-size: clamp(1.55rem, 3vw, 2.1rem); margin: 0 0 1.1rem; }
.chapter p { margin: 0 0 1.15rem; }
.chapter > p:first-of-type::first-letter { font-family: var(--display); float: left; font-size: 3.1em; line-height: .86; font-weight: 650; padding: .04em .07em 0 0; color: var(--accent-text); }

.pull { margin: 2.4rem 0; padding: 0 0 0 1.1rem; border-left: 3px solid var(--gold); }
.pull p { font-family: var(--display); font-size: clamp(1.15rem, 2.4vw, 1.5rem); font-weight: 500; line-height: 1.4; color: var(--ink); margin: 0; font-style: italic; }
.pull-label { display: block; margin: .55rem 0 0; font-family: var(--sans); font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); font-style: normal; }

/* ---------- verdict cards ---------- */
.verdicts { list-style: none; margin: 1.8rem 0 0; padding: 0; display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr)); align-items: start; }
.vcard { perspective: 1600px; }
.vcard button {
  all: unset; display: grid; width: 100%; min-height: 11.5rem; cursor: pointer;
  transform-style: preserve-3d; transition: transform .5s cubic-bezier(.2,.7,.3,1); border-radius: 10px;
}
.vcard button:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.vcard[data-flipped="true"] button { transform: rotateY(180deg); }
.vface {
  grid-area: 1 / 1; min-height: 11.5rem; backface-visibility: hidden; border-radius: 10px; border: 1px solid var(--rule);
  background: var(--surface); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .6rem;
}
.vface-back { transform: rotateY(180deg); }
.v-tag { font-family: var(--sans); font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); }
.v-claim { font-family: var(--display); font-size: 1.12rem; font-weight: 600; line-height: 1.32; color: var(--ink); margin: 0; }
.v-hint { margin-top: auto; font-family: var(--sans); font-size: .76rem; color: var(--ink-muted); }
.v-verdict { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--sans); font-size: .82rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.v-verdict.is-true { color: var(--verdict-true); }
.v-verdict.is-false { color: var(--verdict-false); }
.v-explain { font-family: var(--serif); font-size: .96rem; line-height: 1.5; color: var(--ink-soft); margin: 0; }
.v-source { margin-top: auto; font-family: var(--sans); font-size: .74rem; color: var(--ink-muted); }
@media (prefers-reduced-motion: reduce) { .vcard button { transition: none; } }

/* ---------- footer ---------- */
footer.site { border-top: 1px solid var(--rule); padding: 2.4rem var(--gutter) 3rem; font-family: var(--sans); font-size: .85rem; color: var(--ink-muted); }
footer.site .wrap-wide { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; align-items: center; }
footer.site a { color: var(--ink-soft); }
footer.site nav { display: flex; flex-wrap: wrap; gap: .3rem 1rem; }

/* ---------- 404 ---------- */
.nf-main { padding-block: 5rem; max-width: 40rem; }
.btn {
  display: inline-block; padding: .55rem 1rem; border-radius: 999px; text-decoration: none;
  border: 1px solid var(--ink-muted); color: var(--ink-soft); background: var(--surface); font-family: var(--sans);
}
.btn:hover { border-color: var(--accent); color: var(--accent-text); }

/* ---------- misc ---------- */
.lang-note { font-family: var(--sans); font-size: .82rem; color: var(--ink-muted); }
::selection { background: var(--gold); color: var(--on-accent); }
