/* site-16.css — live site styles, loaded AFTER site-16-base.css.
   Inherits every token, the masthead, hero, ledger, work grid and colophon,
   then adds:
     1. a richer dark theme (deeper paper, crisper rules, punchier accent)
     2. archive list + filters, single post (prose body, sticky TOC, reading bar),
        About page, and 404.
   Same families (Fraunces / Atkinson / Space Grotesk) and the one oxblood accent. */

/* ════════════════════════════════════════════════════════════════
   1. Richer dark theme — overrides site-16-base's html.is-dark tokens
   ════════════════════════════════════════════════════════════════ */
/* Real monospace for code (the --mono token is Space Grotesk, a sans used for
   design labels sitewide — kept distinct). System stack: no webfont request. */
:root {
    --code-font: ui-monospace, "JetBrains Mono", "SF Mono", "Cascadia Code",
                 "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;
}

html.is-dark {
    --paper: #0f0d0a;                          /* deeper warm near-black */
    --paper-deep: #181410;                     /* gradient crown, a touch lifted */
    --ink: #f1ece2;                            /* brighter primary for presence */
    --ink-soft: #b9b0a3;                       /* raised secondary contrast (~8.9:1) */
    --oxblood: #e2855f;                        /* punchier coral accent */
    --hairline: rgba(241, 236, 226, 0.20);     /* crisper rules */
    --frame: rgba(241, 236, 226, 0.40);
}

/* Deeper paper means the radial body wash needs a hair more lift to read. */
html.is-dark body {
    background: radial-gradient(125% 65% at 50% 0%, var(--paper-deep) 0%, var(--paper) 58%);
}
/* Coral accent in dark: white text on it fails contrast, so the primary
   button uses the dark paper as its label in both rest and hover states. */
html.is-dark .btn { color: var(--paper); }
html.is-dark .btn:hover { color: var(--paper); }
/* The quiet (outline) variant keeps the bright ink label — the rule above is
   only for the filled coral primary. */
html.is-dark .btn--quiet { color: var(--ink); }
html.is-dark .btn--quiet:hover { color: var(--oxblood); }
html.is-dark .figure__frame {
    background: linear-gradient(180deg, color-mix(in oklab, var(--paper) 78%, var(--ink) 6%), var(--paper));
}

/* ════════════════════════════════════════════════════════════════
   2. Shared bits across the new pages
   ════════════════════════════════════════════════════════════════ */
.masthead nav a[aria-current="page"] { color: var(--ink); font-weight: 700; }
html.is-dark .masthead nav a[aria-current="page"] { color: var(--ink); }

/* Page header block (archives, about, 404) — the hero's quieter sibling */
.page-head { margin-bottom: clamp(2.5rem, 6vh, 4rem); }
.page-title {
    font-family: var(--display); font-weight: 500;
    font-size: clamp(2.25rem, 5vw, 3.4rem); line-height: 1.05;
    letter-spacing: -0.02em; font-variation-settings: "opsz" 120;
    margin-top: 0.6rem;
}
.page-intro {
    margin-top: 1.1rem; max-width: 60ch;
    font-size: 1.05rem; color: var(--ink-soft);
}

/* ════════════════════════════════════════════════════════════════
   3. Archive — filters + results + pager (list reuses .ledger/.entry)
   ════════════════════════════════════════════════════════════════ */
.filters {
    display: flex; flex-wrap: wrap; gap: 1.4rem 2rem;
    align-items: flex-end;
    padding: 1.4rem 0 1.6rem;
    border-top: 1px solid var(--hairline);
    border-bottom: 1px solid var(--hairline);
    margin-bottom: 1.5rem;
}
.filters__label {
    display: block; padding: 0;
    font-family: var(--mono); font-size: 0.7rem;
    letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--ink-soft); margin-bottom: 0.5rem;
}
.filters__search { flex: 1 1 16rem; }
.filters__search input {
    width: 100%; font-family: var(--body); font-size: 0.95rem;
    color: var(--ink); background: transparent;
    border: none; border-bottom: 1px solid var(--ink-soft);
    padding: 0.4rem 0.1rem;
}
.filters__search input::placeholder { color: var(--ink-soft); opacity: 0.8; }
.filters__search input:focus-visible {
    outline: none; border-bottom-color: var(--oxblood);
}
.filters__group { border: none; padding: 0; margin: 0; min-width: 0; }
.filters__tags { display: flex; flex-wrap: wrap; gap: 0.4rem 0.6rem; }
.tagcheck {
    display: inline-flex; align-items: baseline; gap: 0.35rem;
    font-size: 0.8125rem; color: var(--ink-soft);
    border: 1px solid var(--ink-soft); border-radius: 2rem;
    padding: 0.25rem 0.7rem; cursor: pointer;
    transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.tagcheck:hover { border-color: var(--oxblood); color: var(--ink); }
.tagcheck input { position: absolute; opacity: 0; width: 0; height: 0; }
.tagcheck small { font-family: var(--mono); font-size: 0.65rem; opacity: 0.7; }
.tagcheck:has(input:checked) {
    background: var(--ink); border-color: var(--ink); color: var(--paper);
}
.tagcheck:has(input:focus-visible) { outline: 2px solid var(--oxblood); outline-offset: 2px; }
.filters__row {
    display: flex; flex-wrap: wrap; gap: 1rem 1.5rem;
    align-items: flex-end; margin-left: auto;
}
.filters__sort select {
    font-family: var(--body); font-size: 0.9rem; color: var(--ink);
    background: transparent; border: 1px solid var(--ink-soft);
    border-radius: 2px; padding: 0.45rem 0.6rem;
}
.filters__sort select:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 2px; }
.filters__actions { display: flex; gap: 0.6rem; }

.results-line {
    font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.04em;
    color: var(--ink-soft); margin-bottom: 0.5rem;
}

