/* Ruby Xocolatl — a lean Tufte-flavoured stylesheet.
   Body: ET Book (self-hosted). Code: IBM Plex Mono. Light/dark via tokens.
   Replaces the ~450-line inlined Tufte fork. */

/* ---------- Fonts (self-hosted) ---------- */
/* ET Book ships separate files for line vs. old-style figures (no OpenType
   toggle), so the body roman face is the old-style cut: old-style figures in
   running text, in sidenote numbers and in dates. Tables use the line-figure
   cut for lining/tabular numerals. */
@font-face {
  font-family: "ET Book"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/et-book-roman-old-style-figures.woff") format("woff");
}
@font-face {
  font-family: "ET Book"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("/fonts/et-book-display-italic-old-style-figures.woff") format("woff");
}
@font-face {
  font-family: "ET Book"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/fonts/et-book-bold-line-figures.woff") format("woff");
}
@font-face {
  font-family: "ET Book LF"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/et-book-roman-line-figures.woff") format("woff");
}

/* IBM Plex Mono — latin + latin-ext, regular / italic / semibold */
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/ibm-plex-mono-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("/fonts/ibm-plex-mono-latin-400-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("/fonts/ibm-plex-mono-latin-ext-400-italic.woff2") format("woff2");
  unicode-range: U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/fonts/ibm-plex-mono-latin-ext-600-normal.woff2") format("woff2");
  unicode-range: U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light dark;
  --font-serif: "ET Book", Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-serif-lf: "ET Book LF", var(--font-serif);
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  /* fluid scale: ~360px -> ~1280px viewport */
  --step--1: clamp(0.9rem, 0.86rem + 0.2vw, 1rem);        /* notes, captions */
  --step-0:  clamp(1.0625rem, 0.97rem + 0.42vw, 1.25rem); /* body */
  --step-1:  clamp(1.25rem, 1.12rem + 0.6vw, 1.55rem);    /* h3 */
  --step-2:  clamp(1.5rem, 1.27rem + 1vw, 2.1rem);        /* h2 */
  --step-3:  clamp(2.1rem, 1.6rem + 2.2vw, 3.4rem);       /* h1 / title */

  --leading: 1.55;
  --leading-tight: 1.15;
  --leading-note: 1.4;
  --flow: 1.1em;
  --measure: 34em;
  --note-w: clamp(12rem, 22vw, 17rem);
  --note-gap: 2.5rem;
  --gutter: 1rem;

  /* light: warm cotton paper, grana cochinilla accent */
  --paper: #fbf8f1;
  --ink: #1f1b16;
  --ink-muted: #5c5248;
  --ink-soft: #8a7d70;
  --rule: #e3dccf;
  --code-bg: #f3eee3;
  --accent: #9b1b30;
  --link-line: #b9ad9c;
  --selection: #ecdcc8;

  /* chart palette (viz style spec §1, §8): card mat, accent wash, and the six
     Mexican-dye categorical slots plus slot 7, fucsia / rosa mexicano. */
  --card: #f3eee3; --wash: rgba(155, 27, 48, .10);
  --c1: #9d2a39; --c2: #2b5591; --c3: #ba8416; --c4: #018e7d; --c5: #a16fb8; --c6: #566d22; --c7: #e4007c;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #17130f; --ink: #e8e1d6; --ink-muted: #a89c8e; --ink-soft: #7f7366; --rule: #3a322a;
    --code-bg: #211b16; --accent: #d69a6f; --link-line: #6e6254; --selection: #4a3626;
    --card: #241e18; --wash: rgba(214, 154, 111, .12);
    --c1: #bc4852; --c2: #618dce; --c3: #bf8a2a; --c4: #149483; --c5: #915aa8; --c6: #566d22; --c7: #df5da7;
  }
}
:root[data-theme="dark"] {
  --paper: #17130f; --ink: #e8e1d6; --ink-muted: #a89c8e; --ink-soft: #7f7366; --rule: #3a322a;
  --code-bg: #211b16; --accent: #d69a6f; --link-line: #6e6254; --selection: #4a3626;
  --card: #241e18; --wash: rgba(214, 154, 111, .12);
  --c1: #bc4852; --c2: #618dce; --c3: #bf8a2a; --c4: #149483; --c5: #915aa8; --c6: #566d22; --c7: #df5da7;
}
:root[data-theme="light"] {
  --paper: #fbf8f1; --ink: #1f1b16; --ink-muted: #5c5248; --ink-soft: #8a7d70; --rule: #e3dccf;
  --code-bg: #f3eee3; --accent: #9b1b30; --link-line: #b9ad9c; --selection: #ecdcc8;
  --card: #f3eee3; --wash: rgba(155, 27, 48, .10);
  --c1: #9d2a39; --c2: #2b5591; --c3: #ba8416; --c4: #018e7d; --c5: #a16fb8; --c6: #566d22; --c7: #e4007c;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: var(--step-0);
  line-height: var(--leading);
  font-kerning: normal;
  counter-reset: sidenote-counter errata-counter;
}
::selection { background: var(--selection); }

