/* Accessibility-First: every text pair is 7:1 or better (WCAG 1.4.6 AAA) in all three themes. */

:root {
  --paper: #fbfaf6;
  --surface: #ffffff;
  --surface-2: #f1efe7;
  --ink: #141414;
  --ink-2: #3b3b3b;
  --brand: #364f6a;
  --on-brand: #fbfaf6;
  --rule: #141414;
  --rule-soft: #8a8a8a;
  --mark: #ffd84d;
  --on-mark: #141414;
  --warn: #7a3b00;
  --ok: #1c5a3f;
  --code-bg: #f1efe7;
  --code-comment: #4a4a4a;
  --code-keyword: #141414;
  --code-string: #364f6a;
  --focus-inner: #141414;
  --focus-outer: #ffd84d;
  --band: #141414;
  --on-band: #fbfaf6;
  --on-band-2: #d9d6cc;
  --radius: 6px;
  --measure: 66ch;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --line: 1.6;
  --para: 1.1em;
  --letter: 0;
  --word: 0;
  --font: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
  font-size: 125%;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="contrast"]) {
    --paper: #111418; --surface: #1b2129; --surface-2: #202833; --ink: #f5f3ec; --ink-2: #cdd3db;
    --brand: #a9c8e8; --on-brand: #111418; --rule: #f5f3ec; --rule-soft: #8793a1; --warn: #ffc27a; --ok: #8fe0b8;
    --code-bg: #0b0e12; --code-comment: #b8c0ca; --code-keyword: #ffffff; --code-string: #a9c8e8;
    --focus-inner: #f5f3ec; --band: #05070a; --on-band: #f5f3ec; --on-band-2: #cdd3db; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #111418; --surface: #1b2129; --surface-2: #202833; --ink: #f5f3ec; --ink-2: #cdd3db;
  --brand: #a9c8e8; --on-brand: #111418; --rule: #f5f3ec; --rule-soft: #8793a1; --warn: #ffc27a; --ok: #8fe0b8;
  --code-bg: #0b0e12; --code-comment: #b8c0ca; --code-keyword: #ffffff; --code-string: #a9c8e8;
  --focus-inner: #f5f3ec; --band: #05070a; --on-band: #f5f3ec; --on-band-2: #cdd3db; color-scheme: dark;
}
:root[data-theme="contrast"] {
  --paper: #000000; --surface: #000000; --surface-2: #0d0d0d; --ink: #ffffff; --ink-2: #ffffff;
  --brand: #ffe14d; --on-brand: #000000; --rule: #ffffff; --rule-soft: #ffffff; --mark: #ffe14d; --warn: #ffe14d; --ok: #7dffb0;
  --code-bg: #000000; --code-comment: #ffffff; --code-keyword: #ffe14d; --code-string: #7de3ff;
  --focus-inner: #ffffff; --focus-outer: #00e5ff; --band: #000000; --on-band: #ffffff; --on-band-2: #ffffff; color-scheme: dark;
}

:root[data-size="s"] { font-size: 112.5%; }
:root[data-size="l"] { font-size: 143.75%; }
:root[data-size="xl"] { font-size: 162.5%; }

/* WCAG 1.4.12 minimums, offered as a setting rather than left to bookmarklets. */
:root[data-spacing="wide"] { --line: 1.9; --para: 2em; --letter: 0.12em; --word: 0.16em; }

*, *::before, *::after { box-sizing: border-box; }
* { animation: none; transition: none; }

:root[data-motion="on"] { scroll-behavior: smooth; }
:root[data-motion="on"] a, :root[data-motion="on"] .btn, :root[data-motion="on"] .card {
  transition: background-color 150ms ease, text-decoration-thickness 150ms ease, color 150ms ease;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: var(--line);
  letter-spacing: var(--letter);
  word-spacing: var(--word);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

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

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.6em; font-weight: 800; color: var(--ink); text-wrap: balance; }
h1 { font-size: clamp(2.2rem, 5.2vw, 3.6rem); letter-spacing: -0.015em; line-height: 1.08; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }
p { margin: 0 0 var(--para); max-width: var(--measure); }
ul, ol { padding-left: 1.4em; max-width: var(--measure); }
li { margin-bottom: 0.4em; }

a { color: var(--brand); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.22em; }
a:hover { text-decoration-thickness: 4px; }
a:active { background: var(--mark); color: var(--on-mark); }

mark, .hl { background: var(--mark); color: var(--on-mark); padding: 0 0.15em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }

