/* ==========================================================================
   toddreboul.com — encyclopedic design system
   Wikipedia's information architecture, rebuilt as warm editorial neutral.

   Palette intent: paper and ink, not screen and pixels. A warm off-white
   stock, warm charcoal text, deep navy for authority, brass for accent.
   Dark mode is a warm graphite — the same system with the lights off, not a
   cold blue-black. It only appears if the reader's OS asks for it, or if they
   pick it from the toggle.

   No dependencies. No build step. Edit § 1 and the whole site reskins.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Palette — light (the default anyone sees unless they've asked for dark) */
  --paper:        #faf9f6;
  --paper-wash:   #f2efe7;
  --surface:      #ffffff;
  --surface-2:    #f4f1ea;
  --ink:          #1a1917;
  --ink-soft:     #3c3833;
  --muted:        #6e6862;
  --rule:         #e7e2d8;
  --rule-strong:  #d1cabe;

  --accent:       #1f3a5f;   /* deep navy — authority without corporate blue */
  --accent-hover: #16293f;
  --accent-soft:  #ecf0f6;
  --accent-line:  #c4d0e0;

  /* Warm metallic — the "expensive" note. Kept dark enough to clear WCAG AA
     as small-caps text (it is used for timeline dates, kickers and citation
     markers, not just as a rule colour). */
  --brass:        #7f6034;
  --brass-soft:   #f7f1e5;
  --brass-line:   #e0d0b4;

  /* Filled blocks that carry light text. These must NOT be derived from
     --accent: in dark mode --accent flips to a light blue for legibility on a
     dark page, which would put white text on a light background. Keep the
     "seal" navy fixed in both themes, and give the infobox header its own
     dark-mode value. */
  --seal-bg:      #1f3a5f;
  --seal-fg:      #ffffff;
  --ibhead-bg:    #1f3a5f;
  --ibhead-fg:    #ffffff;

  --shadow-sm:    0 1px 2px rgb(40 34 24 / .05), 0 1px 1px rgb(40 34 24 / .04);
  --shadow-md:    0 4px 14px rgb(40 34 24 / .07), 0 1px 3px rgb(40 34 24 / .05);
  --shadow-lg:    0 18px 50px rgb(40 34 24 / .13), 0 4px 14px rgb(40 34 24 / .07);

  /* Type */
  --font-ui:      ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body:    ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, ui-serif, serif;
  --font-mono:    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Metrics */
  --rail-left:  248px;
  --rail-right: 340px;
  --gutter:     44px;
  --measure:    70ch;
  --radius:     12px;
  --radius-sm:  7px;
  --header-h:   60px;

  /* Motion */
  --ease: cubic-bezier(.22, 1, .36, 1);
  --dur:  .32s;

  color-scheme: light;
}

:root[data-theme="dark"] {
  /* Warm graphite — same system, lights off. Not a cold blue-black. */
  --paper:        #171614;
  --paper-wash:   #1e1c19;
  --surface:      #1f1e1b;
  --surface-2:    #272522;
  --ink:          #edeae3;
  --ink-soft:     #cfcac0;
  --muted:        #9a948a;
  --rule:         #2f2d29;
  --rule-strong:  #45413a;

  --accent:       #9db8dd;
  --accent-hover: #b8cbe8;
  --accent-soft:  #1d2836;
  --accent-line:  #3a4c66;

  --brass:        #cba873;
  --brass-soft:   #2a2419;
  --brass-line:   #4a3f2b;

  /* Navy seal still reads on warm graphite; the infobox header goes to a
     slate block with normal ink text rather than white-on-pale-blue. */
  --seal-bg:      #2a4570;
  --seal-fg:      #ffffff;
  --ibhead-bg:    #262b34;
  --ibhead-fg:    var(--ink);

  --shadow-sm:    0 1px 2px rgb(0 0 0 / .45);
  --shadow-md:    0 4px 14px rgb(0 0 0 / .5);
  --shadow-lg:    0 18px 52px rgb(0 0 0 / .65);

  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 26px);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  letter-spacing: -.004em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* A barely-there warm wash behind the top of the page — reads as paper
   catching light rather than as a gradient. */
