/* ============================================================================
   blog.css — standalone reading theme for /blog/
   ----------------------------------------------------------------------------
   Hand-authored source (NOT generated). Derived from the Editorial
   broadsheet theme (themes/editorial/theme.css): warm paper, Fraunces
   display, terracotta accent — extracted into a focused, prose-first
   reading surface with a light/dark toggle. The blog deliberately does
   NOT participate in the homepage's 8-theme rotation; you "leave" the
   portfolio when you click through, the same way Cool Projects does.

   Colour scheme is driven by [data-scheme="light|dark"] on <html>, set
   before first paint by the inline bootstrap in each page's <head> and
   toggled at runtime by blog.js (persisted to localStorage).
   ========================================================================= */

/* ─────────────────────────── Design tokens ─────────────────────────── */
:root {
  --font-display: "Fraunces", "Tiempos Headline", Georgia, "Times New Roman", serif;
  --font-body:    "Newsreader", Georgia, "Times New Roman", serif;
  --font-ui:      "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono:    "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  --measure: 68ch;
  --pad: clamp(20px, 5vw, 56px);

  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur: 320ms;

  --radius: 6px;
}

/* Light (default) — warm broadsheet paper */
html[data-scheme="light"] {
  color-scheme: light;
  --bg:       #F8F5EE;
  --bg-2:     #F1ECE1;
  --surface:  #FFFFFF;
  --ink:      #1A1613;
  --body:     #322C25;
  --muted:    #6B5F4E;  /* 5.72:1 on --bg, 5.29:1 on --bg-2 (was #7C6E5C at a borderline 4.55:1) */
  --rule:     #E3DAC9;
  --rule-2:   #D2C6B2;
  --accent:   #C9724C;
  --accent-2: #A9542F;
  --mark-bg:  rgba(201, 114, 76, 0.14);
  --shadow:   0 1px 2px rgba(26, 22, 19, .05), 0 12px 32px rgba(26, 22, 19, .07);
}

/* Dark — warm charcoal, same terracotta family brightened */
html[data-scheme="dark"] {
  color-scheme: dark;
  --bg:       #15110D;
  --bg-2:     #1D1813;
  --surface:  #201A14;
  --ink:      #F2EBDF;
  --body:     #D8CFC0;
  --muted:    #9C8E7A;
  --rule:     #312920;
  --rule-2:   #3E3527;
  --accent:   #E0926B;
  --accent-2: #EBA984;
  --mark-bg:  rgba(224, 146, 107, 0.18);
  --shadow:   0 1px 2px rgba(0, 0, 0, .3), 0 16px 40px rgba(0, 0, 0, .45);
}

/* ───────────────────────────── Reset ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--font-body);
  font-size: 19px;
  line-height: 1.72;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

img { max-width: 100%; height: auto; }

a { color: var(--accent-2); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }

::selection { background: var(--mark-bg); }

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: var(--radius);
  z-index: 100;
  font-family: var(--font-ui);
}
.skip:focus { left: 12px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

/* Screen-reader-only utility — used for the search result live region
   and any other announce-but-don't-show text. */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Reading progress — thin accent bar pinned above the topbar on post
   pages. Width is driven by blog.js via transform: scaleX(0..1), which
   stays off the layout/paint hot path. */
.read-progress {
  position: fixed;
  top: 0; left: 0;
  z-index: 60;
  width: 100%; height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

/* ─────────────────────────── Top bar ──────────────────────────────── */
.blog-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px var(--pad);
  /* color-mix fallback for Safari ≤16.1 — without it the sticky bar
     computes no background and scrolling text shows through. */
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.blog-mark {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
.blog-mark::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  margin-right: 9px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}
.blog-topnav { display: flex; align-items: center; gap: 18px; }
.blog-topnav a {
  font-family: var(--font-ui);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-decoration: none;
  text-transform: lowercase;
}
.blog-topnav a:hover { color: var(--ink); }

.scheme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  padding: 0;
  border: 1px solid var(--rule-2);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.scheme-toggle:hover { border-color: var(--accent); transform: rotate(18deg); }
.scheme-toggle-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: inset -4px -4px 0 0 var(--surface);
  transition: box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
html[data-scheme="dark"] .scheme-toggle-dot { box-shadow: inset 0 0 0 0 var(--surface); }

/* ─────────────────────────── Footer ───────────────────────────────── */
.blog-footer {
  margin-top: 80px;
  padding: 28px var(--pad) 48px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--muted);
}
.blog-footer a { color: var(--muted); }
.blog-footer a:hover { color: var(--accent); }

/* ════════════════════════════ INDEX ═══════════════════════════════ */
.blog-index main, .blog-post main { max-width: 880px; margin: 0 auto; padding: 0 var(--pad); }

