/* The blog in the Lav look (2026-10-25): the index (/blog) and every post (/blog/*).
   Tokens from /assets/tokens.css ([data-look="lav"]), header and footer from
   /assets/chrome.css. This file carries everything the posts share: the reading
   column, the hero, sections, the summary, the aside card, the numbers row, code
   panels and their highlighting, figures, the byline, the suggested read and the
   side contents list. A post's own components stay in that post's <style> block.

   Shape: the homepage's 12 column grid (16 px gap, 56 px gutter, max 1440; one column
   on a 20 px gutter under 860 px). Everything sits on the left gutter. The reading
   column is 8 columns (880 px at 1440); prose inside it keeps a Body measure of about
   34em. .wrap-wide blocks run to 9 columns. Above 1200 px the contents list sits in
   columns 10 to 12 once the hero has scrolled away. Sections are separated by space
   and hairlines, not boxes; the surface colour is kept for code and for the things a
   post lets you press. Accent is for content links and the focus ring only. */

/* ── Base (same as the homepage) ── */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; font-optical-sizing: auto; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
[data-look="lav"] {
  color-scheme: light;
  /* Older names the posts' own CSS still reads: no serif in this look, and the band,
     accent line and status colours are matte versions in the page palette. */
  --serif: var(--sans);
  --bg-alt: var(--surface);
  --accent-line: color-mix(in srgb, var(--accent) 40%, transparent);
  --green: #2B5538; --amber: #6E4A14; --red: #8A3426;
  --green-bg: rgba(43,85,56,0.12); --amber-bg: rgba(110,74,20,0.12); --red-bg: rgba(138,52,38,0.12);
  /* Code: ink for the text, muted comments, and two quiet hues from the status set. */
  --code-ink: var(--ink); --code-com: var(--muted); --code-str: #2B5538; --code-num: #6E4A14; --code-kw: var(--ink);
  --blog-col: 880px; --blog-wide: 992px; --measure: 34em;
}
[data-look="lav"][data-theme="dark"] {
  color-scheme: dark;
  --green: #9DBFA3; --amber: #D9B47A; --red: #E09A8C;
  --green-bg: rgba(157,191,163,0.14); --amber-bg: rgba(217,180,122,0.14); --red-bg: rgba(224,154,140,0.14);
  --code-str: #9DBFA3; --code-num: #D9B47A;
}
body { margin: 0; min-width: 320px; min-height: 100svh; font-size: var(--t-body); line-height: var(--lh-body); letter-spacing: var(--tr-body); font-weight: 400; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
p, h1, h2, h3, h4, ul, ol, dl, dd, figure, blockquote { margin: 0; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--ink); color: var(--bg); }
strong { font-weight: 500; color: var(--ink); }

.t-title { font-size: var(--t-title); line-height: var(--lh-title); letter-spacing: var(--tr-title); font-weight: 300; }
.t-statement { font-size: var(--t-statement); line-height: var(--lh-statement); letter-spacing: var(--tr-statement); font-weight: 400; }
.t-body { font-size: var(--t-body); line-height: var(--lh-body); letter-spacing: var(--tr-body); font-weight: 400; }
.t-ui { font-size: var(--t-ui); line-height: var(--lh-ui); letter-spacing: 0; font-weight: 400; }
.t-caption { font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); font-weight: 400; }

