/* =====================================================================
   armstrong.is — core stylesheet
   This single file is the consistency layer for the whole site.
   Every page links it; change a token here and it propagates everywhere.
   Design notes live in GUIDELINES.md.

   The system is carried over from the original theme: Ballinger
   (Adobe Fonts) for everything, Pitch for the meta voice, a 12px
   baseline grid, black-on-white with a dark inverted index + footer.
   ===================================================================== */

/* ---- Pitch (self-hosted, Klim Type Foundry) ------------------------ */
@font-face { font-family: "Pitch"; src: url("/assets/fonts/pitch-light.woff2") format("woff2"); font-style: normal; font-weight: 300; font-display: fallback; }
@font-face { font-family: "Pitch"; src: url("/assets/fonts/pitch-light-italic.woff2") format("woff2"); font-style: italic; font-weight: 300; font-display: fallback; }
@font-face { font-family: "Pitch"; src: url("/assets/fonts/pitch-regular.woff2") format("woff2"); font-style: normal; font-weight: 400; font-display: fallback; }
@font-face { font-family: "Pitch"; src: url("/assets/fonts/pitch-regular-italic.woff2") format("woff2"); font-style: italic; font-weight: 400; font-display: fallback; }
@font-face { font-family: "Pitch"; src: url("/assets/fonts/pitch-medium.woff2") format("woff2"); font-style: normal; font-weight: 500; font-display: fallback; }
@font-face { font-family: "Pitch"; src: url("/assets/fonts/pitch-medium-italic.woff2") format("woff2"); font-style: italic; font-weight: 500; font-display: fallback; }
@font-face { font-family: "Pitch"; src: url("/assets/fonts/pitch-semibold.woff2") format("woff2"); font-style: normal; font-weight: 600; font-display: fallback; }
@font-face { font-family: "Pitch"; src: url("/assets/fonts/pitch-semibold-italic.woff2") format("woff2"); font-style: italic; font-weight: 600; font-display: fallback; }
@font-face { font-family: "Pitch"; src: url("/assets/fonts/pitch-bold.woff2") format("woff2"); font-style: normal; font-weight: 700; font-display: fallback; }
@font-face { font-family: "Pitch"; src: url("/assets/fonts/pitch-bold-italic.woff2") format("woff2"); font-style: italic; font-weight: 700; font-display: fallback; }

/* ---- Design tokens ------------------------------------------------- */
:root {
  /* Colour — white paper, near-black ink, no accent hue: emphasis is
     carried by weight, underlines and the dark inverted panels. */
  --paper:          #ffffff;
  --panel:          #111111;                /* inverted index + footer */
  --ink:            #111111;
  --ink-muted:      rgb(0 0 0 / 0.6);      /* body copy, metadata */
  --ink-faint:      rgb(0 0 0 / 0.4);      /* quiet labels */
  --hairline:       rgb(0 0 0 / 0.2);      /* rules + dividers */
  --paper-sunk:     rgb(0 0 0 / 0.04);     /* code blocks */
  --inverse-ink:    #ffffff;
  --inverse-muted:  rgb(255 255 255 / 0.6);
  --inverse-hairline: rgb(255 255 255 / 0.2);

  /* Type — Ballinger carries the voice, Pitch carries the meta. */
  --sans: ballinger, "Helvetica Neue", Arial, sans-serif;
  --mono: "Pitch", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* The 12px baseline grid drives all rhythm. */
  --baseline: 12px;

  /* Reading measure (the old fixed 800px column) + the active margin */
  --measure:    50rem;
  --pad-inline: clamp(1.5rem, 5vw, 3.75rem);

  /* Vertical rhythm scale — baseline multiples */
  --space-1: calc(var(--baseline) * 0.5);
  --space-2: var(--baseline);
  --space-3: calc(var(--baseline) * 2);
  --space-4: calc(var(--baseline) * 3);
  --space-5: calc(var(--baseline) * 5);
  --space-6: calc(var(--baseline) * 8);
}

/* ---- Reset-ish ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  overflow-x: clip;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 400;
  line-height: calc(var(--baseline) * 2);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Short pages: the dark footer still sits at the viewport bottom */
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
main { padding-bottom: var(--space-6); }
main.home { padding-bottom: 0; }
img, video, svg, iframe { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }

::selection { background: rgb(0 0 0 / 0.12); }

/* Visible keyboard focus everywhere */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 1px;
}

/* ---- Page shell ---------------------------------------------------- */
/* A single centred column. The padding-inline IS the active margin:
   it breathes with the viewport instead of leaving dead template space. */
.shell {
  width: 100%;
  max-width: calc(var(--measure) + var(--pad-inline) * 2);
  margin-inline: auto;
  padding-inline: var(--pad-inline);
}

/* ---- Masthead — sits at the page margins, like the old header ------ */
.masthead {
  max-width: none;
  display: flex;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  flex-wrap: wrap;
  padding-block: var(--space-3) var(--space-5);
  font-size: 16px;
  color: var(--ink-muted);
}
.masthead .home {
  flex: none;
  display: block;
  text-decoration: none;
}
.masthead .home img {
  width: calc(var(--baseline) * 4);
  height: calc(var(--baseline) * 4);
  border-radius: 100%;
}
.masthead .ms-line { margin: 0; line-height: calc(var(--baseline) * 1.5); }
.masthead .ms-line a { color: var(--ink); font-weight: 500; text-decoration: none; }
.masthead .ms-line a:hover { text-decoration: underline; }
.masthead .sayhi {
  margin-left: auto;
  background: var(--panel);
  color: var(--inverse-ink);
  padding: var(--space-1) var(--space-2);
  border-radius: 100px;
  text-decoration: none;
  white-space: nowrap;
  font-size: 14px;
}
.masthead .sayhi:hover { text-decoration: underline; }

/* ---- Headings ------------------------------------------------------ */
h1, h2, h3 {
  font-family: var(--sans);
  font-weight: 500;
  color: var(--ink);
}
h1 {
  font-size: 36px;
  line-height: calc(var(--baseline) * 4);
  letter-spacing: -0.05ex;
  margin: 0 0 var(--space-1);
}
h2 {
  font-size: 16px;
  line-height: calc(var(--baseline) * 2);
  margin: var(--space-5) 0 var(--space-2);
}
h3 {
  font-size: 16px;
  line-height: calc(var(--baseline) * 2);
  margin: var(--space-4) 0 var(--space-1);
  color: var(--ink-muted);
}
@media all and (min-width: 600px) {
  h1 { font-size: 54px; line-height: calc(var(--baseline) * 5); }
}
@media all and (min-width: 768px) {
  h1 { font-size: 80px; line-height: calc(var(--baseline) * 7); }
}
@media all and (min-width: 1080px) {
  h2 { font-size: 19px; line-height: calc(var(--baseline) * 2.5); }
  h3 { font-size: 19px; line-height: calc(var(--baseline) * 2.5); }
}

/* ---- Post body ----------------------------------------------------- */
/* Post titles + their date are centred on wider screens, as before. */
.post h1 { margin-top: var(--space-4); }
.post .updated {
  font-family: var(--mono);
  font-style: italic;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.05ex;
  color: var(--ink-muted);
  margin: 0 0 var(--space-5);
}
@media all and (min-width: 600px) {
  .post h1, .post .updated { text-align: center; }
  .post .updated { font-size: 16px; }
}

.post article { max-width: var(--measure); }
.post p, .post ul, .post ol, .post blockquote, .post figure, .post pre, .post table {
  max-width: var(--measure);
}
.post p, .post ul, .post ol {
  color: var(--ink-muted);
  margin: 0 0 var(--space-3);
}
@media all and (min-width: 1080px) {
  .post p, .post ul, .post ol, .post blockquote {
    font-size: 19px;
    line-height: calc(var(--baseline) * 2.5);
    margin-bottom: calc(var(--baseline) * 2.5);
  }
}
.post a { text-decoration: underline; }
.post a:hover { color: var(--ink); }
.post strong { color: var(--ink); font-weight: 600; }