:focus-visible {
  outline: 4px solid var(--focus-inner);
  outline-offset: 3px;
  box-shadow: 0 0 0 10px var(--focus-outer);
  border-radius: 2px;
}
:focus:not(:focus-visible) { outline: none; }

.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;
}

.skip-link {
  position: absolute; left: 1rem; top: -10rem; z-index: 100;
  background: var(--mark); color: var(--on-mark); font-weight: 800; font-size: 1.1rem;
  padding: 0.8rem 1.2rem; border: 4px solid var(--on-mark); text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.wrap { width: min(1240px, 100% - 2 * var(--gutter)); margin-inline: auto; }
.prose-wrap { width: min(46rem, 100% - 2 * var(--gutter)); margin-inline: auto; }

.mono { font-family: var(--mono); }
.eyebrow {
  font-family: var(--mono); font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-2); margin: 0 0 0.6rem;
}
.muted { color: var(--ink-2); }
.lede { font-size: 1.25rem; line-height: 1.5; color: var(--ink); max-width: 38ch; }

/* ---------- Display settings band ---------- */
.prefs { background: var(--band); color: var(--on-band); border-bottom: 1px solid var(--rule-soft); }
.prefs > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.6rem;
  min-height: 48px; font-weight: 700; font-size: 0.9rem; width: min(1240px, 100% - 2 * var(--gutter)); margin-inline: auto;
}
.prefs > summary::-webkit-details-marker { display: none; }
.prefs > summary .chev { margin-left: auto; font-family: var(--mono); font-size: 0.8rem; color: var(--on-band-2); }
.prefs[open] > summary .chev-closed, .prefs:not([open]) > summary .chev-open { display: none; }
.prefs > summary svg { flex: none; }
.prefs-body {
  width: min(1240px, 100% - 2 * var(--gutter)); margin-inline: auto; padding: 0.2rem 0 1rem;
  display: flex; flex-wrap: wrap; gap: 0.8rem 1.8rem; align-items: flex-end;
}
.seg { border: 0; margin: 0; padding: 0; min-width: 0; }
.seg legend { font-size: 0.8rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--on-band-2); padding: 0; margin-bottom: 0.3rem; }
.seg-row { display: flex; flex-wrap: wrap; border: 2px solid var(--on-band); border-radius: var(--radius); overflow: hidden; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span {
  display: flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 0.8rem;
  font-size: 0.9rem; font-weight: 700; color: var(--on-band); border-right: 2px solid var(--on-band);
}
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--mark); color: var(--on-mark); }
.seg input:checked + span::before { content: "✓ "; white-space: pre; }
.seg input:focus-visible + span { outline: 4px solid var(--mark); outline-offset: -8px; box-shadow: inset 0 0 0 8px var(--band); }
.prefs-note { font-size: 0.85rem; color: var(--on-band-2); margin: 0; max-width: 32ch; }

/* ---------- Site header ---------- */
.site-header { border-bottom: 4px solid var(--rule); background: var(--paper); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap; padding: 1rem 0; }
.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: var(--ink); min-height: 48px; }
.brand svg { flex: none; }
.brand-name { font-weight: 800; font-size: 1.15rem; line-height: 1.1; }
.brand-name small { display: block; font-family: var(--mono); font-weight: 400; font-size: 0.75rem; color: var(--ink-2); letter-spacing: 0.04em; }
.site-nav ul { display: flex; flex-wrap: wrap; gap: 0.3rem; list-style: none; margin: 0; padding: 0; max-width: none; }
.site-nav li { margin: 0; }
.site-nav a {
  display: flex; align-items: center; min-height: 48px; padding: 0 0.85rem; color: var(--ink);
  font-weight: 700; text-decoration: none; border-bottom: 4px solid transparent; font-size: 1rem;
}
.site-nav a:hover { text-decoration: underline; text-decoration-thickness: 3px; }
.site-nav a[aria-current="page"] { border-bottom-color: var(--ink); background: var(--surface-2); }
.site-nav a[aria-current="page"]::before { content: "▸"; margin-right: 0.35rem; font-size: 0.8em; }