.sec { max-width: var(--maxw); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

/* The header's Blog link is the current page on the index and on every post. */
.site-nav a[aria-current="page"] { border-bottom-color: var(--ink); }

/* Content links: accent, underlined. Only links in running text; components style their own. */
.link,
:where(.prose, .brief-body, .tldr, .reflection, .kicker, .post-lede, .end-meta, .byline-note, .post-figure figcaption, .post-body) a:not([class]) {
  color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px;
}
.link:hover,
:where(.prose, .brief-body, .tldr, .reflection, .kicker, .post-lede, .end-meta, .byline-note, .post-figure figcaption, .post-body) a:not([class]):hover { text-decoration-thickness: 2px; }

/* Inline code: mono on the surface, ink, no border. */
code { font-family: var(--mono); font-size: 0.84em; font-weight: 400; letter-spacing: 0; padding: 0.12em 0.4em; border-radius: 6px; background: var(--surface); color: var(--ink); }
pre code, pre code[class*="language-"] { padding: 0; border-radius: 0; background: none; font-size: inherit; }

/* ══════════════════════════════════════════════════════════
   The index (/blog)
   ══════════════════════════════════════════════════════════ */
.blog-index { padding-bottom: 200px; }
.blog-intro { padding-top: 120px; }
.blog-intro__title { margin-left: var(--tr-title); color: var(--ink); }
.blog-intro__lead { margin-top: 28px; max-width: 30em; color: var(--muted); text-wrap: pretty; }

/* One row per post: date and kind on the left, the title and a short line beside them. */
.posts { list-style: none; padding: 0; margin-top: 96px; border-top: 1px solid var(--hairline); }
.posts li { border-bottom: 1px solid var(--hairline); }
.post-row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 16px; padding: 36px 0 40px; color: var(--ink); }
.post-row__meta { grid-column: 1 / span 3; display: flex; flex-direction: column; gap: 2px; padding-top: 0.45em; color: var(--muted); }
.post-row__body { grid-column: 4 / span 7; display: flex; flex-direction: column; gap: 14px; }
.post-row__title { color: var(--ink); text-wrap: balance; }
.post-row__title span { border-bottom: 1px solid transparent; transition: border-color .2s var(--ease); }
.post-row:hover .post-row__title span { border-bottom-color: var(--ink); }
.post-row__line { max-width: 34em; color: var(--muted); text-wrap: pretty; }
.post-row:focus-visible { outline-offset: 6px; }

/* ══════════════════════════════════════════════════════════
   A post
   ══════════════════════════════════════════════════════════ */
main > article { padding-bottom: 160px; }
.wrap, .wrap-wide { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.wrap > * { max-width: var(--blog-col); }
.wrap-wide > * { max-width: var(--blog-wide); }

/* ── Hero: a UI line, the title, the lede, then the facts in a row under a hairline. ── */
.post-hero { padding-top: 120px; }
.post-eyebrow { margin-bottom: 28px; color: var(--muted); font-size: var(--t-ui); line-height: var(--lh-ui); }
.post-hero h1 { margin: 0 0 0 var(--tr-title); max-width: 12em; color: var(--ink); font-size: var(--t-title); line-height: var(--lh-title); letter-spacing: var(--tr-title); font-weight: 300; text-wrap: balance; }
:where(.post-hero h1, .section-head h2, .reflection h2, .blog-intro__title) em { font-style: normal; color: inherit; }
.post-lede { margin-top: 32px; max-width: var(--measure); color: var(--muted); text-wrap: pretty; }
.hero-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 16px; row-gap: 28px; margin-top: 64px; padding-top: 20px; border-top: 1px solid var(--hairline); }
.hero-meta-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hero-meta-label { color: var(--muted); font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); }
.hero-meta-value { color: var(--ink); font-size: var(--t-body); line-height: var(--lh-body); letter-spacing: var(--tr-body); }
.hero-meta-sub { color: var(--muted); font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); }

/* ── Summary: a hairline, a UI label, then Body. ── */
.tldr { margin-top: 72px; padding-top: 20px; border-top: 1px solid var(--hairline); }
.tldr-label { margin-bottom: 16px; color: var(--muted); font-size: var(--t-ui); line-height: var(--lh-ui); }
.tldr p { max-width: var(--measure); color: var(--ink); text-wrap: pretty; }
.tldr p + p { margin-top: 1em; }
.tldr em { font-style: italic; }