.page-layout { max-width: 72rem; margin-inline: auto; padding-inline: var(--gutter); padding-bottom: 4rem; }

/* masthead / nav */
.site-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1.6rem 0;
  max-width: calc(var(--measure) + var(--note-gap) + var(--note-w));
  margin-inline: auto;
}
.masthead, .masthead:link, .masthead:visited {
  color: var(--accent);
  font-size: 3em;
  line-height: 1.1;
  text-decoration: none;
}
.masthead:hover { color: var(--accent); text-decoration: none; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.2rem; }
.site-nav a {
  color: var(--ink-muted);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
  text-decoration: none;
}
.site-nav a:hover { color: var(--accent); }

/* Theme toggle: a nav-styled icon button (muted ink, accent on hover). */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  color: var(--ink-muted);
  font-size: inherit;
  line-height: 0;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.theme-toggle .icon { width: 1em; height: 1em; }
/* Default (light resolved): moon shows, sun hidden. */
.theme-toggle .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: inline; }
}
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }

article, .index {
  position: relative;
  max-width: calc(var(--measure) + var(--note-gap) + var(--note-w));
  margin-inline: auto;
  padding-block: 2rem 5rem;
}
article > section, article > .post-meta, article > .byline,
.subtitle, .front-matter, #TOC { max-width: var(--measure); }
article > section > * { margin-block: 0; }
article > section > * + * { margin-top: var(--flow); }
p { text-wrap: pretty; hyphens: auto; }

/* ---------- Headings ---------- */
h1, h2, h3 { font-weight: 400; line-height: var(--leading-tight); text-wrap: balance; }
h1 { font-size: var(--step-3); margin: 0 0 0.4em; letter-spacing: -0.01em; }
h2 { font-size: var(--step-2); font-style: italic; margin: 2.2em 0 0.6em; }
/* Index headings (years + "Front matter"): ~0.8em of the h2's own size above,
   ~0.4em down to the first post. The lists carry no margin (see .index ol), so
   this top margin never stacks with a list margin below the previous year. */
.index h2 { margin: 0.8em 0 0.4em; }
h3 { font-size: var(--step-1); font-style: italic; margin: 1.8em 0 0.5em; }
.subtitle { font-style: italic; color: var(--ink-muted); font-size: var(--step-1); margin: 0 0 1.2rem; }
.post-meta {
  color: var(--ink-muted);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
  margin: 0 0 2.5rem;
}
.byline { color: var(--ink-muted); font-style: italic; margin-top: 3rem; }
.view-source { display: block; font-style: normal; font-size: var(--step--1); margin-top: 0.4rem; }
.newthought { font-variant-caps: all-small-caps; letter-spacing: 0.04em; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5em 0; max-width: var(--measure); }

