/* ============================================================================
   segfault.sh  —  a monochrome terminal/disassembler theme
   Hand-written. No framework. Edit freely.
   ========================================================================= */

/* ---- font ---------------------------------------------------------------- */
@font-face {
  font-family: 'vga';
  src: url('/assets/vga.woff2') format('woff2');
  font-display: swap;
}

/* ---- tokens -------------------------------------------------------------- */
:root {
  --void:  #060606;   /* background            */
  --panel: #0b0b0b;   /* raised surfaces       */
  --ghost: #161616;   /* hover fill            */
  --line:  #1f1f1f;   /* faint dividers        */
  --faint: #383838;   /* borders / rules       */
  --dim:   #8c8c8c;   /* secondary text        */
  --ink:   #e7e7e7;   /* primary text          */
  --paper: #f3f3f3;   /* inverse foreground    */

  /* monochrome by default; build.py overrides --accent from site.json */
  --accent: var(--ink);

  --font-vga:  'vga', ui-monospace, monospace;
  --font-mono: ui-monospace, 'Cascadia Code', 'JetBrains Mono', 'SF Mono',
               'SFMono-Regular', Menlo, Consolas, 'DejaVu Sans Mono', monospace;

  --measure: 74ch;
  --frame:   880px;
}

/* light / inverse-video mode (a real terminal "light" theme = swap fg/bg) */
html[data-mode="light"] {
  --void:  #f3f3f3;
  --panel: #eaeaea;
  --ghost: #dedede;
  --line:  #d2d2d2;
  --faint: #9a9a9a;
  --dim:   #555;
  --ink:   #111;
  --paper: #060606;
}

/* ---- reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--void);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}
::selection { background: var(--paper); color: var(--void); }
img { max-width: 100%; height: auto; }

a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--faint); }
a:hover { color: var(--void); background: var(--accent); border-color: var(--accent); }
a:focus-visible,
button:focus-visible,
.row a:focus-visible { outline: none; }   /* the row highlights via :focus-within instead */

/* ---- page frame ---------------------------------------------------------- */
.wrap { max-width: var(--frame); margin: 0 auto; padding: 34px 18px 64px; }

.frame { position: relative; border: 1px solid var(--faint); background: var(--void); }
.frame__legend, .frame__addr {
  position: absolute; top: -0.72em;
  background: var(--void); padding: 0 8px;
  font-family: var(--font-vga); font-size: 13px; color: var(--dim);
  letter-spacing: .02em; white-space: nowrap;
}
.frame__legend { left: 16px; }
.frame__addr   { right: 16px; }
.frame__legend a { border: 0; color: var(--ink); }
.frame__legend a:hover { background: var(--accent); color: var(--void); }

