:root {
  --bg: #fbfbf9;
  --surface: #f0f0ed;
  --text: #18181b;
  --muted: #66676b;
  --rule: #e2e2de;
  --accent: #1f7a63;
  --ink: #18181b;   /* solid marks (logo tiles, bars): the text's color here, dimmer than it in the dark theme */
  --serif: "Spectral", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --page: 1400px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1e1f22;
    --surface: #28292c;
    --text: #d2d2ce;
    --muted: #a1a2a6;
    --rule: #393a3f;
    --accent: #4fb393;
    --ink: #bdbdb9;
  }
}

:root[data-theme="dark"] {
  --bg: #1e1f22;
  --surface: #28292c;
  --text: #d2d2ce;
  --muted: #a1a2a6;
  --rule: #393a3f;
  --accent: #4fb393;
  --ink: #bdbdb9;
}

/* selected text: a light wash of the accent, in either theme */
::selection { background: rgba(31, 122, 99, 0.2); background: color-mix(in srgb, var(--accent) 24%, transparent); }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.01em;   /* Spectral sets wide */
}

a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }

/* The theme's cross-fade (theme.js): the old and the new picture of the page, as long as the old fade was */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 400ms; }

/* Header: stays at the top of the window; once the page scrolls (the script below sets .scrolled) it narrows to a
   bar with a rule under it. Full width, so nothing shows beside it; its contents within the page's width. */
:root { --header-h: 56px; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 24px max(16px, calc((100% - var(--page)) / 2 + 16px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: padding 200ms ease, border-color 200ms ease;
}
.site-header.scrolled { padding-top: 11px; padding-bottom: 11px; border-bottom-color: var(--rule); }
.read-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); transform: scaleX(0);
                 transform-origin: left center; opacity: 0; transition: opacity 200ms ease; pointer-events: none; }
.site-header.scrolled .read-progress { opacity: 1; }   /* shown once the header narrows, over its bottom rule */
.brand { display: inline-flex; align-items: center; gap: 0.33em; font-size: 30px; color: inherit; text-decoration: none; transition: font-size 200ms ease; }
.site-header.scrolled .brand { font-size: 23px; }
/* centered on the wordmark's cap height and baseline, not its line box (no descenders in "TensorLean") */
.brand-mark { width: 0.87em; height: 0.87em; flex: none; transform: translateY(-0.03em); }
.brand-mark .ink { fill: var(--ink); }
.brand-mark .accent { fill: var(--accent); }
/* Text inside links gets its own color: a visited link's inherited color skips the theme fade. */
.wordmark { font-family: var(--serif); font-size: 1em; font-weight: 500; font-variant-caps: small-caps; letter-spacing: -0.01em; line-height: 1; color: var(--text); }
.wordmark .lean { color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 20px; }
.header-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 17px;
  text-decoration: none;
}
.header-link > * { color: var(--text); transition: color 150ms ease; }
.header-link svg { transform: translateY(-0.11em); }   /* on the text's cap height, like the brand mark */
.header-link:hover > * { color: var(--accent); }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.theme-toggle:hover { background: var(--surface); }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* Hero */
.post-hero { max-width: var(--page); margin: 0 auto; padding: 32px 16px 36px; }
.post-hero h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(32px, 4.4vw, 58px);
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin: 0;
}
.post-hero .title-line { display: block; text-wrap: balance; }   /* a line that wraps leaves no single word behind */
/* wide screens: the title's longer line (20.22 em) ends at the body column's right edge, as the hero below it does. The
   body ends 232px before the right edge while the columns are at their minimum gaps, and at half the width plus 428px
   once the gaps grow (.post-grid) */
@media (min-width: 1081px) {
  .post-hero { container-type: inline-size; }
  .post-hero h1 { font-size: calc(min(100cqw - 232px, 50cqw + 428px) / 20.22); }
}
/* phones: three lines, small enough that "From Math to Machine, in Minutes:" (15.21 em wide) keeps one line and the
   subtitle takes two, "End-to-End Formal" / "Verification of GPU Kernels" */
