/* ==========================================================================
   MLBAnalytic.com — styles.css
   "Box Score" system: vintage baseball almanac meets clean stats dashboard.
   Display: Oswald (condensed) · Body: Source Serif 4
   Single stylesheet. All design tokens live in CSS variables (:root).
   Sections:
     1. Tokens / theme        7. Cards & grids
     2. Reset & base          8. Hero
     3. Typography            9. Article layout
     4. Layout helpers       10. Tables / figures / code / quotes / ad slots
     5. Skip link & a11y     11. Author bio / related / prev-next / breadcrumb
     6. Header / nav / search 12. Motion · 13. Responsive · 14. Utilities
   ========================================================================== */

/* 1. TOKENS / THEME -------------------------------------------------------- */
:root {
  /* Palette — light "cream paper" theme */
  --paper:      #f6f1e7;   /* page background  */
  --paper-2:    #efe8d8;   /* sunken panels    */
  --card:       #fbf7ee;   /* raised surfaces  */
  --ink:        #16243f;   /* deep navy text   */
  --ink-soft:   #4d5a72;   /* secondary text   */
  --ink-faint:  #8b91a0;   /* meta / captions  */
  --accent:     #b5121b;   /* stitch red       */
  --accent-ink: #8d0e15;   /* red on light, AA for text */
  --rule:       #d9cfb8;   /* hairline divider */
  --rule-soft:  #e6ddca;
  --shadow:     20 33 63;  /* rgb of navy, used in shadows */
  --ok:         #1f7a4d;

  /* Type */
  --font-display: "Oswald", "Arial Narrow", system-ui, sans-serif;
  --font-body:    "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --measure: 42rem;          /* ~720px article column   */
  --wide:    72rem;          /* index / grid container  */

  /* Space + shape */
  --gap: clamp(1rem, 2.5vw, 1.75rem);
  --pad: clamp(1.1rem, 4vw, 2rem);
  --radius: 4px;             /* crisp, almost-square corners */
  --radius-lg: 8px;
  --tap: 44px;               /* min touch target */

  --grain-opacity: .04;
  --grain-blend: multiply;
}

[data-theme="dark"] {
  --paper:      #14181f;
  --paper-2:    #1a1f29;
  --card:       #1c222b;
  --ink:        #ece4d4;
  --ink-soft:   #b3b9c4;
  --ink-faint:  #7e8593;
  --accent:     #e45b4b;
  --accent-ink: #f08272;     /* lighter red reads on dark for AA */
  --rule:       #2c3340;
  --rule-soft:  #242a34;
  --shadow:     0 0 0;
  --ok:         #54c08a;
  --grain-opacity: .05;
  --grain-blend: screen;
}

/* Respect users who prefer dark before JS runs (still overridable by toggle) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --paper:#14181f; --paper-2:#1a1f29; --card:#1c222b; --ink:#ece4d4;
    --ink-soft:#b3b9c4; --ink-faint:#7e8593; --accent:#e45b4b;
    --accent-ink:#f08272; --rule:#2c3340; --rule-soft:#242a34;
    --shadow:0 0 0; --ok:#54c08a; --grain-opacity:.05; --grain-blend:screen;
  }
}

/* 2. RESET & BASE --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

body {
  font-family: var(--font-body);
  font-size: clamp(1.02rem, .98rem + .3vw, 1.16rem);
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper);
  font-feature-settings: "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Subtle paper grain — CSS-only, non-interactive overlay */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--grain-blend);
}
/* keep real content above the grain */
body > * { position: relative; z-index: 2; }

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

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }

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

/* 3. TYPOGRAPHY ----------------------------------------------------------- */
h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: .005em;
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: clamp(2.1rem, 1.4rem + 3.2vw, 3.6rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.05rem); margin-top: 2.4em; }
h3 { font-size: clamp(1.2rem, 1.05rem + .7vw, 1.45rem); margin-top: 1.8em; }
h2 + h3 { margin-top: 1em; }
p, ul, ol, blockquote, figure, table, pre { margin-block: 1.05em; }
strong { font-weight: 600; }
small { font-size: .82em; color: var(--ink-soft); }
abbr[title] { text-decoration: underline dotted; cursor: help; }