/* Pager — footnote-mono numerals, oxblood current */
.pager {
    display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center;
    margin-top: 2.5rem; padding-top: 1.4rem;
    border-top: 1px solid var(--hairline);
    font-family: var(--mono); font-size: 0.85rem;
}
.pager__link {
    display: inline-block; padding: 0.4rem 0.7rem;
    color: var(--ink-soft); text-decoration: none;
    border: 1px solid transparent; border-radius: 2px;
    transition: color 0.18s ease, border-color 0.18s ease;
}
a.pager__link:hover { color: var(--oxblood); border-color: var(--hairline); }
.pager__link.is-active { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.pager__gap { color: var(--ink-soft); padding: 0 0.2rem; }

/* ════════════════════════════════════════════════════════════════
   4. Single post — head, prose body, sticky TOC, reading bar
   ════════════════════════════════════════════════════════════════ */
.read-bar {
    position: fixed; top: 0; left: 0; z-index: 60;
    height: 2px; width: 100%;
    background: var(--oxblood);
    transform: scaleX(0); transform-origin: left center;
}
.article-back { margin-top: 0.5rem; margin-bottom: 2rem; }
.article-head { margin-bottom: 1.4rem; }
/* Metadata sits ABOVE the title; the section label is an inline accent. */
.article-meta {
    font-family: var(--mono);
    font-size: 0.78rem; letter-spacing: 0.03em; color: var(--ink-soft);
    margin-bottom: 1rem;
}
.article-kicker { font-size: inherit; }
.article-title {
    font-family: var(--display); font-weight: 500;
    font-size: clamp(2.1rem, 4.6vw, 3.4rem); line-height: 1.08;
    letter-spacing: -0.02em; font-variation-settings: "opsz" 120;
    max-width: 30ch;
}
/* Excerpt as a standfirst directly under the title. */
.article-standfirst {
    margin-top: 1rem; max-width: 56ch;
    font-family: var(--display); font-style: italic; font-weight: 400;
    font-size: clamp(1.05rem, 1.6vw, 1.25rem); line-height: 1.5;
    color: var(--ink-soft);
}
.article-tags {
    margin-top: 0.9rem; font-style: italic;
    font-size: 0.85rem; color: var(--ink-soft);
}
.article .rule--heavy { margin-bottom: 2rem; }

/* Two columns on wide screens: prose + sticky contents rail */
.article-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 14rem;
    gap: clamp(2rem, 5vw, 4rem);
    align-items: start;
}
.article-content { min-width: 0; max-width: 70ch; }

/* Lede illustration — the post's cover, printed at column width under the rule.
   Sits above the prose, never above the title: the header (kicker, title,
   standfirst) stays the reader's first contact.

   Shares the .figure-embed shell (mat, frame, radii) so the lede and the in-prose
   figures below it read as one system rather than two. No aspect-ratio/object-fit:
   covers carry text inside the artwork, and a fixed ratio would crop the numbers
   off any future upload that isn't 4:3. */
.article-lede {
    margin: 0 0 2rem; padding: 0.75rem;
    border: 1px solid var(--frame); border-radius: 8px;
    background: color-mix(in oklab, var(--paper-deep) 35%, transparent);
}
.article-lede > img {
    display: block; width: 100%; height: auto; border-radius: 4px;
}
/* Dark: the cream plate is the brightest thing on the page and out-shouts the
   title. Knock it back onto the mat. No hover-to-restore — an <img> takes no
   focus and touch has no hover, so it would be a sighted-mouse-only easter egg. */
html.is-dark .article-lede > img {
    filter: brightness(0.80) contrast(1.02);
}

/* Prose typography for render_markdown() output */
.article-content > * + * { margin-top: 1.15rem; }
/* First block sits flush with the rule and the Contents rail beside it */
.article-content > *:first-child { margin-top: 0; }
.article-content h2 {
    font-family: var(--display); font-weight: 500; color: var(--oxblood);
    font-size: clamp(1.5rem, 3vw, 1.9rem); line-height: 1.2;
    letter-spacing: -0.01em; margin-top: 2.6rem; scroll-margin-top: 1.5rem;
}
.article-content h3 {
    font-family: var(--display); font-weight: 500; font-style: italic; color: var(--oxblood);
    font-size: 1.25rem; line-height: 1.3; margin-top: 1.9rem; scroll-margin-top: 1.5rem;
}
.article-content p { color: var(--ink); }
.article-content a {
    color: var(--oxblood); text-decoration: none;
    background-image: linear-gradient(var(--oxblood), var(--oxblood));
    background-repeat: no-repeat; background-position: 0 100%; background-size: 100% 1px;
}
.article-content a:hover { background-size: 100% 2px; }
.article-content strong { font-weight: 700; }
.article-content ul, .article-content ol { padding-left: 1.4rem; }
.article-content li + li { margin-top: 0.4rem; }
.article-content li { padding-left: 0.2rem; }
.article-content blockquote {
    border-left: 2px solid var(--hairline);
    padding-left: 1.2rem; margin-left: 0;
    font-style: italic; color: var(--ink-soft);
}
.article-content code,
.prose-section code {
    font-family: var(--code-font); font-size: 0.86em;
    background: color-mix(in oklab, var(--ink) 8%, transparent);
    padding: 0.1rem 0.35rem; border-radius: 3px;
}
.article-content pre,
.prose-section pre {
    font-family: var(--code-font); font-size: 0.82rem; line-height: 1.6;
    background: color-mix(in oklab, var(--ink) 6%, transparent);
    border: 1px solid var(--hairline); border-radius: 4px;
    padding: 1rem 1.1rem; overflow-x: auto;
}
.article-content pre code,
.prose-section pre code { background: none; padding: 0; }

/* ── Syntax highlighting (highlight.js token classes) ───────────────────
   highlight.js ships no inline styles — it only adds .hljs-* span wrappers —
   so the palette lives here, tuned to the warm editorial theme. CDN theme CSS
   is blocked by the style-src CSP, which is why this is self-hosted. */
