/* ==========================================================================
   site.css — "The Engineer's Notebook" (approved prototype, 2026-11-23)
   Neutral paper; burgundy and butter used like a pen and a highlighter.
   Instrument Serif (display) · Geist (text, UI) · Geist Mono (labels).

   Contrast (WCAG 2.2): ink 15.6:1 · muted 5.9:1 · burgundy 11.3:1 on paper;
   ink on butter 12.3:1. Butter is never used for text.

   The legacy page /blog/performance-optimization.html still uses the old
   style.css + articles.css; nothing here affects it.
   ========================================================================== */

@font-face { font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/instrument-serif-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap; src: url("/fonts/instrument-serif-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Geist"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/fonts/geist-latin-wght-normal.woff2") format("woff2"); }
@font-face { font-family: "Geist Mono"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/fonts/geist-mono-latin-wght-normal.woff2") format("woff2"); }

:root {
  --paper: #FCFAF6;
  --white: #FFFFFF;
  --ink: #202020;
  --body: #3A3A3A;
  --muted: #626262;
  --wine: #651D32;
  --butter: #F4DF96;
  --rule: #E4E0D9;
  --rule-strong: #CBC5BA;
  --control: #8C857A; /* ≥3:1 on white, for control outlines */
  --display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --text: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --header-h: 112px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { background: var(--paper); color: var(--ink); font: 400 1.0625rem/1.6 var(--text); -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
main:focus { outline: none; }
img, svg, picture, video, iframe { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
ul[class], ol[class] { list-style: none; padding: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--wine); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--butter); color: var(--ink); }
[id] { scroll-margin-top: calc(var(--header-h) + 16px); }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 16px; top: -80px; background: var(--ink); color: var(--white); padding: 8px 14px; z-index: 50; text-decoration: none; }
.skip-link:focus { top: 8px; }
.js .no-js-only { display: none; }

.wrap { width: 100%; max-width: 1232px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
@media (min-width: 720px) { .wrap { padding-left: 32px; padding-right: 32px; } }

/* ---- Shared type and links ---------------------------------------------- */
.label { font: 500 0.72rem/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.label--wine { color: var(--wine); }
.mark { background: linear-gradient(transparent 58%, var(--butter) 58%, var(--butter) 92%, transparent 92%); padding: 0 0.08em; }
.link { text-decoration: none; background: linear-gradient(var(--wine), var(--wine)) 0 100% / 0 1.5px no-repeat; transition: background-size 0.35s var(--ease); padding-bottom: 2px; }
.link:hover, .link:focus-visible { background-size: 100% 1.5px; }
.arrow { display: inline-block; transition: transform 0.3s var(--ease); }
a:hover .arrow { transform: translateX(3px); }
.text-btn { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-decoration-color: var(--wine); text-underline-offset: 3px; }
.text-btn[hidden] { display: none; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font: 500 0.72rem/1.4 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.meta .t { color: var(--wine); }
.meta--inline { display: inline-flex; }
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 999px; background: var(--ink); color: var(--white); text-decoration: none; font-weight: 500; transition: background 0.2s; }
.btn:hover { background: var(--wine); }
.dev-status-badge { display: inline-block; padding: 1px 6px; background: var(--butter); color: var(--ink); font: 500 0.7rem var(--mono); }
.breadcrumb ol { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; font: 500 0.72rem var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.breadcrumb li + li::before { content: "/"; margin-right: 6px; }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { color: var(--wine); }

/* ---- Header ------------------------------------------------------------- */
.header { position: sticky; top: 0; z-index: 30; background: rgba(252, 250, 246, 0.96); border-bottom: 1px solid var(--rule); }
.header__row { display: flex; align-items: center; gap: 20px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; }
.brand__mark { width: 30px; height: 30px; flex: none; }
.brand__name { font: 400 1.45rem/1 var(--display); letter-spacing: -0.01em; }
.brand__role { font: 500 0.66rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding-left: 10px; border-left: 1px solid var(--rule-strong); }
.nav { display: flex; gap: 22px; }
.nav a { position: relative; font-size: 0.92rem; font-weight: 500; color: var(--muted); text-decoration: none; padding: 8px 0; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 2px; background: var(--wine); }
.tools { display: flex; align-items: center; gap: 8px; }
.search-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 12px; border: 1px solid var(--control); border-radius: 999px; background: var(--white); cursor: pointer; font-size: 0.86rem; color: var(--muted); }
.search-btn[hidden] { display: none; }
.search-btn:hover { border-color: var(--ink); color: var(--ink); }
.search-btn kbd { font: 500 0.7rem var(--mono); border: 1px solid var(--rule); border-radius: 4px; padding: 1px 5px; background: var(--paper); }
.contact-btn { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 999px; background: var(--ink); color: var(--white); text-decoration: none; font-size: 0.86rem; font-weight: 500; transition: background 0.2s; }
.contact-btn:hover { background: var(--wine); }
.menu-btn { display: none; height: 36px; padding: 0 12px; border: 1px solid var(--control); border-radius: 999px; background: var(--white); cursor: pointer; font-size: 0.86rem; font-weight: 500; }
.topics-bar { border-top: 1px solid var(--rule); }
.topics-bar ul { list-style: none; margin: 0; padding: 9px 0; display: flex; gap: 26px; overflow-x: auto; scrollbar-width: none; }
.topics-bar ul::-webkit-scrollbar { display: none; }
.topics-bar a { display: inline-flex; gap: 7px; align-items: baseline; white-space: nowrap; font-size: 0.84rem; color: var(--muted); text-decoration: none; padding: 2px 0; }
.topics-bar a b { font: 500 0.68rem var(--mono); color: var(--wine); }
.topics-bar a:hover, .topics-bar a[aria-current="page"] { color: var(--ink); }
.topics-bar a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--wine); text-underline-offset: 4px; }
.mobile-nav { display: none; border-top: 1px solid var(--rule); padding: 8px 0 16px; }
.mobile-nav a { display: block; padding: 12px 0; border-bottom: 1px solid var(--rule); text-decoration: none; font-size: 1.05rem; }
.mobile-nav a[aria-current="page"] { color: var(--wine); }
.mobile-nav.is-open { display: block; }
@media (max-width: 960px) { .brand__role { display: none; } }
@media (max-width: 860px) {
  .js .nav, .js .contact-btn { display: none; }
  .js .menu-btn { display: inline-flex; align-items: center; }
  .search-btn span, .search-btn kbd { display: none; }
  .search-btn { width: 36px; padding: 0; justify-content: center; }
  .header__row { flex-wrap: wrap; }
  .nav { flex-wrap: wrap; gap: 4px 16px; }
}

/* ---- Hero --------------------------------------------------------------- */
.hero { padding: clamp(36px, 5vw, 72px) 0 clamp(28px, 4vw, 48px); }
.hero__grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(24px, 4vw, 64px); align-items: center; }
.hero h1 { font: 400 clamp(2.6rem, 1.4rem + 4.4vw, 4.75rem)/0.98 var(--display); letter-spacing: -0.02em; margin-top: 18px; text-wrap: balance; }
.hero h1 em, .page-title em, .topics__intro h2 em { font-style: italic; color: var(--wine); }
.hero__lede { margin-top: 22px; max-width: 54ch; font-size: 1.12rem; color: var(--body); }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: 28px; }
.hero__byline { display: flex; align-items: center; gap: 10px; margin-top: 30px; font-size: 0.88rem; color: var(--muted); }
.hero__byline svg { width: 22px; height: 22px; flex: none; }
.figure svg { width: 100%; height: auto; }
.flow { stroke-dasharray: 6 8; }
@media (prefers-reduced-motion: no-preference) { .flow { animation: flow 2.4s linear infinite; } }
@keyframes flow { to { stroke-dashoffset: -28; } }
@media (max-width: 860px) { .hero__grid { grid-template-columns: 1fr; } .figure { max-width: 520px; } }

/* ---- Sections ----------------------------------------------------------- */
.section { padding: clamp(40px, 6vw, 84px) 0 0; }
.section--tight { padding-top: clamp(24px, 3vw, 40px); }
.head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 16px 24px; padding-bottom: 18px; border-bottom: 1px solid var(--ink); margin-bottom: 26px; }
.head h2 { font: 400 clamp(1.9rem, 1.3rem + 2vw, 2.8rem)/1.05 var(--display); letter-spacing: -0.015em; margin-top: 8px; }
@media (max-width: 600px) { .head { grid-template-columns: 1fr; } }

