/* ==========================================================================
   secreci.com — design system
   "The Dossier": warm paper, oxide-red accent, mono file metadata.
   Layers: fonts → tokens → base → layout → components → prose → code →
           utilities → motion → print
   ========================================================================== */

/* --------------------------------------------------------------------------
   Fonts (self-hosted, variable, latin subset)
   -------------------------------------------------------------------------- */

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/fonts/newsreader-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url("/fonts/newsreader-latin-italic.woff2") format("woff2");
}

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/fonts/space-grotesk-latin.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/plex-mono-latin.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/plex-mono-latin-500.woff2") format("woff2");
}

@font-face {
  font-family: "Caveat";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/caveat-latin.woff2") format("woff2");
}

/* --------------------------------------------------------------------------
   Tokens
   Static light values first as fallback for browsers without light-dark().
   -------------------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  /* Fallbacks (light) */
  --paper: #faf8f5;
  --paper-raised: #f3efe8;
  --ink: #211b13;
  --ink-muted: #6e6457;
  --rule: #e3dcd1;
  --accent: #b43c26;
  --accent-hover: #8c2e1c;

  /* Theme-aware tokens */
  --paper: light-dark(#faf8f5, #16130f);
  --paper-raised: light-dark(#f3efe8, #201b15);
  --ink: light-dark(#211b13, #ebe3d7);
  --ink-muted: light-dark(#6e6457, #a2978a);
  --rule: light-dark(#e3dcd1, #2e2820);
  --accent: light-dark(#b43c26, #ff7a5c);
  --accent-hover: light-dark(#8c2e1c, #ffa18b);

  /* Code panel: warm dark slate in both themes */
  --code-paper: light-dark(#241e17, #100d09);
  --code-ink: #e8e0d4;
  --code-muted: #857a6a;
  --code-rule: #3a322a;

  /* Type */
  --font-body: "Newsreader", "Iowan Old Style", Georgia, serif;
  --font-display: "Space Grotesk", "Avenir Next", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-hand: "Caveat", "Bradley Hand", "Segoe Print", cursive;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1.125rem;
  --text-lg: 1.3rem;

  /* Rhythm */
  --space-2xs: 0.375rem;
  --space-xs: 0.75rem;
  --space-sm: 1.25rem;
  --space-md: 2rem;
  --space-lg: 3.25rem;
  --space-xl: 5.25rem;

  --measure: 44rem;
  --radius: 6px;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 420;
  line-height: 1.7;
  background: var(--paper);
  color: var(--ink);
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern";
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  width: 100%;
}

::selection {
  background: var(--accent);
  color: var(--paper);
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 150ms ease;
}

a:hover {
  color: var(--accent-hover);
}

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

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

/* --------------------------------------------------------------------------
   Layout containers
   -------------------------------------------------------------------------- */

.page,
.post,
.site-nav,
.site-footer-inner {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--space-sm);
}

.page,
.post {
  /* Fluid top space: generous on desktop, tight on phones. */
  padding-block: clamp(1.5rem, 1rem + 3vw, var(--space-lg)) var(--space-xl);
}

/* --------------------------------------------------------------------------
   Site header
   -------------------------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--rule);
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding-block: var(--space-xs);
}

.brand {
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.45rem;
  letter-spacing: -0.01em;
}

/* The wordmark's last glyphs sit under a redaction bar; hover declassifies.
   inline-block + line-height 1 keeps the bar hugging the glyphs instead of
   filling the whole line box. */
.brand-redact {
  display: inline-block;
  line-height: 1;
  background: var(--ink);
  color: var(--ink);
  padding: 0.06em 0.1em 0.12em;
  margin-left: 0.02em;
  border-radius: 1px;
  transition: color 200ms ease;
}

.brand:hover .brand-redact,
.brand:focus-visible .brand-redact {
  color: var(--paper);
}

.site-nav-links {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 3vw, 1.6rem);
}

.site-nav-links a {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 2px solid transparent;
  padding-block: 0.15em;
  transition: border-color 150ms ease, color 150ms ease;
}

.site-nav-links a:hover {
  color: var(--accent);
}

.site-nav-links a[aria-current="page"] {
  border-bottom-color: var(--accent);
}

#theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease;
}

#theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Moon shown in light (the thing you'd switch to), sun in dark. */
.icon-sun { display: none; }
.icon-moon { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }

/* --------------------------------------------------------------------------
   Mono "file header" voice: kickers, filelines, section labels
   -------------------------------------------------------------------------- */

.kicker,
.fileline,
.fileline-label,
.section-label,
.archive-filter label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.fileline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin-bottom: var(--space-sm);
}

.fileline-label {
  color: var(--accent);
}

.section-label {
  display: block;
  border-bottom: 1px solid var(--rule);
  padding-bottom: var(--space-2xs);
  margin-bottom: var(--space-sm);
}

/* --------------------------------------------------------------------------
   Home
   -------------------------------------------------------------------------- */

.masthead {
  padding-block: clamp(1rem, 0.5rem + 2.5vw, var(--space-lg)) clamp(var(--space-lg), 2rem + 4vw, var(--space-xl));
}

.masthead .kicker {
  margin-bottom: var(--space-sm);
}

.masthead-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.9rem, 1.2rem + 3.2vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.022em;
  text-wrap: balance;
  max-width: 22ch;
}

.masthead-intro {
  margin-top: var(--space-sm);
  font-size: var(--text-lg);
  line-height: 1.6;
  color: var(--ink-muted);
  max-width: 36em;
}

.masthead-intro a {
  color: var(--ink);
}

.masthead-intro a:hover {
  color: var(--accent);
}

.home-section {
  margin-bottom: var(--space-xl);
}

.home-more {
  margin-top: var(--space-sm);
  font-family: var(--font-display);
  font-size: 0.95rem;
}

.home-subscribe {
  max-width: 36em;
}

/* --------------------------------------------------------------------------
   Page headers (archive, topics, tag pages)
   -------------------------------------------------------------------------- */

.page-header {
  margin-bottom: var(--space-lg);
}

.page-header .kicker {
  margin-bottom: var(--space-2xs);
}

.page-lede {
  margin-top: var(--space-2xs);
  color: var(--ink-muted);
}

/* --------------------------------------------------------------------------
   Ledger (post lists)
   -------------------------------------------------------------------------- */

.ledger {
  list-style: none;
  padding: 0;
}

.ledger-row {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: var(--space-sm);
  padding-block: var(--space-xs);
  border-bottom: 1px solid var(--rule);
}

.ledger-row:first-child {
  border-top: 1px solid var(--rule);
}

.section-label + .ledger .ledger-row:first-child {
  border-top: 0;
}

.ledger-date {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  padding-top: 0.45em;
  white-space: nowrap;
}

.ledger-title {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.2rem;
  line-height: 1.35;
  color: var(--ink);
  text-decoration: none;
}

.ledger-title:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.ledger-desc {
  margin-top: 0.15em;
  font-size: var(--text-sm);
  color: var(--ink-muted);
  max-width: 34em;
}

@media (max-width: 36rem) {
  .ledger-row {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }
  .ledger-date {
    padding-top: 0;
  }
}

/* --------------------------------------------------------------------------
   Archive
   -------------------------------------------------------------------------- */

.archive-year {
  margin-bottom: var(--space-lg);
}

.archive-year-heading {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
  margin-bottom: var(--space-2xs);
}

.archive-filter {
  margin-bottom: var(--space-lg);
}

.archive-filter input {
  display: block;
  width: 100%;
  margin-top: var(--space-2xs);
  padding: 0.6em 0.8em;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.archive-filter input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: transparent;
}

.archive-filter-status {
  margin-top: var(--space-2xs);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-muted);
  min-height: 1.2em;
}

/* --------------------------------------------------------------------------
   Tags / topics
   -------------------------------------------------------------------------- */

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.4em 0.75em;
  transition: border-color 150ms ease, color 150ms ease;
}

