/* ============================================================
   Stack - design tokens
   One 720px measure down the middle. Space Grotesk headlines,
   Literata prose, Plex Mono labels. Zero radius, no shadows,
   one accent, no dark mode. Palette carried over unchanged.
   ============================================================ */
:root {
  --canvas: #fbfaf7; /* page ground, never pure white */
  --sheet: #ffffff; /* code filename bar only */
  --panel: #f2f0e9; /* code body - the only tinted surface */
  --ink: #17181a; /* headlines, section rules, primary button */
  --prose: #2e2e2a; /* article body + list items */
  --text: #4a4a45; /* summaries, deks, secondary prose */
  --muted: #6b6b66; /* mono meta, footer, field labels */
  --faint: #6f6f66; /* code comments, figure dates */
  /* Was #8e8e86, which is 3.16:1 on the canvas and fails WCAG AA. It is
     used for figure dates, which are real text, not decoration. #6f6f66
     is 4.86:1 on canvas and 4.45:1 on the code panel. */
  --rule: #dfddd5; /* record dividers, header underline */
  --accent: #8c2f39; /* links, record numbers, kicker, active nav */
  --accent-dark: #6e242c; /* link hover + pressed */
  --accent-on-ink: #d9c2c4; /* accent text on ink surfaces only */
  --prose-on-ink: #b8b4a8; /* secondary text on ink surfaces */
  --rule-on-ink: rgba(251, 250, 247, 0.2); /* dividers on ink */
  --ok: #4a6b4e; /* code strings, live status */
  --code-text: #25262a;
  --row-hover: #f7f5ef;

  /* Type: three families */
  --sans: var(--font-sans), "Space Grotesk", system-ui, sans-serif;
  --serif: var(--font-serif), Georgia, "Times New Roman", serif;
  --mono: var(--font-mono), ui-monospace, Menlo, monospace;

  --measure: 900px;
}

* {
  box-sizing: border-box;
  border-radius: 0;
}
html {
  -webkit-text-size-adjust: 100%;
  /* Always reserve the scrollbar gutter, so a short page and a long one centre
     their content identically instead of shifting on navigation. */
  scrollbar-gutter: stable;
}
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-dark);
}
::selection {
  background: #e7d3d5;
  color: var(--ink);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The measure: one centred column, everything lives inside it. */
.measure {
  max-width: var(--measure);
  margin: 0 auto;
}
@media (max-width: 940px) {
  .measure {
    max-width: none;
    padding-inline: 24px;
  }
}
@media (max-width: 600px) {
  .measure {
    padding-inline: 18px;
  }
}

/* The post frame matches the site measure exactly. It used to be narrower,
   which made the header and footer jump horizontally when navigating between
   a post and any other page. Same width everywhere means no layout shift. */
.measure--post {
  max-width: var(--measure);
  margin: 0 auto;
}
@media (max-width: 940px) {
  .measure--post {
    max-width: none;
    padding-inline: 24px;
  }
}
@media (max-width: 600px) {
  .measure--post {
    padding-inline: 18px;
  }
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 50;
  background: var(--ink);
  color: var(--canvas);
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
}
.skip-link:focus {
  left: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   Motion - nothing moves on hover. One entrance.
   ============================================================ */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.fade-up {
  animation: fadeUp 0.5s ease-out both;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ============================================================
   Post prose - a single 620px column with ruled section headings.
   Section numbers live in the rail, not the prose.
   ============================================================ */
.post-prose .lead {
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.7;
  color: var(--ink);
  margin: 0 0 28px;
}
/* Same size and leading as .hero-blurb on the home page, so the reading text
   does not subtly change weight when you move from the landing page into a
   post. These were 18.5/1.82 here and 18.5/1.8 there. */
.post-prose p {
  font-family: var(--serif);
  font-size: 18.5px;
  line-height: 1.8;
  color: var(--prose);
  margin: 0 0 24px;
}
.post-prose h2 {
  font-family: var(--sans);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin: 36px 0 12px;
  border-top: 1px solid var(--ink);
  padding-top: 16px;
  scroll-margin-top: 24px;
}
.post-prose h2.first {
  margin-top: 0;
}
.post-prose h3 {
  font-family: var(--sans);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 28px 0 10px;
}
.post-prose ul,
.post-prose ol {
  font-family: var(--serif);
  font-size: 18.5px;
  line-height: 1.8;
  color: var(--prose);
  margin: 0 0 26px;
  padding-left: 20px;
}
.post-prose li {
  margin-bottom: 6px;
}
.post-prose blockquote {
  margin: 0 0 24px;
  border-left: 2px solid var(--accent);
  padding: 2px 0 2px 20px;
}
.post-prose blockquote p {
  font-family: var(--serif);
  font-size: 20px;
  font-style: italic;
  line-height: 1.65;
  color: var(--ink);
  margin: 0;
}
.post-prose a {
  color: var(--accent);
  border-bottom: 1px solid var(--accent);
}
.post-prose a:hover {
  color: var(--accent-dark);
  border-color: var(--accent-dark);
}
.post-prose :not(pre) > code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 0 5px;
  color: var(--ink);
}

@media (max-width: 600px) {
  .post-prose .lead {
    font-size: 19px;
  }
  .post-prose p,
  .post-prose ul,
  .post-prose ol {
    font-size: 17.5px;
    line-height: 1.8;
  }
  .post-prose h2 {
    font-size: 22px;
    padding-top: 14px;
  }
}