/* ---- top bar / nav ------------------------------------------------------- */
.bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.bar__prompt { font-family: var(--font-vga); color: var(--dim); }
.bar__prompt b { color: var(--ink); font-weight: normal; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.nav a {
  border: 0; padding: 2px 9px; color: var(--dim);
  font-family: var(--font-vga); font-size: 13px; letter-spacing: .03em;
}
.nav a:hover { background: var(--accent); color: var(--void); }
.nav a[aria-current="page"] { color: var(--ink); }
/* the active item's color rule has the same specificity as :hover and comes
   later, so without this it kept light text on the light hover fill (unreadable) */
.nav a[aria-current="page"]:hover { color: var(--void); }
.nav a[aria-current="page"]::before { content: "["; color: var(--faint); }
.nav a[aria-current="page"]::after  { content: "]"; color: var(--faint); }

.searchbtn {
  font-family: var(--font-vga); font-size: 13px; cursor: pointer;
  background: transparent; color: var(--dim);
  border: 1px solid var(--faint); padding: 2px 10px;
}
.searchbtn:hover { background: var(--accent); color: var(--void); border-color: var(--accent); }
.searchbtn kbd {
  font-family: var(--font-mono); background: var(--ghost);
  border: 1px solid var(--faint); border-radius: 2px; padding: 0 4px; margin-left: 6px;
}

/* ---- body region --------------------------------------------------------- */
.main { padding: 26px 22px 30px; }

/* ---- hero (home) --------------------------------------------------------- */
.hero { margin-bottom: 8px; }
.hero__handle {
  font-family: var(--font-vga); font-size: 40px; line-height: 1.05;
  margin: 0 0 6px; letter-spacing: .02em;
}
.hero__handle .cursor {
  display: inline-block; width: .55em; height: 1em; margin-left: .08em;
  background: var(--accent); vertical-align: -0.12em; animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.hero__tagline { color: var(--dim); font-size: 13px; font-family: var(--font-vga);
  letter-spacing: .04em; margin: 0 0 16px; }
.hero__bio { max-width: var(--measure); color: var(--ink); margin: 0 0 22px; }

.cmd { color: var(--dim); margin: 26px 0 12px; font-size: 14px; }
.cmd .sigil { color: var(--accent); }
.cmd .typed { border-right: .5em solid transparent; }

/* ---- post listing (ls -t) ------------------------------------------------ */
.listing { display: flex; flex-direction: column; }
.row {
  position: relative;          /* anchor for the stretched title link */
  display: grid; grid-template-columns: 6.6em 5.2em 1fr auto;
  gap: 14px; align-items: baseline;
  padding: 7px 10px; border: 0; color: var(--ink);
  border-top: 1px solid var(--line);
}
.row:last-child { border-bottom: 1px solid var(--line); }
.row:hover, .row.is-active, .row:focus-within { background: var(--accent); color: var(--void); }
.row:hover *, .row.is-active *, .row:focus-within * { color: var(--void) !important; }
.row__date { color: var(--dim); font-variant-numeric: tabular-nums; font-size: 13px; }
/* tag is its own link, sitting above the stretched title link so it stays clickable */
.row__tag  { color: var(--dim); font-size: 13px; border: 0; position: relative; z-index: 1; }
a.row__tag:hover { text-decoration: underline; }
/* the title link stretches over the whole row -> the whole row opens the post */
.row__title { font-weight: 600; color: var(--ink); border: 0; }
.row__title::after { content: ""; position: absolute; inset: 0; }
.row__min  { color: var(--dim); font-size: 13px; white-space: nowrap; }
.row__title .draft { color: var(--accent); font-size: 11px; border: 1px solid currentColor;
  padding: 0 4px; margin-left: 8px; vertical-align: 1px; }

/* ---- generic prose (post body) ------------------------------------------- */
.prose { max-width: var(--measure); }
.prose > * + * { margin-top: 1.05em; }
.prose h1, .prose h2, .prose h3, .prose h4 {
  font-family: var(--font-vga); font-weight: normal; line-height: 1.2;
  margin-top: 1.8em; letter-spacing: .01em; scroll-margin-top: 18px;
}
.prose h1 { font-size: 30px; }
.prose h2 { font-size: 21px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.prose h3 { font-size: 17px; color: var(--ink); }
.prose h4 { font-size: 15px; color: var(--dim); }
.prose h2 .headerlink, .prose h3 .headerlink {
  border: 0; color: var(--faint); margin-left: .4em; opacity: 0; font-size: .8em;
}
.prose h2:hover .headerlink, .prose h3:hover .headerlink { opacity: 1; }
.prose p, .prose li { color: var(--ink); }
.prose strong { color: var(--ink); font-weight: 700; }
.prose em { font-style: italic; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin-top: .3em; }
.prose ul > li::marker { content: "\2013  "; color: var(--dim); }
.prose hr { border: 0; border-top: 1px solid var(--faint); margin: 2.2em 0; }
.prose blockquote {
  border-left: 2px solid var(--faint); margin: 0; padding: 2px 0 2px 16px; color: var(--dim);
}
.prose a { color: var(--ink); border-bottom: 1px solid var(--faint); }
.prose a:hover { background: var(--accent); color: var(--void); }
.prose a.ext::after { content: " \2197"; color: var(--dim); font-size: .85em; }

/* tables */
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.prose thead th { font-family: var(--font-vga); font-weight: normal; color: var(--dim);
  border-bottom: 1px solid var(--faint); }
/* only real content tables; the Pygments listing also renders a <tbody><tr>,
   and in light mode --ghost (#dedede) behind light-on-dark code is unreadable */
.prose table:not(.highlighttable) tbody tr:hover { background: var(--ghost); }

/* inline code */
.prose :not(pre) > code {
  font-family: var(--font-mono); font-size: .9em;
  background: var(--ghost); border: 1px solid var(--line);
  padding: 0 5px; border-radius: 2px; color: var(--ink);
}

/* footnotes */
.footnote { font-size: 13px; color: var(--dim); }
.prose .footnote-ref a, .prose a.footnote-backref { border: 0; }
.prose .footnote { border-top: 1px solid var(--line); margin-top: 2.4em; padding-top: 14px; }
/* the footnotes extension emits its own <hr> inside .footnote; we already draw a
   border-top, so the two stacked into a weird double rule. Hide the extra one. */
.prose .footnote > hr { display: none; }

/* ---- code listings (the signature) --------------------------------------- *
 * Listings are pinned to literal dark values in EVERY theme. A terminal pane
 * stays a terminal pane even when the page around it goes to paper-white. The
 * Pygments output (MonoStyle) is light-on-#0b0b0b, so these must not invert.  */
.codeblock {
  --cb-bg:    #0b0b0b;  --cb-chrome: #060606;
  --cb-line:  #1f1f1f;  --cb-faint:  #383838;
  --cb-dim:   #8c8c8c;  --cb-ink:    #e7e7e7;  --cb-accent: #e7e7e7;
  margin: 1.4em 0; border: 1px solid var(--cb-faint); background: var(--cb-bg);
}
.codeblock figcaption {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 10px; border-bottom: 1px solid var(--cb-faint);
  font-family: var(--font-vga); font-size: 12px; color: var(--cb-dim);
  background: var(--cb-chrome);
}
.codeblock .fname { color: var(--cb-ink); }
.codeblock .lang  { margin-left: auto; text-transform: uppercase; letter-spacing: .08em; }
/* both caption buttons share one fixed height + border-box, so they line up to
   the pixel regardless of their different fonts/contents. */
.codeblock .copy, .codeblock .nums {
  display: inline-flex; align-items: center; justify-content: center;
  height: 18px; box-sizing: border-box; padding: 0 8px;
  border: 1px solid var(--cb-faint); background: transparent; color: var(--cb-dim);
  font-family: var(--font-vga); font-size: 11px; cursor: pointer;
}
.codeblock .copy:hover, .codeblock .nums:hover {
  background: var(--cb-accent); color: var(--cb-bg); border-color: var(--cb-accent); }
.codeblock .copy.done { color: var(--cb-ink); border-color: var(--cb-ink); }
/* the '#' toggle uses the mono font (the VGA '#' renders as a dense blob here).
   the two buttons sit in a tight pair via .capbtns; dims when numbers are off. */
.codeblock .capbtns { display: inline-flex; align-items: center; gap: 6px; }
.codeblock .nums { min-width: 20px; padding: 0 6px;
  font-family: var(--font-mono); font-size: 13px; line-height: 1; }
.codeblock .nums[aria-pressed="false"] { color: var(--cb-faint); border-color: var(--cb-line); }

/* pygments emits a linenumber table; style the gutter like a disassembly listing.
   the background stack is a right-edge scroll-shadow (pure CSS): a cover that
   scrolls with the content (background-attachment: local) sits over a shadow
   fixed to the pane (scroll) — so the fade only shows while there's more to the
   right. Same trick on the hexdump pane below. */
.codeblock .highlight, .hexdump .hx {
  overflow-x: auto;
  background:
    linear-gradient(to left, var(--cb-bg) 55%, transparent) 100% 0 / 44px 100% no-repeat,
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.5), transparent) 100% 0 / 22px 100% no-repeat;
  background-attachment: local, scroll;
  background-color: var(--cb-bg);
  /* a thin monochrome scrollbar that belongs to the dark pane, instead of the
     default OS-grey bar. scoped to these panes only — the page scroll is left to
     the OS. colours come from the pinned-dark --cb-* tokens, so it stays dark in
     light mode too (the listings do). standard props for firefox + new chrome. */
  scrollbar-width: thin;
  scrollbar-color: var(--cb-faint) transparent;
}
.codeblock .highlight::-webkit-scrollbar, .hexdump .hx::-webkit-scrollbar { height: 12px; }
.codeblock .highlight::-webkit-scrollbar-track, .hexdump .hx::-webkit-scrollbar-track {
  background: transparent; }
.codeblock .highlight::-webkit-scrollbar-thumb, .hexdump .hx::-webkit-scrollbar-thumb {
  background-color: var(--cb-faint); border: 3px solid transparent; background-clip: padding-box; }
.codeblock .highlight:hover::-webkit-scrollbar-thumb, .hexdump .hx:hover::-webkit-scrollbar-thumb {
  background-color: var(--cb-dim); }
.codeblock .highlight pre { margin: 0; padding: 12px 0; background: transparent; }
/* a hand-rolled listing (the about-page `whoami`) is a bare <div class="highlight">
   <pre> with no linenos table, so it misses the td.code 0-14px inset and the text
   sits flush on the border. Pad the direct-child <pre>; Pygments' <pre> nests
   deeper (td.code > div > pre) so it's untouched. */
.codeblock .highlight > pre { padding: 12px 14px; }
.codeblock table.highlighttable { border-collapse: collapse; width: 100%; }
.codeblock td.linenos {
  width: 1%; white-space: nowrap; text-align: right; vertical-align: top;
  padding: 12px 12px 12px 14px; color: var(--cb-faint);
  border-right: 1px solid var(--cb-line); user-select: none;
}
.codeblock td.linenos pre { padding: 0; }
.codeblock td.code { padding: 0 14px; vertical-align: top; }
.codeblock td.code pre { padding: 12px 0; }
.codeblock code { font-family: var(--font-mono); font-size: 13.5px; line-height: 1.55; }
/* the gutter is a separate <pre> with no <code>; pin it to the SAME font metrics
   as the code or the two columns drift and the numbers run out before the code
   ends. (Higher specificity than pygments' `.codeblock .highlight pre { 125% }`.) */
.codeblock td.linenos, .codeblock td.linenos pre {
  font-family: var(--font-mono); font-size: 13.5px; line-height: 1.55;
}
.codeblock .hll { background: #161616; display: block; } /* highlighted line */

/* line-number gutter toggle: the caption '#' button hides this one listing's
   gutter to reclaim horizontal width (per-listing, resets on reload). Only the
   column is hidden — each code line keeps its #prefix-N <span id>, so inbound
   permalinks still resolve. */
.codeblock.nonums td.linenos { display: none; }

/* line-number permalinks: each gutter number links to #prefix-N, each code line
   is a <span id="prefix-N"> we light up on :target */
.codeblock td.linenos a { color: inherit; border: 0; text-decoration: none; }
.codeblock td.linenos a:hover { color: var(--cb-ink); background: transparent; }
.codeblock .highlight code > span[id] { scroll-margin-top: 80px; }
.codeblock .highlight code > span[id]:target {
  display: block; background: #20242a; box-shadow: inset 2px 0 0 var(--cb-ink);
}

/* diff fences: pygments already greys deleted / brightens inserted; add the
   line tint + a +/- gutter bar (:has on the linespan picks the whole line) */
.codeblock .highlight code > span[id]:has(> .gd) {
  display: block; background: rgba(140,140,140,.07); box-shadow: inset 2px 0 0 var(--cb-faint); }
.codeblock .highlight code > span[id]:has(> .gi) {
  display: block; background: rgba(231,231,231,.08); box-shadow: inset 2px 0 0 var(--cb-ink); }
/* inset every diff line so the +/- marker clears the 2px gutter bar instead of
   sitting on top of it. padding all lines (changed AND context) keeps the marker
   column aligned; the bar stays pinned at the line's left edge. */
.codeblock--diff .highlight code > span[id] { padding-left: 7px; }

/* hexdump pane (```hexdump``` — chrome inherited from .codeblock) */
.hexdump pre { margin: 0; padding: 12px 14px; font-family: var(--font-mono);
  font-size: 13px; line-height: 1.55; color: var(--cb-ink); white-space: pre; }
.hexdump .off { color: var(--cb-faint); }
.hexdump .asc { color: var(--cb-dim); }
.hexdump mark { background: var(--cb-ink); color: var(--cb-bg); }  /* inverse-video byte */

/* asciinema cast (```cast``` -> greyscaled animated SVG; pinned dark) */
.cast { border: 1px solid var(--faint); background: #0b0b0b; margin: 1.4em 0; }
.cast figcaption {
  display: flex; align-items: center; gap: 10px; padding: 5px 10px;
  border-bottom: 1px solid var(--faint); background: #060606;
  font-family: var(--font-vga); font-size: 12px; color: #8c8c8c;
}
.cast figcaption .fname { color: #e7e7e7; }
.cast figcaption .lang { margin-left: auto; text-transform: uppercase; letter-spacing: .08em; }
.cast__svg { overflow-x: auto; padding: 8px; }
.cast__svg svg { display: block; max-width: 100%; height: auto; }
.cast--missing .cast__note { padding: 12px 14px; color: var(--dim);
  font-family: var(--font-mono); font-size: 13px; }

/* standalone pre without our wrapper (defensive) */
.prose > pre { border: 1px solid var(--faint); background: var(--panel);
  padding: 12px 14px; overflow-x: auto; font-size: 13.5px; }

/* ---- target / checksec panel (```target fence```) ------------------------ *
 * Our own markup (unlike the light-on-dark Pygments listings), so it uses the
 * theme tokens and reads correctly in both modes.                            */
.target { border: 1px solid var(--faint); background: var(--panel); margin: 1.4em 0; }
.target figcaption {
  display: flex; align-items: baseline; gap: 10px; padding: 7px 14px;
  border-bottom: 1px solid var(--faint); font-family: var(--font-vga); font-size: 12px;
}
.target .t-label { color: var(--dim); text-transform: uppercase; letter-spacing: .08em; }
.target .t-label::before { content: "// "; color: var(--accent); }
.target .t-file { color: var(--ink); }
.target__grid {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  font-size: 13px; line-height: 1.5;
}
.target__grid--solo { grid-template-columns: 1fr; }   /* facts-only: use full width */
.target__facts, .target__mits { padding: 11px 16px; margin: 0; }
.target__facts + .target__mits { border-left: 1px solid var(--line); }  /* split-view divider */
@media (max-width: 600px) {
  .target__grid { grid-template-columns: 1fr; }
  .target__facts + .target__mits { border-left: 0; border-top: 1px solid var(--line); }
}
/* facts: aligned key / value */
.target__facts > div { display: flex; gap: 12px; padding: 2.5px 0; }
.target__facts dt { color: var(--dim); flex: none; min-width: 5em; }
.target__facts dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
/* mitigations: glyph · name ·····dotted leader····· value */
.target__mits { list-style: none; }
.target__mits li { display: flex; align-items: center; padding: 2.5px 0; }
.target__mits .g  { flex: none; width: 1.3em; text-align: center;
  font-family: var(--font-mono); }
.target__mits .mk { flex: none; color: var(--ink); }
.target__mits .lead { flex: 1 1 auto; min-width: 12px; margin: 0 9px;
  border-bottom: 1px dotted var(--faint); }
.target__mits .mv { flex: none; font-family: var(--font-vga); font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em; }
/* enabled mitigations sit back in grey; the disabled ones — the way in — pop */
.target__mits li.m-on  .g, .target__mits li.m-on  .mv  { color: var(--dim); }
.target__mits li.m-on  .lead { border-bottom-color: var(--line); }
.target__mits li.m-off .g, .target__mits li.m-off .mv  { color: var(--ink); }
.target__mits li.m-off .mv { font-weight: 700; }
.target__mits li.m-meh .g, .target__mits li.m-meh .mv  { color: var(--ink); }

/* ---- admonitions / callouts ---------------------------------------------- */
.admonition {
  border: 1px solid var(--faint); border-left-width: 3px;
  padding: 10px 14px; margin: 1.4em 0; background: var(--panel);
}
.admonition-title {
  font-family: var(--font-vga); font-size: 12px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--dim); margin: 0 0 6px;
}
.admonition-title::before { content: "// "; color: var(--accent); }
.admonition.warning, .admonition.danger { border-left-color: var(--ink); }
.admonition > p { margin: 0; }
.admonition > p + p { margin-top: .6em; }

/* ---- post layout: article + sticky TOC sidebar --------------------------- */
.postwrap.has-toc {
  display: grid; grid-template-columns: minmax(0, 1fr) 13.5em;
  gap: 32px; align-items: start;
}
.postwrap.has-toc .prose { grid-column: 1; grid-row: 1; }
.postwrap.has-toc .toc   { grid-column: 2; grid-row: 1; }

/* ---- table of contents (sticky sidebar, scroll-spy) ---------------------- */
aside.toc {
  position: sticky; top: 22px; align-self: start;
  max-height: calc(100vh - 44px); overflow-y: auto;
  border-left: 1px solid var(--line); padding-left: 16px;
  font-size: 12.5px; line-height: 1.55;
}
aside.toc .toctitle {
  display: block; font-family: var(--font-vga); color: var(--dim); font-size: 11px;
  letter-spacing: .08em; text-transform: uppercase; margin-bottom: 10px;
}
aside.toc .toc { border: 0; padding: 0; background: transparent; }  /* inner md div.toc */
.toc ul { list-style: none; margin: 0; padding-left: 0; }
.toc ul ul { padding-left: 12px; }
.toc li { margin: 3px 0; }
.toc a {
  display: block; border: 0; color: var(--dim);
  position: relative; padding: 1px 0 1px 14px;
}
.toc a:hover { color: var(--ink); background: transparent; }
.toc a.active { color: var(--ink); }
.toc a.active::before { content: "\25B8"; position: absolute; left: 0; top: 1px; color: var(--accent); }

/* ---- related posts ------------------------------------------------------- */
/* no section border-top: the reused .listing rows already cap themselves with a
   top rule (first row) and bottom rule (last row), so an extra line here would
   just sandwich the "// related" label between two rules. */
.related { margin-top: 40px; }
.related__title {
  font-family: var(--font-vga); font-size: 12px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--dim);
}
.related__title::before { content: "// "; color: var(--accent); }
.related .listing { margin-top: 10px; }

/* ---- series box (post in a multi-part series) ----------------------------- */
/* uses theme tokens, so it adapts to light mode (unlike the pinned-dark code). */
.series { border: 1px solid var(--line); padding: 12px 14px; margin: 0 0 26px; font-size: 14px; }
.series__head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.series__label { font-family: var(--font-vga); font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--dim); }
.series__label::before { content: "// "; color: var(--accent); }
.series__name { color: var(--ink); border: 0; }
.series__name:hover { color: var(--accent); text-decoration: underline; }
.series__pos { margin-left: auto; font-size: 12px; color: var(--dim);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
/* a 1px progress bar: how far through the series this part is */
.series__bar { height: 2px; background: var(--line); margin: 0 0 11px; }
.series__bar span { display: block; height: 100%; background: var(--accent); }
/* the box lists EVERY part — it's a table of contents, so it shouldn't truncate.
   numbers come from a CSS counter (not native <ol> markers) so they're right-
   aligned and two-digit parts line up cleanly. */
.series__list { margin: 0; padding-left: 0; color: var(--dim); list-style: none;
  counter-reset: sx; }
.series--long .series__list { column-count: 2; column-gap: 2.4em; }   /* long series: 2 columns */
/* flex row: the number is a fixed-width gutter and the title wraps in its own
   column, so a wrapped title hangs under the title — not under the number. */
.series__list li { counter-increment: sx; margin: 3px 0; padding-left: 7px;
  break-inside: avoid; display: flex; align-items: baseline; }
.series__list li::before { content: counter(sx) "."; flex: 0 0 1.9em;
  margin-right: .6em; text-align: right; color: var(--dim); }
.series__list li.cur { color: var(--ink); font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent); }   /* "you are here" accent bar */
.series__list li.cur::before { color: var(--accent); }
/* no resting underline on part links — a 14-row stack of underlines is noisy; the
   accent-inverse hover still signals they're links. */
.series__list a { border-bottom: 0; }

/* ---- collapsible details / spoiler flag blocks --------------------------- */
.prose details {
  border: 1px solid var(--faint); border-left-width: 3px;
  background: var(--panel); margin: 1.4em 0; padding: 0 14px;
}
.prose details > summary {
  margin: 0 -14px; padding: 10px 14px; cursor: pointer; list-style: none;
  font-family: var(--font-vga); font-size: 12px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--dim); user-select: none;
}
.prose details > summary::-webkit-details-marker { display: none; }
.prose details > summary::before { content: "\25B8  "; color: var(--accent); }
.prose details[open] > summary::before { content: "\25BE  "; }
.prose details > summary:hover { color: var(--ink); }
.prose details[open] > summary { margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.prose details > *:not(summary) { margin-top: .7em; }
.prose details[open] > *:last-child { margin-bottom: 12px; }
.prose details.spoiler > summary::after {
  content: "  // click to reveal"; color: var(--faint);
  text-transform: none; letter-spacing: 0;
}
.prose details.spoiler[open] > summary::after { content: ""; }

/* ---- post header / meta -------------------------------------------------- */
.posthead { margin-bottom: 26px; }
.posthead h1 { font-family: var(--font-vga); font-weight: normal; font-size: 32px;
  line-height: 1.15; margin: 0 0 10px; }
.meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--dim); font-size: 13px;
  font-family: var(--font-vga); letter-spacing: .02em; }
