/* Shared stylesheet for the blog posts (one folder per post, each with its own
   index.html). Palette tokens, the top bar, hero, TL;DR, article typography,
   figure frames, the CTA band and the footer live here; anything a single post
   needs (its charts, the note stepper, tables) stays in that post's <style>.
   Load order: this file first, then the post's own <style>, which may override. */

/* Bright theme is the default; dark is explicit via the toggle. */
:root {
  color-scheme: light;
  --paper: #FFF8F0;
  --paper-2: #F6EBDD;
  --ink: #08090A;
  --ink-2: #2E2F31;
  --mute: #66645F;
  --rule: #EBDFD0;
  --grid: #F1E6D8;
  --accent: #4281A4;
  --accent-text: #2F6485;
  --teal: #52B788;
  --teal-text: #2D7A56;
  --btn-bg: #4281A4;
  --btn-fg: #08090A;
  --good: #2D7A56;
  --band: rgba(82, 183, 136, 0.10);
  --card: #FFFCF8;
  --plate: #FFFFFF;
  --cta-bg: #08090A;         /* Black band, as on the homepage */
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Nova", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 19px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.topbar .brand {
  font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: clamp(12px, 1.5vw, 16px); font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}

/* Left of the bar: the site wordmark leads home, the post title scrolls to top. */
.topbar .crumbs { display: flex; align-items: baseline; gap: 12px; min-width: 0; }

.topbar .home {
  font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 18px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink); text-decoration: none; white-space: nowrap; flex: none;
}

.topbar .sep { color: var(--mute); flex: none; }

.topbar .crumbs .brand { color: var(--mute); font-size: clamp(11px, 1.2vw, 13px); }

@media (max-width: 720px) { .topbar .sep, .topbar .crumbs .brand { display: none; } }

footer.site .home-link { color: var(--ink); font-weight: 600; text-decoration: none; margin-left: 16px; }

footer.site .home-link:hover { color: var(--accent-text); }

.topbar .side { display: flex; align-items: center; gap: 12px; }


.cta-mini {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--btn-fg); background: var(--btn-bg);
  padding: 8px 14px; border-radius: 0; text-decoration: none;
  white-space: nowrap;
}

.cta-mini, .cta-btn {
  border: 1px solid var(--ink); box-shadow: 3px 3px 0 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease;
}


.cta-mini:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 0 var(--ink); }

.cta-mini:active { transform: translate(3px,3px); box-shadow: none; }

@media (max-width: 560px) { .cta-mini { display: none; } }

/* ---------- layout ----------
   .col is the body-copy measure; .wide is the default for every figure,
   chart, and table, so all visuals line up at the same width. */
.col { max-width: 680px; margin: 0 auto; padding: 0 clamp(16px, 5vw, 24px); }

.wide { max-width: 900px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 24px); }

/* ---------- hero ---------- */
header.hero { padding: clamp(48px, 9vh, 96px) 0 8px; text-align: center; }

.eyebrow {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--mute); margin: 0 0 20px;
}

h1 {
  font-size: clamp(32px, 5.8vw, 58px);
  line-height: 1.06;
  letter-spacing: -0.015em;
  font-weight: 600;
  margin: 0 0 24px;
}

.byline .au { white-space: nowrap; display: inline-block; }

.standfirst {
  font-size: clamp(19px, 2.4vw, 22px);
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0 0 12px;
  text-wrap: pretty;
}

.byline {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px; color: var(--mute); letter-spacing: .04em;
  margin: 20px 0 0;
}

.tldr {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 16px 0 6px;
  margin: 34px 0 10px;
}

.tldr-label {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--mute); margin: 0 0 4px;
}

.tldr-row + .tldr-row { border-top: 1px solid var(--grid); }

.tldr-row p { margin: 0; color: var(--ink-2); }

/* ---------- article ---------- */
article { padding-bottom: 40px; }

section { padding: 0; }

.kicker {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--mute); margin: 60px 0 12px;
}

h2 {
  font-size: clamp(25px, 3.2vw, 30px);
  line-height: 1.15; letter-spacing: -0.01em;
  font-weight: 600; margin: 0 0 16px; text-wrap: balance;
}

h3 { font-size: 21px; line-height: 1.3; font-weight: 600; margin: 44px 0 12px; }

p { margin: 0 0 20px; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 2.5px; text-decoration-color: var(--mute); }

a:hover { text-decoration-color: var(--ink); }

.lede::first-letter {
  float: left; font-size: 3.3em; line-height: .82;
  padding: 6px 10px 0 0; font-weight: 600;
}

/* ---------- the three problems ---------- */
.problems { display: grid; gap: 36px; margin: 32px 0; }

.problem { display: grid; grid-template-columns: 58px 1fr; gap: 18px; align-items: start; }

.problem .num {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 27px; font-weight: 700; line-height: 1.1;
  color: var(--teal); padding-top: 2px;
}

.problem h4 { margin: 0 0 8px; font-size: 19px; line-height: 1.3; }

.problem p { margin: 0; font-size: 16.5px; line-height: 1.6; color: var(--ink-2); }

@media (max-width: 560px) { .problem { grid-template-columns: 38px 1fr; gap: 12px; } .problem .num { font-size: 21px; } }