/* Opening paragraph set larger, full ink — the old .has-large-font-size */
.post .lede {
  color: var(--ink);
  font-size: 24px;
  line-height: calc(var(--baseline) * 2.5);
  letter-spacing: -0.025ex;
}
@media all and (min-width: 1080px) {
  .post .lede { font-size: 24px; line-height: calc(var(--baseline) * 3); }
}

/* Lists */
.post ul, .post ol { padding-left: calc(var(--baseline) * 2); }
.post li { margin-bottom: var(--space-1); }
.post li::marker { color: var(--ink-faint); }

/* Quotes — a plain quote and a louder pull-quote */
.post blockquote {
  margin: var(--space-4) 0;
  padding-left: var(--baseline);
  border-left: 2px solid var(--hairline);
  color: var(--ink-muted);
}
.post blockquote p:last-child { margin-bottom: 0; }
.post blockquote cite, .post blockquote footer {
  display: block;
  margin-top: var(--space-2);
  font-style: normal;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.1ex;
  color: var(--ink-muted);
}
.post blockquote cite::before, .post blockquote footer::before { content: "— "; }

.post .pullquote {
  border-left: 0;
  padding: 0;
  margin: var(--space-5) 0;
  color: var(--ink);
  font-style: italic;
  font-size: 24px;
  line-height: calc(var(--baseline) * 3);
  letter-spacing: -0.05ex;
}
.post .pullquote p { color: var(--ink); margin: 0; font-size: inherit; line-height: inherit; }
.post .pullquote p::before { content: "\201C"; margin-left: -0.8ex; }
.post .pullquote p::after { content: "\201D"; }
@media all and (min-width: 600px) {
  .post .pullquote { text-align: center; font-size: 36px; line-height: calc(var(--baseline) * 4); }
  .post .pullquote p::before { margin-left: 0; }
}
@media all and (min-width: 768px) {
  .post .pullquote { font-size: 54px; line-height: calc(var(--baseline) * 5); }
}

/* Figures + captions */
.post figure { margin: var(--space-5) 0; }
.post figure img, .post figure video, .post figure .embed { width: 100%; }
.post figcaption {
  margin-top: var(--space-1);
  font-family: var(--mono);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.05ex;
  color: var(--ink-muted);
}
.post figcaption a { color: var(--ink-muted); }

/* Responsive 16:9 embed wrapper */
.embed {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--panel);
}
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* A figure can break past the measure for emphasis on wide screens */
.post .wide { max-width: min(62rem, 100%); }

/* Tables */
.post table { border-collapse: collapse; width: 100%; margin: var(--space-4) 0; color: var(--ink-muted); }
.post th, .post td { text-align: left; padding: var(--space-1) var(--space-2); border-bottom: 1px solid var(--hairline); }
.post th { color: var(--ink); font-weight: 500; }

/* Code */
.post code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--paper-sunk);
  padding: 0.1em 0.35em;
}
.post pre {
  font-family: var(--mono);
  font-size: 14px;
  line-height: calc(var(--baseline) * 2);
  background: var(--paper-sunk);
  padding: var(--space-2) var(--space-3);
  overflow-x: auto;
  margin: var(--space-4) 0;
}
.post pre code { background: none; padding: 0; font-size: inherit; }

/* Play card — for the embeddable-game posts */
.playcard {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--mono);
  font-weight: 500;
  font-size: 16px;
  text-decoration: none !important;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  padding: var(--space-2) var(--space-3);
}
.playcard .tri { color: var(--ink-faint); }
.playcard:hover { background: var(--panel); color: var(--inverse-ink); }
.playcard:hover .tri { color: var(--inverse-muted); }

/* A single-line post set as a quiet statement */
.post .oneliner {
  color: var(--ink);
  font-size: 24px;
  line-height: calc(var(--baseline) * 3);
  letter-spacing: -0.05ex;
  font-style: italic;
  max-width: 24ch;
  margin: var(--space-2) 0 0;
}

/* Related / further-reading link clusters */
.linklist p { margin: 0 0 var(--space-1); }
.linklist .by {
  font-family: var(--mono);
  font-style: italic;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.05ex;
  color: var(--ink-muted);
}