.meta .tag { border: 0; color: var(--dim); }
.meta .tag::before { content: "#"; color: var(--faint); }
.meta .tag:hover { color: var(--void); background: var(--accent); }

.backlink { display: inline-block; margin-bottom: 18px; border: 0; color: var(--dim);
  font-family: var(--font-vga); font-size: 13px; }
.backlink:hover { color: var(--void); background: var(--accent); }
.backlink::before { content: "\2039 "; }

/* prev / next */
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 40px;
  padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; }
.pager a { border: 0; color: var(--dim); max-width: 46%; }
.pager a:hover { color: var(--void); background: var(--accent); }
.pager .next { margin-left: auto; text-align: right; }
.pager .lbl { display: block; color: var(--dim); font-family: var(--font-vga); font-size: 11px; }

/* numbered index pager (overrides the space-between flex of .pager) */
.pager--num { justify-content: center; align-items: baseline; gap: 4px; }
.pager--num a, .pager--num span { border: 0; max-width: none; color: var(--dim);
  min-width: 1.9em; text-align: center; padding: 2px 7px; }
.pager--num a:hover { color: var(--void); background: var(--accent); }
.pager--num .pg[aria-current="page"] { color: var(--void); background: var(--accent); }
.pager--num .off, .pager--num .gap { color: var(--faint); }
.pager--num .next { margin-left: 0; }