/* ---- Covers ------------------------------------------------------------- */
.cover { position: relative; overflow: hidden; border: 1px solid var(--rule); background: var(--white); aspect-ratio: 16 / 10; }
.cover svg { width: 100%; height: 100%; transition: transform 0.6s var(--ease); }
.cover .accent-move { transition: transform 0.6s var(--ease); }
a:hover .cover > svg { transform: scale(1.025); }
a:hover .cover .accent-move { transform: translate(6px, -4px); }

/* ---- Carousel ----------------------------------------------------------- */
.car-controls { display: flex; align-items: center; gap: 14px; }
.car-controls[hidden] { display: none; }
.car-count { font: 500 0.8rem var(--mono); color: var(--muted); min-width: 4.5ch; text-align: right; }
.car-progress { width: 120px; height: 2px; background: var(--rule); position: relative; overflow: hidden; }
.car-progress i { position: absolute; inset: 0 auto 0 0; width: 25%; background: var(--wine); transition: transform 0.35s var(--ease); }
.car-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--control); background: var(--white); cursor: pointer; display: grid; place-items: center; transition: border-color 0.2s; }
.car-btn:hover:not(:disabled) { border-color: var(--ink); }
.car-btn:disabled { opacity: 0.35; cursor: default; }
.car-btn svg { width: 16px; height: 16px; }
.track { display: grid; grid-auto-flow: column; grid-auto-columns: 58%; gap: 24px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding-bottom: 6px; overscroll-behavior-x: contain; }
.track::-webkit-scrollbar { display: none; }
@media (prefers-reduced-motion: no-preference) { .track { scroll-behavior: smooth; } }
.slide { scroll-snap-align: start; min-width: 0; }
.slide > a { text-decoration: none; display: block; }
.slide__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 16px; }
.type { font: 500 0.7rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; padding: 5px 7px; border: 1px solid var(--ink); }
.type--project { border-color: var(--wine); color: var(--wine); }
.type--invite { background: var(--butter); border-color: var(--butter); }
.slide h3 { font: 400 clamp(1.6rem, 1.2rem + 1.2vw, 2.15rem)/1.08 var(--display); margin-top: 10px; letter-spacing: -0.01em; text-wrap: balance; }
.slide p { margin-top: 8px; color: var(--muted); max-width: 52ch; }
@media (max-width: 860px) { .track { grid-auto-columns: 86%; gap: 16px; } .car-progress { width: 64px; } .car-controls { justify-content: space-between; } }