body::before {
  content: "";
  position: fixed; inset: 0 0 auto 0; height: 60vh;
  background: linear-gradient(180deg, var(--paper-wash), transparent 75%);
  opacity: .7; pointer-events: none; z-index: -1;
}

img, svg, video { max-width: 100%; height: auto; display: block; }

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color var(--dur) var(--ease);
}
a:hover { color: var(--accent-hover); text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

hr { border: 0; border-top: 1px solid var(--rule); margin: 2.4rem 0; }

::selection { background: var(--accent); color: var(--paper); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--seal-bg); color: var(--seal-fg);
  padding: .7rem 1.1rem; border-radius: 0 0 var(--radius-sm) 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* --------------------------------------------------------------------------
   3. Reading progress
   -------------------------------------------------------------------------- */
#progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 100%;
  transform: scaleX(0); transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--accent), var(--brass));
  z-index: 120; will-change: transform;
}

/* --------------------------------------------------------------------------
   4. Masthead
   -------------------------------------------------------------------------- */
.masthead {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 clamp(1rem, 3vw, 2.2rem);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--rule);
}

.brand {
  display: inline-flex; align-items: center; gap: .65rem;
  font-family: var(--font-display);
  font-size: 1.12rem; font-weight: 600; letter-spacing: -.015em;
  color: var(--ink); white-space: nowrap;
}
.brand:hover { color: var(--ink); text-decoration: none; }
.brand-mark {
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--seal-bg);
  color: var(--seal-fg);
  font-family: var(--font-ui);
  font-size: .7rem; font-weight: 700; letter-spacing: .04em;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .12), var(--shadow-sm);
  position: relative;
}
/* brass hairline along the top edge of the mark */
.brand-mark::after {
  content: ""; position: absolute; inset: 0; border-radius: 8px;
  border-top: 1.5px solid color-mix(in srgb, var(--brass) 75%, transparent);
}
.brand-sub {
  color: var(--muted); font-family: var(--font-ui);
  font-size: .68rem; font-weight: 600; letter-spacing: .13em; text-transform: uppercase;
  padding-left: .65rem; margin-left: .15rem; border-left: 1px solid var(--rule-strong);
}

.masthead-nav {
  display: flex; align-items: center; gap: .1rem;
  margin-left: auto;
  font-family: var(--font-ui); font-size: .88rem;
}
.masthead-nav a {
  color: var(--ink-soft); padding: .44rem .74rem; border-radius: var(--radius-sm);
  position: relative;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.masthead-nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.masthead-nav a[aria-current="page"] { color: var(--accent); font-weight: 550; }
.masthead-nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: .74rem; right: .74rem; bottom: .1rem;
  height: 1.5px; background: var(--brass); border-radius: 2px;
}