/* ---- tag index ----------------------------------------------------------- */
.tagcloud { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tagcloud a { border: 1px solid var(--faint); padding: 3px 10px; color: var(--ink);
  font-family: var(--font-vga); font-size: 13px; }
.tagcloud a:hover { background: var(--accent); color: var(--void); border-color: var(--accent); }
.tagcloud .n { color: var(--dim); }
.tagcloud a:hover .n { color: var(--void); }

/* ---- footer / status bar ------------------------------------------------- */
.status {
  display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
  padding: 12px 16px; border-top: 1px solid var(--line);
  font-family: var(--font-vga); font-size: 12px; color: var(--dim);
}
.status .shade { letter-spacing: -1px; color: var(--faint); }
.status .right { margin-left: auto; display: flex; gap: 14px; flex-wrap: wrap; }
.status a { border: 0; color: var(--dim); }
.status a:hover { color: var(--void); background: var(--accent); }
.toggle { background: transparent; border: 0; color: var(--dim); cursor: pointer;
  font-family: var(--font-vga); font-size: 12px; }
.toggle:hover { color: var(--void); background: var(--accent); }

/* ---- command palette (fzf) ----------------------------------------------- */
.palette-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.62);
  display: none; align-items: flex-start; justify-content: center; z-index: 50;
  padding: 11vh 16px 16px; backdrop-filter: blur(1px);
}
.palette-mask.open { display: flex; }
.palette {
  width: 100%; max-width: 660px; background: var(--void);
  border: 1px solid var(--faint); box-shadow: 0 0 0 9999px rgba(0,0,0,.0);
  display: flex; flex-direction: column; max-height: 72vh;
}
.palette__count {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px;
  border-bottom: 1px solid var(--line); color: var(--dim);
  font-family: var(--font-vga); font-size: 12px;
}
.palette__count .rule { flex: 1; height: 0; border-top: 1px solid var(--line); }
.palette__input { display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-bottom: 1px solid var(--faint); }
.palette__input .sigil { color: var(--accent); font-family: var(--font-vga); }
.palette__input input {
  flex: 1; background: transparent; border: 0; outline: 0;
  color: var(--ink); font-family: var(--font-mono); font-size: 15px;
}
.palette__results { overflow-y: auto; }
.presult {
  display: block; padding: 7px 12px 7px 26px; position: relative; border: 0;
  color: var(--ink); cursor: pointer;
}
.presult[aria-selected="true"] { background: var(--accent); color: var(--void); }
.presult[aria-selected="true"] * { color: var(--void) !important; }
.presult[aria-selected="true"]::before {
  content: "\258C"; position: absolute; left: 9px; color: var(--void);
}
.presult .pt { font-weight: 600; }
.presult .pt mark { background: transparent; color: var(--ink); text-decoration: underline;
  text-underline-offset: 2px; font-weight: 800; }