@media (max-width: 640px) { .post-hero h1 { font-size: min(32px, calc((100vw - 32px) / 15.6)); } }
.post-hero .byline { margin: 20px 0 0; font-family: var(--serif); font-size: 20px; color: var(--text); }
/* the authors, each with the marks of its affiliations; under them the marks' legend, smaller */
.post-hero .byline p { margin: 0; }
.post-hero .byline .author { white-space: nowrap; }   /* a name never parted from its marks */
.post-hero .byline sup { font-size: 0.62em; line-height: 0; margin-left: 0.08em; }
.post-hero .byline .equal { margin-left: 0.04em; }   /* the asterisk at the text's size: its glyph sits high already */
.post-hero .byline .affiliations { display: flex; flex-wrap: wrap; gap: 0 1.2em; margin-top: 6px; font-size: 16px; }
/* a green rule under the byline: the title block ends there */
.post-hero .byline::after { content: ""; display: block; height: 2px; margin-top: 10px; background: var(--accent); }
/* narrow screens: the chapter bar's rule follows the byline already */
@media (max-width: 1080px) { .post-hero .byline::after { display: none; } }
/* the opening video: the first row of the body's column, the chapters and the details beside it on wide screens; on
   narrow ones, under the byline and above the chapter bar */
.opening { grid-column: 2; grid-row: 1; margin: 0; position: relative; }
.opening video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 6px; background: #1e1f22; }
@media (max-width: 1080px) { .opening { margin: 0 0 24px; } }
/* the video's first play: the whole poster a button, its mark at the bottom left as in Vimeo's player (a rounded
   rectangle, white on translucent black as the video's own controls), as far from the corner as the quality button
   is from its own; the mark is Material Design's play icon, optically centered in its box as drawn */