/* ---- Topics directory --------------------------------------------------- */
.topics { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(24px, 4vw, 64px); }
.topics__intro { position: sticky; top: calc(var(--header-h) + 28px); align-self: start; }
.topics__intro h2 { font: 400 clamp(1.9rem, 1.3rem + 2vw, 2.8rem)/1.05 var(--display); letter-spacing: -0.015em; margin-top: 8px; }
.topics__intro p { margin-top: 14px; color: var(--muted); max-width: 38ch; }
.dir { border-top: 1px solid var(--ink); }
.dir a { display: grid; grid-template-columns: 52px 44px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 18px 8px; border-bottom: 1px solid var(--rule); text-decoration: none; transition: background 0.25s var(--ease); }
.dir a:hover, .dir a[aria-current="page"] { background: var(--white); }
.dir__num { font: 500 0.8rem var(--mono); color: var(--wine); }
.dir .glyph { width: 40px; height: 40px; }
.glyph .g-accent { transition: transform 0.4s var(--ease); transform-box: fill-box; transform-origin: center; }
.dir a:hover .glyph .g-accent { transform: rotate(-8deg) scale(1.1); }
.dir__name { font: 400 1.75rem/1.1 var(--display); letter-spacing: -0.01em; }
.dir__name span { background: linear-gradient(var(--butter), var(--butter)) 0 88% / 0 0.32em no-repeat; transition: background-size 0.4s var(--ease); }
.dir a:hover .dir__name span, .dir a[aria-current="page"] .dir__name span { background-size: 100% 0.32em; }
.dir__desc { display: block; font: 400 0.92rem/1.45 var(--text); color: var(--muted); margin-top: 4px; }
.dir__count { font: 500 0.72rem var(--mono); color: var(--muted); text-align: right; white-space: nowrap; }
.dir__count.has { color: var(--ink); }
@media (max-width: 860px) {
  .topics { grid-template-columns: 1fr; }
  .topics__intro { position: static; }
  .dir a { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; }
  .dir .glyph { display: none; }
  .dir__name { font-size: 1.45rem; }
}

/* ---- Post rows ---------------------------------------------------------- */
.row { border-bottom: 1px solid var(--rule); }
.row__link { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 28px; padding: 22px 0; text-decoration: none; align-items: start; }
.row__title { font: 400 clamp(1.45rem, 1.2rem + 0.8vw, 1.85rem)/1.12 var(--display); margin-top: 8px; letter-spacing: -0.01em; text-wrap: balance; }
.row__link:hover .row__title { color: var(--wine); }
.row__dek { margin-top: 6px; color: var(--muted); max-width: 62ch; }
@media (max-width: 640px) { .row__link { grid-template-columns: minmax(0, 1fr) 96px; gap: 14px; } .row__cover .cover { aspect-ratio: 1; } }