/* ── Sections: space between them, a UI label, the heading at the Statement size, a muted kicker. ── */
.post-section { padding-top: 136px; scroll-margin-top: 80px; }
.section-label { display: flex; gap: 12px; margin-bottom: 20px; color: var(--muted); font-size: var(--t-ui); line-height: var(--lh-ui); }
.section-label .num { font-variant-numeric: tabular-nums; }
.section-head { margin-bottom: 40px; }
.section-head h2 { max-width: 20em; color: var(--ink); font-size: var(--t-statement); line-height: var(--lh-statement); letter-spacing: var(--tr-statement); font-weight: 400; text-wrap: balance; }
.section-head .kicker { margin-top: 20px; max-width: var(--measure); color: var(--muted); text-wrap: pretty; }

/* ── Prose ── */
.prose, .brief-body, .post-body { max-width: var(--measure); }
:where(.prose, .brief-body, .post-body, .reflection) p { color: var(--ink); text-wrap: pretty; }
:where(.prose, .brief-body, .post-body, .reflection) p + p { margin-top: 1em; }
:where(.prose, .brief-body, .post-body) :is(ul, ol) { margin: 1em 0; padding-left: 1.2em; }
:where(.prose, .brief-body, .post-body) li + li { margin-top: 0.4em; }
:where(.prose, .brief-body, .post-body) h3 { margin: 2em 0 0.6em; font-size: var(--t-body); line-height: var(--lh-body); font-weight: 500; }

/* ── Text and an aside card: the card is a hairline and a short list, sticky beside the text. ── */
.brief-grid { display: grid; grid-template-columns: minmax(0, 1fr) 248px; column-gap: 48px; row-gap: 40px; align-items: start; }
.brief-card { position: sticky; top: 96px; padding-top: 16px; border-top: 1px solid var(--hairline); }
.brief-card :is(h2, h3, h4) { margin: 0 0 8px; color: var(--ink); font-size: var(--t-ui); line-height: var(--lh-ui); font-weight: 400; }
.brief-card dl { display: flex; flex-direction: column; }
.brief-card dl > div { padding: 10px 0; }
.brief-card dl > div + div { border-top: 1px solid var(--hairline); }
.brief-card dt { margin-bottom: 2px; color: var(--muted); font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); }
.brief-card dd { color: var(--ink); font-size: var(--t-ui); line-height: var(--lh-ui); }

/* ── Numbers: a row of figures on a hairline, left aligned, no motion. ── */
.numbers { margin-top: 120px; padding-top: 20px; border-top: 1px solid var(--hairline); }
.numbers-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 16px; row-gap: 32px; }
.num-figure { display: flex; align-items: baseline; gap: 10px; }
.num-count { color: var(--ink); font-size: var(--t-title); line-height: var(--lh-title); letter-spacing: var(--tr-title); font-weight: 300; font-variant-numeric: tabular-nums; }
.num-unit { color: var(--muted); font-size: var(--t-ui); line-height: var(--lh-ui); }
.num-label { margin-top: 12px; max-width: 18em; color: var(--muted); font-size: var(--t-ui); line-height: var(--lh-ui); text-wrap: pretty; }

/* ── Code panels: the surface, tabs as UI words with a 1 px line under the open one,
   the filename and Copy on a hairline, then the code. ── */