/* ---------- Links ---------- */
a { color: inherit; }
a:link, a:visited {
  text-decoration-line: underline;
  text-decoration-color: var(--link-line);
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.18em;
  text-decoration-skip-ink: auto;
}
a:hover { color: var(--accent); text-decoration-color: currentColor; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* Archived-link marker: a quiet small-caps "archived" tag after a Wayback link,
   with a thin space before it. "archivado" on Spanish posts (same class). */
.archived {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
  font-size: 0.8em;
  color: var(--ink-muted);
}
.archived::before { content: "\2009"; /* thin space */ }

/* A link whose target is gone with no archive: keep the text, drop the href,
   render it muted so it reads as inert. */
.dead-link { color: var(--ink-muted); }

/* ---------- Lists, quotes ---------- */
ul, ol { padding-left: 1.4em; }
li + li { margin-top: 0.3em; }
blockquote { margin-inline: 1.5em 0; padding: 0; font-style: italic; }
blockquote footer { font-style: normal; text-align: right; font-size: var(--step--1); color: var(--ink-muted); }
.epigraph blockquote { font-style: italic; }
.epigraph blockquote footer cite { font-style: italic; }

/* ---------- Code ---------- */
code, kbd, pre {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
  font-variant-numeric: lining-nums tabular-nums;
}
:not(pre) > code {
  font-size: 0.82em;
  background: var(--code-bg);
  padding: 0.08em 0.3em;
  border-radius: 3px;
}
pre {
  font-size: var(--step--1);
  line-height: 1.5;
  background: var(--code-bg);
  border-left: 2px solid var(--rule);
  padding: 0.9rem 1.1rem;
  overflow-x: auto;
  tab-size: 2;
  border-radius: 0 3px 3px 0;
}
pre code { font-size: inherit; background: none; padding: 0; }

/* Build-time highlighting (hljs spans), variant C "Accent keywords":
   ink by default, one hue (the accent) for keywords/meta. Works in both themes
   through the tokens. */
pre code span { color: inherit; font-weight: inherit; font-style: inherit; }
.hljs-keyword, .hljs-meta { color: var(--accent); }
.hljs-title { font-weight: 600; }
.hljs-comment { font-style: italic; color: var(--ink-soft); }
.hljs-string, .hljs-symbol { color: var(--ink-muted); }

/* ---------- Tables ---------- */
table {
  border-collapse: collapse;
  font-family: var(--font-serif-lf);
  font-variant-numeric: lining-nums tabular-nums;
  font-size: var(--step--1);
}
th, td { padding: 0.35em 0.8em 0.35em 0; border-bottom: 1px solid var(--rule); text-align: left; }
.table-wrapper { overflow-x: auto; }

/* ---------- Figures ---------- */
img, video { max-width: 100%; height: auto; }
figure { margin: 2em 0; }
figcaption, .sidenote, .marginnote {
  font-size: 0.8rem;
  line-height: var(--leading-note);
  color: var(--ink-muted);
}
figcaption { margin-top: 0.5em; }
.fullwidth { max-width: none; width: 100%; font-style: normal; }
/* Pull-quotes keep the fullwidth upright face but stay within the body measure
   so the quoted text lines up with the <hr> rules above and below it (both
   capped at --measure, indented by blockquote's margin-inline). */
blockquote.fullwidth { width: auto; max-width: var(--measure); }

/* ---------- Sidenotes & margin notes ---------- */
.sidenote-number { counter-increment: sidenote-counter; }
.sidenote-number::after, .sidenote::before {
  color: var(--accent);
  font-size: 0.72em;
  line-height: 0;
  vertical-align: super;
}
.sidenote-number::after { content: counter(sidenote-counter); padding-left: 0.08em; }
.sidenote::before { content: counter(sidenote-counter) "\00a0"; }
input.margin-toggle { display: none; }
/* Numbered-sidenote and lettered-errata labels show their mark inline on every
   screen; only the ⊕/verdict toggles collapse off-screen on the desktop. */
label.margin-toggle:not(.sidenote-number):not(.errata-number) { display: none; }

/* wide: notes live in the right margin */
@media (min-width: 62rem) {
  .sidenote, .marginnote {
    float: right;
    clear: right;
    width: var(--note-w);
    margin: 0.15em calc(-1 * (var(--note-w) + var(--note-gap))) 1em 0;
    position: relative;
  }
  figure > figcaption {
    float: right; clear: right; width: var(--note-w);
    margin: 0 calc(-1 * (var(--note-w) + var(--note-gap))) 0 0;
  }
  .fullwidth { width: calc(100% + var(--note-gap) + var(--note-w)); }
}

/* narrow: notes collapse behind their number / ⊕, expand inline on tap */
@media (max-width: 61.99rem) {
  .sidenote, .marginnote { display: none; }
  label.margin-toggle:not(.sidenote-number) { display: inline; color: var(--accent); }
  label.margin-toggle { cursor: pointer; padding: 0 0.15em; }
  .margin-toggle:checked + .sidenote,
  .margin-toggle:checked + .marginnote {
    display: block;
    margin: 0.6em 0 0.8em 0.25em;
    padding-left: 0.8em;
    border-left: 2px solid var(--rule);
  }
  /* Critical errata ([^2026!-…], the spam-link note): shown inline, no tap. */
  .sidenote.errata.always {
    display: block;
    float: none;
    width: auto;
    margin: 0.6em 0 0.8em 0.25em;
    padding-left: 0.8em;
    border-left: 2px solid var(--rule);
  }
  article { padding-block: 1.5rem 3rem; }
}

/* ---------- 2026 errata annotations ---------- */
/* Three signals mark a 2026 note and no more: the accent (the blog's own red/
   tan) on the mark, a small-caps "2026" stamp, and a 1px hairline. Note text
   stays ink, so the accent reads as a proofreader's pencil, never a fill. */
.errata-year {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-right: 0.35em;
}

/* Lettered errata sidenotes: a separate counter (a, b, c) in the accent, so a
   reader tells "2020 me" (1, 2, 3) from "2026 me" at the anchor. */
.errata-number { counter-increment: errata-counter; cursor: pointer; }
.errata-number::after {
  content: counter(errata-counter, lower-alpha);
  color: var(--accent);
  font-size: 0.72em;
  line-height: 0;
  vertical-align: super;
  padding-left: 0.08em;
}
.sidenote.errata::before {
  content: counter(errata-counter, lower-alpha) "\00a0";
  color: var(--accent);
}
/* The hairline the original notes don't have. */
.sidenote.errata, .marginnote.errata { border-left: 1px solid var(--rule); padding-left: 0.6rem; }

/* Verdicts are words, not colours (held / partly / missed): no traffic lights. */
.verdict-word {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-right: 0.3em;
}

/* One-word correction: the old word struck in muted ink, the fix in the accent. */
del.errata { color: var(--ink-muted); text-decoration: line-through; text-decoration-color: var(--ink-muted); }
ins.errata { text-decoration: none; color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Status line under the post date: framed by two hairlines, smaller type, always
   visible (it's the warning). Rendered from front matter, inside the text column. */
aside.errata-status {
  max-width: var(--measure);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin: 0 0 2.5rem;
  padding: 0.5rem 0;
  font-size: var(--step--1);
  line-height: var(--leading-note);
  color: var(--ink);
}
aside.errata-status p { margin: 0; text-wrap: pretty; }
.errata-label { font-variant-caps: all-small-caps; letter-spacing: 0.06em; color: var(--accent); }
.errata-label::after { content: " · "; color: var(--ink-muted); }

/* "How I'd do this today": a long modern (code) replacement, collapsed on every
   screen so it never swamps the old post. */
details.errata-today {
  max-width: var(--measure);
  border-left: 2px solid var(--rule);
  padding-left: 1rem;
  margin: 2rem 0;
}
details.errata-today summary {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  cursor: pointer;
}
details.errata-today[open] summary { margin-bottom: 0.6rem; }

/* Scorecard: a heading, a word-sized dot tally, then a normal table. */
.scorecard { margin: 2.5rem 0; }
.scorecard-tally { font-variant-caps: all-small-caps; letter-spacing: 0.05em; color: var(--ink-muted); }
.scorecard-tally .dots { letter-spacing: 0.15em; color: var(--accent); font-variant-caps: normal; }

/* Index status label: a muted small-caps word after the title, no pill or colour. */
#TOC .post-status {
  font-variant-caps: all-small-caps;
  font-size: 0.75em;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin-left: 0.6em;
  white-space: nowrap;
}

/* ---------- Index spacing ---------- */
/* Trim the airy masthead→subtitle gap (was ~2rem of top padding). */
.index { padding-top: 1.4rem; }
/* Index lists carry no vertical margin, so the heading margins above fully
   control the rhythm — no list margin adds on top of them. */
.index ol { margin: 0; }
/* The subtitle already sets the ~1.2rem gap down to "Front matter". */
.front-matter h2 { margin-top: 0; }

/* ---------- Index TOC ---------- */
#TOC ol { list-style: none; padding-left: 0; }
#TOC li { display: grid; grid-template-columns: 4.5rem auto; gap: 0.5rem; }
/* Posts within a year: compact, just a hair on top of the line-height. */
#TOC li + li { margin-top: 0.25rem; }
#TOC time {
  color: var(--ink-muted);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.04em;
  font-size: 0.85em;
}
.front-matter ol { list-style: none; padding-left: 0; }

/* ---------- Embeds ---------- */
.iframe-wrapper { position: relative; aspect-ratio: 16 / 9; }
.iframe-wrapper iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- Figure system (viz style spec §3) ---------- */
/* Numbered figures with a small-caps label, an italic caption and a source
   line. Three sizes: main (margin caption at ≥62rem), margin (floats into the
   margin) and full (text + margin width). The figcaption is first in the DOM
   for reading order; `order` then places it in the margin or under the figure. */
figure.main, figure.margin, figure.full { display: flex; flex-direction: column; position: relative; }
figure.main > figcaption, figure.margin > figcaption, figure.full > figcaption { order: 2; float: none; }
figure.main > figcaption, figure.full > figcaption { margin-top: 0.5rem; }
figure.margin > figcaption { margin-top: 0.3rem; }
figure.full { max-width: none; }
figure.full > figcaption { max-width: var(--measure); }
figure.main > .viz-wrap, figure.full > .viz-wrap, figure .hscroll { order: 0; }
.fig-label { color: var(--ink); margin-right: 0.35em; font-variant-caps: all-small-caps; letter-spacing: 0.06em; }
.fig-text { font-style: italic; }
.fig-source { display: block; margin-top: 0.35em; color: var(--ink-muted); }
.fig-source .sc { font-variant-caps: all-small-caps; letter-spacing: 0.06em; }
.fig-ref { text-decoration-color: var(--link-line); }
@media (min-width: 62rem) {
  figure.main > figcaption {
    position: absolute; top: 0; left: calc(100% + var(--note-gap));
    width: var(--note-w); margin: 0; order: 0;
  }
  figure.margin {
    float: right; clear: right; width: var(--note-w); max-width: none;
    margin: 0.3rem calc(-1 * (var(--note-w) + var(--note-gap))) 1rem 0;
  }
}
@media (max-width: 61.99rem) { figure.margin { max-width: 22rem; } }

/* The collapsed data table every chart figure ships (spec §3.4). */
details.data { order: 3; font-size: 0.8rem; color: var(--ink-muted); margin-top: 0.6rem; }
details.data summary { cursor: pointer; font-variant-caps: all-small-caps; letter-spacing: 0.06em; }
details.data table { font-size: 0.85rem; }
details.data td.num, details.data th.num { text-align: right; }

/* ---------- Charts: house style, all colour via tokens (spec §2, §6) ---------- */
/* Narrow-screen variant: main charts ship a 680-wide and a 360-wide SVG; show
   whichever keeps the label text from shrinking below ~10px. */
.viz-wrap .viz-narrow { display: none; }
@media (max-width: 44rem) {
  .viz-wrap .viz-wide { display: none; }
  .viz-wrap .viz-narrow { display: block; }
}
.hscroll { overflow-x: auto; max-width: 100%; }
.hscroll svg.viz { min-width: 40rem; }

svg.viz { display: block; width: 100%; height: auto; overflow: visible; }
.viz text { font-family: var(--font-serif-lf); font-size: 13px; fill: var(--ink-muted); }
.viz-sm text { font-size: 12px; }
.viz .axis-title { font-family: var(--font-serif); font-variant-caps: all-small-caps; letter-spacing: 0.06em; font-size: 13px; }
.viz .tick { font-variant-numeric: lining-nums tabular-nums; }
.viz .label { fill: var(--ink); }
.viz .label-hl { fill: var(--ink); font-weight: 700; }
.viz .value { fill: var(--ink); }
.viz .note { font-family: var(--font-serif); font-style: italic; fill: var(--ink-muted); }
.viz .sub { font-size: 9px; }
.viz .grid { stroke: var(--rule); stroke-width: 1; shape-rendering: crispEdges; }
.viz .axis { stroke: var(--ink-soft); stroke-width: 1; shape-rendering: crispEdges; }
.viz .ref { stroke: var(--ink-soft); stroke-width: 1; }
.viz .ctx { fill: none; stroke: var(--ink-soft); stroke-width: 0.75; stroke-opacity: 0.55; stroke-linejoin: round; }
.viz .ctx.dotted { stroke-width: 1.25; stroke-opacity: 0.8; stroke-dasharray: 0.5 3; stroke-linecap: round; }
.viz .focus { fill: none; stroke: var(--ink); stroke-width: 1.25; stroke-linejoin: round; stroke-linecap: round; }
.viz .hl { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz .wash { fill: var(--wash); stroke: none; }
.viz .dot { fill: var(--ink); stroke: var(--paper); stroke-width: 2; paint-order: stroke; }
.viz .dot-hl { fill: var(--accent); stroke: var(--paper); stroke-width: 2; paint-order: stroke; }
.viz path:hover, .viz circle:hover { stroke-opacity: 1; }

/* Dark mode dims photos only — never screenshots, charts or diagrams, whose
   colours are evidence (see the viz style spec §4.1). A blanket `img` filter
   used to grey out the screenshots and chart PNGs too. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) figure.photo img,
  :root:not([data-theme="light"]) img.photo { filter: brightness(0.88) contrast(1.04); }
}
:root[data-theme="dark"] figure.photo img,
:root[data-theme="dark"] img.photo { filter: brightness(0.88) contrast(1.04); }