.video-start { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 6px;
  background: none; color: #fff; cursor: pointer; }
.video-start[hidden] { display: none; }
.video-start span { position: absolute; left: 10px; bottom: 10px; display: grid; place-items: center;
  width: clamp(48px, 7.5%, 64px); aspect-ratio: 8 / 5; border-radius: 5px; background: rgba(0, 0, 0, 0.6); transition: background 0.2s; }
.video-start:hover span, .video-start:focus-visible span { background: rgba(0, 0, 0, 0.8); }
.video-start:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.video-start svg { height: 70%; aspect-ratio: 1; fill: currentColor; }
/* the video's quality button, at its top right, in the look of the video's own controls (white on translucent black,
   the system's sans-serif) in both themes */
.quality { position: absolute; top: 10px; right: 10px; font: 500 13px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.quality.shown { opacity: 1; pointer-events: auto; }
.quality button { font: inherit; color: #fff; border: 0; cursor: pointer; }
.quality-current { padding: 6px 10px; border-radius: 4px; background: rgba(0, 0, 0, 0.6); }
.quality-menu { position: absolute; top: calc(100% + 4px); right: 0; min-width: 108px; padding: 4px 0; border-radius: 4px;
  background: rgba(0, 0, 0, 0.82); }
.quality-menu button { position: relative; display: block; width: 100%; padding: 7px 14px 7px 30px; text-align: left; background: none; }
.quality-menu button:hover, .quality-menu button:focus-visible { background: rgba(255, 255, 255, 0.14); outline: none; }
.quality-menu button[aria-checked="true"]::before { content: ""; position: absolute; left: 13px; top: 50%; width: 6px; height: 6px;
  margin-top: -3px; border-radius: 50%; background: #fff; }

/* the page's footer: the name at the left, the contact address and the repository at the right, under a rule as wide
   as the page's content (the header's and the columns' edges) */
.site-footer { max-width: var(--page); margin: 0 auto; padding: 0 16px 48px; font-size: 16px; color: var(--muted); }
.site-footer .footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-top: 20px; border-top: 1px solid var(--rule); }
.site-footer .footer-links { display: flex; flex-wrap: wrap; gap: 4px 24px; }
.site-footer a { color: var(--muted); text-decoration: none; transition: color 150ms ease; }
.site-footer a:hover { color: var(--accent); }

/* Three columns: chapters, body, details */
.post-grid {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 16px 128px;
  display: grid;
  grid-template-columns: 216px minmax(0, 840px) 200px;
  justify-content: space-between;
  gap: 32px;
  position: relative;
}

/* the details stay at the top, leaving the right column below them to the side notes */
.toc { grid-column: 1; grid-row: 1 / 3; position: sticky; top: calc(var(--header-h) + 24px); align-self: start; transition: opacity 200ms ease; }
.post-body { grid-column: 2; grid-row: 2; }
.toc.beside-wide { opacity: 0; pointer-events: none; }
.details { grid-column: 3; grid-row: 1 / 3; align-self: start; }

.toc ol { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.toc a {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 15px;
  line-height: 1.4;
  text-decoration: none;
}
.toc .number, .chapter-bar .number { font-variant-numeric: tabular-nums lining-nums; }
.toc a > span, .chapter-bar a > span { color: var(--muted); transition: color 150ms ease; }
.toc a.active > span, .chapter-bar a.active > span { color: var(--text); }
.toc a.active .number { color: var(--accent); }
.toc a:hover > span, .chapter-bar a:hover > span { color: var(--accent); }

.details { font-size: 16px; }
.detail { border-top: 1px solid var(--rule); padding: 12px 0 20px; }
.detail-label { margin: 0 0 4px; font-size: 16px; font-variant-caps: all-small-caps; letter-spacing: 0.05em; color: var(--muted); }
.detail p { margin: 0; }
.detail .note { margin-top: 8px; color: var(--muted); font-size: 14px; }

/* Side notes: [term]^[note] in the article. The note sits in the right column at the term's line
   (absolute, right-aligned to the grid, keeping its static top); narrow screens open it below the line. */
.sidenote-term {
  color: var(--accent);
  text-decoration: underline dotted;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: pointer;
  transition: color 150ms ease;
}
.sidenote-toggle { display: none; }
.sidenote {
  position: absolute;
  right: 16px;
  width: 200px;
  border-top: 1px solid var(--rule);
  padding-top: 8px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  transition: color 150ms ease;
  user-select: none;  /* a note sits inside its paragraph; selecting or copying the paragraph leaves it out */
}
/* the note is headed by its term, in the right column's label style, so the two can be matched by eye */
.sidenote-name {
  display: block;
  margin-bottom: 2px;
  font-size: 16px;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.05em;
  color: var(--accent);
  transition: color 150ms ease;
}
.sidenote-term:hover, .sidenote-term:has(+ .sidenote-toggle + .sidenote:hover),
.sidenote-term:hover + .sidenote-toggle + .sidenote .sidenote-name, .sidenote:hover .sidenote-name { color: var(--accent); }

/* Body */
.post-body { font-family: var(--serif); font-size: 20px; line-height: 1.65; }
.post-body h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 48px 0 16px;
  scroll-margin-top: calc(var(--header-h) + 24px);
  cursor: pointer;
  transition: color 150ms ease;
}
.post-body h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.3;
  letter-spacing: -0.012em;
  margin: 36px 0 10px;
  scroll-margin-top: calc(var(--header-h) + 24px);
  cursor: pointer;
  transition: color 150ms ease;
}
.post-body :is(h2, h3):hover { color: var(--accent); }
/* chapter and section numbers (3, 3.1), counted from the headings; References has no id and no number */
.post-body { counter-reset: chapter; }
.post-body h2[id] { counter-increment: chapter; counter-reset: section; }
.post-body h3[id] { counter-increment: section; }
.post-body h2[id]::before { content: counter(chapter); }
.post-body h3[id]::before { content: counter(chapter) "." counter(section); }
.post-body :is(h2, h3)[id]::before { color: var(--accent); margin-right: 0.5em; font-variant-numeric: lining-nums; }
.post-body strong { font-weight: 600; }
/* the article's links, and the authors' names in the byline */
.post-body a:not(.cite), .post-hero .byline a {
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: color 150ms ease, text-decoration-color 150ms ease;
}
.post-body a:not(.cite):hover, .post-hero .byline a:hover { color: var(--accent); text-decoration-color: var(--accent); }
/* in the byline, three names in a row: the green line thinner and fainter, full on hover */
.post-hero .byline a { text-decoration-thickness: 1px; text-underline-offset: 4px; text-decoration-color: color-mix(in srgb, var(--accent) 50%, transparent); }
/* the summary before Introduction, as in Anthropic's research posts */
.standfirst { margin: 0 0 56px; padding-left: 14px; border-left: 3px solid var(--accent); }   /* marked by a thin bar on its left */
/* wide screens: the bar in the gap beside the column, so the summary's text lines up with the body's */
@media (min-width: 1081px) { .standfirst { margin-left: -20px; padding-left: 17px; } }
.standfirst p:last-child { margin-bottom: 0; }

/* Citations: a superscript number per source, its card on hover or focus, the list after the article */
.cites { font-size: 0.68em; line-height: 0; vertical-align: super; color: var(--muted); white-space: nowrap; }
.cite { position: relative; color: var(--accent); text-decoration: none; font-variant-numeric: lining-nums; border-radius: 3px; padding: 0 1px; }
.cite:hover, .cite:focus-visible { background: var(--surface); outline: none; }
.cite-card {
  display: none;
  position: absolute;
  left: 50%;
  bottom: 1.9em;
  transform: translateX(-50%);
  width: min(340px, 80vw);
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.10);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  z-index: 30;
}
/* open on a click (the page script), on hover where there is a pointer, and on keyboard focus */
.cite.open .cite-card, .cite:focus-visible .cite-card { display: block; }
@media (hover: hover) { .cite:hover .cite-card { display: block; } }
.cite-card > span { display: block; }
.cite-authors, .cite-venue { color: var(--muted); font-size: 14px; }
.cite-title { margin: 2px 0; font-weight: 500; }
.cite-missing { color: #c0392b; }
.references { margin-top: 88px; padding-top: 8px; border-top: 1px solid var(--rule); font-size: 16px; line-height: 1.55; }
.post-body .references h2 { font-size: 22px; margin: 24px 0 16px; cursor: default; }
.post-body .references h2:hover { color: inherit; }
.references ol { padding-left: 1.6em; margin: 0; }
.references li { margin-bottom: 10px; scroll-margin-top: calc(var(--header-h) + 24px); }
.references li:target { color: var(--accent); }
@media (max-width: 1080px) { .standfirst { margin-bottom: 40px; } }
.sc { font-variant-caps: small-caps; letter-spacing: 0.01em; }   /* the TensorLean name, as in the wordmark */
.sc .lean { color: var(--accent); }
.post-body h2:first-child { margin-top: 0; }
.post-body p { margin: 0 0 20px; }
/* lines evened so that a paragraph does not end in a short line (with build.mjs's keepLastWords) */
.post-body p, .post-body li, .post-body figcaption, .standfirst p { text-wrap: pretty; }
.post-body > :is(ol, ul) > li + li { margin-top: 10px; }   /* half a paragraph's gap between items */
.post-body code { font-family: var(--mono); font-size: 0.82em; background: var(--surface); padding: 1px 5px; border-radius: 4px; }
.post-body pre {
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.5;
  background: var(--surface);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
}
.placeholder { color: var(--muted); font-style: italic; }

/* Narrow screens: one column, chapters in a sticky bar */
.chapter-bar { display: none; }

@media (max-width: 1080px) {
  .brand { font-size: 26px; }
  .post-hero { padding: 24px 16px 24px; }
  .post-grid { display: block; }   /* one column in the page's order; a block, so the sticky chapter bar has the whole grid to stick in */
  .toc { display: none; }
  .sidenote { position: static; display: none; width: auto; margin: 8px 0; padding: 2px 0 2px 12px; border-top: 0; border-left: 2px solid var(--rule); font-size: 16px; }
  .sidenote-name { display: none; }
  .sidenote-toggle:checked + .sidenote { display: block; }
  .details { position: static; display: flex; flex-wrap: wrap; gap: 0 32px; margin-bottom: 40px; }
  .detail { flex: 1 1 200px; }
  .post-body { font-size: 18px; }
  .post-body h2 { font-size: 23px; scroll-margin-top: calc(var(--header-h) + 64px); }

  .chapter-bar {
    display: block;
    margin: 0 -16px;   /* the grid's padding: the bar runs the screen's width */
    position: sticky;
    top: calc(var(--header-h) - 2px);   /* tucked under the header's edge, so no line of text shows between them */
    z-index: 10;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
    padding: 0 16px;
    font-size: 16px;
  }
  .chapter-bar summary { cursor: pointer; list-style: none; padding: 14px 0; color: var(--muted); }
  .chapter-bar summary::-webkit-details-marker { display: none; }
  .chapter-bar summary::after { content: "+"; float: right; }
  .chapter-bar[open]:not(.closing) summary::after { content: "–"; }
  .chapter-bar .current { color: var(--text); }
  .chapter-bar ol {   /* over the page, not in its flow: opening it moves nothing below */
    position: absolute; top: 100%; left: 0; right: 0;
    list-style: none; margin: 0; padding: 0 16px 12px;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
    box-shadow: 0 12px 16px -12px rgb(0 0 0 / 0.18);
  }
  .chapter-bar a { display: grid; grid-template-columns: 28px 1fr; gap: 8px; padding: 8px 0; text-decoration: none; }
}

/* Math (KaTeX): its default 1.21em is sized for fonts with a tall x-height; Spectral's is small */
.post-body .katex { font-size: 1.02em; }
.post-body .katex-display { margin: 0.9em 0; }
/* a formula wider than the column scrolls inside its own line instead of widening the page (phones) */
.post-body .katex-display { overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
@media (max-width: 640px) { .post-body .katex-display > .katex { font-size: 0.92em; } }

/* code in a block takes the block's size: the inline-code 0.82em must not shrink it again */
.post-body pre code { font-size: inherit; background: none; padding: 0; border-radius: 0; }

/* Highlighted code (Shiki): each token holds both themes' colors; the page's theme picks one */
.post-body pre.shiki { background: var(--surface) !important; }
.post-body .shiki span { color: var(--shiki-light); }
.post-body .shiki .spec-field { --shiki-light: #6F42C1; --shiki-dark: #B392F0; }
.post-body .shiki .op { --shiki-light: #D73A49; --shiki-dark: #F97583; }   /* Lean's arithmetic, as Python's operators */   /* spec_math, Layout, tensor, …: the themes' purple of a defined name */
:root[data-theme="dark"] .post-body .shiki span { color: var(--shiki-dark); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .post-body .shiki span { color: var(--shiki-dark); }
}

/* trial: the name in the article's text without the accent on "Lean" (the logo and byline keep it) */
.post-body .sc .lean { color: inherit; }

/* ```compare: two code cells side by side, each with a small label; stacked on narrow screens */
.code-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 0 1.2em; }
.code-pair.single { grid-template-columns: minmax(0, 1fr); }
/* a label's file path breaks where it must, so that it never widens the page on a phone */
.code-cell .code-label { overflow-wrap: anywhere; margin: 0 0 6px; font-size: 15px; font-variant-caps: all-small-caps; letter-spacing: 0.05em; color: var(--muted); }
/* two cells side by side (a spec beside its reference): their labels in the text's color and weight, as with outputs */
.code-pair:not(.with-arrow) .code-label { font-size: 17px; font-variant-caps: normal; letter-spacing: 0; color: var(--text); font-weight: 500; }
.code-cell { display: flex; flex-direction: column; }
/* short snippets: a little smaller than other code, and wrapped rather than scrolled when a cell is narrow */
.code-cell pre { flex: 1; margin: 0; font-size: 16px; white-space: pre-wrap; overflow-wrap: anywhere; overflow: visible; }
@media (max-width: 640px) {
  .code-pair { grid-template-columns: minmax(0, 1fr); }
  .code-pair:not(.with-arrow) .code-cell pre { font-size: 14px; }   /* a spec's lines whole on a phone */
  /* on a phone the code keeps its lines, as written, and scrolls sideways in its box like any code block; the code as
     wide as its longest line, so that a marked line's background spans it */
  .code-cell pre { white-space: pre; overflow-wrap: normal; overflow-x: auto; }
  .code-cell pre > code { display: inline-block; min-width: 100%; }
}
/* boxes split by "===": a cell's boxes stacked, each row's two boxes level and of one height */
.code-pair.with-output { grid-auto-flow: column; row-gap: 8px; }
.code-pair.with-output .code-cell { display: contents; }
.code-pair.with-output .code-label { margin: 0; font-size: 17px; font-variant-caps: normal; letter-spacing: 0; color: var(--text); font-weight: 500; }
.code-pair.with-output .code-part { display: flex; flex-direction: column; }
.code-pair.with-output .code-part > * { flex: 1; }
@media (max-width: 640px) {
  .code-pair.with-output { grid-auto-flow: row; grid-template-rows: none !important; }
  .code-pair.with-output .code-cell + .code-cell .code-label { margin-top: 16px; }
}
/* a marked line across the cell: the wrong output red, the right one green */
.code-cell .line.wrong, .code-cell .line.right { display: inline-block; width: 100%; margin: 0 -6px; padding: 0 6px; border-radius: 3px; }
.code-cell .line.wrong { background: color-mix(in srgb, #d73a49 16%, transparent); }
.code-cell .line.right { background: color-mix(in srgb, var(--accent) 18%, transparent); }
/* a formula box: on the code's background, the formula flush left with the code under it */
.math-box { display: flex; flex-direction: column; justify-content: center; padding: 12px 16px; border-radius: 8px; background: var(--surface); }
.math-box .katex-display, .math-box .katex-display > .katex { margin: 0; text-align: left; }

/* ```compare with an arrow: the two cells sized to their code, the arrow between them with its text over and under */
.code-pair.with-arrow { grid-template-columns: auto minmax(120px, 1fr) auto; align-items: end; gap: 0; }
.code-pair.with-arrow .code-cell pre { white-space: pre; }
.code-arrow { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end; padding: 0 12px 6px; min-height: 51px; }
.code-arrow .arrow-over { font-family: var(--mono); font-size: 15px; line-height: 1.3; color: var(--accent); text-align: center; }
.code-arrow .arrow-line { position: relative; height: 0; margin: 5px 4px 5px 0; border-top: 1.5px solid var(--accent); }
.code-arrow .arrow-line::after { content: ""; position: absolute; right: -6px; top: -5.5px; border-left: 8px solid var(--accent); border-top: 4.5px solid transparent; border-bottom: 4.5px solid transparent; }
.code-arrow .arrow-under { font-size: 15px; font-variant-caps: all-small-caps; letter-spacing: 0.05em; color: var(--muted); text-align: center; }
/* stacked where its column is too narrow for three cells: phones, and the narrowest three-column desktop widths */
@media (max-width: 640px), (min-width: 1081px) and (max-width: 1180px) {
  .code-pair.with-arrow { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  /* a downward arrow: its name above the map, both beside the arrow's shaft */
  .code-arrow { position: relative; height: auto; min-height: 0; margin: 2px 0 12px 16px; padding: 0 0 4px 12px;
    flex-direction: column-reverse; align-items: flex-start; border-left: 1.5px solid var(--accent); }
  .code-arrow::after { content: ""; position: absolute; left: -5.25px; bottom: -7px; border-top: 8px solid var(--accent); border-left: 4.5px solid transparent; border-right: 4.5px solid transparent; }
  .code-arrow .arrow-line { display: none; }
  .code-arrow .arrow-over, .code-arrow .arrow-under { text-align: left; }
}

/* phones: less air above the article, so its first lines show on the first screen */
@media (max-width: 640px) {
  .site-header { padding-top: 16px; padding-bottom: 16px; }
  .post-hero { padding: 16px 16px 20px; }
  .post-hero .byline { margin-top: 12px; font-size: 16px; }   /* below the title (about 23px) and the text (18px) */
  .post-hero .byline .affiliations { font-size: 14px; }
  .detail-label { font-size: 14px; }
  .details { margin-bottom: 24px; }
  .detail { flex: 1 1 0; padding: 10px 0 14px; }   /* authors and date side by side, one row */
  .post-body { line-height: 1.6; }   /* as long-form sites set it on phones (1.5–1.6) */
}
/* tables in the article: the text's full width, columns of equal width, thin rules, left-aligned, the header in the
   muted color; on a narrow screen a table sizes to its content and scrolls on its own */
.post-body table { width: 100%; table-layout: fixed; border-collapse: collapse; margin: 18px 0; font-size: 17px; line-height: 1.4; }
.post-body th, .post-body td { padding: 7px 28px 7px 0; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: baseline; }
.post-body th { font-weight: 500; color: var(--muted); }
@media (max-width: 640px) { .post-body table { display: block; width: auto; table-layout: auto; overflow-x: auto; font-size: 15px; } }