.icon-btn {
  width: 35px; height: 35px; flex: none;
  display: grid; place-items: center;
  background: transparent; color: var(--ink-soft);
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--rule-strong); }
.icon-btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.search-trigger {
  display: inline-flex; align-items: center; gap: .5rem;
  height: 35px; padding: 0 .6rem 0 .68rem;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
  font-family: var(--font-ui); font-size: .85rem; cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.search-trigger:hover { border-color: var(--rule-strong); color: var(--ink-soft); }
.search-trigger svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.search-trigger kbd {
  font-family: var(--font-ui); font-size: .68rem; font-weight: 600;
  padding: .14rem .36rem; border: 1px solid var(--rule-strong); border-radius: 4px;
  color: var(--muted); background: var(--paper);
}
@media (max-width: 700px) { .search-trigger .search-label, .search-trigger kbd { display: none; } }

.nav-toggle { display: none; }

/* --------------------------------------------------------------------------
   5. Page shell — three columns, Wikipedia bones
   -------------------------------------------------------------------------- */
.shell {
  display: grid;
  grid-template-columns: var(--rail-left) minmax(0, 1fr) var(--rail-right);
  gap: var(--gutter);
  max-width: 1560px;
  margin: 0 auto;
  padding: 2.6rem clamp(1rem, 3vw, 2.4rem) 5rem;
  align-items: start;
}
.shell--wide  { grid-template-columns: var(--rail-left) minmax(0, 1fr); }
.shell--plain { display: block; max-width: 920px; }

/* --------------------------------------------------------------------------
   6. Left rail — contents / scroll-spy
   -------------------------------------------------------------------------- */
.rail-left {
  position: sticky; top: calc(var(--header-h) + 2rem);
  max-height: calc(100vh - var(--header-h) - 4rem);
  overflow-y: auto; overscroll-behavior: contain;
  font-family: var(--font-ui);
  scrollbar-width: thin;
}
.rail-title {
  font-size: .68rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 .95rem;
}

/* JS wraps the rail's label + list in <details class="toc-disclosure">. On
   desktop it is forced open and the summary behaves like a plain heading; on
   mobile it collapses so the article headline stays above the fold. */
.toc-disclosure summary {
  list-style: none; cursor: default;
  display: flex; align-items: center; justify-content: space-between;
}
.toc-disclosure summary::-webkit-details-marker { display: none; }
.toc-disclosure summary .rail-title { margin-bottom: .95rem; }

.toc { position: relative; padding-left: 1px; }
.toc::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 1.5px; background: var(--rule); border-radius: 2px;
}
.toc-marker {
  position: absolute; left: 0; width: 1.5px; border-radius: 2px;
  background: var(--brass);
  height: 0; top: 0; opacity: 0;
  transition: top var(--dur) var(--ease), height var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.toc a {
  display: block; padding: .34rem 0 .34rem 1.05rem;
  font-size: .86rem; line-height: 1.45;
  color: var(--muted);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.toc a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.toc a.is-active { color: var(--ink); font-weight: 600; }
.toc .toc-sub a { padding-left: 1.95rem; font-size: .81rem; }

.rail-aux { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.rail-aux a {
  display: flex; align-items: center; gap: .45rem;
  padding: .3rem 0; font-size: .84rem; color: var(--muted);
}
.rail-aux a:hover { color: var(--accent); text-decoration: none; }

/* --------------------------------------------------------------------------
   7. Article
   -------------------------------------------------------------------------- */
.article { min-width: 0; }

.hatnote {
  font-size: .885rem; color: var(--muted); font-style: italic;
  padding: .6rem 1rem; margin: 0 0 1.5rem;
  background: var(--surface-2); border-left: 2px solid var(--brass-line);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.hatnote a { font-style: normal; }

.article-header { margin-bottom: 1.9rem; }

.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-ui); font-size: .68rem; font-weight: 700;
  letter-spacing: .15em; text-transform: uppercase; color: var(--brass);
  margin-bottom: .85rem;
}
.eyebrow::before {
  content: ""; width: 20px; height: 1.5px; background: var(--brass); border-radius: 2px;
}

.article-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5.6vw, 3.7rem);
  line-height: 1.04; letter-spacing: -.022em; font-weight: 600;
  margin: 0 0 .55rem;
  text-wrap: balance;
}
.article-subtitle {
  font-size: 1.1rem; color: var(--muted); margin: 0;
  max-width: 60ch; text-wrap: pretty; line-height: 1.6;
}
.title-rule {
  height: 1px; margin: 1.5rem 0 0;
  background: linear-gradient(90deg, var(--brass-line) 0 90px, var(--rule) 90px, transparent);
}

/* Lead paragraph — the encyclopedic opener */
.lead {
  font-size: 1.235rem; line-height: 1.62; color: var(--ink-soft);
  margin: 1.7rem 0 2.1rem; max-width: var(--measure);
  text-wrap: pretty;
}
.lead strong, .lead b { color: var(--ink); font-weight: 650; }