@media (max-width: 760px) {
  .header-row { flex-direction: column; align-items: stretch; }
  .site-nav ul { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
  .site-nav a { justify-content: center; border: 2px solid var(--rule-soft); border-radius: var(--radius); padding: 0 0.4rem; }
  .site-nav a[aria-current="page"] { border: 3px solid var(--ink); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 52px; padding: 0.6rem 1.3rem;
  border: 3px solid var(--ink); border-radius: var(--radius); font: inherit; font-weight: 800; font-size: 1rem;
  text-decoration: none; cursor: pointer; background: var(--ink); color: var(--paper); line-height: 1.2;
}
.btn:hover { background: var(--brand); border-color: var(--brand); color: var(--on-brand); text-decoration: underline; }
.btn:active { transform: translateY(1px); }
.btn--outline { background: transparent; color: var(--ink); }
.btn--outline:hover { background: var(--surface-2); color: var(--ink); border-color: var(--ink); }
.btn--small { min-height: 44px; padding: 0.3rem 0.9rem; font-size: 0.9rem; }
.btn[aria-busy="true"] { cursor: progress; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.9rem 1.2rem; align-items: center; }
.link-tertiary { font-weight: 700; color: var(--ink-2); }

/* ---------- Sections ---------- */
.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; border-bottom: 2px solid var(--rule-soft); }
.section:last-of-type { border-bottom: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 2rem; margin-bottom: 1.8rem; }
.section-head h2 { margin: 0; }
.section-head p { margin: 0.4rem 0 0; color: var(--ink-2); }
.num { font-family: var(--mono); font-weight: 700; font-size: 0.85rem; color: var(--ink-2); display: block; margin-bottom: 0.3rem; letter-spacing: 0.05em; }
.section-head h2 { border-left: 8px solid var(--ink); padding-left: 0.8rem; }

/* ---------- Page hero ---------- */
.page-hero { padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(2rem, 4vw, 3rem); border-bottom: 2px solid var(--rule-soft); }
.page-hero h1 { max-width: 20ch; }
.page-hero .lede { max-width: 48ch; }
.page-hero-grid { display: grid; gap: 2rem; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 980px) { .page-hero-grid { grid-template-columns: 1.2fr 1fr; gap: 3.5rem; } }
.hero-figure { margin: 0; }
.hero-figure img { width: 100%; border: 3px solid var(--rule); border-radius: var(--radius); aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-2); }
.hero-figure figcaption { font-size: 0.85rem; color: var(--ink-2); margin-top: 0.5rem; }

/* ---------- Home hero ---------- */
.home-hero { padding: clamp(2.5rem, 6vw, 5rem) 0; border-bottom: 4px solid var(--rule); }
.home-hero-grid { display: grid; gap: 2.5rem; }
@media (min-width: 980px) { .home-hero-grid { grid-template-columns: 1.35fr 1fr; gap: 4rem; align-items: start; } }
.home-hero h1 { font-size: clamp(2.5rem, 6.4vw, 4.6rem); max-width: 14ch; }
.home-hero .lede { max-width: 40ch; margin-bottom: 2rem; }
.home-hero figure img { aspect-ratio: 4 / 5; object-position: 30% 30%; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border: 3px solid var(--rule); border-radius: var(--radius); margin: 0 0 2rem; max-width: 36rem; background: var(--surface); }
.stats div { padding: 0.9rem 1rem; border-right: 2px solid var(--rule); }
.stats div:last-child { border-right: 0; }
.stats dt { font-family: var(--mono); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); font-weight: 700; }
.stats dd { margin: 0; font-size: clamp(1.5rem, 3.4vw, 2.1rem); font-weight: 800; font-variant-numeric: tabular-nums; order: -1; }
.stats div { display: flex; flex-direction: column; }
@media (max-width: 420px) { .stats div { padding: 0.7rem 0.6rem; } }