.scripts-container { margin-top: 40px; border-radius: 20px; background: var(--surface); overflow: hidden; }
.script-tabs { display: flex; flex-wrap: wrap; gap: 4px 24px; padding: 8px 24px 0; border-bottom: 1px solid var(--hairline); }
.script-tab { position: relative; padding: 10px 0 11px; color: var(--muted); font-size: var(--t-ui); line-height: var(--lh-ui); transition: color .2s var(--ease); }
.script-tab:hover { color: var(--ink); }
.script-tab.active { color: var(--ink); }
.script-tab.active::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--ink); }
.script-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 6px 12px 6px 24px; border-bottom: 1px solid var(--hairline); }
.script-filename { min-width: 0; color: var(--muted); font-family: var(--mono); font-size: 12.5px; line-height: 18px; letter-spacing: 0; overflow-wrap: anywhere; }
.copy-btn { flex: none; min-height: 36px; padding: 0 12px; color: var(--ink); font-size: var(--t-caption); line-height: var(--lh-caption); border-radius: 999px; transition: background-color .2s var(--ease); }
.copy-btn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.copy-btn.copied { color: var(--muted); }
.script-panel { display: none; }
.script-panel.active { display: block; }
.scripts-container pre, .script-panel pre, pre[class*="language-"] {
  margin: 0; padding: 22px 24px 26px; overflow-x: auto; background: none; border: 0; border-radius: 0;
  font-family: var(--mono); font-size: 13px; line-height: 1.7; font-weight: 400; color: var(--code-ink); tab-size: 4; text-shadow: none; white-space: pre;
}
code[class*="language-"] { font-family: var(--mono); color: var(--code-ink); text-shadow: none; background: none; }
/* Highlighting in the page palette: comments muted, strings green, numbers amber, the rest ink. */
.token.comment, .token.block-comment, .token.prolog, .token.doctype, .token.cdata { color: var(--code-com); font-style: italic; }
.token.string, .token.char, .token.attr-value, .token.regex { color: var(--code-str); }
.token.number, .token.boolean, .token.constant { color: var(--code-num); }
.token.keyword, .token.atrule, .token.important { color: var(--code-kw); font-weight: 500; }
.token.function, .token.class-name, .token.builtin, .token.selector, .token.attr-name, .token.property, .token.tag, .token.variable, .token.namespace, .token.symbol, .token.entity, .token.url { color: var(--code-ink); }
.token.operator, .token.punctuation { color: var(--muted); }

/* ── Figures: a 28 px frame, the caption under it. ── */
.post-figure { margin: 48px 0; }
.post-figure img { width: 100%; height: auto; border-radius: 28px; background: var(--surface); }
.post-figure figcaption { margin-top: 12px; color: var(--muted); font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); }

/* ── Outcome: the last section, a hairline and the heading at the Statement size. ── */
.reflection { padding-top: 20px; border-top: 1px solid var(--hairline); }
.reflection .section-label { margin-top: 0; }
.reflection h2 { max-width: 20em; margin-bottom: 32px; color: var(--ink); font-size: var(--t-statement); line-height: var(--lh-statement); letter-spacing: var(--tr-statement); font-weight: 400; text-wrap: balance; }
.reflection p { max-width: var(--measure); }
.reflection strong { color: var(--ink); }

/* ── Byline and the post's facts ── */
.post-end { margin-top: 136px; padding-top: 20px; border-top: 1px solid var(--hairline); }
.end-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); column-gap: 16px; row-gap: 28px; }
.byline { grid-column: 1 / span 4; }
.byline-avatar { display: none; }
.byline-name { color: var(--ink); font-size: var(--t-ui); line-height: var(--lh-ui); }
.byline-role { color: var(--muted); font-size: var(--t-ui); line-height: var(--lh-ui); }
.byline-note { margin-top: 12px; max-width: 26em; color: var(--muted); font-size: var(--t-ui); line-height: 22px; text-wrap: pretty; }
.end-meta { grid-column: 5 / span 4; display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: var(--t-ui); line-height: var(--lh-ui); }
.end-meta strong { color: var(--ink); font-weight: 400; }

/* ── Suggested read: a UI label, then the title and its line as one link. ── */
.suggested-read { margin-top: 72px; }
.suggested-read:empty { display: none; }
.suggested-read-label { margin-bottom: 12px; color: var(--muted); font-size: var(--t-ui); line-height: var(--lh-ui); }
.suggested-read-card { display: block; max-width: 34em; color: var(--ink); }
.sr-icon, .sr-arrow { display: none; }
.sr-title { display: inline; color: var(--ink); font-size: var(--t-statement); line-height: var(--lh-statement); letter-spacing: var(--tr-statement); border-bottom: 1px solid transparent; transition: border-color .2s var(--ease); }
.suggested-read-card:hover .sr-title { border-bottom-color: var(--ink); }
.sr-desc { margin-top: 10px; color: var(--muted); font-size: var(--t-ui); line-height: 22px; text-wrap: pretty; }