/* Section rhythm */
.article section { scroll-margin-top: calc(var(--header-h) + 26px); }
.article h2 {
  font-family: var(--font-display);
  font-size: 1.85rem; line-height: 1.2; letter-spacing: -.018em; font-weight: 600;
  margin: 3.4rem 0 .3rem; padding-bottom: .5rem;
  border-bottom: 1px solid var(--rule);
  position: relative;
}
/* brass tick under each section heading */
.article h2::after {
  content: ""; position: absolute; left: 0; bottom: -1px;
  width: 46px; height: 1.5px; background: var(--brass); border-radius: 2px;
}
.article h3 {
  font-size: 1.18rem; font-weight: 650; letter-spacing: -.01em;
  margin: 2.1rem 0 .55rem; color: var(--ink);
}
.article h4 {
  font-size: 1rem; font-weight: 650; margin: 1.5rem 0 .35rem; color: var(--ink-soft);
}
.article p { margin: 0 0 1.1rem; max-width: var(--measure); text-wrap: pretty; }
.article ul, .article ol { max-width: var(--measure); margin: 0 0 1.2rem; padding-left: 1.35rem; }
.article li { margin: .38rem 0; }
.article li::marker { color: var(--brass); }

/* Heading anchor affordance */
.anchor-link {
  position: absolute; left: -1.4rem; top: 50%; transform: translateY(-58%);
  opacity: 0; font-size: .9rem; color: var(--rule-strong);
  transition: opacity var(--dur) var(--ease), color var(--dur) var(--ease);
  padding: 0 .25rem;
}
h2:hover .anchor-link, h3:hover .anchor-link, .anchor-link:focus-visible { opacity: 1; }
.anchor-link:hover { color: var(--brass); text-decoration: none; }
@media (max-width: 1100px) { .anchor-link { display: none; } }

blockquote {
  margin: 1.8rem 0; padding: .3rem 0 .3rem 1.4rem;
  border-left: 2px solid var(--brass);
  font-family: var(--font-display); font-size: 1.2rem; line-height: 1.55;
  color: var(--ink-soft); font-style: italic;
  max-width: var(--measure);
}
blockquote cite {
  display: block; margin-top: .65rem;
  font-family: var(--font-ui); font-size: .8rem; font-style: normal;
  color: var(--muted); letter-spacing: .04em; text-transform: uppercase; font-weight: 600;
}
blockquote cite::before { content: "— "; }

code, kbd, samp {
  font-family: var(--font-mono); font-size: .86em;
  background: var(--surface-2); padding: .14em .38em; border-radius: 4px;
}

/* --------------------------------------------------------------------------
   8. Infobox — the signature Wikipedia element, made expensive
   -------------------------------------------------------------------------- */
.rail-right { position: sticky; top: calc(var(--header-h) + 2rem); min-width: 0; }

.infobox {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  font-family: var(--font-ui);
  font-size: .865rem;
}
.infobox-head {
  padding: 1.05rem 1.15rem;
  background: var(--ibhead-bg);
  color: var(--ibhead-fg);
  border-top: 2px solid var(--brass);
}
.infobox-head h2 {
  all: unset;
  display: block;
  font-family: var(--font-display); font-size: 1.18rem; font-weight: 600;
  letter-spacing: -.012em; line-height: 1.25;
}
.infobox-head p {
  margin: .28rem 0 0; font-size: .74rem; opacity: .8;
  letter-spacing: .09em; text-transform: uppercase; font-weight: 600;
}

.infobox-figure { margin: 0; background: var(--surface-2); border-bottom: 1px solid var(--rule); }
.infobox-figure img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.infobox-figure figcaption {
  padding: .58rem .95rem; font-size: .76rem; line-height: 1.4; color: var(--muted);
  border-top: 1px solid var(--rule);
}

.infobox dl { margin: 0; padding: .3rem 0; }
.infobox-row {
  display: grid; grid-template-columns: 6rem 1fr; gap: .6rem;
  padding: .56rem 1.15rem;
  border-top: 1px solid var(--rule);
}
.infobox-row:first-child { border-top: 0; }
.infobox dt {
  font-size: .69rem; font-weight: 700; letter-spacing: .1em;
  color: var(--muted); text-transform: uppercase; padding-top: .18rem;
}
.infobox dd { margin: 0; color: var(--ink-soft); line-height: 1.5; }
.infobox dd ul { list-style: none; margin: 0; padding: 0; }
.infobox dd li { margin: 0 0 .2rem; }

.infobox-section-label {
  padding: .52rem 1.15rem; margin: 0;
  background: var(--surface-2);
  border-top: 1px solid var(--rule);
  font-size: .66rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted);
}