.eyebrow {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .8rem;
  font-weight: 600;
  color: var(--accent-ink);
}

/* numerals everywhere stat-y read as box-score */
.tnum, table, .stat, time, .byline { font-variant-numeric: tabular-nums lining-nums; }

/* 4. LAYOUT HELPERS ------------------------------------------------------- */
.container { width: min(100% - 2 * var(--pad), var(--wide)); margin-inline: auto; }
.container--narrow { width: min(100% - 2 * var(--pad), var(--measure)); margin-inline: auto; }
main { display: block; min-height: 60vh; padding-block: clamp(1.5rem, 4vw, 3rem); }
section { margin-block: clamp(2.5rem, 6vw, 4.5rem); }

/* Baseball-stitch divider */
.stitches {
  height: 12px; border: 0; width: 100%;
  background: repeating-linear-gradient(62deg, var(--accent) 0 2px, transparent 2px 9px);
  opacity: .85; margin-block: clamp(2rem, 5vw, 3.5rem);
}
hr, .rule { border: 0; height: 1px; background: var(--rule); margin-block: 2rem; }

/* 5. SKIP LINK & A11Y ----------------------------------------------------- */
.skip-link {
  position: absolute; left: .5rem; top: -3rem;
  background: var(--ink); color: var(--paper);
  padding: .6rem 1rem; border-radius: var(--radius); z-index: 100;
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: .08em;
  transition: top .2s ease;
}
.skip-link:focus { top: .5rem; text-decoration: none; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* 6. HEADER / NAV / SEARCH ------------------------------------------------ */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 2px solid var(--ink);
}
.header-inner {
  width: min(100% - 2 * var(--pad), var(--wide)); margin-inline: auto;
  display: flex; align-items: center; gap: 1rem;
  min-height: 64px; padding-block: .55rem;
}
.brand { display: inline-flex; align-items: center; gap: .55rem; margin-right: auto; }
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  background: var(--accent); position: relative;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 60%, #000);
}
.brand__mark::before, .brand__mark::after {
  content: ""; position: absolute; inset: 4px 7px;
  border-left: 2px dashed #fff; opacity: .85;
}
.brand__mark::after { inset: 4px 7px; border-left: 0; border-right: 2px dashed #fff; }
.brand__name {
  font-family: var(--font-display); font-weight: 700; font-size: 1.32rem;
  letter-spacing: .02em; text-transform: uppercase; color: var(--ink); line-height: 1;
}
.brand__name b { color: var(--accent-ink); font-weight: 700; }

.primary-nav ul { list-style: none; display: flex; align-items: center; gap: .15rem; padding: 0; margin: 0; }
.primary-nav a {
  display: inline-block; padding: .5rem .7rem; border-radius: var(--radius);
  font-family: var(--font-display); text-transform: uppercase;
  font-size: .92rem; letter-spacing: .05em; font-weight: 500; color: var(--ink);
}
.primary-nav a:hover { background: var(--paper-2); text-decoration: none; color: var(--accent-ink); }
.primary-nav a[aria-current="page"] { color: var(--accent-ink); box-shadow: inset 0 -3px 0 var(--accent); }

.header-tools { display: flex; align-items: center; gap: .4rem; }

/* search */
.search { position: relative; }
.search__input {
  font: inherit; font-size: .92rem; color: var(--ink);
  background: var(--card); border: 1.5px solid var(--rule);
  border-radius: var(--radius); padding: .45rem .7rem .45rem 2rem; width: 11rem;
  transition: width .2s ease, border-color .2s ease;
}
.search__input:focus { width: 14rem; border-color: var(--accent); outline: none; }
.search::before {
  content: ""; position: absolute; left: .6rem; top: 50%; width: 14px; height: 14px;
  transform: translateY(-50%);
  background: var(--ink-faint);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M21 20l-4.35-4.35a7.5 7.5 0 10-1.4 1.4L20 21zM5 10.5a5.5 5.5 0 1111 0 5.5 5.5 0 01-11 0z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M21 20l-4.35-4.35a7.5 7.5 0 10-1.4 1.4L20 21zM5 10.5a5.5 5.5 0 1111 0 5.5 5.5 0 01-11 0z'/%3E%3C/svg%3E") center/contain no-repeat;
  pointer-events: none;
}
.search__results {
  position: absolute; top: calc(100% + .4rem); right: 0; width: min(22rem, 86vw);
  background: var(--card); border: 1.5px solid var(--ink); border-radius: var(--radius);
  box-shadow: 0 12px 30px rgb(var(--shadow) / .18); overflow: hidden; z-index: 60;
  max-height: 70vh; overflow-y: auto;
}
.search__results:empty, .search__results[hidden] { display: none; }
.search__result { display: block; padding: .6rem .8rem; border-bottom: 1px solid var(--rule-soft); }
.search__result:last-child { border-bottom: 0; }
.search__result:hover, .search__result:focus { background: var(--paper-2); text-decoration: none; }
.search__result strong { display: block; font-family: var(--font-display); font-weight: 600; color: var(--ink); }
.search__result span { font-size: .85rem; color: var(--ink-soft); }
.search__result mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; }
.search__empty { padding: .7rem .8rem; color: var(--ink-soft); font-size: .9rem; }