.feature > a { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(20px, 3vw, 44px); align-items: center; padding-bottom: 28px; border-bottom: 1px solid var(--ink); text-decoration: none; }
.feature h2 { font: 400 clamp(1.9rem, 1.3rem + 2vw, 2.8rem)/1.05 var(--display); letter-spacing: -0.015em; margin-top: 10px; text-wrap: balance; }
.feature > a:hover h2 { color: var(--wine); }
.feature__text p:last-child { margin-top: 10px; color: var(--muted); }
@media (max-width: 860px) { .feature > a { grid-template-columns: 1fr; } }

/* ---- Founder Stories ---------------------------------------------------- */
.founders { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(24px, 4vw, 64px); border-top: 3px solid var(--wine); padding-top: 28px; }
.founders__q { margin-top: 14px; font: 400 clamp(2rem, 1.3rem + 2.6vw, 3.4rem)/1.05 var(--display); letter-spacing: -0.015em; text-wrap: balance; }
.founders__q em { color: var(--wine); }
.founders__note { margin-top: 16px; }
.founders__body > * + * { margin-top: 14px; }
.founders__body p { color: var(--body); }
.formats { border-top: 1px solid var(--rule); }
.formats li { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); font-size: 0.94rem; }
.formats b { font: 500 0.72rem var(--mono); letter-spacing: 0.06em; text-transform: uppercase; padding-top: 3px; }
@media (max-width: 860px) { .founders { grid-template-columns: 1fr; } }