.infobox-links {
  display: flex; flex-wrap: wrap; gap: .42rem;
  padding: .9rem 1.15rem;
  border-top: 1px solid var(--rule);
}
.infobox-links a {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .32rem .68rem; font-size: .78rem; font-weight: 550;
  color: var(--ink-soft); background: var(--surface);
  border: 1px solid var(--rule-strong); border-radius: 100px;
  transition: all var(--dur) var(--ease);
}
.infobox-links a:hover {
  color: var(--accent); border-color: var(--accent); background: var(--accent-soft);
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   9. Stat strip
   -------------------------------------------------------------------------- */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px; margin: 2.1rem 0;
  background: var(--rule);
  border: 1px solid var(--rule); border-radius: var(--radius);
  overflow: hidden;
}
.stat {
  background: var(--surface); padding: 1.2rem 1.25rem;
  position: relative;
}
.stat::before {
  content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 2px;
  background: var(--brass); transform: scaleX(0); transform-origin: 0 50%;
  transition: transform .6s var(--ease);
}
.stats:hover .stat::before,
.stat:hover::before { transform: scaleX(1); }
.stat-value {
  font-family: var(--font-display); font-size: 2.15rem; font-weight: 600;
  letter-spacing: -.028em; line-height: 1; color: var(--ink);
  font-variant-numeric: lining-nums tabular-nums;
}
.stat-value .suffix { font-size: .58em; color: var(--brass); margin-left: .08em; }
.stat-label {
  font-family: var(--font-ui); font-size: .7rem; font-weight: 700;
  letter-spacing: .11em; text-transform: uppercase; color: var(--muted);
  margin-top: .5rem;
}

/* --------------------------------------------------------------------------
   10. Cards
   -------------------------------------------------------------------------- */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 1.1rem; margin: 1.6rem 0 2.1rem;
}
.card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 1.25rem 1.3rem 1.3rem;
  position: relative; overflow: hidden;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.card::after {
  content: ""; position: absolute; inset: auto auto 0 0; height: 2px; width: 100%;
  background: var(--brass);
  transform: scaleX(0); transform-origin: 0 50%;
  transition: transform .45s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--rule-strong); }
.card:hover::after { transform: scaleX(1); }
.card-kicker {
  font-family: var(--font-ui); font-size: .67rem; font-weight: 700;
  letter-spacing: .13em; text-transform: uppercase; color: var(--muted);
  margin-bottom: .5rem;
}
.card h3 {
  font-family: var(--font-display); font-size: 1.22rem; font-weight: 600;
  letter-spacing: -.014em; margin: 0 0 .45rem; line-height: 1.25;
}
.card h3 a { color: var(--ink); }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card h3 a:hover { color: var(--accent); text-decoration: none; }
.card p { font-size: .89rem; color: var(--muted); margin: 0 0 .9rem; line-height: 1.58; }
.card-meta { margin-top: auto; display: flex; flex-wrap: wrap; gap: .35rem; font-family: var(--font-ui); }