/* icon buttons */
.icon-btn {
  width: var(--tap); height: 38px; min-width: 38px; display: inline-grid; place-items: center;
  background: transparent; border: 1.5px solid var(--rule); border-radius: var(--radius);
  color: var(--ink); cursor: pointer; font-size: 1.1rem; line-height: 1;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.theme-toggle .moon { display: none; }
.theme-toggle .sun { display: inline; }
[data-theme="dark"] .theme-toggle .moon { display: inline; }
[data-theme="dark"] .theme-toggle .sun  { display: none; }

.nav-toggle { display: none; }

/* 7. CARDS & GRIDS -------------------------------------------------------- */
.grid { display: grid; gap: var(--gap); }
.grid--cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.grid--cats { grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }

.card {
  background: var(--card); border: 1.5px solid var(--rule);
  border-radius: var(--radius-lg); padding: 1.2rem 1.25rem 1.35rem;
  display: flex; flex-direction: column; gap: .55rem;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  position: relative; overflow: hidden;
}
.card::after { /* top ledger line */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--accent); opacity: 0; transition: opacity .18s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgb(var(--shadow) / .14); border-color: var(--ink); }
.card:hover::after { opacity: 1; }
.card a { color: inherit; }
.card a::after { content: ""; position: absolute; inset: 0; } /* whole-card link */
.card__title { font-family: var(--font-display); font-weight: 600; font-size: 1.28rem; line-height: 1.1; color: var(--ink); }
.card:hover .card__title { color: var(--accent-ink); }
.card__desc { color: var(--ink-soft); font-size: .96rem; line-height: 1.55; }
.card__meta { margin-top: auto; display: flex; align-items: center; gap: .6rem; font-size: .8rem; color: var(--ink-faint); font-family: var(--font-display); letter-spacing: .04em; }
.card__meta time { text-transform: uppercase; }