.presult .pmeta { color: var(--dim); font-size: 12px; font-family: var(--font-vga); margin-left: 8px; }
.presult .psnip { display: block; color: var(--dim); font-size: 12.5px; margin-top: 2px; }
.presult .psnip mark { background: var(--paper); color: var(--void); }
.palette__hint { padding: 6px 12px; border-top: 1px solid var(--line); color: var(--faint);
  font-family: var(--font-vga); font-size: 11px; display: flex; gap: 14px; flex-wrap: wrap; }
.palette__hint kbd { color: var(--dim); }
.palette__empty { padding: 18px 12px; color: var(--dim); font-size: 13px; }

/* ---- help overlay -------------------------------------------------------- */
.help-mask { position: fixed; inset: 0; background: rgba(0,0,0,.62); display: none;
  align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.help-mask.open { display: flex; }
.help { width: 100%; max-width: 440px; background: var(--void); border: 1px solid var(--faint);
  padding: 16px 18px; font-size: 13px; }
/* we move focus to the dialog for the focus-trap; it's not a control the user
   tabbed to, so suppress the browser's (blue) default focus ring on it */
.help:focus, .help:focus-visible { outline: none; }
.help h2 { font-family: var(--font-vga); font-weight: normal; margin: 0 0 12px; color: var(--dim);
  font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.help dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.help dt { font-family: var(--font-mono); color: var(--ink); }
.help dt kbd { border: 1px solid var(--faint); border-radius: 2px; padding: 0 6px;
  background: var(--ghost); }
.help dd { margin: 0; color: var(--dim); }

/* ---- 404 ----------------------------------------------------------------- */
.fourohfour { text-align: center; padding: 30px 0; }
.fourohfour pre { font-family: var(--font-vga); color: var(--dim); display: inline-block;
  text-align: left; font-size: 14px; line-height: 1.25; }

/* ---- crt (opt-in) -------------------------------------------------------- */
html[data-crt="on"] body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 9;
  background: repeating-linear-gradient(transparent 0 2px, rgba(0,0,0,.16) 2px 3px);
  mix-blend-mode: multiply;
}

/* ---- math (build-time MathML; the browser renders it, we just space it) -- */
.math { color: var(--ink); }
/* the browser's default math font is a thin serif; bump the size so glyphs — and
   especially the auto-shrunk sub/superscripts — stay legible on the dark pane. */
.math math { font-size: 1.18em; }
.math-block { margin: 1.5em 0; overflow-x: auto; overflow-y: hidden; text-align: center; }
.math-block math { display: block; }
.math .tex { font-style: italic; }   /* fallback when latex2mathml is unavailable */

/* ---- figures / images ---------------------------------------------------- */
figure.img { margin: 1.5em 0; border: 1px solid var(--line); background: var(--panel); }
figure.img img { display: block; width: 100%; height: auto; }
figure.img figcaption {
  padding: 7px 12px; border-top: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 12.5px; color: var(--dim); line-height: 1.5;
}
figure.img figcaption::before { content: "// "; color: var(--accent); font-family: var(--font-vga); }
.prose img[data-lb] { cursor: zoom-in; }   /* only zoomable once app.js binds it */

/* ---- image lightbox (built by app.js; absent without JS) ----------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 80; display: none; cursor: zoom-out;
  align-items: center; justify-content: center; padding: 24px; background: rgba(0,0,0,.92);
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 95vw; max-height: 92vh; width: auto; height: auto;
  border: 1px solid var(--faint); }
.lightbox:focus { outline: none; }

/* ---- reading progress (posts; JS-driven, absent without JS) -------------- */
.progress {
  position: fixed; top: 0; left: 0; width: 100%; height: 2px; z-index: 60;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  pointer-events: none; will-change: transform;
}

/* ---- responsive ---------------------------------------------------------- */
/* below the frame width the two-column post layout gets cramped; fold the TOC
   inline above the article as a compact bordered block */
@media (max-width: 860px) {
  .postwrap.has-toc { display: block; }
  aside.toc {
    position: static; max-height: none; overflow: visible;
    border-left: 3px solid var(--faint); padding: 10px 14px; margin-bottom: 24px;
  }
  aside.toc .toctitle { margin-bottom: 6px; }
}

@media (max-width: 620px) {
  .wrap { padding: 26px 11px 48px; }
  .frame__addr { display: none; }
  .bar { gap: 8px; padding: 12px; }
  .nav { width: 100%; margin-left: 0; order: 3; }
  .searchbtn { margin-left: auto; }
  .main { padding: 22px 14px 24px; }
  .hero__handle { font-size: 30px; }
  .row { grid-template-columns: 1fr auto; gap: 4px 10px; padding: 9px 6px; }
  .row__date { grid-column: 1; }
  .row__min { grid-column: 2; grid-row: 1; }
  .row__tag { grid-column: 1; grid-row: 2; }
  .row__title { grid-column: 1 / -1; grid-row: 3; }
  .series--long .series__list { column-count: 1; }   /* 2 columns are too narrow on a phone */
  .palette-mask { padding-top: 6vh; }
  .pager { flex-direction: column; }
  .pager--num { flex-direction: row; flex-wrap: wrap; }   /* keep page numbers on one line */
  .pager .next { text-align: left; margin-left: 0; }
  .pager a { max-width: 100%; }
}

/* ---- a11y ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.skip { position: absolute; left: -9999px; top: 0; background: var(--accent); color: var(--void);
  padding: 8px 12px; z-index: 100; border: 0; }
.skip:focus { left: 8px; top: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- print: ink on paper, chrome stripped, listings readable ------------- */
@page { margin: 1.6cm; }
@media print {
  html, body, .wrap, .frame, .main {
    background: #fff !important; color: #000 !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .progress, .bar, .frame__legend, .frame__addr, .status, .backlink, .pager,
  aside.toc, .series, .palette-mask, .help-mask, .skip, .searchbtn, .related,
  .copy, .nums, .headerlink, html[data-crt="on"] body::after { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .frame { border: 0; }
  .main { padding: 0; }
  .postwrap.has-toc { display: block; }
  .prose, .prose p, .prose li, .prose strong, .prose h1, .prose h2, .prose h3,
  .prose h4, .posthead h1, .meta { color: #000 !important; }
  .meta, .prose blockquote { color: #333 !important; }
  a { color: #000 !important; border: 0; text-decoration: underline; }
  /* show external link targets so a printed page is self-contained */
  .prose a.ext[href]::after { content: " (" attr(href) ")"; font-size: .85em; color: #444; }
  .prose h2 { border-color: #bbb !important; }
  .prose :not(pre) > code { background: #eee !important; color: #000 !important;
    border-color: #ccc !important; }
  /* invert code listings — they're light-on-dark on screen, ink-hungry on paper */
  .codeblock { --cb-bg:#fff; --cb-chrome:#f1f1f1; --cb-line:#ccc; --cb-faint:#999;
    --cb-dim:#555; --cb-ink:#000; --cb-accent:#000; border-color:#999 !important; }
  .codeblock figcaption { background:#f1f1f1 !important; color:#444 !important;
    border-color:#ccc !important; }
  .codeblock .highlight, .codeblock .highlight pre { background:#fff !important; }
  .codeblock .highlight, .codeblock .highlight * { color:#1a1a1a !important; }
  .codeblock .highlight .k, .codeblock .highlight .kt, .codeblock .highlight .kd,
  .codeblock .highlight .nf, .codeblock .highlight .nc { color:#000 !important;
    font-weight:700; }
  .codeblock .highlight .c, .codeblock .highlight .c1, .codeblock .highlight .cm {
    color:#666 !important; }
  /* drop the gutter and wrap lines so nothing is clipped off the right edge
     (a wrapped line + a separate one-number-per-line gutter would desync) */
  .codeblock td.linenos { display: none !important; }
  .codeblock td.code { padding: 12px 14px !important; }
  .codeblock td.code pre, .codeblock code {
    white-space: pre-wrap !important; overflow-wrap: anywhere; }
  .codeblock .highlight { overflow-x: visible !important; }
  .codeblock .hll, .codeblock code > span[id]:target { background:#ececec !important;
    box-shadow:none !important; }
  .target, .admonition, details { border-color:#999 !important; background:#fff !important; }
  .target figcaption, .target .t-file, .target__facts dd, .target__mits .mk,
  details > summary, .admonition-title { color:#000 !important; }
  /* panel uses --ink/--dim (light in dark mode) → invisible on paper; recolor */
  .target__mits { border-left-color:#ccc !important; }
  .target .t-label, .target .t-label::before, .target__facts dt,
  .target__mits .g, .target__mits .mv { color:#555 !important; }
  .target__mits li.m-off .g, .target__mits li.m-off .mv { color:#000 !important; }
  .target__mits .lead { border-bottom-color:#bbb !important; }
  .codeblock, .target, .admonition, details, figure, pre, blockquote,
  .prose img { break-inside: avoid; }
  .prose h2, .prose h3, .prose h4 { break-after: avoid; }
}