/* ---------- Cards and lists ---------- */
.grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr)); }
.card {
  position: relative; display: flex; flex-direction: column; background: var(--surface);
  border: 2px solid var(--rule-soft); border-radius: var(--radius); padding: 1.3rem; min-width: 0;
}
.card:hover { border-color: var(--ink); background: var(--surface-2); }
.card:focus-within { border-color: var(--ink); }
.card h3 { font-size: 1.2rem; margin: 0 0 0.5rem; }
.card h3 a { color: var(--ink); text-decoration-thickness: 2px; }
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card h3 a:focus-visible { outline: none; box-shadow: none; }
.card:has(h3 a:focus-visible) { outline: 4px solid var(--focus-inner); outline-offset: 3px; box-shadow: 0 0 0 10px var(--focus-outer); }
.card p { margin: 0 0 0.8rem; color: var(--ink-2); }
.card .meta { margin-top: auto; }
.card-img { margin: -1.3rem -1.3rem 1.1rem; border-bottom: 2px solid var(--rule-soft); aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.meta { font-family: var(--mono); font-size: 0.8rem; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 0.2rem 0.9rem; }
.meta span + span::before { content: "·"; margin-right: 0.9rem; }
.card .inline-link { position: relative; z-index: 1; }

.tag-list { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; margin: 0.4rem 0 0; }
.tag-list li { margin: 0; font-family: var(--mono); font-size: 0.8rem; border: 2px solid var(--rule-soft); border-radius: 999px; padding: 0.1rem 0.65rem; color: var(--ink); }

.badge { display: inline-block; font-family: var(--mono); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.05rem 0.5rem; border: 2px solid var(--ink); border-radius: 4px; color: var(--ink); }
.badge--new { background: var(--mark); color: var(--on-mark); border-color: var(--on-mark); }
.badge--solid { background: var(--ink); color: var(--paper); }

/* Rows: text-first list, the default presentation for article indexes. */
.rows { list-style: none; padding: 0; margin: 0; max-width: none; border-top: 3px solid var(--rule); }
.rows > li { margin: 0; border-bottom: 2px solid var(--rule-soft); }
.row { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 0.3rem 1.5rem; padding: 1.2rem 0; position: relative; }
.row time { font-family: var(--mono); font-size: 0.85rem; color: var(--ink-2); padding-top: 0.25rem; font-variant-numeric: tabular-nums; }
.row h3 { font-size: 1.2rem; margin: 0 0 0.3rem; }
.row h3 a { color: var(--ink); }
.row p { margin: 0; color: var(--ink-2); }
.row .tag-list { margin-top: 0.5rem; }
@media (max-width: 600px) { .row { grid-template-columns: 1fr; } }

/* ---------- Callouts ---------- */
.callout { border: 3px solid var(--ink); border-radius: var(--radius); padding: 1.1rem 1.3rem; margin: 1.8rem 0; background: var(--surface); max-width: var(--measure); }
.callout p:last-child { margin-bottom: 0; }
.callout-label { display: flex; align-items: center; gap: 0.5rem; font-weight: 800; margin: 0 0 0.4rem; font-size: 1rem; }
.callout-label svg { flex: none; }
.callout--why { border-style: solid; border-left-width: 10px; }
.callout--question { border-style: dashed; background: var(--surface-2); }
.callout--note { border-style: double; border-width: 6px; }
.callout--skill { border-color: var(--brand); border-left-width: 10px; }

.band-dark { background: var(--band); color: var(--on-band); border-radius: var(--radius); padding: clamp(1.5rem, 4vw, 2.5rem); }
.band-dark h2, .band-dark h3 { color: var(--on-band); }
.band-dark p { color: var(--on-band-2); }
.band-dark a:not(.btn) { color: var(--on-band); }
.band-dark .btn { background: var(--mark); color: var(--on-mark); border-color: var(--mark); }
.band-dark .btn:hover { background: var(--on-band); color: var(--band); border-color: var(--on-band); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field label { font-weight: 700; }
.field .hint { font-size: 0.9rem; color: var(--ink-2); }
input[type="email"], input[type="search"], input[type="text"], select {
  font: inherit; font-size: 1rem; min-height: 52px; padding: 0.5rem 0.9rem; border: 3px solid var(--ink); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); width: 100%;
}
input::placeholder { color: var(--ink-2); opacity: 1; }
.form-inline { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: flex-end; }
.form-inline .field { flex: 1 1 16rem; }
.form-status { font-weight: 700; margin: 0.6rem 0 0; min-height: 1.6em; }
.form-status.is-error { color: var(--warn); }
.form-status.is-success { color: var(--ok); }

/* ---------- Footer ---------- */
.site-footer { background: var(--band); color: var(--on-band); margin-top: 4rem; padding: 3.5rem 0 2rem; }
.site-footer a { color: var(--on-band); }
.site-footer h2 { color: var(--on-band); font-size: 1.1rem; margin-bottom: 0.8rem; }
.site-footer p { color: var(--on-band-2); }
.footer-grid { display: grid; gap: 2.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin: 0; }
.footer-grid li a { display: inline-flex; align-items: center; min-height: 44px; }
.site-footer input { border-color: var(--on-band); background: var(--band); color: var(--on-band); }
.site-footer input::placeholder { color: var(--on-band-2); }
.site-footer .btn { background: var(--mark); color: var(--on-mark); border-color: var(--mark); }
.site-footer .form-status.is-success, .site-footer .form-status.is-error { color: var(--on-band); }
.a11y-statement { border: 2px solid var(--on-band-2); border-radius: var(--radius); padding: 1.1rem 1.3rem; margin-top: 2.5rem; }
.a11y-statement h2 { margin-bottom: 0.4rem; }
.a11y-statement ul { list-style: square; padding-left: 1.2rem; margin: 0; columns: 2 18rem; color: var(--on-band-2); }
.a11y-statement li { margin-bottom: 0.3rem; }
.footer-bottom { border-top: 2px solid var(--on-band-2); margin-top: 2.5rem; padding-top: 1.2rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; color: var(--on-band-2); font-size: 0.9rem; }
.footer-bottom p { margin: 0; }

/* ---------- Article ---------- */
.article-head { padding: clamp(2rem, 5vw, 3.5rem) 0 2rem; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.3rem; padding: 0; margin: 0 0 1.2rem; font-size: 0.95rem; max-width: none; }
.breadcrumb li { margin: 0; }
.breadcrumb li + li::before { content: "/"; margin-right: 0.3rem; color: var(--ink-2); }
.article-head h1 { max-width: 22ch; }
.article-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); border: 3px solid var(--rule); border-radius: var(--radius); margin: 1.5rem 0 0; background: var(--surface); max-width: 52rem; }
.article-facts div { padding: 0.7rem 1rem; border-right: 2px solid var(--rule-soft); border-bottom: 2px solid var(--rule-soft); }
.article-facts dt { font-family: var(--mono); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); font-weight: 700; }
.article-facts dd { margin: 0; font-weight: 800; }
.article-hero { margin: 0 0 2.5rem; }
.article-hero img { width: 100%; max-height: 28rem; object-fit: cover; border: 3px solid var(--rule); border-radius: var(--radius); background: var(--surface-2); }
.article-hero figcaption { font-size: 0.85rem; color: var(--ink-2); margin-top: 0.5rem; }