/* category badge — ticket / scoreboard stub */
.badge {
  display: inline-flex; align-items: center; gap: .35rem; align-self: flex-start;
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: .08em;
  font-size: .72rem; font-weight: 600; line-height: 1;
  padding: .32rem .55rem; color: var(--accent-ink);
  background: color-mix(in srgb, var(--accent) 10%, var(--card));
  border: 1.5px solid var(--accent); border-radius: 3px;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.badge--plain { color: var(--ink-soft); border-color: var(--rule); background: var(--paper-2); }
.badge--plain::before { background: var(--ink-faint); }

/* category navigation cards (homepage) */
.cat-card { text-align: left; }
.cat-card .card__title { font-size: 1.18rem; }
.cat-card .count { font-family: var(--font-display); color: var(--accent-ink); font-weight: 600; }

/* 8. HERO ----------------------------------------------------------------- */
.hero {
  border-bottom: 2px solid var(--ink);
  background:
    radial-gradient(120% 90% at 88% -10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 60%),
    var(--paper-2);
}
.hero__inner { width: min(100% - 2 * var(--pad), var(--wide)); margin-inline: auto; padding-block: clamp(2.5rem, 7vw, 5rem); }
.hero h1 { max-width: 16ch; }
.hero__lede { font-size: clamp(1.1rem, 1rem + .6vw, 1.4rem); color: var(--ink-soft); max-width: 52ch; margin-top: 1rem; }
.hero__cta { margin-top: 1.6rem; display: flex; gap: .8rem; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: .5rem; cursor: pointer;
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: .06em;
  font-weight: 600; font-size: .95rem; padding: .7rem 1.15rem; border-radius: var(--radius);
  border: 2px solid var(--ink); background: var(--ink); color: var(--paper);
  transition: transform .15s ease, background .15s ease, color .15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn--accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: var(--paper); }

/* featured article block */
.featured { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(1.2rem, 3vw, 2.5rem); align-items: center; }
.featured__art { aspect-ratio: 16 / 10; border-radius: var(--radius-lg); border: 1.5px solid var(--rule); object-fit: cover; background: var(--paper-2); }
.featured h2 { margin-top: .4rem; font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem); }
.featured .card__desc { font-size: 1.05rem; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; border-bottom: 2px solid var(--ink); padding-bottom: .5rem; }
.section-head h2 { margin: 0; font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem); }
.section-head a { font-family: var(--font-display); text-transform: uppercase; font-size: .82rem; letter-spacing: .06em; white-space: nowrap; }

/* 9. ARTICLE LAYOUT ------------------------------------------------------- */
.article-head { width: min(100% - 2 * var(--pad), var(--measure)); margin: 0 auto clamp(1.4rem, 4vw, 2.2rem); }
.article-head h1 { margin-top: .4rem; }
.byline {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem;
  margin-top: 1rem; color: var(--ink-soft); font-size: .92rem;
  font-family: var(--font-display); letter-spacing: .03em; text-transform: uppercase;
}
.byline .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-faint); }
.byline a { color: var(--accent-ink); }

.article-body { width: min(100% - 2 * var(--pad), var(--measure)); margin-inline: auto; }
.article-body > p:first-of-type { font-size: 1.14em; }
.article-body > p:first-of-type::first-letter {
  font-family: var(--font-display); font-weight: 700; float: left;
  font-size: 3.1em; line-height: .72; padding: .06em .12em 0 0; color: var(--accent-ink);
}
.article-body ul, .article-body ol { padding-left: 1.3em; }
.article-body li { margin-block: .35em; }
.article-body li::marker { color: var(--accent-ink); }

/* Table of contents */
.toc {
  background: var(--paper-2); border: 1.5px solid var(--rule); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 1rem 1.2rem; margin: 1.8rem 0;
}
.toc__title { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .1em; font-size: .82rem; color: var(--ink-soft); margin-bottom: .5rem; }
.toc ol { list-style: none; padding: 0; margin: 0; counter-reset: toc; }
.toc li { counter-increment: toc; margin: .25rem 0; }
.toc a { color: var(--ink); display: inline-flex; gap: .5rem; }
.toc a::before { content: counter(toc, decimal-leading-zero); color: var(--accent-ink); font-family: var(--font-display); font-weight: 600; }
.toc a:hover { color: var(--accent-ink); }