.tag {
  display: inline-block; padding: .2rem .55rem;
  font-size: .69rem; font-weight: 650; letter-spacing: .04em;
  color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--rule); border-radius: 100px;
}
.tag--active { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.tag--amber  { color: var(--brass); background: var(--brass-soft); border-color: var(--brass-line); }

/* --------------------------------------------------------------------------
   11. Timeline
   -------------------------------------------------------------------------- */
.timeline { position: relative; margin: 2.1rem 0; padding-left: 1.7rem; max-width: var(--measure); }
.timeline::before {
  content: ""; position: absolute; left: 4px; top: .55rem; bottom: .55rem;
  width: 1.5px; background: linear-gradient(180deg, var(--brass), var(--rule));
  border-radius: 2px;
}
.tl-item { position: relative; padding: 0 0 2rem; }
.tl-item::before {
  content: ""; position: absolute; left: -1.7rem; top: .5rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 1.5px solid var(--brass);
  box-shadow: 0 0 0 3px var(--paper);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.tl-item:hover::before { background: var(--brass); transform: scale(1.3); }
.tl-date {
  font-family: var(--font-ui); font-size: .72rem; font-weight: 700;
  letter-spacing: .13em; text-transform: uppercase; color: var(--brass);
  font-variant-numeric: lining-nums tabular-nums;
}
.tl-item h3 { margin: .25rem 0 .32rem; font-size: 1.1rem; font-weight: 650; letter-spacing: -.01em; }
.tl-item p { margin: 0; font-size: .94rem; color: var(--muted); }

/* --------------------------------------------------------------------------
   12. Tables
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 1.6rem 0; -webkit-overflow-scrolling: touch; }
table.wikitable {
  width: 100%; border-collapse: collapse;
  font-family: var(--font-ui); font-size: .885rem;
  background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius);
  overflow: hidden;
}
table.wikitable th {
  text-align: left; padding: .72rem .95rem;
  background: var(--surface-2);
  font-size: .69rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
  border-bottom: 1px solid var(--rule);
}
table.wikitable td {
  padding: .72rem .95rem; border-bottom: 1px solid var(--rule);
  color: var(--ink-soft); vertical-align: top;
  font-variant-numeric: lining-nums tabular-nums;
}
table.wikitable tbody tr:last-child td { border-bottom: 0; }
table.wikitable tbody tr { transition: background var(--dur) var(--ease); }
table.wikitable tbody tr:hover { background: var(--surface-2); }

/* --------------------------------------------------------------------------
   13. Citations & references
   -------------------------------------------------------------------------- */
sup.cite { line-height: 0; white-space: nowrap; }
sup.cite a {
  font-family: var(--font-ui); font-size: .68rem; font-weight: 700;
  color: var(--brass); padding: 0 .1em;
  font-variant-numeric: lining-nums tabular-nums;
}
sup.cite a::before { content: "["; }
sup.cite a::after  { content: "]"; }
sup.cite a:hover { text-decoration: none; background: var(--brass-soft); border-radius: 3px; }

.references { counter-reset: ref; list-style: none; padding: 0; margin: 1.3rem 0 0; }
.references li {
  counter-increment: ref;
  position: relative; padding: .55rem 0 .55rem 2.5rem;
  font-size: .885rem; line-height: 1.55; color: var(--muted);
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: calc(var(--header-h) + 26px);
  transition: background var(--dur) var(--ease);
}
.references li::before {
  content: counter(ref) ".";
  position: absolute; left: 0; top: .55rem; width: 2rem; text-align: right;
  font-family: var(--font-ui); font-size: .78rem; font-weight: 700;
  color: var(--brass); font-variant-numeric: lining-nums tabular-nums;
}
.references li:target,
.references li.flash { background: var(--brass-soft); border-radius: var(--radius-sm); }
.references cite { font-style: normal; color: var(--ink-soft); font-weight: 550; }

/* Citation hover card */
.cite-pop {
  position: absolute; z-index: 140;
  max-width: 340px; padding: .75rem .9rem;
  background: var(--surface); color: var(--ink-soft);
  border: 1px solid var(--rule-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-ui); font-size: .81rem; line-height: 1.5;
  opacity: 0; transform: translateY(4px); pointer-events: none;
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}
.cite-pop.is-open { opacity: 1; transform: translateY(0); }
.cite-pop .pop-label {
  display: block; font-size: .63rem; font-weight: 700; letter-spacing: .13em;
  text-transform: uppercase; color: var(--brass); margin-bottom: .35rem;
}

/* Internal-link preview card */
.preview-pop {
  position: absolute; z-index: 140; width: 330px;
  background: var(--surface);
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); overflow: hidden;
  opacity: 0; transform: translateY(6px) scale(.985); pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
  font-family: var(--font-ui);
  border-top: 2px solid var(--brass);
}
.preview-pop.is-open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.preview-pop .pv-body { padding: .9rem 1rem; }
.preview-pop .pv-kicker {
  font-size: .63rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--brass); margin-bottom: .3rem;
}
.preview-pop .pv-title {
  font-family: var(--font-display); font-size: 1.06rem; font-weight: 600;
  letter-spacing: -.012em; margin: 0 0 .32rem; color: var(--ink);
}
.preview-pop .pv-text { margin: 0; font-size: .83rem; line-height: 1.5; color: var(--muted); }
.preview-pop .pv-foot {
  padding: .52rem 1rem; border-top: 1px solid var(--rule); background: var(--surface-2);
  font-size: .73rem; color: var(--muted);
}