/* ---- Panels ------------------------------------------------------------- */
.duo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 64px); }
.panel { border-top: 1px solid var(--ink); padding-top: 22px; }
.panel h2 { font: 400 clamp(1.8rem, 1.3rem + 1.6vw, 2.4rem)/1.05 var(--display); margin-top: 8px; }
.panel p { margin-top: 12px; color: var(--body); }
.panel .sketch { margin-top: 18px; border: 1px solid var(--rule); background: var(--white); }
.panel .links { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; margin-top: 16px; font-weight: 500; }
.thinking { margin-top: 16px; border-top: 1px solid var(--rule); }
.thinking li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: 0.95rem; }
.thinking li b { font: 500 0.72rem var(--mono); color: var(--wine); padding-top: 4px; }
.signature { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.signature svg { width: 34px; height: 34px; }
.signature span { font: italic 400 1.5rem var(--display); }
.contact { margin-top: 16px; border-top: 1px solid var(--rule); }
.contact li { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.contact a { overflow-wrap: anywhere; font-weight: 500; }
@media (max-width: 860px) { .duo { grid-template-columns: 1fr; } }

/* ---- Page heads, archives, projects ------------------------------------- */
.page-head { padding: clamp(36px, 5vw, 64px) 0 clamp(20px, 3vw, 32px); border-bottom: 1px solid var(--rule); }
.page-title { font: 400 clamp(2.4rem, 1.4rem + 3.6vw, 4.2rem)/1 var(--display); letter-spacing: -0.02em; margin-top: 12px; text-wrap: balance; max-width: 22ch; }
.page-intro { margin-top: 16px; max-width: 60ch; font-size: 1.1rem; color: var(--body); }
.page-head__topic { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; }
.page-head__glyph .glyph { width: clamp(72px, 10vw, 128px); height: auto; }
.empty { padding: 28px 0 8px; }
.empty__title { font: 400 1.9rem/1.1 var(--display); }
.empty p + p { margin-top: 6px; color: var(--muted); }
.back { margin-top: 28px; }
.section-title { font: 400 clamp(1.7rem, 1.3rem + 1.4vw, 2.3rem)/1.05 var(--display); padding-bottom: 14px; border-bottom: 1px solid var(--ink); }
.project { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 12px clamp(20px, 3vw, 48px); padding: 24px 0; border-bottom: 1px solid var(--rule); }
.project__title { font: 400 1.65rem/1.1 var(--display); letter-spacing: -0.01em; }
.project__head .meta { margin-top: 8px; }
.project__links { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-weight: 500; font-size: 0.95rem; }
.project__body > * + * { margin-top: 10px; }
.project__body p { color: var(--body); }
.project__body ul { padding-left: 1.1rem; color: var(--body); }
.project__body li + li { margin-top: 4px; }
.project__body li::marker { color: var(--wine); }
.stack { font: 500 0.74rem/1.6 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.stack--large { margin-top: 16px; font-size: 0.8rem; max-width: 80ch; }
.muted { color: var(--muted); }
@media (max-width: 860px) { .project { grid-template-columns: 1fr; } .page-head__topic { grid-template-columns: 1fr; } .page-head__glyph { display: none; } }

/* ---- Article ------------------------------------------------------------ */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 40; pointer-events: none; }
.progress i { display: block; height: 100%; width: 100%; background: var(--wine); transform-origin: 0 50%; transform: scaleX(0); }
.article__head { padding-top: clamp(32px, 5vw, 56px); max-width: 960px; }
.article__title { font: 400 clamp(2.4rem, 1.4rem + 3.8vw, 4.4rem)/1 var(--display); letter-spacing: -0.02em; margin-top: 12px; text-wrap: balance; }
.article__dek { margin-top: 16px; font-size: 1.2rem; line-height: 1.5; color: var(--body); max-width: 60ch; }
.byline { display: flex; align-items: center; gap: 12px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--rule); }
.byline svg { width: 30px; height: 30px; flex: none; }
.byline p { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.byline p > a { font-weight: 600; text-decoration: none; }
.article__cover { margin-top: 28px; max-width: 1080px; }
.article__cover .cover { aspect-ratio: 21 / 9; }
@media (max-width: 640px) { .article__cover .cover { aspect-ratio: 16 / 10; } }
.article__layout { display: grid; grid-template-columns: minmax(0, 42rem); justify-content: center; gap: 48px; margin-top: clamp(28px, 4vw, 48px); }
.article__layout.has-toc { grid-template-columns: 220px minmax(0, 42rem); justify-content: center; }
.toc { position: sticky; top: calc(var(--header-h) + 24px); align-self: start; }
.toc summary { cursor: pointer; padding-bottom: 10px; border-bottom: 1px solid var(--ink); list-style: none; }
.toc summary::-webkit-details-marker { display: none; }
.toc ol { list-style: none; padding: 0; margin-top: 8px; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a { display: grid; grid-template-columns: 26px minmax(0, 1fr); padding: 7px 0; font-size: 0.9rem; color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--rule); }
.toc a::before { content: counter(toc, decimal-leading-zero); font: 500 0.7rem var(--mono); color: var(--wine); padding-top: 3px; }
.toc a:hover, .toc a[aria-current="true"] { color: var(--ink); }
@media (max-width: 1060px) {
  .article__layout.has-toc { grid-template-columns: minmax(0, 42rem); }
  .toc { position: static; }
}

.prose { font-size: 1.12rem; line-height: 1.75; color: var(--body); }
.prose > * + * { margin-top: 1.2em; }
.prose h2 { font: 400 clamp(1.8rem, 1.4rem + 1.2vw, 2.3rem)/1.12 var(--display); color: var(--ink); margin-top: 1.9em; letter-spacing: -0.01em; }
.prose h3 { font: 600 1.2rem/1.35 var(--text); color: var(--ink); margin-top: 1.7em; }
.prose h2 + *, .prose h3 + * { margin-top: 0.6em; }
.prose a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--wine); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.prose a:hover { color: var(--wine); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.45em; }
.prose li::marker { color: var(--wine); }
.prose blockquote { margin: 1.6em 0; padding: 0.2em 0 0.2em 1.1em; border-left: 3px solid var(--wine); font: italic 400 1.45em/1.3 var(--display); color: var(--ink); }
.prose blockquote p + p { margin-top: 0.5em; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin-block: 2.5em; }
.prose code { font: 0.86em var(--mono); background: var(--white); border: 1px solid var(--rule); padding: 0.08em 0.35em; border-radius: 4px; }
.prose pre { font: 0.86rem/1.65 var(--mono); background: var(--white); color: var(--ink); border: 1px solid var(--rule); border-top: 2px solid var(--ink); padding: 16px 18px; overflow-x: auto; }
.prose pre code { border: 0; padding: 0; background: none; font-size: inherit; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.94rem; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--rule); }
.prose th { font: 500 0.72rem var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.prose img, .prose picture img { border: 1px solid var(--rule); background: var(--white); }
.prose figcaption, .article-image figcaption { margin-top: 10px; font: 500 0.72rem/1.5 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.token.comment, .token.prolog, .token.cdata { color: var(--muted); font-style: italic; }
.token.keyword, .token.selector, .token.important, .token.atrule { color: var(--wine); }
.token.string, .token.attr-value, .token.char, .token.regex { color: #2F5D50; }
.token.function, .token.class-name { color: var(--ink); font-weight: 600; }
.token.number, .token.boolean, .token.constant { color: #7A4B12; }
.metric-box { padding: 18px 22px; background: var(--white); border: 1px solid var(--rule); border-left: 3px solid var(--wine); }
.metric-box .big-number { display: block; font: 400 2rem/1.1 var(--display); color: var(--ink); }
.metric-box p { margin-top: 6px; font: 500 0.72rem/1.5 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.section-divider { text-align: center; color: var(--wine); letter-spacing: 0.6em; }
.highlight { padding: 18px 22px; background: var(--white); border-left: 3px solid var(--ink); }
.video-embed { position: relative; aspect-ratio: 16 / 9; margin-bottom: 28px; background: var(--white); border: 1px solid var(--rule); }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.article__foot { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--ink); }
.article__foot > * + * { margin-top: 22px; }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.share .label { margin-right: 4px; }
.share__btn { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; background: var(--white); border: 1px solid var(--control); border-radius: 999px; color: var(--ink); font-size: 0.86rem; font-weight: 500; text-decoration: none; cursor: pointer; }
.share__btn:hover { border-color: var(--ink); }
.share__btn[hidden] { display: none; }
.share__status { font: 500 0.72rem var(--mono); letter-spacing: 0.04em; color: var(--wine); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags a { display: inline-block; font: 500 0.72rem var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); text-decoration: none; padding: 5px 8px; border: 1px solid var(--rule-strong); }
.tags a:hover { color: var(--wine); border-color: var(--wine); }
.author { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 14px; align-items: start; padding: 18px; background: var(--white); border: 1px solid var(--rule); }
.author svg { width: 36px; height: 36px; }
.author p { color: var(--body); font-size: 0.98rem; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pager__item { display: block; padding: 16px 0; border-top: 1px solid var(--rule); text-decoration: none; }
.pager__item--next { text-align: right; }
.pager__title { display: block; margin-top: 6px; font: 400 1.35rem/1.15 var(--display); }
.pager__item:hover .pager__title { color: var(--wine); }
.reading { max-width: calc(42rem + 64px); }

/* ---- Footer ------------------------------------------------------------- */
.footer { margin-top: clamp(56px, 8vw, 112px); border-top: 1px solid var(--ink); padding: 40px 0 28px; }
.footer__grid { display: grid; grid-template-columns: minmax(0, 4fr) repeat(3, minmax(0, 2fr)); gap: 28px; }
.footer__brand p { margin-top: 12px; color: var(--muted); max-width: 32ch; font-size: 0.95rem; }
.footer__h { font: 500 0.72rem var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.footer__list li + li { margin-top: 6px; }
.footer__list a { text-decoration: none; font-size: 0.95rem; display: inline-block; padding: 2px 0; }
.footer__list a:hover { color: var(--wine); }
.footer__base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--rule); font: 500 0.72rem var(--mono); letter-spacing: 0.04em; color: var(--muted); }
@media (max-width: 860px) { .footer__grid { grid-template-columns: 1fr 1fr; } .footer__brand { grid-column: 1 / -1; } }

/* ---- Search dialog ------------------------------------------------------ */
dialog.search { width: min(640px, calc(100% - 32px)); margin: 12vh auto auto; padding: 0; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); }
dialog.search::backdrop { background: rgba(32, 32, 32, 0.35); }
.search__bar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--rule); }
.search__bar input { flex: 1; min-width: 0; border: 0; background: transparent; font: 400 1.15rem var(--text); color: var(--ink); outline: none; }
.search__bar button { border: 1px solid var(--control); background: var(--white); border-radius: 6px; padding: 4px 8px; font: 500 0.72rem var(--mono); cursor: pointer; }
.search__results { max-height: 55vh; overflow: auto; padding: 6px 0; }
.search__results a { display: block; padding: 10px 16px; text-decoration: none; }
.search__results a:hover, .search__results a:focus-visible { background: var(--white); outline: none; }
.search__results .r-type { display: block; font: 500 0.68rem var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--wine); }
.search__results .r-title { display: block; font-weight: 500; }
.search__empty { padding: 14px 16px; color: var(--muted); font-size: 0.94rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .header, .footer, .share, .progress, .toc, .skip-link, .video-embed { display: none !important; }
  body { background: #fff; }
}