.article-layout { display: grid; gap: 2.5rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .article-layout { grid-template-columns: 17rem minmax(0, 46rem); justify-content: center; gap: 4rem; } }
.toc { border: 3px solid var(--rule); border-radius: var(--radius); padding: 1rem 1.2rem; background: var(--surface); align-self: start; }
@media (min-width: 1100px) { .toc { position: sticky; top: 1rem; } }
.toc h2 { font-size: 1rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 0.6rem; }
.toc ol { padding-left: 1.3rem; margin: 0; }
.toc li { margin: 0; }
.toc a { display: inline-block; padding: 0.35rem 0; color: var(--ink); text-decoration-thickness: 1px; }
.toc a[aria-current="true"] { font-weight: 800; text-decoration-thickness: 3px; }
.toc a[aria-current="true"]::after { content: " ◂ reading"; font-family: var(--mono); font-size: 0.75rem; font-weight: 400; color: var(--ink-2); }
.toc .progress-text { font-family: var(--mono); font-size: 0.8rem; color: var(--ink-2); margin: 0.8rem 0 0; }

.prose { font-size: 1rem; }
.prose > * { max-width: var(--measure); }
.prose h2 { margin-top: 2.6em; padding-top: 0.6em; border-top: 3px solid var(--rule); scroll-margin-top: 1.5rem; }
.prose h2 .num { margin-bottom: 0.2rem; }
.prose ol, .prose ul { margin: 0 0 var(--para); }
.prose code:not(pre code) { font-family: var(--mono); font-size: 0.9em; background: var(--code-bg); border: 1px solid var(--rule-soft); border-radius: 4px; padding: 0.05em 0.3em; }
.prose em { font-style: italic; }

.code-block { margin: 1.8rem 0; border: 3px solid var(--rule); border-radius: var(--radius); background: var(--code-bg); max-width: none; overflow: hidden; }
.code-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.3rem 0.4rem 0.3rem 1rem; border-bottom: 2px solid var(--rule); background: var(--surface); }
.code-bar .lang { font-family: var(--mono); font-weight: 700; font-size: 0.85rem; }
.code-block pre { margin: 0; padding: 1.1rem 1.2rem; overflow-x: auto; font-family: var(--mono); font-size: 0.85rem; line-height: 1.6; color: var(--ink); tab-size: 2; }
.code-block pre:focus-visible { outline-offset: -6px; box-shadow: inset 0 0 0 10px var(--focus-outer); }
.tok-c { color: var(--code-comment); font-style: italic; }
.tok-k { color: var(--code-keyword); font-weight: 700; }
.tok-s { color: var(--code-string); }

.after-article { margin-top: 3rem; display: grid; gap: 2rem; }
.share-row { display: flex; flex-wrap: wrap; gap: 0.7rem; }