/* ---- Editorial essay: contents + chapter headings ----------------- */
.post .contents {
  max-width: var(--measure);
  margin: var(--space-4) 0 var(--space-5);
}
.post .contents-label {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.2ex;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 var(--space-1);
}
.post .contents ol { list-style: none; margin: 0; padding: 0; }
.post .contents li + li { border-top: 1px solid var(--hairline); }
.post .contents a {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  text-decoration: none;
  color: var(--ink);
  font-size: 19px;
}
.post .contents a:hover .c-title { text-decoration: underline; text-underline-offset: 0.18em; }
.post .contents .c-num {
  flex: none;
  width: 2rem;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 14px;
  color: var(--ink-faint);
}

/* Numbered chapter heading — a strong editorial divider between movements */
.post .chapter {
  display: grid;
  gap: var(--space-1);
  max-width: var(--measure);
  margin: var(--space-6) 0 var(--space-4);
  padding-top: var(--space-3);
  border-top: 2px solid var(--ink);
  scroll-margin-top: var(--space-3);
}
.post .chapter .chapter-num {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.2ex;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.post .chapter .chapter-title {
  font-weight: 500;
  font-size: 36px;
  line-height: calc(var(--baseline) * 4);
  letter-spacing: -0.05ex;
  color: var(--ink);
}

/* ---- Full-bleed media + the vertical-pacing demo ------------------ */
.post figure.full-bleed {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  margin-block: var(--space-5);
}
.post figure.full-bleed img { width: 100%; }
/* The line column: fixed at a few screen-heights, stretched edge to edge.
   preserveAspectRatio="none" in the SVG keeps line spacing tied to height,
   not width, so going full-bleed doesn't fatten the lines. */
.post figure.pace { margin-block: 0; }
.post figure.pace img { height: 1500vh; }

.post .pace-chart {
  max-width: var(--measure);
  margin: var(--space-5) 0;
  padding: var(--space-3);
  border: 2px solid var(--ink);
  background: var(--paper);
}
.pace-chart-cap {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.05ex;
  color: var(--ink-muted);
  margin: 0 0 var(--space-2);
}
.pace-chart-canvas svg { width: 100%; height: auto; display: block; }
.pace-verdict {
  font-style: italic;
  color: var(--ink);
  margin: var(--space-3) 0 0;
}

/* ---- "Next" forward nav ------------------------------------------- */
.next {
  position: relative;
  display: block;
  max-width: var(--measure);
  margin-top: var(--space-6);
  padding-top: var(--space-2);
  border-top: 1px solid var(--hairline);
  text-decoration: none;
}
.next .eyebrow {
  display: block;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.2ex;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: var(--space-1);
}
.next .next-title {
  font-weight: 500;
  font-size: 24px;
  line-height: calc(var(--baseline) * 2.5);
  letter-spacing: -0.05ex;
  color: var(--ink);
}
.next:hover .next-title { text-decoration: underline; text-underline-offset: 0.18em; }
.next .arrow { color: var(--ink-faint); }
.next:hover .arrow { visibility: hidden; }
.next:hover .next-title::after {
  content: "☞";
  position: absolute;
  right: 0;
  color: var(--hairline);
  text-decoration: none;
}

/* ---- Footer — dark, like the original ------------------------------ */
.site-footer {
  margin-top: auto;
  background: var(--panel);
  color: var(--inverse-muted);
  max-width: none;
  padding-block: var(--space-4);
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  align-items: baseline;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); }
.site-footer a { color: var(--inverse-muted); text-decoration: none; }
.site-footer a:hover { color: var(--inverse-ink); text-decoration: underline; }
.site-footer .copyright { margin: 0 0 0 auto; color: var(--inverse-muted); }

/* =====================================================================
   HOMEPAGE
   ===================================================================== */
.home .intro {
  font-weight: 500;
  letter-spacing: -0.05ex;
  font-size: 36px;
  line-height: calc(var(--baseline) * 3.5);
  margin: 0 0 var(--space-5);
  padding: var(--space-4) 0;
}
@media all and (min-width: 600px) {
  .home .intro {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 40vh;
    font-size: 54px;
    line-height: calc(var(--baseline) * 5);
  }
}
@media all and (min-width: 768px) {
  .home .intro { font-size: 80px; line-height: calc(var(--baseline) * 7); }
}