.tag:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tag-count {
  margin-left: 0.6em;
  color: var(--ink-muted);
}

.topics {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
}

.topics-index {
  gap: var(--space-xs);
}

.topics-index .tag {
  font-size: var(--text-sm);
  padding: 0.55em 0.9em;
}

/* --------------------------------------------------------------------------
   Post (article)
   -------------------------------------------------------------------------- */

.post-header {
  margin-bottom: var(--space-md);
}

.post-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.8rem, 1.2rem + 2.6vw, 2.7rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

/* The standfirst reads as a handwritten note about the file's contents. */
.standfirst {
  margin-top: var(--space-xs);
  font-family: var(--font-hand);
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink-muted);
  text-wrap: pretty;
  transform: rotate(-0.4deg);
  max-width: 32em;
}

.provenance {
  margin-top: var(--space-sm);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.provenance-stamp {
  display: inline-block;
  margin-right: 0.75em;
  padding: 0.25em 0.6em;
  border: 1px solid var(--accent);
  border-radius: 2px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  transform: rotate(-1deg);
}

/* Table of contents */

.toc {
  margin-bottom: var(--space-md);
  padding: var(--space-sm);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-raised);
}

.toc-heading {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: var(--space-2xs);
}

.toc ol {
  list-style: none;
  padding: 0;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  line-height: 2;
}