a.wikilink { border-bottom: 1px dotted var(--accent-line); }
a.wikilink:hover { text-decoration: none; border-bottom-style: solid; }

/* --------------------------------------------------------------------------
   14. Callouts
   -------------------------------------------------------------------------- */
.callout {
  display: flex; gap: .9rem;
  padding: 1.05rem 1.2rem; margin: 1.7rem 0; max-width: var(--measure);
  background: var(--surface); border: 1px solid var(--rule);
  border-left: 2px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0;
}
.callout--amber { border-left-color: var(--brass); }
.callout-icon { flex: none; width: 20px; height: 20px; color: var(--accent); margin-top: .16rem; }
.callout--amber .callout-icon { color: var(--brass); }
.callout-icon svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.callout-body { min-width: 0; }
.callout-body p { margin: 0; font-size: .91rem; line-height: 1.6; }
.callout-body strong { color: var(--ink); }

/* --------------------------------------------------------------------------
   15. Command palette / search
   -------------------------------------------------------------------------- */
.palette-backdrop {
  position: fixed; inset: 0; z-index: 190;
  background: rgb(26 22 16 / .4);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: none; padding: 12vh 1rem 1rem;
  justify-content: center; align-items: flex-start;
}
.palette-backdrop.is-open { display: flex; animation: fade .18s var(--ease); }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.palette {
  width: 100%; max-width: 570px;
  background: var(--surface);
  border: 1px solid var(--rule-strong); border-radius: 14px;
  box-shadow: var(--shadow-lg); overflow: hidden;
  font-family: var(--font-ui);
  border-top: 2px solid var(--brass);
  animation: rise .24s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(-10px) scale(.98) } to { opacity: 1; transform: none } }

.palette-input-row { display: flex; align-items: center; gap: .7rem; padding: .95rem 1.15rem; border-bottom: 1px solid var(--rule); }
.palette-input-row svg { width: 18px; height: 18px; flex: none; color: var(--muted); stroke: currentColor; fill: none; stroke-width: 1.7; }
#palette-input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--ink); font-family: inherit; font-size: 1.02rem;
}
#palette-input::placeholder { color: var(--muted); }

.palette-results { list-style: none; margin: 0; padding: .4rem; max-height: 46vh; overflow-y: auto; }
.palette-results li { margin: 0; }
.palette-results a { display: block; padding: .62rem .78rem; border-radius: var(--radius-sm); color: var(--ink); }
.palette-results a:hover, .palette-results a.is-active { background: var(--accent-soft); text-decoration: none; }
.palette-results a.is-active { outline: 1px solid var(--accent-line); }
.pr-title { font-size: .94rem; font-weight: 600; letter-spacing: -.008em; }
.pr-desc  { font-size: .79rem; color: var(--muted); margin-top: .14rem; line-height: 1.45; }
.pr-section { font-size: .65rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--brass); }
.palette-empty { padding: 1.7rem 1.15rem; text-align: center; color: var(--muted); font-size: .89rem; }
.palette-foot {
  display: flex; gap: 1rem; padding: .58rem 1.15rem;
  border-top: 1px solid var(--rule); background: var(--surface-2);
  font-size: .73rem; color: var(--muted);
}
.palette-foot kbd {
  font-family: inherit; font-size: .68rem; font-weight: 600; background: var(--surface);
  border: 1px solid var(--rule-strong); border-radius: 4px; padding: .1rem .3rem; margin-right: .25rem;
}