/* ── Back to the index ── */
.post-back { display: inline-block; margin-top: 56px; padding: 6px 0; color: var(--ink); font-size: var(--t-ui); line-height: var(--lh-ui); border-bottom: 1px solid transparent; transition: border-color .2s var(--ease); }
.post-back:hover { border-bottom-color: var(--ink); }
.post-back .arr { display: none; }

/* ── Contents list: columns 10 to 12, fixed, shown once the hero has gone (blog.js). ── */
.toc-side {
  position: fixed; z-index: 10; top: 50%; transform: translateY(-50%);
  right: max(var(--gutter), calc((100vw - var(--maxw)) / 2 + var(--gutter)));
  width: min(240px, calc((min(100vw, var(--maxw)) - 2 * var(--gutter) - 176px) / 4));
  display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; transition: opacity .3s var(--ease), visibility 0s linear .3s;
}
.toc-side.visible { opacity: 1; visibility: visible; transition: opacity .3s var(--ease), visibility 0s; }
.toc-side-item { display: grid; grid-template-columns: 2.2em 1fr; padding: 4px 0; color: var(--muted); font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); transition: color .2s var(--ease); }
.toc-side-item:hover, .toc-side-item.active { color: var(--ink); }
.toc-side-num { font-variant-numeric: tabular-nums; }

/* Scroll reveal is off in this look (the posts read without it); the class stays because
   some posts start their own diagrams when it is set. */
.reveal { opacity: 1; transform: none; }

/* ── Widths ── */
@media (max-width: 1199px) {
  .toc-side { display: none; }
}
@media (max-width: 1100px) {
  .post-row__body { grid-column: 4 / span 9; }
}
@media (max-width: 860px) {
  .blog-intro { padding-top: 88px; }
  .blog-intro__lead { margin-top: 20px; }
  .posts { margin-top: 56px; }
  .post-row { display: flex; flex-direction: column; gap: 12px; padding: 28px 0 32px; }
  .post-row__meta { flex-direction: row; flex-wrap: wrap; gap: 0 12px; padding-top: 0; }
  .post-row__body { gap: 10px; }
  .post-row__title { font-size: var(--t-statement); }
  .blog-index { padding-bottom: 140px; }

  .post-hero { padding-top: 88px; }
  .post-eyebrow { margin-bottom: 20px; }
  .post-hero h1 { max-width: none; }
  .post-lede { margin-top: 24px; }
  .hero-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 44px; }
  .tldr { margin-top: 56px; }
  .post-section { padding-top: 96px; scroll-margin-top: 64px; }
  .section-head { margin-bottom: 28px; }
  .section-head .kicker { margin-top: 16px; }
  .brief-grid { grid-template-columns: minmax(0, 1fr); }
  .brief-card { position: static; }
  .numbers { margin-top: 96px; }
  .numbers-grid { grid-template-columns: minmax(0, 1fr); }
  .scripts-container { margin-left: calc(-1 * var(--gutter) + 8px); margin-right: calc(-1 * var(--gutter) + 8px); border-radius: 16px; }
  .script-tabs { padding: 4px 16px 0; gap: 0 20px; }
  .script-tab { min-height: 44px; }
  .script-toolbar { padding: 4px 6px 4px 16px; }
  .copy-btn { min-height: 44px; }
  .scripts-container pre, .script-panel pre, pre[class*="language-"] { padding: 18px 16px 22px; font-size: 12.5px; }
  .post-figure { margin: 36px 0; }
  .post-figure img { border-radius: 20px; }
  .post-end { margin-top: 96px; }
  .end-grid { display: flex; flex-direction: column; }
  .end-meta a { display: inline-block; padding: 11px 0; margin: -11px 0; }
  .suggested-read { margin-top: 56px; }
  .post-back { margin-top: 40px; padding: 12px 0; }
  main > article { padding-bottom: 120px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .post-row__title span, .script-tab, .copy-btn, .sr-title, .post-back, .toc-side, .toc-side-item { transition: none; }
}