.index-head { padding: clamp(48px, 9vw, 96px) 0 40px; border-bottom: 1px solid var(--rule); }
.index-kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin: 0 0 14px;
}
.index-h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(52px, 11vw, 104px);
  line-height: 0.94;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin: 0;
}
.index-lede {
  max-width: 52ch;
  margin: 22px 0 0;
  font-size: 20px;
  color: var(--muted);
  font-style: italic;
}

.index-search { position: relative; margin-top: 30px; max-width: 440px; }
#blog-search {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  transition: border-color var(--dur) var(--ease);
}
#blog-search::placeholder { color: var(--muted); }
#blog-search:focus { outline: none; border-color: var(--accent); }
.search-results {
  position: absolute;
  z-index: 40;
  inset-inline: 0;
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.search-results a {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: var(--ink);
}
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a:focus { background: var(--bg-2); }
.search-results .sr-title { font-family: var(--font-ui); font-weight: 600; font-size: 14px; }
.search-results .sr-ex { font-size: 13px; color: var(--muted); margin-top: 2px; }
.search-results .sr-ex mark { background: var(--mark-bg); color: inherit; padding: 0 2px; }
.search-results .sr-empty { padding: 14px 16px; color: var(--muted); font-family: var(--font-ui); font-size: 13px; }

/* ── Pinned showcase ─────────────────────────────────────────────────
   Compact cards between the header and the feed for posts with
   `pinned: true`. Surface card + accent top rule keeps them clearly
   "chosen" without shouting; the excerpt clamps to two lines so two
   pins cost ~180px of vertical space, total. Grid auto-fits: one pin
   spans the full measure, two sit side by side on desktop. */
.index-pinned { padding: 34px 0 4px; }
.index-pinned-h {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-2);
  font-weight: 500;
  margin: 0 0 14px;
}
.pin-glyph { flex: none; }
.pinned-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 14px;
}
.pinned-card a {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 18px 20px 16px;
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
.pinned-card a:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.pinned-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 23px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.pinned-card a:hover .pinned-title { color: var(--accent-2); }
.pinned-excerpt {
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pinned-meta {
  margin-top: auto;
  padding-top: 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--muted);
}

/* ── Year-jump strip ─────────────────────────────────────────────────
   One mono line of #y-<year> anchors, shown once the archive spans
   multiple years. scroll-padding-top on html keeps landings clear of
   the sticky topbar. */
.index-years {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 18px;
  padding: 20px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
}
.index-years-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-right: 2px;
}
.index-years a {
  color: var(--accent-2);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.index-years a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.index-year { padding: 40px 0 8px; }
.index-year-h {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 8px;
  font-weight: 500;
}
.index-list { list-style: none; margin: 0; padding: 0; }
.index-row { border-top: 1px solid var(--rule); }
.index-link {
  display: grid;
  grid-template-columns: 130px 1fr;
  grid-template-areas: "date title" "date meta" "date excerpt";
  gap: 2px 24px;
  padding: 22px 0;
  text-decoration: none;
  color: inherit;
  transition: background var(--dur) var(--ease);
}
.index-link:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.index-link time {
  grid-area: date;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  padding-top: 6px;
}
.index-title {
  grid-area: title;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(23px, 3.4vw, 30px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.index-link:hover .index-title { color: var(--accent-2); }
.index-meta {
  grid-area: meta;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: lowercase;
  margin-top: 4px;
}
.index-excerpt { grid-area: excerpt; color: var(--muted); margin-top: 8px; max-width: 60ch; }
.index-empty { padding: 60px 0; color: var(--muted); font-style: italic; }

/* Tag-filter banner — injected by blog.js when the index is opened
   with ?tag=<t> (post tag pills link here). */
.index-filter {
  margin: 18px 0 0;
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--muted);
}
.index-filter a { color: var(--accent-2); }

/* ════════════════════════════ POST ════════════════════════════════ */
.post { padding-top: clamp(36px, 7vw, 72px); }
.post-head { max-width: var(--measure); margin: 0 auto; }
.post-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
  padding: 0;
}
.post-tags li {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
  padding: 4px 10px;
  border: 1px solid var(--rule-2);
  border-radius: 100px;
  transition: border-color var(--dur) var(--ease);
}
.post-tags li:hover { border-color: var(--accent); }
.post-tags a { color: inherit; text-decoration: none; }
.post-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(38px, 6.4vw, 66px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin: 0;
}
.post-deck {
  font-size: clamp(20px, 2.6vw, 24px);
  line-height: 1.45;
  font-style: italic;
  color: var(--muted);
  margin: 20px 0 0;
}
.post-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--muted);
}
.post-byline span:first-child { color: var(--ink); font-weight: 500; }

.post-hero {
  max-width: 1000px;
  margin: 44px auto 0;
}
.post-hero img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }

/* Table of contents */
.post-toc {
  max-width: var(--measure);
  margin: 44px auto 0;
  padding: 18px 22px;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
}
.post-toc-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}
.post-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.post-toc li { margin: 4px 0; }
.post-toc .toc-h3 { padding-left: 18px; }
.post-toc a {
  font-family: var(--font-ui);
  font-size: 14.5px;
  color: var(--muted);
  text-decoration: none;
}
.post-toc a:hover, .post-toc a.is-active { color: var(--accent-2); }

/* ≥1280px: the TOC leaves the prose flow and becomes a sticky rail in
   the right margin, so the scroll-spy highlight is actually visible
   while reading instead of scrolled away at the top of the post. The
   rail is absolutely positioned against the article; the inner wrapper
   is the sticky element. Threshold chosen so the 220px rail never
   overflows the viewport (validated at exactly 1280px). */
@media (min-width: 1280px) {
  .blog-post .post { position: relative; }
  .post-toc {
    position: absolute;
    top: 0; bottom: 0;
    left: calc(50% + (var(--measure) / 2) + 44px);
    width: 220px;
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
  }
  .post-toc-inner {
    position: sticky;
    top: 96px;
    max-height: calc(100vh - 128px);
    overflow-y: auto;
    padding: 2px 0 2px 16px;
    border-left: 1px solid var(--rule);
  }
  .post-toc a { font-size: 13px; }
  .post-toc a.is-active { font-weight: 500; }
  .post-toc li { margin: 6px 0; }
  /* Keep an (optional) hero image clear of the rail. */
  .post-hero { max-width: var(--measure); }
}

/* ─────────────────────────── Prose body ───────────────────────────── */
.post-body { max-width: var(--measure); margin: 48px auto 0; }
.post-body > * { margin-block: 0 1.45em; }

.post-body p { color: var(--body); }

/* Drop cap on the opening paragraph — the broadsheet signature. */
.post-body > p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-weight: 600;
  float: left;
  font-size: 3.6em;
  line-height: 0.78;
  padding: 6px 12px 0 0;
  color: var(--accent-2);
}

.post-body h2, .post-body h3, .post-body h4 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -0.02em;
  scroll-margin-top: 88px;
}
.post-body h2 { font-size: clamp(28px, 4vw, 38px); font-weight: 600; margin-top: 1.8em; }
.post-body h3 { font-size: clamp(22px, 3vw, 27px); font-weight: 500; margin-top: 1.5em; }
.post-body h4 { font-size: 20px; font-weight: 600; font-family: var(--font-ui); margin-top: 1.4em; }

.heading-anchor {
  margin-left: 10px;
  color: var(--rule-2);
  text-decoration: none;
  font-family: var(--font-ui);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
h2:hover .heading-anchor, h3:hover .heading-anchor,
.heading-anchor:focus-visible { opacity: 1; }
.heading-anchor:hover { color: var(--accent); }

.post-body ul, .post-body ol { padding-left: 1.4em; }
.post-body li { margin-bottom: 0.5em; }
.post-body li::marker { color: var(--accent-2); }

.post-body blockquote {
  margin-inline: 0;
  padding: 4px 0 4px 24px;
  border-left: 3px solid var(--accent);
  font-style: italic;
  font-size: 1.08em;
  color: var(--ink);
}
.post-body blockquote p:last-child { margin-bottom: 0; }

.post-body hr {
  border: 0;
  height: 1px;
  background: var(--rule-2);
  margin-block: 2.4em;
}

.post-body a { color: var(--accent-2); text-decoration: underline; }
.post-body a:hover { color: var(--accent); }

.post-body img {
  display: block;
  margin-inline: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Diagrams — inline SVGs emitted by scripts/build-blog.js from
   blog/diagrams/*.svg. The SVG paints itself with the page's custom
   properties (var(--ink), var(--accent), var(--surface), …) so it
   follows the light/dark toggle with no runtime work. The figure gets
   a quiet card treatment; on narrow screens it scrolls horizontally
   instead of shrinking labels below legibility. */
.post-body .diagram {
  margin: 2.2em 0;
  padding: 20px clamp(12px, 3vw, 28px);
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow-x: auto;
}
.post-body .diagram svg {
  display: block;
  margin-inline: auto;
  width: 100%;
  height: auto;
  min-width: 560px;   /* keep 12px mono labels legible; scroll on phones */
  max-width: 720px;
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 15px;
}
.post-body th, .post-body td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
}
.post-body th { color: var(--ink); font-weight: 600; border-bottom-color: var(--rule-2); }
.post-body tbody tr:hover { background: var(--bg-2); }

/* Inline code */
.post-body :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--accent-2);
}