/* ---------- Series ---------- */
.series { border: 3px solid var(--rule); border-radius: var(--radius); padding: 1.3rem; background: var(--surface); }
.series ol { list-style: none; padding: 0; margin: 0.8rem 0 0; max-width: none; display: grid; gap: 0.6rem; }
.series li { margin: 0; display: grid; grid-template-columns: 3rem 1fr; gap: 0.8rem; align-items: start; }
.series .part { font-family: var(--mono); font-weight: 800; border: 2px solid var(--ink); border-radius: 4px; text-align: center; padding: 0.1rem 0; }
.series .is-soon .part { border-style: dashed; color: var(--ink-2); border-color: var(--ink-2); }

/* ---------- Jump nav ---------- */
.jump { border-top: 2px solid var(--rule-soft); border-bottom: 2px solid var(--rule-soft); padding: 0.8rem 0; background: var(--paper); }
.jump ul { display: flex; flex-wrap: wrap; gap: 0.5rem 0.4rem; list-style: none; margin: 0; padding: 0; max-width: none; align-items: center; }
.jump li { margin: 0; }
.jump .label { font-weight: 800; margin-right: 0.5rem; }
.jump a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.8rem; border: 2px solid var(--ink); border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 700; }
.jump a:hover { background: var(--surface-2); text-decoration: underline; }

/* ---------- Projects ---------- */
.feature { display: grid; gap: 2rem; border: 4px solid var(--rule); border-radius: var(--radius); padding: clamp(1.3rem, 3vw, 2.2rem); background: var(--surface); }
@media (min-width: 980px) { .feature { grid-template-columns: 1.2fr 1fr; align-items: center; } }
.feature img { width: 100%; border: 2px solid var(--rule); border-radius: var(--radius); background: var(--surface-2); aspect-ratio: 16/10; object-fit: cover; }
.statline { display: grid; grid-template-columns: repeat(3, 1fr); border: 2px solid var(--rule); border-radius: var(--radius); margin: 1.2rem 0; max-width: 28rem; }
.statline div { padding: 0.6rem 0.8rem; border-right: 2px solid var(--rule); display: flex; flex-direction: column; }
.statline div:last-child { border-right: 0; }
.statline dt { font-family: var(--mono); font-size: 0.8rem; text-transform: uppercase; color: var(--ink-2); font-weight: 700; }
.statline dd { margin: 0; font-size: 1.5rem; font-weight: 800; order: -1; font-variant-numeric: tabular-nums; }

.proj { display: grid; gap: 1.5rem; padding: 1.8rem 0; border-bottom: 2px solid var(--rule-soft); }
@media (min-width: 900px) { .proj { grid-template-columns: 22rem minmax(0, 1fr); gap: 2.5rem; } }
.proj h3 { margin-bottom: 0.4rem; }
.proj-img { border: 2px solid var(--rule); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); aspect-ratio: 16 / 10; }
.proj-img img { width: 100%; height: 100%; object-fit: cover; }
.recording { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 0.6rem; padding: 1.2rem; background: var(--band); color: var(--on-band); height: 100%; font-family: var(--mono); font-size: 0.85rem; }
.recording p { margin: 0; color: var(--on-band-2); }
.recording a { color: var(--on-band); font-weight: 700; }
.recording .prompt-line::before { content: "$ "; color: var(--mark); }

/* ---------- Patterns ---------- */
.explain-3 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); list-style: none; padding: 0; margin: 1.5rem 0; max-width: none; counter-reset: way; }
.explain-3 li { border: 3px solid var(--rule); border-radius: var(--radius); padding: 1rem 1.2rem; margin: 0; background: var(--surface); counter-increment: way; }
.explain-3 li::before { content: counter(way); display: inline-grid; place-items: center; width: 2rem; height: 2rem; border: 2px solid var(--ink); border-radius: 50%; font-weight: 800; margin-bottom: 0.4rem; }
.explain-3 strong { display: block; font-size: 1.15rem; }
.filters { display: grid; gap: 1.2rem; margin-bottom: 1.5rem; }
.pill-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pill { font: inherit; font-weight: 700; font-size: 0.95rem; min-height: 44px; padding: 0 1rem; border: 2px solid var(--ink); background: var(--surface); color: var(--ink); border-radius: 999px; cursor: pointer; }
.pill:hover { background: var(--surface-2); text-decoration: underline; }
.pill[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.pill[aria-pressed="true"]::before { content: "✓ "; }
.result-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; border-top: 3px solid var(--rule); padding-top: 1rem; margin-bottom: 1.2rem; }
.result-bar p { margin: 0; font-weight: 800; font-size: 1.1rem; }
.sort { display: flex; align-items: center; gap: 0.6rem; }
.sort select { width: auto; }
.pattern-card .glyph { height: 7rem; margin: -1.3rem -1.3rem 1rem; border-bottom: 2px solid var(--rule-soft); background: var(--surface-2); display: grid; place-items: center; color: var(--ink); border-radius: var(--radius) var(--radius) 0 0; }
.pattern-card .goodfor { font-size: 0.95rem; }
.empty { border: 3px dashed var(--ink); border-radius: var(--radius); padding: 2rem; text-align: left; }
.empty h3 { margin-bottom: 0.4rem; }