/* Recommended / Random picks — the old "highlight links" */
.picks {
  display: grid;
  gap: var(--space-3);
  padding-bottom: var(--space-5);
}
@media all and (min-width: 600px) {
  .picks { grid-template-columns: 1fr 1fr; gap: var(--space-3); }
}
.pick .eyebrow {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.05ex;
  text-transform: uppercase;
  color: var(--ink-muted);
  border-top: 1px solid var(--hairline);
  padding-top: var(--space-2);
  margin: 0 0 var(--space-2);
}
.pick a {
  position: relative;
  display: block;
  font-size: 24px;
  line-height: calc(var(--baseline) * 2.5);
  letter-spacing: -0.05ex;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink);
  padding-right: 1.5em;
}
.pick a:hover { text-decoration: underline; }
.pick a:hover::after {
  content: "☞";
  position: absolute;
  top: 0;
  right: 0;
  color: var(--hairline);
}

/* The signature: a vertical "stem" the A–Z index grows along —
   inverted to the original dark index panel. */
.index {
  background: var(--panel);
  color: var(--inverse-muted);
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: var(--space-5) var(--pad-inline) var(--space-6);
}
.index .index-inner {
  max-width: var(--measure);
  margin-inline: auto;
  position: relative;
  padding-left: calc(var(--baseline) * 2.5);
  border-left: 1.5px solid var(--inverse-hairline);
}
.letter-group { position: relative; padding: var(--space-3) 0; }
.letter-group + .letter-group { border-top: 1px solid var(--inverse-hairline); }
.letter-group .letter {
  position: absolute;
  left: calc(var(--baseline) * -2.5 - 0.75px);
  top: var(--space-3);
  transform: translateX(-50%);
  width: calc(var(--baseline) * 2);
  height: calc(var(--baseline) * 2);
  display: grid;
  place-items: center;
  background: var(--panel);
  font-family: var(--mono);
  font-weight: 500;
  font-size: 14px;
  text-transform: uppercase;
  color: var(--inverse-ink);
}
.index ul { list-style: none; margin: 0; padding: 0; }
.index li { margin: 0; }
.index li a {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem var(--space-2);
  padding: calc(var(--baseline) * 0.4) 0;
  text-decoration: none;
  color: var(--inverse-muted);
}
.index .entry-title { font-size: 19px; transition: color 0.2s; }
.index li a:hover .entry-title {
  color: var(--inverse-ink);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.index .entry-section {
  margin-left: auto;
  font-family: var(--mono);
  font-weight: 500;
  font-style: italic;
  font-size: 14px;
  letter-spacing: -0.05ex;
  color: var(--inverse-muted);
  opacity: 0;
  transition: opacity 0.2s;
}
.index li a:hover .entry-section { opacity: 1; }

/* Leaves unfurl on scroll — disabled under reduced-motion (below) */
.reveal { opacity: 0; transform: translateY(0.5rem); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }

/* =====================================================================
   SECTION INDEX
   ===================================================================== */
.section-index h1 { margin: var(--space-4) 0 var(--space-5); }
.post-list { list-style: none; margin: 0; padding: 0; max-width: var(--measure); }
.post-list li { border-top: 1px solid var(--hairline); }
.post-list li:last-child { border-bottom: 1px solid var(--hairline); }
.post-list a {
  position: relative;
  display: block;
  padding: var(--space-3) 0;
  padding-right: 1.5em;
  text-decoration: none;
  color: var(--ink);
}
.post-list .pl-title {
  font-size: 24px;
  line-height: calc(var(--baseline) * 2.5);
  letter-spacing: -0.05ex;
  font-weight: 500;
}
.post-list a:hover .pl-title { text-decoration: underline; text-underline-offset: 0.18em; }
.post-list a:hover::after {
  content: "☞";
  position: absolute;
  top: var(--space-3);
  right: 0;
  color: var(--hairline);
}
.post-list .pl-sum { display: block; color: var(--ink-muted); font-size: 16px; margin-top: 0.15rem; }

/* ---- Motion / accessibility --------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