/* --------------------------------------------------------------------------
   16. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--surface);
  padding: 2.7rem clamp(1rem, 3vw, 2.4rem);
  font-family: var(--font-ui); font-size: .865rem;
}
.footer-inner {
  max-width: 1560px; margin: 0 auto;
  display: grid; grid-template-columns: 1.4fr repeat(auto-fit, minmax(150px, 1fr)); gap: 2rem;
}
.footer-brand p { margin: .55rem 0 0; color: var(--muted); max-width: 40ch; line-height: 1.6; }
.footer-col h3 {
  font-size: .67rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 .75rem;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin: 0 0 .4rem; }
.footer-col a { color: var(--ink-soft); }
.footer-col a:hover { color: var(--accent); }

.footer-cats {
  max-width: 1560px; margin: 2.3rem auto 0; padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
}
.footer-cats .cats-label { font-size: .68rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); margin-right: .35rem; }
.footer-legal {
  max-width: 1560px; margin: 1.45rem auto 0; padding-top: 1.15rem;
  border-top: 1px solid var(--rule);
  display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; justify-content: space-between;
  color: var(--muted); font-size: .81rem;
}

/* --------------------------------------------------------------------------
   17. Reveal-on-scroll
   -------------------------------------------------------------------------- */
/* Gated on .has-js, which the inline <head> script sets. Without that gate a
   reader with JavaScript off would get a permanently invisible article — the
   content is in the DOM, but opacity:0 with nothing ever to clear it. */
.has-js [data-reveal] {
  opacity: 0; transform: translateY(14px);
  transition: opacity .55s var(--ease), transform .55s var(--ease);
}
.has-js [data-reveal].is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .has-js [data-reveal] { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   18. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1240px) {
  .shell { grid-template-columns: var(--rail-left) minmax(0, 1fr); }
  .rail-right { position: static; grid-column: 2; margin-bottom: 2rem; }
  .infobox { max-width: 400px; }
}

@media (max-width: 960px) {
  .shell, .shell--wide { grid-template-columns: minmax(0, 1fr); gap: 1.6rem; }
  .rail-right { grid-column: 1; }
  .infobox { max-width: none; }

  .nav-toggle { display: grid; }
  .masthead-nav {
    position: fixed; top: var(--header-h); left: 0; right: 0; z-index: 99;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--rule);
    box-shadow: var(--shadow-md);
    padding: .5rem;
    transform: translateY(-8px); opacity: 0; pointer-events: none;
    transition: opacity .2s var(--ease), transform .2s var(--ease);
  }
  .masthead-nav.is-open { transform: none; opacity: 1; pointer-events: auto; }
  .masthead-nav a { padding: .68rem .8rem; }
  .masthead-nav a[aria-current="page"]::after { left: .8rem; right: auto; width: 18px; }

  /* TOC becomes a tappable disclosure above the article */
  .rail-left {
    position: static; max-height: none; overflow: visible;
    background: var(--surface); border: 1px solid var(--rule);
    border-radius: var(--radius); padding: 0 1rem;
  }
  .toc-disclosure summary {
    cursor: pointer; padding: .9rem 0;
    -webkit-tap-highlight-color: transparent;
  }
  .toc-disclosure summary .rail-title { margin: 0; }
  .toc-disclosure summary::after {
    content: ""; flex: none;
    width: 8px; height: 8px; margin-right: 2px;
    border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform var(--dur) var(--ease);
  }
  .toc-disclosure[open] summary::after { transform: rotate(-135deg) translate(-1px, -1px); }
  .toc-disclosure[open] .toc { padding-bottom: 1rem; }
  .rail-aux { display: none; }
}

@media (max-width: 620px) {
  body { font-size: 16.5px; }
  .shell { padding: 1.7rem 1rem 3.5rem; }
  .brand-sub { display: none; }
  .lead { font-size: 1.12rem; }
  .infobox-row { grid-template-columns: 5.4rem 1fr; }
  .stat-value { font-size: 1.8rem; }
  .footer-inner { grid-template-columns: 1fr; gap: 1.7rem; }
}

/* --------------------------------------------------------------------------
   19. Print — a clean paper CV falls out for free
   -------------------------------------------------------------------------- */
@media print {
  .masthead, .rail-left, #progress, .palette-backdrop, .site-footer, .cite-pop, .preview-pop { display: none !important; }
  body::before { display: none; }
  .shell { display: block; max-width: none; padding: 0; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .article h2 { page-break-after: avoid; }
  .card, .infobox, .stat { break-inside: avoid; }
  a { color: #000; text-decoration: underline; }
  .infobox { box-shadow: none; }
  .infobox-head { background: #eee !important; color: #000 !important; }
}