.usecases { columns: 2 16rem; max-width: none; }
.tabs { border: 3px solid var(--rule); border-radius: var(--radius); background: var(--surface); margin-top: 2rem; }
.tabs-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: stretch; border-bottom: 3px solid var(--rule); gap: 0.4rem; padding-right: 0.5rem; }
[role="tablist"] { display: flex; flex-wrap: wrap; }
[role="tab"] { font: inherit; font-weight: 700; min-height: 52px; padding: 0 1.1rem; background: transparent; color: var(--ink); border: 0; border-right: 2px solid var(--rule-soft); border-bottom: 5px solid transparent; cursor: pointer; }
[role="tab"]:hover { text-decoration: underline; }
[role="tab"][aria-selected="true"] { background: var(--surface-2); border-bottom-color: var(--ink); }
[role="tab"]:focus-visible { outline-offset: -6px; box-shadow: inset 0 0 0 10px var(--focus-outer); }
.tab-actions { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0; flex-wrap: wrap; }
[role="tabpanel"] { padding: 1.5rem; }
[role="tabpanel"] pre { margin: 0; overflow-x: auto; font-family: var(--mono); font-size: 0.85rem; line-height: 1.6; background: var(--code-bg); padding: 1rem; border: 2px solid var(--rule-soft); border-radius: var(--radius); }
.panel-note { font-size: 0.95rem; }