.toc-level-3 {
  padding-left: 1.25em;
}

.toc a {
  text-decoration: none;
  color: var(--ink);
}

.toc a:hover {
  color: var(--accent);
}

/* Post footer: tags, pagination, related */

.post-footer {
  margin-top: var(--space-lg);
  border-top: 1px solid var(--rule);
  padding-top: var(--space-sm);
  display: grid;
  gap: var(--space-md);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2xs);
}

.post-tags .fileline-label {
  margin-right: 0.5em;
}

.post-pagination {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

.post-pagination-link {
  display: block;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--space-xs) var(--space-sm);
  transition: border-color 150ms ease;
}

.post-pagination-link:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.post-pagination-link.next {
  grid-column: 2;
  text-align: right;
}

.post-pagination-title {
  display: block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.4;
  margin-top: 0.2em;
}

.post-pagination-link:hover .post-pagination-title {
  color: var(--accent);
}

@media (max-width: 36rem) {
  .post-pagination {
    grid-template-columns: 1fr;
  }
  .post-pagination-link.next {
    grid-column: auto;
    text-align: left;
  }
}

.related-list {
  list-style: none;
  padding: 0;
}

.related-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-sm);
  padding-block: var(--space-2xs);
}

.related-list a {
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
}

.related-list a:hover {
  color: var(--accent);
}

.related-list time {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-muted);
  white-space: nowrap;
}

.subscribe-note {
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

/* --------------------------------------------------------------------------
   Prose (article body)
   -------------------------------------------------------------------------- */

.prose {
  text-wrap: pretty;
}

.prose > * + * {
  margin-top: var(--space-sm);
}

.prose h2,
.prose h3,
.prose h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin-top: var(--space-md);
  text-wrap: balance;
}

.prose h2 { font-size: 1.5rem; }
.prose h3 { font-size: 1.2rem; }
.prose h4 { font-size: 1.05rem; }

/* Headings are their own permalinks (markdown-it-anchor headerLink). */
.heading-anchor {
  text-decoration: none;
  color: inherit;
}

.heading-anchor::after {
  content: " #";
  color: var(--ink-muted);
  font-weight: 400;
  opacity: 0;
  transition: opacity 150ms ease;
}

.heading-anchor:hover {
  color: inherit;
}

.heading-anchor:hover::after,
.heading-anchor:focus-visible::after {
  opacity: 1;
  color: var(--accent);
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
}

.prose li + li {
  margin-top: 0.35em;
}

.prose li > ul,
.prose li > ol {
  margin-top: 0.35em;
}

.prose blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-sm);
  font-style: italic;
  font-size: var(--text-lg);
  line-height: 1.6;
  color: var(--ink-muted);
}