/* 10. TABLES / FIGURES / CODE / QUOTES / AD SLOTS ------------------------- */
.table-wrap { overflow-x: auto; margin-block: 1.4rem; border: 1.5px solid var(--ink); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .94rem; background: var(--card); }
caption { caption-side: bottom; text-align: left; color: var(--ink-faint); font-size: .82rem; padding: .6rem .2rem 0; font-style: italic; }
thead th {
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: .05em;
  font-size: .82rem; font-weight: 600; text-align: right; color: var(--paper);
  background: var(--ink); padding: .55rem .7rem; white-space: nowrap;
}
thead th:first-child, tbody th { text-align: left; }
tbody td, tbody th { padding: .5rem .7rem; text-align: right; border-bottom: 1px solid var(--rule-soft); }
tbody th { font-weight: 600; font-family: var(--font-body); }
tbody td:first-child, tbody th:first-child { text-align: left; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--paper-2) 55%, transparent); }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.t-hi { color: var(--accent-ink); font-weight: 600; }

/* full-bleed stat table — an intentional grid-break moment */
.bleed { width: min(100vw - 2rem, var(--wide)); margin-inline: calc(50% - min(50vw - 1rem, var(--wide) / 2)); }

figure { margin-inline: 0; }
figure img { border: 1.5px solid var(--rule); border-radius: var(--radius); background: var(--card); }
figcaption { color: var(--ink-faint); font-size: .85rem; margin-top: .5rem; padding-left: .1rem; border-left: 3px solid var(--accent); padding-left: .7rem; }
figcaption b, figcaption strong { color: var(--ink-soft); }

pre {
  background: #0f1620; color: #e7ecf3; border-radius: var(--radius); border: 1px solid #243044;
  padding: 1rem 1.1rem; overflow-x: auto; font-size: .88rem; line-height: 1.55;
  font-family: "SF Mono", "Cascadia Code", "Consolas", ui-monospace, monospace;
}
[data-theme="dark"] pre { background: #0b1019; }
pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
code {
  font-family: "SF Mono", "Cascadia Code", "Consolas", ui-monospace, monospace;
  font-size: .88em; background: var(--paper-2); padding: .12em .4em; border-radius: 3px;
  border: 1px solid var(--rule-soft);
}
.code-label { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; color: var(--ink-faint); margin-bottom: -.6rem; }

blockquote, .pullquote {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.3rem, 1.1rem + 1vw, 1.8rem); line-height: 1.2;
  color: var(--ink); border-left: 4px solid var(--accent);
  padding: .3rem 0 .3rem 1.2rem; margin: 1.8rem 0; text-wrap: balance;
}
.pullquote { border: 0; text-align: center; padding: 1.5rem 0; }
.pullquote::before { content: "\201C"; color: var(--accent); font-size: 1.4em; line-height: 0; vertical-align: -.3em; }
blockquote cite { display: block; font-family: var(--font-body); font-style: italic; font-weight: 400; font-size: 1rem; color: var(--ink-soft); margin-top: .5rem; }

/* AD SLOTS — empty, structurally ready (no ad code) */
.ad-slot {
  margin: 2rem auto; min-height: 96px; display: grid; place-items: center;
  border: 1.5px dashed var(--rule); border-radius: var(--radius);
  background: repeating-linear-gradient(135deg, transparent 0 12px, color-mix(in srgb, var(--rule) 25%, transparent) 12px 13px);
  color: var(--ink-faint); font-family: var(--font-display); text-transform: uppercase;
  letter-spacing: .12em; font-size: .72rem; width: 100%;
}
.ad-slot[data-ad="leaderboard"] { min-height: 120px; }

/* key formula / stat callout */
.formula { background: var(--paper-2); border: 1.5px solid var(--rule); border-radius: var(--radius); padding: 1rem 1.2rem; overflow-x: auto; font-size: 1.02rem; }
.formula b { color: var(--accent-ink); }
.statline { display: flex; flex-wrap: wrap; gap: 1.2rem; margin: 1.6rem 0; }
.statline .stat { background: var(--card); border: 1.5px solid var(--rule); border-radius: var(--radius); padding: .8rem 1rem; min-width: 7rem; }
.statline .stat b { display: block; font-family: var(--font-display); font-size: 2rem; line-height: 1; color: var(--accent-ink); }
.statline .stat span { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-family: var(--font-display); }