/* Hairline stat strip demo, fixed so labels never overflow at five tiles. */
.hss-caption { font-weight: 700; margin: 0 0 0.7rem; }
.hss-strip { display: grid; gap: 2px; background: var(--rule); border: 2px solid var(--rule); border-radius: var(--radius); overflow: hidden; grid-template-columns: 1fr; margin-bottom: 1.8rem; max-width: none; }
@media (min-width: 30rem) { .hss-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 52rem) { .hss-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); } .hss-strip--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.hss-tile { background: var(--surface); padding: 0.9rem 1rem; display: flex; flex-direction: column; min-width: 0; text-align: left; font: inherit; color: var(--ink); border: 0; }
.hss-tile .lbl { font-family: var(--mono); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; color: var(--ink-2); overflow-wrap: anywhere; }
.hss-tile .fig { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.hss-tile .sub { font-size: 0.85rem; color: var(--ink-2); }
.hss-tile .fig.is-missing { color: var(--ink-2); }
button.hss-tile { cursor: pointer; min-height: 44px; }
button.hss-tile:hover { background: var(--surface-2); }
button.hss-tile[aria-pressed="true"] { background: var(--mark); color: var(--on-mark); }
button.hss-tile[aria-pressed="true"] .lbl, button.hss-tile[aria-pressed="true"] .sub { color: var(--on-mark); }
button.hss-tile[aria-pressed="true"] .lbl::before { content: "✓ "; }
button.hss-tile:focus-visible { outline-offset: -6px; box-shadow: inset 0 0 0 10px var(--focus-outer); position: relative; z-index: 1; }
.dl-list { list-style: none; padding: 0; margin: 0; border-top: 2px solid var(--rule); max-width: none; }
.dl-list li { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 0.6rem 0; border-bottom: 1px solid var(--rule-soft); margin: 0; }
.dl-list .st { font-family: var(--mono); font-size: 0.85rem; font-weight: 700; }
.dl-status { font-weight: 700; margin-top: 0.8rem; }

/* ---------- About ---------- */
.timeline { list-style: none; padding: 0; margin: 0; max-width: none; border-left: 6px solid var(--ink); }
.timeline > li { padding: 0 0 2rem 1.6rem; position: relative; margin: 0; }
.timeline > li::before { content: ""; position: absolute; left: -15px; top: 0.35rem; width: 20px; height: 20px; background: var(--paper); border: 4px solid var(--ink); border-radius: 50%; }
.timeline .period { font-family: var(--mono); font-weight: 700; color: var(--ink-2); }
.timeline ul { margin-top: 0.4rem; }
.career { width: 100%; border-collapse: collapse; margin: 1rem 0 2rem; font-size: 0.95rem; }
.career caption { text-align: left; font-weight: 800; margin-bottom: 0.4rem; }
.career th, .career td { border: 2px solid var(--rule-soft); padding: 0.55rem 0.8rem; text-align: left; vertical-align: top; }
.career th { background: var(--surface-2); font-family: var(--mono); font-size: 0.8rem; text-transform: uppercase; }
.table-scroll { overflow-x: auto; }
.principles { list-style: none; padding: 0; margin: 0; counter-reset: pr; max-width: none; display: grid; gap: 1rem; }
.principles li { counter-increment: pr; font-size: 1.3rem; font-weight: 700; font-style: italic; padding-left: 3rem; position: relative; margin: 0; max-width: 40ch; }
.principles li::before { content: counter(pr, decimal-leading-zero); position: absolute; left: 0; top: 0.2rem; font-family: var(--mono); font-style: normal; font-size: 0.9rem; color: var(--mark); }
:root[data-theme="light"] .band-dark .principles li::before, :root:not([data-theme]) .band-dark .principles li::before { color: var(--mark); }
.skills-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.skills-grid ul { padding-left: 1.1rem; }

details.disclose { border: 3px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
details.disclose > summary { cursor: pointer; min-height: 52px; display: flex; align-items: center; padding: 0.6rem 1.2rem; font-weight: 800; list-style: none; }
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose > summary::before { content: "+ Show "; font-family: var(--mono); margin-right: 0.3rem; }
details.disclose[open] > summary::before { content: "− Hide "; }
details.disclose > .disclose-body { padding: 0 1.2rem 1.2rem; }

/* ---------- Structure view: reveals headings and landmarks ---------- */
:root[data-structure="on"] h1::before, :root[data-structure="on"] h2::before, :root[data-structure="on"] h3::before {
  font-family: var(--mono); font-size: 0.75rem; font-weight: 700; font-style: normal; letter-spacing: 0; vertical-align: middle;
  background: var(--mark); color: var(--on-mark); padding: 0.1rem 0.35rem; margin-right: 0.5rem; border-radius: 3px; display: inline-block;
}
:root[data-structure="on"] h1::before { content: "H1"; }
:root[data-structure="on"] h2::before { content: "H2"; }
:root[data-structure="on"] h3::before { content: "H3"; }
:root[data-structure="on"] header.site-header, :root[data-structure="on"] main, :root[data-structure="on"] footer.site-footer, :root[data-structure="on"] nav, :root[data-structure="on"] aside {
  outline: 3px dashed var(--mark); outline-offset: -3px; position: relative;
}
:root[data-structure="on"] [data-landmark]::after {
  content: attr(data-landmark); position: absolute; top: 0; right: 0; z-index: 5;
  background: var(--mark); color: var(--on-mark); font-family: var(--mono); font-size: 0.75rem; font-weight: 700; padding: 0.1rem 0.4rem;
}

.two-col { display: grid; gap: 2.5rem; }
@media (min-width: 980px) { .two-col { grid-template-columns: 1fr 1fr; } }
.stack > * + * { margin-top: 1rem; }
.center-note { text-align: center; }

@media (forced-colors: active) {
  .seg input:checked + span, .pill[aria-pressed="true"], button.hss-tile[aria-pressed="true"] { forced-color-adjust: none; background: Highlight; color: HighlightText; }
  :focus-visible { outline: 4px solid Highlight; }
}

@media print {
  .prefs, .site-nav, .site-footer, .toc, .share-row, .skip-link { display: none !important; }
  a::after { content: " (" attr(href) ")"; font-size: 0.8em; }
}

/* ---------- Logo ---------- */
.logo rect { fill: var(--ink); }
.logo text { fill: var(--paper); font-family: var(--font); font-weight: 800; font-size: 20px; letter-spacing: 0; }
.site-footer .logo rect { fill: var(--on-band); }
.site-footer .logo text { fill: var(--band); }
.muted-band { font-weight: 400; color: var(--on-band-2); }
@media (max-width: 640px) { .muted-band { display: none; } }
@media (min-width: 1000px) { .footer-grid { grid-template-columns: 1.2fr 0.8fr 0.8fr 1.6fr; } }
.hss-tile dd, .hss-tile dt { margin: 0; }
:root[data-structure="on"] [data-landmark]::after { transform: translateY(-100%); }
:root[data-structure="on"] main[data-landmark]::after { transform: none; }
[hidden] { display: none !important; }
.feature { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 980px) { .feature { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }
.statline dt { overflow-wrap: anywhere; }
@media (max-width: 480px) { .statline div { padding: 0.5rem; } .statline dt { font-size: 0.8rem; letter-spacing: 0; } }