/* ─────────────────────── Code blocks (Shiki) ──────────────────────── */
.shiki {
  position: relative;
  margin-inline: calc(-1 * clamp(0px, 2vw, 20px));
  padding: 18px 20px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  -webkit-overflow-scrolling: touch;
}
.shiki code { font-family: inherit; }
/* Dual-theme: Shiki emits --shiki-light / --shiki-dark on every token.
   We bind them to the active scheme so syntax colours follow the toggle. */
.shiki, .shiki span { color: var(--shiki-light); background-color: var(--shiki-light-bg); }
.shiki span { background-color: transparent; }
html[data-scheme="dark"] .shiki,
html[data-scheme="dark"] .shiki span { color: var(--shiki-dark); }
html[data-scheme="dark"] .shiki { background-color: var(--shiki-dark-bg); }

.code-copy {
  position: absolute;
  top: 8px; right: 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  border: 1px solid var(--rule-2);
  border-radius: 5px;
  padding: 4px 9px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--dur) var(--ease), color var(--dur) var(--ease);
}
.shiki:hover .code-copy, .code-copy:focus-visible { opacity: 1; }
.code-copy.copied { color: var(--accent-2); border-color: var(--accent); }
/* No hover on touch devices — the button has to be visible to exist. */
@media (hover: none) {
  .code-copy { opacity: 1; }
}

/* Mermaid diagrams (rendered client-side; centred SVG) */
.mermaid {
  margin: 1.6em auto;
  padding: 8px;
  text-align: center;
  background: transparent;
  border: 0;
  overflow-x: auto;
}
.mermaid:not([data-processed]) {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  white-space: pre-wrap;
}

/* KaTeX — let display math scroll on small screens */
.post-body .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }

/* ───────────────────────── Footnotes ──────────────────────────────── */
.footnotes {
  max-width: var(--measure);
  margin: 56px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font-size: 16px;
  color: var(--muted);
}
.footnotes-sep { display: none; }
.footnote-ref a { text-decoration: none; color: var(--accent-2); font-family: var(--font-ui); }
.footnote-backref { text-decoration: none; }

/* ─────────────────────────── Post footer ──────────────────────────── */
.post-foot {
  max-width: var(--measure);
  margin: 56px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}
.post-updated {
  display: block;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.post-foot-actions {
  margin: 16px 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--muted);
}
.post-foot-actions a { color: var(--accent-2); }
.copy-link {
  font: inherit;
  color: var(--accent-2);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
.copy-link:hover, .copy-link.copied { color: var(--accent); }

.post-foot-home { margin-top: 16px; font-family: var(--font-ui); font-size: 14px; }
.post-foot-home a { color: var(--muted); text-decoration: none; }
.post-foot-home a:hover { color: var(--accent); }

.post-pager {
  max-width: var(--measure);
  margin: 40px auto 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.post-pager a {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.post-pager a:hover { border-color: var(--accent); background: var(--bg-2); }
.post-pager span {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.post-pager strong {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  color: var(--ink);
  line-height: 1.2;
}
.pager-next { text-align: right; }

/* ─────────────────────────── Responsive ───────────────────────────── */
@media (max-width: 620px) {
  body { font-size: 18px; }
  .index-link {
    grid-template-columns: 1fr;
    grid-template-areas: "date" "title" "meta" "excerpt";
    gap: 4px;
  }
  .index-link time { padding-top: 0; }
  .post-pager { grid-template-columns: 1fr; }
  .pager-next { text-align: left; }
  .post-body > p:first-of-type::first-letter { font-size: 3em; }
}

/* ─────────────────────────── Print ────────────────────────────────── */
/* Blog pages don't load styles.css, so they need their own print
   flattening. Without it, a dark-scheme reader prints cream text on
   white paper (near-invisible) underneath sticky chrome. Force light
   ink-on-paper tokens for BOTH schemes, drop the reading chrome, and
   let code blocks wrap instead of clipping. */
@media print {
  html[data-scheme="light"], html[data-scheme="dark"] {
    --bg: #fff; --bg-2: #fff; --surface: #fff;
    --ink: #000; --body: #000; --muted: #444;
    --rule: #ccc; --rule-2: #ccc;
    --accent: #000; --accent-2: #000;
    --mark-bg: transparent;
    --shadow: none;
  }
  *, *::before, *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    transition: none !important;
    animation: none !important;
  }
  body { background: #fff !important; font-size: 11pt; line-height: 1.5; }

  /* Reading chrome that has no business on paper */
  .blog-topbar, .read-progress, .scheme-toggle, .code-copy,
  .copy-link, .post-foot-actions, .post-toc, .post-pager,
  .index-search, .skip {
    display: none !important;
  }

  pre.shiki {
    overflow: visible;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid #ccc;
  }

  /* Printed text keeps its references */
  .post-body a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 85%;
    color: #555 !important;
  }
}