/* author TODO note (visible build-time marker, muted) */
.todo-note { background: color-mix(in srgb, var(--accent) 8%, var(--card)); border: 1.5px dashed var(--accent); border-radius: var(--radius); padding: .8rem 1rem; color: var(--accent-ink); font-size: .9rem; }

/* 11. AUTHOR BIO / RELATED / PREV-NEXT / BREADCRUMB ----------------------- */
.breadcrumb { width: min(100% - 2 * var(--pad), var(--measure)); margin: 0 auto 1.2rem; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .05em; font-size: .78rem; }
.breadcrumb li { display: flex; gap: .4rem; align-items: center; color: var(--ink-faint); }
.breadcrumb li + li::before { content: "›"; color: var(--ink-faint); }
.breadcrumb a { color: var(--ink-soft); }
.breadcrumb [aria-current="page"] { color: var(--accent-ink); }

.author-box {
  display: flex; gap: 1.1rem; align-items: flex-start;
  background: var(--paper-2); border: 1.5px solid var(--rule); border-radius: var(--radius-lg);
  padding: 1.2rem 1.3rem; margin: 2.2rem 0;
}
.author-box__avatar { width: 64px; height: 64px; flex: none; border-radius: 50%; background: var(--accent); display: grid; place-items: center; color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; border: 2px solid var(--ink); }
.author-box h3 { margin: 0 0 .2rem; font-size: 1.15rem; }
.author-box p { margin: 0; color: var(--ink-soft); font-size: .94rem; }

.related h2, .endnav-wrap h2 { font-size: 1.3rem; }
.related ul { list-style: none; padding: 0; display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.related li { background: var(--card); border: 1.5px solid var(--rule); border-radius: var(--radius); padding: .85rem 1rem; transition: border-color .15s ease, transform .15s ease; }
.related li:hover { border-color: var(--ink); transform: translateY(-2px); }
.related a { font-family: var(--font-display); font-weight: 500; color: var(--ink); display: block; line-height: 1.15; }
.related a:hover { color: var(--accent-ink); text-decoration: none; }
.related .badge { margin-bottom: .4rem; }

.endnav { display: flex; justify-content: space-between; gap: 1rem; margin: 2rem 0; flex-wrap: wrap; }
.endnav a { flex: 1 1 14rem; border: 1.5px solid var(--rule); border-radius: var(--radius); padding: .9rem 1.1rem; color: var(--ink); transition: border-color .15s ease; }
.endnav a:hover { border-color: var(--accent); text-decoration: none; }
.endnav small { display: block; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); font-size: .72rem; }
.endnav .next { text-align: right; }
.endnav strong { font-family: var(--font-display); font-weight: 500; color: var(--ink); }

.sources { background: var(--paper-2); border-radius: var(--radius); border: 1.5px solid var(--rule); padding: 1rem 1.3rem; }
.sources h2 { margin-top: .2rem; font-size: 1.2rem; }
.sources ul { margin: 0; }

/* 12. MOTION -------------------------------------------------------------- */
/* Hiding is gated on .js so content is ALWAYS visible without JavaScript */
.js .fade-up { opacity: 0; transform: translateY(14px); transition: opacity .55s ease, transform .55s ease; }
.js .fade-up.in-view { opacity: 1; transform: none; }
.js .grid .fade-up:nth-child(2) { transition-delay: .06s; }
.js .grid .fade-up:nth-child(3) { transition-delay: .12s; }
.js .grid .fade-up:nth-child(4) { transition-delay: .18s; }
.js .grid .fade-up:nth-child(5) { transition-delay: .24s; }
.js .grid .fade-up:nth-child(6) { transition-delay: .30s; }
@media (prefers-reduced-motion: reduce) { .js .fade-up { opacity: 1; transform: none; } }