/* ---------- figures ---------- */
figure.viz {
  margin: 56px 0;
  padding: 0;
}

figure.viz .viz-title { font-size: 17px; font-weight: 600; margin: 0 0 14px; }

figure.viz .plot-wrap { overflow-x: auto; }

figure.viz svg { display: block; width: 100%; height: auto; }

figure.viz figcaption {
  font-size: 13.5px; line-height: 1.55; color: var(--mute);
  border-top: 1px solid var(--rule); margin-top: 12px; padding-top: 10px;
}

/* embedded matplotlib figures sit on a white plate in both themes */
figure.viz .plate {
  background: var(--plate); border-radius: 0; padding: 0; overflow: hidden;
}

figure.viz .plate img { display: block; width: 100%; height: auto; }

.legend { display: flex; flex-wrap: wrap; gap: 14px 20px; margin: 0 0 12px; }

.legend span {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13.5px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 7px;
}

.legend i { width: 12px; height: 12px; border-radius: 0; display: inline-block; }

/* svg series classes */
.s-hero { fill: var(--accent); }

.s-frontier { fill: var(--teal); }

.axis-text { fill: var(--mute); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 14.5px; }

.row-label { fill: var(--ink-2); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 15.5px; }

.val-label { fill: var(--ink); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 15px; font-weight: 600; }

.grid-line { stroke: var(--grid); stroke-width: 1; }

.ceiling-line { stroke: var(--mute); stroke-width: 1.2; stroke-dasharray: 5 4; }

.annot { fill: var(--mute); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 14px; }

.mark { cursor: default; }

.mark:hover { opacity: .85; }

/* ---------- checklist: ruled self-audit sheet ---------- */
.checklist {
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  padding: 20px 0 26px; margin: 40px 0;
}

.checklist h3 { margin: 0 0 18px; font-size: 19px; }

.checklist ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }

@media (min-width: 640px) { .checklist ul { grid-template-columns: 1fr 1fr; gap: 13px 36px; } }

.checklist li { position: relative; padding-left: 30px; font-size: 16px; line-height: 1.5; color: var(--ink-2); }

/* ---------- data table ---------- */
.tbl-wrap { overflow-x: auto; }

table.data {
  border-collapse: collapse; width: 100%; min-width: 640px;
  font-size: 14.5px; line-height: 1.5;
}

table.data th {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--mute); text-align: left; font-weight: 600;
  border-bottom: 1.5px solid var(--rule); padding: 8px 16px 8px 0;
}

table.data td { border-bottom: 1px solid var(--rule); padding: 10px 16px 10px 0; vertical-align: top; }

table.data td:first-child { white-space: nowrap; font-weight: 600; vertical-align: middle; }

/* ---------- appendix: reference table, out of the narrative ---------- */
.appendix { border-top: 2px solid var(--ink); margin: 64px 0 0; padding-top: 22px; }

.appendix h2 { font-size: clamp(21px, 2.4vw, 25px); margin-bottom: 10px; }

.appendix-intro { font-size: 15.5px; line-height: 1.55; color: var(--mute); max-width: 68ch; }

/* ---------- CTA: inverted closing band ---------- */
.cta-panel {
  background: var(--cta-bg); color: #FFF8F0;
  padding: clamp(32px, 5vw, 52px);
  border-radius: 0;
  margin: 64px 0 48px; text-align: center;
}

.cta-panel h2 { margin-bottom: 0; color: inherit; }

.cta-panel p { max-width: 58ch; color: inherit; opacity: .85; margin-left: auto; margin-right: auto; }

.cta-panel > :last-child { margin-bottom: 0; }

/* Same button as the homepage's closing band: Floral White with a hard
   Cerulean shade, on the dark panel in both themes. */
.cta-btn {
  display: inline-block; margin-top: 24px;
  font-family: "Iowan Old Style", "Palatino Nova", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 15px; font-weight: 500;
  color: #08090A; background: #FFF8F0; text-decoration: none;
  border: 1px solid #FFF8F0; border-radius: 0;
  padding: 12px 22px;
  box-shadow: 4px 4px 0 0 #4281A4;
  transition: transform .15s ease, box-shadow .15s ease;
}
.cta-btn::after { content: " \2192"; }

.cta-btn:hover { transform: translate(-1px,-1px); box-shadow: 5px 5px 0 0 #4281A4; }

.cta-btn:active { transform: translate(4px,4px); box-shadow: none; }

.cta-note { font-size: 13.5px; margin-top: 14px; opacity: .6; }

/* ---------- footnotes / footer ---------- */
.footnotes {
  border-top: 1px solid var(--rule); margin-top: 56px; padding-top: 24px;
  font-size: 14px; color: var(--mute); line-height: 1.6;
}

.footnotes ol { padding-left: 20px; margin: 10px 0; display: grid; gap: 8px; }

footer.site {
  border-top: 1px solid var(--rule); margin-top: 30px;
  padding: 26px clamp(16px, 4vw, 40px) 48px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px; color: var(--mute);
  display: flex; flex-wrap: wrap; gap: 10px 28px; justify-content: space-between;
}

/* ---------- reveal ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(14px); transition: opacity .55s ease, transform .55s ease; }
  .reveal.in { opacity: 1; transform: none; }
}