.prose blockquote cite {
  display: block;
  margin-top: 0.5em;
  font-family: var(--font-mono);
  font-style: normal;
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.prose hr {
  border: 0;
  margin-block: var(--space-md);
  text-align: center;
  color: var(--ink-muted);
}

.prose hr::before {
  content: "⁂";
  font-size: var(--text-base);
  letter-spacing: 0.5em;
}

/* Images read as photographic prints taped into the file. */
.prose img {
  display: block;
  margin-inline: auto;
  padding: 0.45rem;
  background: #faf7f1;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 2px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
}

.prose p:has(> img:only-child) {
  position: relative;
  width: fit-content;
  margin-inline: auto;
  padding-top: 0.9rem;
  transform: rotate(-0.7deg);
}

.prose p:has(> img:only-child):nth-of-type(even) {
  transform: rotate(0.55deg);
}

.prose p:has(> img:only-child):nth-of-type(3n) {
  transform: rotate(-0.3deg);
}

/* The strip of tape holding the print in place. */
.prose p:has(> img:only-child)::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 50%;
  width: 5.5rem;
  height: 1.5rem;
  transform: translateX(-50%) rotate(-2deg);
  background: light-dark(rgba(222, 210, 188, 0.55), rgba(255, 248, 235, 0.14));
  border-inline: 1px solid light-dark(rgba(0, 0, 0, 0.05), rgba(255, 255, 255, 0.06));
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.prose th {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  color: var(--ink-muted);
}

.prose th,
.prose td {
  padding: 0.5em 0.75em 0.5em 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

/* Footnotes (markdown-it-footnote) */

.footnotes-sep {
  margin-block: var(--space-md);
}

.footnotes {
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

.footnote-ref a,
.footnote-backref {
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   Code
   -------------------------------------------------------------------------- */

code,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.86em;
}

.prose :not(pre) > code {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.1em 0.35em;
  overflow-wrap: break-word;
}

.prose pre {
  position: relative;
  background: var(--code-paper);
  color: var(--code-ink);
  border-radius: var(--radius);
  padding: var(--space-sm);
  overflow-x: auto;
  font-size: var(--text-sm);
  line-height: 1.6;
  tab-size: 2;
}

.prose pre code {
  font-size: inherit;
  background: none;
  border: 0;
  padding: 0;
}

/* Language chip + copy button (inserted by enhance script) */

.code-label {
  position: absolute;
  top: 0.6rem;
  right: 3.1rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--code-muted);
  pointer-events: none;
}

.code-copy {
  position: absolute;
  top: 0.45rem;
  right: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  padding: 0;
  border: 1px solid var(--code-rule);
  border-radius: 4px;
  background: transparent;
  color: var(--code-muted);
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}

.code-copy:hover {
  color: var(--code-ink);
  border-color: var(--code-muted);
}

.code-copy[data-copied]::after {
  content: "Copied";
  position: absolute;
  right: calc(100% + 0.5rem);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--code-ink);
  white-space: nowrap;
}

/* Syntax palette (Prism classes), warm base16 */

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata { color: var(--code-muted); font-style: italic; }

.token.punctuation { color: #b8aa98; }

.token.property,
.token.tag,
.token.constant,
.token.symbol,
.token.deleted { color: #ff9d6e; }

.token.boolean,
.token.number { color: #d8a0df; }

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted { color: #b8cc8a; }

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string { color: #9fc6c0; }

.token.atrule,
.token.attr-value,
.token.keyword { color: #ff9d6e; }

.token.function,
.token.class-name { color: #ffd17a; }

.token.regex,
.token.important,
.token.variable { color: #e8c4a0; }

.token.important,
.token.bold { font-weight: 600; }
.token.italic { font-style: italic; }

/* --------------------------------------------------------------------------
   Reading progress (CSS scroll-driven; no JS)
   -------------------------------------------------------------------------- */

.progress {
  display: none;
}

@supports (animation-timeline: scroll()) {
  .progress {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    transform-origin: 0 50%;
    transform: scaleX(0);
    animation: grow-progress linear forwards;
    animation-timeline: scroll(root block);
    z-index: 10;
  }

  @keyframes grow-progress {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
  }
}

/* --------------------------------------------------------------------------
   Site footer
   -------------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: var(--space-xl);
}

.site-footer-inner {
  padding-block: var(--space-md);
  display: grid;
  gap: var(--space-sm);
}

/* Oversized closing wordmark; declassifies on hover like the header brand. */
.site-footer-wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.6rem, 8vw, 4.2rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink-muted);
  user-select: none;
}

.site-footer-wordmark .brand-redact {
  background: var(--ink-muted);
  color: var(--ink-muted);
}

.site-footer-wordmark:hover .brand-redact {
  color: var(--paper);
}

.site-footer-name {
  font-family: var(--font-display);
  font-weight: 600;
}

.site-footer-role {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.site-footer-nav {
  display: flex;
  gap: var(--space-lg);
  flex-wrap: wrap;
}

.site-footer-nav ul {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.3em;
}

.site-footer-nav a {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  text-decoration: none;
  color: var(--ink-muted);
}

.site-footer-nav a:hover {
  color: var(--accent);
}

.site-footer-colophon {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.03em;
  color: var(--ink-muted);
}

.site-footer-colophon a {
  color: inherit;
}

.site-footer-colophon a:hover {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

.skip-link {
  position: absolute;
  left: var(--space-sm);
  top: -100%;
  z-index: 20;
  padding: 0.5em 1em;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-display);
  border-radius: 0 0 var(--radius) var(--radius);
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.redacted {
  background: var(--ink);
  color: var(--ink);
}

.redacted::selection {
  background: var(--accent);
  color: var(--paper);
}

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .progress {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */

@media print {
  .site-header,
  .site-footer,
  .progress,
  .post-pagination,
  .related,
  .subscribe-note,
  .skip-link,
  .code-copy {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .prose a {
    color: inherit;
  }

  .prose a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #444;
  }
}