/* 13. FOOTER -------------------------------------------------------------- */
.site-footer { border-top: 2px solid var(--ink); background: var(--paper-2); margin-top: clamp(3rem, 8vw, 5rem); }
.footer-inner { width: min(100% - 2 * var(--pad), var(--wide)); margin-inline: auto; padding-block: clamp(2rem, 5vw, 3rem); display: grid; gap: 1.6rem; grid-template-columns: 1.4fr 1fr 1fr; }
.footer-inner h4 { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .08em; font-size: .82rem; color: var(--ink-soft); margin-bottom: .6rem; }
.footer-inner ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.footer-inner a { color: var(--ink); font-size: .94rem; }
.footer-inner a:hover { color: var(--accent-ink); }
.footer-brand p { color: var(--ink-soft); font-size: .92rem; max-width: 34ch; margin-top: .6rem; }
.footer-bottom { border-top: 1px solid var(--rule); }
.footer-bottom-inner { width: min(100% - 2 * var(--pad), var(--wide)); margin-inline: auto; padding-block: 1rem; display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; justify-content: space-between; color: var(--ink-faint); font-size: .82rem; }

/* 14. RESPONSIVE ---------------------------------------------------------- */
@media (max-width: 860px) {
  .featured { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .nav-toggle {
    display: inline-grid; place-items: center; order: 3;
    width: 42px; height: 38px; background: transparent; border: 1.5px solid var(--rule);
    border-radius: var(--radius); cursor: pointer; color: var(--ink);
  }
  .nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after {
    content: ""; display: block; width: 20px; height: 2px; background: currentColor; transition: transform .2s ease, opacity .2s ease;
  }
  .nav-toggle__bars { position: relative; }
  .nav-toggle__bars::before { position: absolute; top: -6px; }
  .nav-toggle__bars::after { position: absolute; top: 6px; }
  .nav-toggle[aria-expanded="true"] .nav-toggle__bars { background: transparent; }
  .nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { transform: translateY(6px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] .nav-toggle__bars::after { transform: translateY(-6px) rotate(-45deg); }

  .primary-nav {
    position: fixed; inset: 64px 0 auto 0; background: var(--paper);
    border-bottom: 2px solid var(--ink); padding: .6rem var(--pad) 1rem;
    transform: translateY(-12px); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
    max-height: calc(100vh - 64px); overflow-y: auto;
  }
  .primary-nav.open { transform: none; opacity: 1; pointer-events: auto; }
  .primary-nav ul { flex-direction: column; align-items: stretch; gap: .1rem; }
  .primary-nav a { padding: .8rem .6rem; font-size: 1.05rem; border-bottom: 1px solid var(--rule-soft); border-radius: 0; }
  .primary-nav a[aria-current="page"] { box-shadow: inset 4px 0 0 var(--accent); }
}
@media (max-width: 560px) {
  .search__input { width: 8.5rem; }
  .search__input:focus { width: 10.5rem; }
  .footer-inner { grid-template-columns: 1fr; }
  .header-inner { gap: .5rem; }
  .brand__name { font-size: 1.15rem; }
  .article-body > p:first-of-type::first-letter { font-size: 2.6em; }
  .endnav { flex-direction: column; }
  .endnav .next { text-align: left; }
}
@media (min-width: 561px) and (max-width: 860px) {
  .search__input { width: 9.5rem; }
  .search__input:focus { width: 12rem; }
}

/* 15. UTILITIES ----------------------------------------------------------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.muted { color: var(--ink-soft); }
.lede { font-size: 1.15rem; color: var(--ink-soft); }
.tag-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.no-wrap { white-space: nowrap; }
.print-only { display: none; }
@media print {
  .site-header, .site-footer, .ad-slot, .endnav, .toc, .search { display: none !important; }
  body::before { display: none; }
  body { color: #000; background: #fff; }
}