.hljs { color: inherit; background: none; }
.hljs-comment, .hljs-quote { color: #6b645a; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal,
.hljs-section, .hljs-name, .hljs-doctag { color: #8c2f1b; font-weight: 600; }
.hljs-string, .hljs-regexp, .hljs-addition,
.hljs-meta .hljs-string { color: #3a7d52; }
.hljs-number, .hljs-bullet { color: #9a5b1e; }
.hljs-title, .hljs-title.function_, .hljs-title.class_ { color: #2f5d8c; }
.hljs-built_in, .hljs-class .hljs-title, .hljs-symbol { color: #6b3f9e; }
.hljs-attr, .hljs-attribute, .hljs-variable,
.hljs-template-variable, .hljs-property { color: #9a5b1e; }
.hljs-type, .hljs-params, .hljs-selector-id, .hljs-selector-class { color: #2f5d8c; }
.hljs-meta, .hljs-comment.hljs-meta { color: #8a8175; }
.hljs-deletion { color: #8c2f1b; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

html.is-dark .hljs-comment, html.is-dark .hljs-quote { color: #9b9184; }
html.is-dark .hljs-keyword, html.is-dark .hljs-selector-tag,
html.is-dark .hljs-literal, html.is-dark .hljs-section,
html.is-dark .hljs-name, html.is-dark .hljs-doctag { color: #e0826a; }
html.is-dark .hljs-string, html.is-dark .hljs-regexp,
html.is-dark .hljs-addition, html.is-dark .hljs-meta .hljs-string { color: #7fc99a; }
html.is-dark .hljs-number, html.is-dark .hljs-bullet { color: #d6a05e; }
html.is-dark .hljs-title, html.is-dark .hljs-title.function_,
html.is-dark .hljs-title.class_ { color: #6fa8d6; }
html.is-dark .hljs-built_in, html.is-dark .hljs-class .hljs-title,
html.is-dark .hljs-symbol { color: #b48fe0; }
html.is-dark .hljs-attr, html.is-dark .hljs-attribute,
html.is-dark .hljs-variable, html.is-dark .hljs-template-variable,
html.is-dark .hljs-property { color: #d6a05e; }
html.is-dark .hljs-type, html.is-dark .hljs-params,
html.is-dark .hljs-selector-id, html.is-dark .hljs-selector-class { color: #6fa8d6; }
html.is-dark .hljs-meta { color: #7d756a; }
html.is-dark .hljs-deletion { color: #e0826a; }
.article-content img {
    display: block; max-width: 100%; height: auto;
}
/* Enclosed figures — images and chart embeds share one framed treatment,
   with the caption sitting inside the frame at the bottom. */
.figure-embed {
    margin: 1.6rem 0; padding: 0.75rem;
    border: 1px solid var(--frame); border-radius: 8px;
    background: color-mix(in oklab, var(--paper-deep) 35%, transparent);
}
.figure-embed > img { width: 100%; border-radius: 4px; }
.figure-embed .figure-caption {
    margin: 0.7rem 0 0.1rem; padding: 0 0.15rem;
    font-style: italic; font-size: 0.82rem; line-height: 1.45;
    color: var(--ink-soft); text-align: center;
}
/* Bare caption (no enclosing figure) keeps a sensible default. */
.figure-caption {
    display: block; margin: 0.5rem 0 1.6rem;
    font-style: italic; font-size: 0.82rem; color: var(--ink-soft); text-align: center;
}
.article-content hr {
    border: none; border-top: 1px solid var(--hairline); margin: 2.2rem 0;
}
.article-content table {
    width: 100%; border-collapse: collapse;
    font-size: 0.9rem; margin: 2rem 0;
    display: block; overflow-x: auto; -webkit-overflow-scrolling: touch;
    border-top: 2px solid var(--ink);
}
.article-content th, .article-content td {
    text-align: left; padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--hairline);
    border-right: 1px solid var(--hairline);
    font-variant-numeric: tabular-nums;
}
.article-content th:last-child, .article-content td:last-child { border-right: none; }
.article-content th {
    font-family: var(--mono); font-size: 0.72rem;
    letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft);
    white-space: nowrap;
}
.article-content thead tr {
    border-bottom: 1px solid color-mix(in oklab, var(--ink) 55%, transparent);
    background: color-mix(in oklab, var(--ink) 4%, transparent);
}
.article-content tbody tr:hover {
    background: color-mix(in oklab, var(--ink) 4%, transparent);
}
.article-content tbody tr:last-child td { border-bottom: none; }

/* Heading copy-link anchor (added by site-16-article.js) */
.heading-anchor {
    margin-left: 0.4rem; color: var(--oxblood); opacity: 0;
    text-decoration: none; font-weight: 400;
    transition: opacity 0.15s ease;
}
.article-content h2:hover .heading-anchor,
.article-content h3:hover .heading-anchor,
.heading-anchor:focus-visible { opacity: 1; }
.heading-anchor.copied::after {
    content: " copied"; font-family: var(--mono);
    font-size: 0.6rem; letter-spacing: 0.06em; color: var(--ink-soft);
}

/* Sticky rail holds the contents list and, beneath a separator, related posts */
.article-rail {
    position: sticky; top: 1.5rem; align-self: start;
}
.article-toc {
    font-size: 0.82rem; border-left: 1px solid var(--hairline);
    padding-left: 1.1rem;
}
.rail-related {
    margin-top: 1.4rem; padding-top: 1.4rem;
    border-top: 1px solid var(--hairline);
    border-left: 1px solid var(--hairline); padding-left: 1.1rem;
    font-size: 0.82rem;
}
.rail-related__list { list-style: none; padding: 0; margin: 0.6rem 0 0; }
.rail-related__item + .rail-related__item { margin-top: 0.7rem; }
.rail-related__item a {
    display: block; color: var(--ink); text-decoration: none; line-height: 1.3;
    transition: color 0.15s ease;
}
.rail-related__item a:hover { color: var(--oxblood); }
.rail-related__meta {
    display: block; margin-top: 0.15rem;
    font-family: var(--mono); font-size: 0.62rem;
    letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700;
}
.toc__title {
    font-family: var(--mono); font-size: 0.68rem;
    letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--ink-soft); margin-bottom: 0.7rem;
}
.toc__list { list-style: none; padding: 0; margin: 0; }
.toc__item { line-height: 1.35; }
.toc__item + .toc__item { margin-top: 0.45rem; }
.toc__item--h1 { font-weight: 600; }
.toc__item--h1 + .toc__item { margin-top: 0.6rem; }
.toc__item--h2 { font-weight: 500; }
.toc__item--h3 { padding-left: 0.85rem; }
.article-toc a {
    color: var(--ink-soft); text-decoration: none;
    transition: color 0.15s ease;
}
.article-toc a:hover, .article-toc a.is-active { color: var(--oxblood); }
.article-toc a.is-active { font-weight: 700; }

/* Author sign-off + citation — a working-paper colophon, deliberately styled
   as a contributor note, not a CTA block (no card, no fill, no button). */
.article-sign { max-width: 70ch; margin-top: clamp(2.5rem, 6vh, 4rem); }
.article-sign .rule { border-top: 1px solid var(--hairline); margin-bottom: 1.3rem; }
.article-sign__bio { font-size: 0.95rem; color: var(--ink); max-width: 64ch; }
.article-sign__bio strong { font-weight: 700; }
.article-sign__corr { margin-top: 0.9rem; font-size: 0.92rem; color: var(--ink-soft); }
.article-sign__corr a {
    color: var(--oxblood); text-decoration: none;
    border-bottom: 1px solid color-mix(in oklab, var(--oxblood) 45%, transparent);
}
.article-sign__corr a:hover { border-bottom-color: var(--oxblood); }
.article-sign__dot { color: var(--ink-soft); margin: 0 0.35rem; }
.article-sign__cite {
    margin-top: 1.1rem; font-family: var(--mono);
    font-size: 0.72rem; line-height: 1.55; letter-spacing: 0.02em; color: var(--ink-soft);
}
.article-sign__cite a {
    color: var(--ink-soft); text-decoration: underline; text-underline-offset: 2px;
}
.article-sign__cite a:hover { color: var(--oxblood); }

/* Related list reuses .ledger/.entry from site-16-base */
.related { margin-top: clamp(3.5rem, 8vh, 5.5rem); }
.related .rule--heavy { margin-bottom: 0.85rem; }
/* Shown both here and in the rail (.rail-related) — rail is desktop-only,
   this block always renders below the sign-off. */

/* ════════════════════════════════════════════════════════════════
   5. About page — prose sections + methods grid
   ════════════════════════════════════════════════════════════════ */
.prose-section { max-width: 64ch; }
.prose-section p + p { margin-top: 1.1rem; }
.prose-section p { color: var(--ink); }
.prose-section a {
    color: var(--oxblood); text-decoration: none;
    border-bottom: 1px solid color-mix(in oklab, var(--oxblood) 45%, transparent);
}
.prose-section a:hover { border-bottom-color: var(--oxblood); }

.methods {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(1.4rem, 3vw, 2.2rem); max-width: none;
}
.methods__item {
    border-top: 1px solid var(--hairline); padding-top: 0.9rem;
}
.methods__item h3 {
    font-family: var(--display); font-weight: 500;
    font-size: 1.1rem; margin-bottom: 0.4rem;
}
.methods__item p { font-size: 0.94rem; color: color-mix(in oklab, var(--ink-soft) 70%, var(--ink)); }
/* the About contact section reuses .contact__pitch / .contact__notes */
.prose-section .contact__notes { margin-top: 1.3rem; }

/* ════════════════════════════════════════════════════════════════
   6. 404
   ════════════════════════════════════════════════════════════════ */
.error-page { min-height: 48vh; }
.error-page .hero__actions { margin-top: 1.8rem; }

/* ════════════════════════════════════════════════════════════════
   7. Responsive
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 860px) {
    .article-body { grid-template-columns: 1fr; }
    .article-rail { display: none; }   /* the rail folds away; headings stay anchored */
    .methods { grid-template-columns: 1fr; }
    .filters__row { margin-left: 0; width: 100%; }
}
@media (max-width: 560px) {
    .filters { gap: 1.1rem; }
    .filters__sort, .filters__actions { flex: 1 1 auto; }
}

/* ── Research codebases ─────────────────────────────────────────────
   Stack chips, status badges, and the single-page question + actions.
   All colours reference the shared theme tokens so light/dark both work. */
.chip--stack {
    display: inline-block;
    font-family: "Space Grotesk", ui-monospace, monospace;
    font-size: 0.74rem;
    line-height: 1.4;
    letter-spacing: 0.01em;
    padding: 0.1rem 0.5rem;
    margin: 0 0.3rem 0.3rem 0;
    border: 1px solid var(--frame);
    border-radius: 999px;
    color: var(--ink-soft);
}
.codebase-chips { display: flex; flex-wrap: wrap; align-items: center; }

.codebase-status {
    font-variant-caps: all-small-caps;
    letter-spacing: 0.06em;
    font-weight: 600;
}
.codebase-status--complete { color: #3a7d52; }            /* AA on light paper (~4.6:1) */
html.is-dark .codebase-status--complete { color: #5fb37e; } /* lifted for the dark crown */
.codebase-status--ongoing  { color: var(--oxblood); }
.codebase-status--archived { color: var(--ink-soft); }

.codebase-question {
    font-family: "Fraunces", Georgia, serif;
    font-size: 1.18rem;
    font-style: italic;
    line-height: 1.45;
    color: var(--ink-soft);
    margin: 0.3rem 0 0.7rem;
    max-width: 52ch;
}

.codebase-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--hairline);
}

/* Deferred (coming-soon) rows on the /projects index read quieter and inert. */
.entry--muted { opacity: 0.55; cursor: default; }
.entry--muted h3 { color: var(--ink-soft); }

/* ── /projects index ─────────────────────────────────────────────────────
   Two deliberately different shapes: Projects is an enriched ledger (built,
   sequential things); Current work is a status-card grid (live, parallel
   activities). A one-line lede frames each section. */
.section-lede {
    max-width: 62ch;
    margin: -0.85rem 0 1.6rem;
    color: var(--ink-soft);
    font-size: 1rem;
    line-height: 1.5;
}

/* Enriched ledger rows — the whole row is the link; the meaningless ordinal
   is gone, replaced by a type tag + a concrete stat, a stack signature, and
   an explicit action. */
.entry--rich { display: block; padding: 0; }
.entry__link {
    display: block;
    padding: 1.4rem 0;
    text-decoration: none;
    color: inherit;
}
.entry__link:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 4px; }
.entry__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}
.entry__type {
    font-family: var(--mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--oxblood);
}
.entry__stat {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--ink-soft);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.entry__title {
    font-family: var(--display);
    font-weight: 500;
    font-size: clamp(1.3rem, 2.6vw, 1.7rem);
    line-height: 1.25;
    margin: 0;
    width: fit-content;
    background-image: linear-gradient(var(--oxblood), var(--oxblood));
    background-repeat: no-repeat;
    background-position: 0 100%;
    background-size: 0% 1px;
    transition: background-size 0.25s ease, color 0.2s ease;
}
.entry__excerpt { margin-top: 0.5rem; max-width: 60ch; color: var(--ink); }
.entry__sig {
    margin-top: 0.7rem;
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--ink-soft);
}
.entry__cta {
    display: inline-block;
    margin-top: 0.9rem;
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--oxblood);
}
.entry__cta span { display: inline-block; transition: transform 0.2s ease; }
.entry--rich:hover .entry__title { color: var(--oxblood); background-size: 100% 1px; }
.entry--rich:hover .entry__cta span { transform: translateX(4px); }

/* Current-work status cards — parallel activities, each a self-contained tile. */
.work-cards {
    list-style: none;
    margin: 0;
    padding: 1.6rem 0 0;
    border-top: 1px solid var(--hairline);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: clamp(1rem, 2.5vw, 1.5rem);
}
.work-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: 100%;
    padding: 1.25rem;
    border: 1px solid var(--hairline);
    border-radius: 10px;
    background: color-mix(in oklab, var(--paper-deep) 40%, transparent);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.work-card:hover {
    border-color: var(--oxblood);
    transform: translateY(-2px);
    background: color-mix(in oklab, var(--paper-deep) 75%, transparent);
}
.work-card:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 3px; }
.work-card__status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-soft);
}
.work-card__dot {
    width: 7px; height: 7px; flex: none;
    border-radius: 50%;
    background: var(--ink-soft);
}
.work-card--live .work-card__status { color: var(--oxblood); }
.work-card--live .work-card__dot { background: var(--oxblood); }
.work-card__title {
    font-family: var(--display);
    font-weight: 500;
    font-size: 1.25rem;
    line-height: 1.25;
    margin: 0.1rem 0 0;
}
.work-card__note {
    margin: 0;
    font-family: var(--display);
    font-style: italic;
    font-size: 1rem;
    color: var(--ink-soft);
}
.work-card__desc {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--ink);
}
.work-card__sig {
    font-family: var(--mono);
    font-size: 0.76rem;
    color: var(--ink-soft);
}
.work-card__cta {
    margin-top: auto;
    padding-top: 0.5rem;
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--oxblood);
}
.work-card__cta span { display: inline-block; transition: transform 0.2s ease; }
.work-card:hover .work-card__cta span { transform: translateX(4px); }

@media (max-width: 420px) {
    .entry__head { flex-wrap: wrap; gap: 0.2rem 1rem; }
    .entry__stat { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .entry__title,
    .entry__cta span,
    .work-card,
    .work-card__cta span { transition: none; }
    .work-card:hover { transform: none; }
}

/* ── Featured flagship (homepage + section archive) ─────────────────
   The single promoted article. Side-by-side cover + body on desktop;
   stacks on mobile. Falls back to a body-only card with no image. */
.featured__card {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: clamp(1.25rem, 3vw, 2.5rem);
    align-items: center;
    padding: clamp(1.25rem, 2.5vw, 1.9rem);
    border: 1px solid var(--frame);
    border-radius: 12px;
    background: color-mix(in oklab, var(--paper-deep) 50%, transparent);
}
.featured__card--text { grid-template-columns: 1fr; }
.featured__media { display: block; order: 2; }
.featured__media img {
    display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
    border: 1px solid var(--frame); border-radius: 8px;
}
.featured__body { order: 1; min-width: 0; }
.featured__kicker {
    display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline;
    font-size: 0.8125rem; color: var(--ink-soft); margin-bottom: 0.6rem;
}
.featured__kicker .entry__section { letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; }
.featured__title {
    font-family: var(--display); font-weight: 500;
    font-size: clamp(1.7rem, 3.4vw, 2.5rem); line-height: 1.15;
    margin: 0 0 0.6rem;
}
.featured__title a {
    color: inherit; text-decoration: none;
    background-image: linear-gradient(var(--oxblood), var(--oxblood));
    background-repeat: no-repeat; background-position: 0 100%; background-size: 0% 1px;
    transition: background-size 0.25s ease, color 0.2s ease;
}
.featured__title a:hover { color: var(--oxblood); background-size: 100% 1px; }
.featured__excerpt { margin: 0 0 1rem; max-width: 52ch; color: var(--ink); line-height: 1.55; }
.featured__cta { font-family: var(--mono); font-size: 0.85rem; color: var(--oxblood); text-decoration: none; }
.featured__cta:hover { text-decoration: underline; }
@media (max-width: 720px) {
    .featured__card { grid-template-columns: 1fr; }
    .featured__media { order: 1; }
    .featured__body { order: 2; }
}

/* ── Cover fallback: a post's first live Chart.js figure stands in for a missing
   cover image. Size it to the SAME footprint a cover image would occupy and show
   only the chart canvas — the embed's own title / stats / legend / caption are
   the post's job, not the cover's. `.entry--embed` inherits the `.entry--media`
   column (clamp 110–180px); the box clips to the cover aspect ratio. */
.entry__thumb--embed,
.featured__media--embed {
    align-self: start; overflow: hidden;
    border: 1px solid var(--frame); border-radius: 6px; background: var(--paper);
}
.entry__thumb--embed { aspect-ratio: 4 / 3; }
.featured__media--embed { order: 2; aspect-ratio: 4 / 3; }
/* Strip the article-figure chrome and keep only the chart (the div holding the
   <canvas>), stretched to fill the cover box. */
.entry__thumb--embed .figure-embed,
.featured__media--embed .figure-embed,
.entry__thumb--embed .chart-embed,
.featured__media--embed .chart-embed {
    margin: 0; padding: 0; border: 0; border-radius: 0; background: none;
    height: 100%; width: 100%;
}
.entry__thumb--embed .chart-embed > *:not(:has(canvas)),
.featured__media--embed .chart-embed > *:not(:has(canvas)) { display: none !important; }
.entry__thumb--embed .chart-embed > *:has(canvas),
.featured__media--embed .chart-embed > *:has(canvas) {
    height: 100% !important; width: 100% !important; margin: 0 !important;
}
@media (max-width: 720px) {
    .featured__media--embed { order: 1; }
}
/* Mobile: chart embeds are authored for article width — their stat grids and
   rotated canvas annotations crowd at phone width. Drop the chart cover and let
   the card fall back to text-only. */
@media (max-width: 560px) {
    .entry--embed { grid-template-columns: 3.5rem 1fr; }
    .entry__thumb--embed,
    .featured__media--embed { display: none; }
}

/* ── Project cards (homepage) ───────────────────────────────────────
   Codebases shown as a card grid — a deliberately different shape from
   the research/writing ledger rows above. */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: clamp(1rem, 2.5vw, 1.5rem);
}
.project-card {
    display: flex; flex-direction: column; gap: 0.5rem;
    height: 100%; padding: 1.25rem;
    border: 1px solid var(--hairline); border-radius: 10px;
    background: color-mix(in oklab, var(--paper-deep) 40%, transparent);
    transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.project-card:hover {
    border-color: var(--oxblood); transform: translateY(-2px);
    background: color-mix(in oklab, var(--paper-deep) 75%, transparent);
}
.project-card__meta {
    display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
    font-family: var(--mono); font-size: 0.72rem;
    text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-soft);
}
.project-card__type { color: var(--oxblood); }
.project-card__year { font-variant-numeric: tabular-nums; }
.project-card__title {
    font-family: var(--display); font-weight: 500;
    font-size: 1.25rem; line-height: 1.25; margin: 0.1rem 0 0;
}
.project-card__title a {
    color: inherit; text-decoration: none;
    background-image: linear-gradient(var(--oxblood), var(--oxblood));
    background-repeat: no-repeat; background-position: 0 100%; background-size: 0% 1px;
    transition: background-size 0.25s ease, color 0.2s ease;
}
.project-card:hover .project-card__title a { color: var(--oxblood); background-size: 100% 1px; }
.project-card__desc { margin: 0; font-size: 0.92rem; line-height: 1.5; color: var(--ink); }
.project-card__stack { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.2rem 0 0; }
.project-card__cta {
    margin-top: auto; padding-top: 0.6rem;
    font-family: var(--mono); font-size: 0.8rem; color: var(--oxblood); text-decoration: none;
}
.project-card__cta:hover { text-decoration: underline; }
@media (prefers-reduced-motion: reduce) {
    .featured__title a, .project-card, .project-card__title a { transition: none; }
    .project-card:hover { transform: none; }
}

/* ── Projects hub header — intro + in-page nav beside a small status hook ── */
.projects-hub {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: clamp(1.5rem, 4vw, 3.5rem);
    align-items: end;
}
.projects-nav { display: flex; flex-wrap: wrap; gap: 1.25rem; margin-top: 1.2rem; }
.projects-nav a {
    font-family: var(--mono); font-size: 0.8rem; color: var(--oxblood); text-decoration: none;
}
.projects-nav a:hover { text-decoration: underline; }
.projects-dist {
    border: 1px solid var(--hairline); border-radius: 10px; padding: 1.1rem 1.25rem;
    background: color-mix(in oklab, var(--paper-deep) 40%, transparent);
}
.projects-dist__title {
    font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--ink-soft); margin: 0 0 0.8rem;
}
.projects-dist__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.projects-dist__row { display: grid; grid-template-columns: 5.5rem 1fr 1.5rem; align-items: center; gap: 0.6rem; }
.projects-dist__label { font-size: 0.78rem; color: var(--ink-soft); }
.projects-dist__track {
    height: 7px; border-radius: 999px;
    background: color-mix(in oklab, var(--ink) 8%, transparent); overflow: hidden;
}
.projects-dist__fill { display: block; height: 100%; border-radius: 999px; background: var(--oxblood); }
.projects-dist__fill--ongoing { background: color-mix(in oklab, var(--oxblood) 60%, var(--paper)); }
.projects-dist__fill--archived { background: var(--ink-soft); }
.projects-dist__count {
    font-family: var(--mono); font-size: 0.8rem; color: var(--ink-soft);
    font-variant-numeric: tabular-nums; text-align: right;
}
.section-title[id] { scroll-margin-top: 2rem; }
@media (max-width: 720px) {
    .projects-hub { grid-template-columns: 1fr; align-items: start; }
}

/* ── Design-previews gallery (/projects/site) ───────────────────────── */
.preview-gallery {
    list-style: none;
    margin: 1.6rem 0 0.8rem;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.6rem;
}
.preview-card { display: flex; flex-direction: column; }
.preview-card__shot {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    padding: 0;
    border: 1px solid var(--hairline);
    border-radius: 4px;
    overflow: hidden;
    background: var(--paper-deep);
    cursor: zoom-in;
}
.preview-card__shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.preview-card__shot--empty {
    display: grid;
    place-items: center;
    cursor: default;
    color: var(--ink-soft);
    font-family: "Space Grotesk", ui-monospace, monospace;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
}
.preview-card__body { padding: 0.7rem 0.1rem 0; }
.preview-card__body h3 { margin: 0 0 0.2rem; font-size: 1.05rem; }
.preview-card__body p { margin: 0 0 0.5rem; color: var(--ink-soft); font-size: 0.92rem; line-height: 1.4; }
.preview-card__live {
    font-size: 0.85rem; font-weight: 500; color: var(--oxblood);
    display: inline-block;
    border-bottom: 1px solid color-mix(in oklab, var(--oxblood) 40%, transparent);
}
.preview-gallery__note { margin-top: 0.4rem; font-size: 0.85rem; }

/* ── Lightbox (previews-lightbox.js) ───────────────────────────────── */
body.lightbox-open { overflow: hidden; }
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: clamp(1rem, 4vw, 3rem);
}
.lightbox[hidden] { display: none; }
.lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 6, 4, 0.82);
    cursor: zoom-out;
}
.lightbox__figure {
    position: relative;
    margin: 0;
    max-width: min(1200px, 100%);
    max-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.lightbox__img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border: 1px solid var(--frame);
    border-radius: 4px;
    background: var(--paper);
}
.lightbox__caption {
    color: #f1ece2;
    font-family: "Fraunces", Georgia, serif;
    font-size: 0.95rem;
    text-align: center;
}
.lightbox__close {
    position: absolute;
    top: -2.6rem;
    right: 0;
    width: 2.2rem;
    height: 2.2rem;
    border: none;
    border-radius: 50%;
    background: rgba(241, 236, 226, 0.12);
    color: #f1ece2;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}
.lightbox__close:hover { background: rgba(241, 236, 226, 0.22); }
.lightbox__close:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 2px; }

/* ── Pipeline hero (infrastructure) — a one-shot "build" animation.
   The pipeline draws itself on load (raw data → clean · model · render → a
   rising result curve), then settles to a static picture so it stops competing
   with the prose. Only the result point keeps a slow breath. SVG + CSS, no JS;
   every part also renders fully with motion disabled or in a headless shot. ── */
.page-cta { margin: 0.6rem 0 0.2rem; }
.page-viz { margin: 1.6rem 0 0.2rem; }
.page-viz svg { width: 100%; height: auto; display: block; overflow: visible; }
.page-viz svg text { font-family: var(--mono); fill: var(--ink-soft); }

.vp-ease { /* token holder; curves referenced below */ }
.vp-wire, .vp-track { fill: none; stroke: var(--ink-soft); stroke-width: 1.5; stroke-linecap: round; opacity: 0.55; }
.vp-tick { stroke: var(--ink-soft); stroke-width: 2; stroke-linecap: round; opacity: 0.75; }
.vp-node { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.vp-node--accent { stroke: var(--oxblood); }
.vp-stage-label { font-size: 12px; fill: var(--ink-soft); }
.vp-stage-label--accent { fill: var(--oxblood); }
.vp-label { font-size: 11px; fill: var(--ink-soft); opacity: 0.8; }
.vp-axis { stroke: var(--ink-soft); stroke-width: 1; opacity: 0.35; }
.vp-result { fill: none; stroke: var(--oxblood); stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.vp-result-dot { fill: var(--oxblood); }
.vp-pulse { fill: var(--oxblood); }

/* draw-in: pathLength="1" normalises every path so one dash rule fits all */
.vp-wire, .vp-track, .vp-result { stroke-dasharray: 1; stroke-dashoffset: 1; }
.vp-tick, .vp-stage, .vp-axis, .vp-label, .vp-result-dot { opacity: 0; }

@keyframes vpDraw  { to { stroke-dashoffset: 0; } }
@keyframes vpFade  { to { opacity: 1; } }
@keyframes vpRise  { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes vpPop   { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: scale(1); } }
@keyframes vpPulse { 0% { offset-distance: 0%; opacity: 0; } 12% { opacity: 1; } 85% { opacity: 1; } 100% { offset-distance: 100%; opacity: 0; } }
@keyframes vpBreath { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.55); opacity: 0.55; } }

.vp-anim .vp-tick        { animation: vpRise 0.45s cubic-bezier(0.23,1,0.32,1) forwards; }
.vp-anim .vp-tick:nth-of-type(1) { animation-delay: 0.05s; }
.vp-anim .vp-tick:nth-of-type(2) { animation-delay: 0.13s; }
.vp-anim .vp-tick:nth-of-type(3) { animation-delay: 0.21s; }
.vp-anim .vp-wire        { animation: vpDraw 0.6s cubic-bezier(0.23,1,0.32,1) 0.3s forwards; }
.vp-anim .vp-track       { animation: vpDraw 0.65s cubic-bezier(0.23,1,0.32,1) 0.6s forwards; }
.vp-anim .vp-stage       { transform-box: fill-box; transform-origin: center; }
.vp-anim .vp-stage--1    { animation: vpRise 0.4s cubic-bezier(0.23,1,0.32,1) 0.8s forwards; }
.vp-anim .vp-stage--2    { animation: vpRise 0.4s cubic-bezier(0.23,1,0.32,1) 1.0s forwards; }
.vp-anim .vp-stage--3    { animation: vpRise 0.4s cubic-bezier(0.23,1,0.32,1) 1.2s forwards; }
.vp-anim .vp-pulse       { offset-path: path('M 52 70 H 560'); offset-distance: 0%; opacity: 0; animation: vpPulse 0.95s cubic-bezier(0.77,0,0.175,1) 1.05s forwards; }
.vp-anim .vp-wire--2     { animation: vpDraw 0.55s cubic-bezier(0.23,1,0.32,1) 1.45s forwards; }
.vp-anim .vp-axis        { animation: vpFade 0.5s ease 1.55s forwards; }
.vp-anim .vp-result      { animation: vpDraw 0.85s cubic-bezier(0.23,1,0.32,1) 1.85s forwards; }
.vp-anim .vp-result-dot  { transform-box: fill-box; transform-origin: center; animation: vpPop 0.4s cubic-bezier(0.34,1.56,0.64,1) 2.55s forwards, vpBreath 3.6s ease-in-out 3.0s infinite; }
.vp-anim .vp-label       { animation: vpFade 0.5s ease forwards; }
.vp-anim .vp-label--figure { animation-delay: 2.4s; }

/* No JS fallback: if .vp-anim never gets added, show the finished picture. */
.page-viz:not(.vp-anim) .vp-wire,
.page-viz:not(.vp-anim) .vp-track,
.page-viz:not(.vp-anim) .vp-result { stroke-dashoffset: 0; }
.page-viz:not(.vp-anim) .vp-tick,
.page-viz:not(.vp-anim) .vp-stage,
.page-viz:not(.vp-anim) .vp-axis,
.page-viz:not(.vp-anim) .vp-label,
.page-viz:not(.vp-anim) .vp-result-dot { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
    .vp-anim .vp-wire, .vp-anim .vp-track, .vp-anim .vp-result { stroke-dashoffset: 0; animation: none; }
    .vp-anim .vp-tick, .vp-anim .vp-stage, .vp-anim .vp-axis, .vp-anim .vp-label, .vp-anim .vp-result-dot { opacity: 1; animation: none; transform: none; }
    .vp-anim .vp-pulse { display: none; }
}

/* ── Page facts — real signal in place of decorative viz. A hairline-ruled row
   of mono micro-labels + values (and optional chips); informs, never obstructs. ── */
.page-facts {
    display: flex; flex-wrap: wrap; gap: 1.1rem 2.6rem;
    margin: 1.6rem 0 0.2rem; padding: 1rem 0;
    border-top: 1px solid var(--hairline);
    border-bottom: 1px solid var(--hairline);
}
.page-facts__item { display: flex; flex-direction: column; gap: 0.3rem; }
.page-facts__k {
    font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.09em;
    text-transform: uppercase; color: var(--ink-soft);
}
.page-facts__v { font-size: 0.98rem; color: var(--ink); line-height: 1.3; }
.page-facts__chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.page-facts__chips .chip--stack { margin: 0; }
@media (max-width: 560px) {
    .page-facts { flex-direction: column; gap: 0.85rem; }
}

/* ── Latest-from-archive card — live DB pull; rewards the eye with something to read. ── */
.latest-card {
    display: block; margin: 1.6rem 0 0.2rem; padding: 1.05rem 1.2rem;
    border: 1px solid var(--hairline); border-radius: 5px;
    text-decoration: none; color: inherit;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.latest-card:hover { border-color: var(--oxblood); background: color-mix(in oklab, var(--paper) 94%, var(--oxblood)); }
.latest-card:hover .latest-card__title { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.latest-card__k {
    font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.09em;
    text-transform: uppercase; color: var(--oxblood);
}
.latest-card__title { margin: 0.45rem 0 0.35rem; font-size: 1.2rem; line-height: 1.25; }
.latest-card__excerpt { margin: 0; color: color-mix(in oklab, var(--ink-soft) 78%, var(--ink)); font-size: 0.93rem; line-height: 1.5; }
.latest-card__meta { margin: 0.55rem 0 0; font-family: var(--mono); font-size: 0.72rem; color: var(--ink-soft); }

/* ── Expandable code block (<details>) — collapsed by default, opens in place. ── */
.code-expand { border: 1px solid var(--hairline); border-radius: 4px; margin: 1.1rem 0; overflow: hidden; }
.code-expand > summary {
    list-style: none; cursor: pointer; padding: 0.7rem 0.95rem;
    font-family: var(--mono); font-size: 0.8rem; color: var(--ink-soft);
    display: flex; align-items: center; gap: 0.5rem; user-select: none;
}
.code-expand > summary::-webkit-details-marker { display: none; }
.code-expand > summary::before { content: "▸"; color: var(--oxblood); transition: transform 0.18s ease; }
.code-expand[open] > summary::before { transform: rotate(90deg); }
.code-expand > summary:hover { color: var(--ink); }
.code-expand > summary:focus-visible { outline: 2px solid var(--oxblood); outline-offset: -2px; }
.code-expand[open] > summary { border-bottom: 1px solid var(--hairline); }
.code-expand pre { margin: 0; border: 0; border-radius: 0; }

/* Full-paper PDF download button on /post pages */
.paper-download-wrap { margin: 1.5rem 0 0; }
.paper-download-wrap--end { margin: 2.5rem 0 0; }
/* The end-of-post button sits inside .article-content, whose `a` rule would
   otherwise repaint it oxblood-on-oxblood and add the underline gradient. */
.article-content .btn { color: #fff; background-image: none; }
.article-content .btn:hover { color: #fff; background-image: none; }
html.is-dark .article-content .btn,
html.is-dark .article-content .btn:hover { color: var(--paper); }

/* Subscribe CTA at the end of every post's article body */
.post-subscribe {
    margin: 2.5rem 0 0;
    padding-top: 1.3rem;
    border-top: 1px solid var(--hairline);
    font-size: 0.95rem;
    color: var(--ink-soft);
}

/* ════════════════════════════════════════════════════════════════
   /cv — the CV as a page. Entry rows run content-left, dates-right;
   below 720px they stack, dates first, so the role never wraps under
   a floating date. Same tokens and rhythm as the rest of site-16.
   ════════════════════════════════════════════════════════════════ */
.cv-head {
    display: flex; flex-wrap: wrap; align-items: flex-end;
    justify-content: space-between; gap: 1.5rem 2rem;
}
.cv-head__lead { flex: 1 1 32ch; }
.cv-head__action { flex: 0 0 auto; }

.cv-contact {
    display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem;
    margin-top: 1.3rem;
    font-family: var(--mono); font-size: 0.85rem;
    color: var(--ink-soft);
}
.cv-contact a {
    color: var(--ink); text-decoration: none;
    border-bottom: 1px solid var(--hairline);
}
.cv-contact a:hover { color: var(--oxblood); border-bottom-color: var(--oxblood); }

.cv-section { margin-bottom: clamp(2.75rem, 6vh, 4.5rem); }

.cv-entry {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 2rem;
    align-items: baseline;
    padding: 1.4rem 0;
    border-top: 1px solid var(--hairline);
}
.cv-section .cv-entry:first-of-type { border-top: 0; padding-top: 0; }

.cv-entry__role {
    grid-column: 1; grid-row: 1;
    font-family: var(--display); font-weight: 500;
    font-size: 1.1rem; line-height: 1.3;
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.55rem;
}
/* The organisation reads as the quieter half of the same line. */
.cv-entry__org { font-family: var(--body); font-size: 0.95rem; color: var(--ink-soft); }
.cv-entry__org::before { content: "· "; }

.cv-entry__meta {
    grid-column: 2; grid-row: 1;
    display: flex; flex-direction: column; align-items: flex-end; gap: 0.15rem;
    font-family: var(--mono); font-size: 0.8rem; white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: var(--ink-soft);
}
/* No opacity dampener: --ink-soft at 0.8 alpha lands under 4.5:1 at this size. */
.cv-entry__place { font-size: 0.75rem; }

.cv-entry__body { grid-column: 1; grid-row: 2; max-width: 68ch; margin-top: 0.6rem; }
.cv-entry__body p { color: var(--ink); font-size: 0.95rem; }
.cv-entry__points { list-style: none; padding: 0; margin: 0; }
.cv-entry__points li {
    position: relative; padding-left: 1.1rem; margin-bottom: 0.35rem;
    font-size: 0.95rem; color: var(--ink); line-height: 1.55;
}
.cv-entry__points li::before {
    content: ""; position: absolute; left: 0; top: 0.62em;
    width: 5px; height: 1px; background: var(--oxblood);
}
/* Two classes deep: .cv-entry__body p would otherwise out-rank a single class. */
.cv-entry__body .cv-entry__aside, .cv-section > .cv-entry__aside {
    margin-top: 0.7rem; font-size: 0.875rem; color: var(--ink-soft);
}
.cv-entry__aside a, .cv-skills dd a {
    color: var(--oxblood); text-decoration: none;
    border-bottom: 1px solid transparent;
}
.cv-entry__aside a:hover, .cv-skills dd a:hover { border-bottom-color: var(--oxblood); }

/* Selected research — rhymes with the entry rows: title left, date right */
.cv-papers { list-style: none; padding: 0; margin: 0; }
.cv-papers__item { border-top: 1px solid var(--hairline); }
.cv-papers__item:first-child { border-top: 0; }
.cv-papers__link {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 2rem; align-items: baseline;
    padding: 0.85rem 0;
    text-decoration: none; color: var(--ink);
}
.cv-papers__title { font-family: var(--display); font-size: 1rem; line-height: 1.35; }
.cv-papers__date {
    font-family: var(--mono); font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    color: var(--ink-soft); white-space: nowrap;
}
.cv-papers__link:hover .cv-papers__title { color: var(--oxblood); }
.cv-papers__link:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 3px; }

.cv-skills { margin: 0; }
.cv-skills__row {
    display: grid; grid-template-columns: 8rem minmax(0, 1fr);
    column-gap: 2rem;
    padding: 0.85rem 0;
    border-top: 1px solid var(--hairline);
}
.cv-skills__row:first-child { border-top: 0; padding-top: 0; }
.cv-skills dt {
    font-family: var(--mono); font-size: 0.78rem;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--ink-soft); padding-top: 0.15rem;
}
.cv-skills dd { margin: 0; font-size: 0.95rem; color: var(--ink); max-width: 62ch; }

@media (max-width: 720px) {
    .cv-head { align-items: flex-start; }
    .cv-entry, .cv-papers__link, .cv-skills__row { grid-template-columns: minmax(0, 1fr); }
    /* Dates lead the stacked row — a role title shouldn't wrap around a date. */
    .cv-entry__meta {
        grid-column: 1; grid-row: 1;
        flex-direction: row; align-items: baseline; gap: 0.6rem;
        margin-bottom: 0.3rem;
    }
    .cv-entry__role { grid-row: 2; }
    .cv-entry__body { grid-row: 3; }
    .cv-papers__link { row-gap: 0.2rem; }
    .cv-papers__date { order: -1; }
    .cv-skills__row { row-gap: 0.3rem; }
}

/* Printing a CV is the point. Drop the site chrome, keep the document.
   Only the navigational asides (.cv-more) go — a printed page can't be
   clicked, but "Coursework: …" is CV content and stays. */
@media print {
    .masthead, .colophon, .skip-link, .theme-toggle,
    .nav-toggle, .cv-head__action, .cv-more { display: none !important; }
    /* Reveal-on-scroll never fires in print; force the sections visible. */
    html.js .cv-section.reveal, html.js .rule--heavy.reveal {
        opacity: 1 !important; transform: none !important;
    }
    .sheet { padding: 0 !important; max-width: none !important; }
    .page-head { margin-bottom: 1.4rem; }
    /* Sections may split across pages; a single entry may not. Holding whole
       sections together stranded half a page of white space. */
    .cv-section { margin-bottom: 1.1rem; }
    .cv-section .section-title { margin-bottom: 0.8rem; break-after: avoid; }
    .cv-entry, .cv-papers__item, .cv-skills__row { break-inside: avoid; }
    .cv-entry { padding: 0.55rem 0; }
    .cv-entry__body { margin-top: 0.3rem; }
    .cv-entry__points li { margin-bottom: 0.15rem; }
    .cv-papers__link { padding: 0.45rem 0; }
    .cv-contact a, .cv-papers__link { color: #000; }
    /* A printed page can't be clicked — give the reader the address once. */
    .cv-print-only { display: inline !important; }
}
.cv-print-only { display: none; }
