/* chrisbarlow.nz design system.
   No border radius, no shadows, no gradients: every edge is a 1px rule.
   Breakpoints are content-driven: 900px where the rails stop earning their space,
   600px where three-column grids stop working. */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 100%;
  font-display: swap;
  src: url(/fonts/archivo-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 100%;
  font-display: swap;
  src: url(/fonts/archivo-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url(/fonts/jetbrainsmono-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url(/fonts/jetbrainsmono-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ------------------------------------------------------------------------------------
   Tokens. The OS setting picks a palette; the header button overrides it via data-theme. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --quiet: #eef0f5;
  --ink: #14161a;
  --muted: #4d5561;
  --soft: #5d6673;
  --rule: #d8dce2;
  --hair: #e3e7ec;
  --accent: #1c5b78;
  --on-accent: #ffffff;
  color-scheme: light;

  --sans: "Archivo", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --gutter: 64px;
  --max: 1120px;
  --header-h: 81px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a;
    --surface: #1a1d23;
    --quiet: #171a1f;
    --ink: #eef0f3;
    --muted: #a2a9b4;
    --soft: #8d95a1;
    --rule: #2b3038;
    --hair: #262b33;
    --accent: #8fbcd4;
    --on-accent: #0f1115;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #14161a;
  --surface: #1a1d23;
  --quiet: #171a1f;
  --ink: #eef0f3;
  --muted: #a2a9b4;
  --soft: #8d95a1;
  --rule: #2b3038;
  --hair: #262b33;
  --accent: #8fbcd4;
  --on-accent: #0f1115;
  color-scheme: dark;
}

/* ------------------------------------------------------------------------------------
   Resets, focus and utilities */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, p, ul, ol, dl, dd, figure, pre {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

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

a {
  color: inherit;
}

p, h1, h2, h3, li, dd {
  text-wrap: pretty;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
}

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

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

/* The route behind every page. Fixed, so the content scrolls over it; surfaces such as
   cards and the header cover it, which is what keeps it quiet. */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  color: var(--soft);
  opacity: 0.2;
  pointer-events: none;
}
.backdrop-route {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.backdrop-start,
.backdrop-stop {
  position: absolute;
  transform: translate(-50%, -50%);
}
.backdrop-start {
  left: 7%;
  top: 16%;
}
.backdrop-flag {
  position: absolute;
  left: 88%;
  top: 88%;
  transform: translate(-4px, -60px);
}
/* The header keeps its own sticky positioning and z-index, so it is left out here. */
body > :not(.backdrop):not(.skip-link):not(.site-header) {
  position: relative;
  z-index: 1;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 10;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14px;
  text-decoration: none;
}
.skip-link:focus {
  top: 16px;
}

.wrap {
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* The header stays on screen, so anchors land below it. */
[id] {
  scroll-margin-top: calc(var(--header-h) + 24px);
}

/* Links in prose carry the accent; the underline stays so colour is never the only cue. */
.prose a,
.theme-intro a,
.card-why a,
.intro a,
.lede a,
.site-footer a {
  color: var(--accent);
}
.prose a:hover,
.theme-intro a:hover,
.card-why a:hover,
.intro a:hover,
.lede a:hover,
.site-footer a:hover {
  color: var(--ink);
}

/* A standalone link: accent, a rule beneath, and a 44px target. */
.link-rule {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}
.link-rule:hover {
  color: var(--ink);
}

.label {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  border: 1px solid var(--accent);
  padding: 3px 8px;
}
.label--filled {
  background: var(--quiet);
}

.spine {
  font-family: var(--mono);
  font-size: 20px;
  line-height: 1;
  color: var(--accent);
}

.spine-sm {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--soft);
}

.metrics {
  white-space: pre;
}

/* ------------------------------------------------------------------------------------
   Header and footer */

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 18px;
}

.wordmark {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 14px;
  align-content: center;
  min-height: 44px;
  text-decoration: none;
  color: var(--ink);
}

.wordmark-name {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.04em;
}

.wordmark-strapline {
  font-size: 14px;
  color: var(--muted);
}
.wordmark:hover .wordmark-strapline {
  color: var(--ink);
}

.site-header-controls {
  display: flex;
  align-items: center;
  gap: 28px;
}

.site-nav {
  display: flex;
  gap: 28px;
  font-size: 14px;
  font-weight: 500;
}

.site-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  color: var(--muted);
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
}

.mode-toggle {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  background: none;
  border: 0;
  padding: 0;
  color: var(--soft);
  cursor: pointer;
}
.mode-toggle:hover {
  color: var(--ink);
}

/* The icon shows the mode the button switches to: a sun while dark, a crescent while light. */
.mode-toggle .icon-sun {
  display: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mode-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .mode-toggle .icon-moon { display: none; }
}
:root[data-theme="dark"] .mode-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .mode-toggle .icon-moon { display: none; }

.site-footer {
  border-top: 1px solid var(--rule);
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}
.site-footer .wrap {
  padding-block: 22px 30px;
}

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

.lede {
  display: flex;
  flex-direction: column;
  gap: 36px;
  padding-block: 120px 96px;
}

.lede-line {
  max-width: 940px;
  font-size: 62px;
  line-height: 1.04;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.lede-sub {
  max-width: 640px;
  font-size: 19px;
  line-height: 1.6;
  color: var(--muted);
}

.teasers-block {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding-bottom: 96px;
}

.teasers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--hair);
  border: 1px solid var(--hair);
}

.teaser a {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  min-height: 168px;
  padding: 26px 24px 22px;
  background: var(--surface);
  text-decoration: none;
}

.teaser-num {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.teaser-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.teaser-name {
  font-size: 23px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.teaser-desc {
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
}
.teaser a:hover .teaser-desc {
  color: var(--ink);
}

/* Side quests is the subordinate cell: same grid, visibly less weight. */
.teaser--quiet a {
  gap: 8px;
  padding: 20px 24px;
  background: var(--quiet);
}
.teaser--quiet .teaser-num {
  color: var(--soft);
}
.teaser--quiet .teaser-text {
  gap: 8px;
}
.teaser--quiet .teaser-name {
  font-size: 17px;
  font-weight: 500;
  color: var(--muted);
}
.teaser--quiet .teaser-desc {
  font-size: 14px;
  color: var(--soft);
}
.teaser--quiet a:hover .teaser-name,
.teaser--quiet a:hover .teaser-desc {
  color: var(--ink);
}

.contact-block {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-bottom: 88px;
}

.contact-heading {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.channels {
  border-top: 1px solid var(--rule);
}

.channel {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) auto;
  grid-template-areas: "name desc handle";
  gap: 24px;
  align-items: baseline;
  padding: 18px 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: var(--ink);
}

.channel-name {
  grid-area: name;
  font-size: 16px;
  font-weight: 600;
}

.channel-desc {
  grid-area: desc;
  font-size: 15px;
  color: var(--muted);
}

.channel-handle {
  grid-area: handle;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  overflow-wrap: anywhere;
}

.channel:hover .channel-desc {
  color: var(--ink);
}

/* ------------------------------------------------------------------------------------
   Page intros (Projects, Writing) */

.intro {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-block: 88px 56px;
  max-width: 672px;
}

.intro--lead {
  max-width: 732px;
}

.page-title {
  font-size: 58px;
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -0.035em;
}

.intro-lead {
  font-size: 21px;
  line-height: 1.5;
}

.intro-p {
  font-size: 16.5px;
  line-height: 1.72;
  color: var(--muted);
}
.intro--lead .intro-p {
  font-size: 16px;
  line-height: 1.7;
}

.written {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: 72px;
}

.section-heading {
  font-size: 34px;
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.prose {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 680px;
}
.prose p {
  font-size: 16.5px;
  line-height: 1.72;
  color: var(--muted);
}

/* The numbered Theme list stands in for the rail below 900px. */
.theme-list {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 32px;
  margin-top: 4px;
  border-top: 1px solid var(--rule);
}
.theme-list a {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 6px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 14.5px;
  line-height: 1.35;
  text-decoration: none;
  color: var(--ink);
}
.theme-list a:hover span:last-child {
  color: var(--accent);
}

/* ------------------------------------------------------------------------------------
   Rails: Projects' Themes and About's "On this page" */

.rail-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
  padding-bottom: 96px;
}

.rail {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  display: flex;
  flex-direction: column;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.rail-label {
  padding-bottom: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--soft);
}

.rail a {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  padding: 8px 0;
  font-size: 13.5px;
  line-height: 1.35;
  text-decoration: none;
  color: var(--ink);
}
.rail a:hover span:last-child {
  color: var(--accent);
}

/* ------------------------------------------------------------------------------------
   Projects: Theme sections, cards and tiles */

.themes {
  display: flex;
  flex-direction: column;
  gap: 72px;
  min-width: 0;
}

.theme {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.theme-head {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding-top: 18px;
  border-top: 1px solid var(--ink);
}

.theme-head-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.theme-head-body .eyebrow + .theme-name,
.intro .eyebrow + .page-title {
  margin-top: -8px;
}

.theme-name {
  font-size: 34px;
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.theme-desc {
  font-size: 18px;
  line-height: 1.45;
  color: var(--ink);
}

.theme-intro {
  display: flex;
  flex-direction: column;
  gap: 13px;
  max-width: 680px;
}
.theme-intro p {
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--muted);
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--hair);
  border: 1px solid var(--hair);
}

.card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 26px;
  background: var(--surface);
}

.card-main {
  display: flex;
  flex-direction: column;
  gap: 13px;
  min-width: 0;
}

/* The image is an aside: the card is complete without one, and nothing moves when absent. */
.card-main--image {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 272px;
  grid-template-rows: auto auto 1fr;
  column-gap: 28px;
  row-gap: 13px;
}
.card-main--image > .card-head,
.card-main--image > .card-tagline,
.card-main--image > .card-why {
  grid-column: 1;
}
.card-main--image > .card-why {
  align-self: start;
}
.card-image {
  grid-column: 2;
  grid-row: 1 / 4;
  width: 100%;
  border: 1px solid var(--hair);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.card-name {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.card-tagline {
  max-width: 660px;
  font-size: 16.5px;
  line-height: 1.45;
  color: var(--ink);
}

.card-why,
.why-rest {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 660px;
}
.card-why p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted);
}

.js .why-rest:not(.is-open) {
  display: none;
}
html:not(.js) .why-toggle {
  display: none;
}

.why-toggle {
  align-self: flex-start;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  background: none;
  border: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  cursor: pointer;
}
.why-toggle:hover {
  color: var(--ink);
}

/* With a mouse, the rest of the why appears in a bubble on hover or focus, so nothing
   needs a click. A click still pins it open. Touch keeps the disclosure. */
@media (hover: hover) and (min-width: 601px) {
  .js .card-why {
    position: relative;
  }
  .js .why-rest {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 3;
    max-width: 660px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--rule);
  }
  .js .card-why:has(.why-toggle:hover, .why-toggle:focus-visible, .why-rest:hover) .why-rest {
    display: flex;
  }
}

.card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  padding-top: 6px;
  border-top: 1px solid var(--hair);
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  column-gap: 18px;
}
.card-links .link-rule {
  font-size: 15px;
}

.card-meta {
  margin-left: auto;
  display: flex;
  gap: 18px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--soft);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--hair);
  border: 1px solid var(--hair);
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px;
  background: var(--quiet);
}

.tile-name {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.tile-desc {
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.tile-foot {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 12px;
  padding-top: 8px;
}
.tile-foot .link-rule {
  font-size: 14px;
}
.tile-foot .metrics {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--soft);
}

/* ------------------------------------------------------------------------------------
   Writing */

.articles {
  max-width: var(--max);
  margin-inline: auto;
  padding: 0 var(--gutter) 96px;
}
.articles > .entry:first-child {
  border-top: 1px solid var(--ink);
}

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

.entry-link,
.series-head {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 200px;
  gap: 24px 32px;
  align-items: start;
}

/* The image column is always there, so titles line up whether or not a row has one. */
.entry-figure {
  min-width: 0;
}

.entry-link {
  padding: 24px 0;
  text-decoration: none;
  color: var(--ink);
}

.entry-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.entry-title {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.entry-desc {
  max-width: 620px;
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--muted);
}

.entry-link:hover .entry-desc,
.part:hover .part-desc {
  color: var(--ink);
}
.entry-link:hover .entry-title {
  color: var(--accent);
}

.entry-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--soft);
  text-align: right;
}

.entry-pub {
  color: var(--accent);
}

/* An image is an aside on the row, like the card image: the row is complete without one. */
.entry-image {
  width: 100%;
  border: 1px solid var(--hair);
}

.series {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 0;
}

.series-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.parts {
  margin-left: 192px;
  border-left: 1px solid var(--rule);
}

.part {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 120px;
  gap: 20px;
  align-items: baseline;
  padding: 12px 0 12px 24px;
  text-decoration: none;
  color: var(--ink);
}

.part-label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
}

.part-desc {
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--muted);
}

.part-date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--soft);
  text-align: right;
}

/* ------------------------------------------------------------------------------------
   About: numbered sections, the portrait and the Model summary */

.numbered-page {
  padding-top: 88px;
}

.numbered-list {
  display: flex;
  flex-direction: column;
  gap: 64px;
  min-width: 0;
}

.numbered {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding-top: 18px;
  border-top: 1px solid var(--ink);
}

.numbered-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
.numbered--contact .numbered-body {
  gap: 20px;
}

.numbered-heading {
  font-size: 34px;
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.025em;
}

/* At full width the summary panel carries its own number; the heading is for the rail
   and for screen readers, and shows again once the layout stacks. */
.numbered--panel {
  padding-top: 0;
  border-top: 0;
}
.numbered--panel .numbered-heading {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.portrait {
  max-width: 420px;
  margin-top: 4px;
}
.portrait img {
  width: 100%;
  border: 1px solid var(--rule);
}

.summary-block {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 88px;
}

.summary {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  padding: 26px 28px;
  background: var(--surface);
  border: 1px solid var(--rule);
}

.summary-source {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.summary-source .label {
  letter-spacing: 0.1em;
  padding: 4px 9px;
}

.summary-line {
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
}

.counts {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  background: var(--hair);
  border: 1px solid var(--hair);
}
.counts li {
  flex: 1 1 136px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--bg);
}

.count-n {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.count-type {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--soft);
}

.summary-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.summary-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.summary-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--soft);
}

.fields {
  border-top: 1px solid var(--hair);
}
.fields div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hair);
}
.fields dt {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--soft);
}
.fields dd {
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.raw {
  padding: 14px 16px;
  background: var(--quiet);
  border: 1px solid var(--hair);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.summary-link {
  align-self: flex-start;
  font-size: 15px;
}

/* ------------------------------------------------------------------------------------
   900px: the rails stop earning their space */

@media (max-width: 900px) {
  :root {
    --gutter: 40px;
    --header-h: 73px;
  }

  .site-header-inner {
    padding-block: 14px;
  }
  .wordmark-name,
  .wordmark-strapline {
    font-size: 13px;
  }
  .site-header-controls,
  .site-nav {
    gap: 24px;
  }
  .site-footer {
    font-size: 13.5px;
  }
  .site-footer .wrap {
    padding-block: 20px 26px;
  }

  .lede {
    gap: 30px;
    padding-block: 88px 72px;
  }
  .lede-line {
    font-size: 48px;
  }
  .lede-sub {
    font-size: 18px;
  }
  .teasers-block {
    padding-bottom: 72px;
  }
  .teaser a {
    padding: 22px 20px 20px;
  }
  .teaser-name {
    font-size: 20px;
  }
  .contact-block {
    padding-bottom: 64px;
  }
  .contact-heading {
    font-size: 28px;
  }
  .channel {
    grid-template-columns: 140px minmax(0, 1fr) auto;
    gap: 20px;
  }

  .intro {
    gap: 22px;
    padding-block: 64px 40px;
    max-width: 620px;
  }
  .page-title {
    font-size: 50px;
  }
  .intro-lead {
    font-size: 19px;
    line-height: 1.45;
  }
  .intro-p,
  .intro--lead .intro-p {
    font-size: 15.5px;
    line-height: 1.7;
  }

  .theme-list {
    display: grid;
  }

  .rail-layout {
    display: block;
    padding-bottom: 48px;
  }
  .rail {
    display: none;
  }

  .themes {
    gap: 44px;
  }
  .theme {
    gap: 24px;
  }
  .theme-head {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 18px;
    padding-top: 16px;
  }
  .theme-head .spine {
    font-size: 18px;
  }
  .theme-head-body {
    gap: 14px;
  }
  .theme-name {
    font-size: 30px;
    line-height: 1.1;
  }
  .theme-desc {
    font-size: 17px;
  }
  .theme-intro {
    max-width: 620px;
  }
  .theme-intro p {
    font-size: 15px;
  }

  /* Side quests' header loses weight along with its tiles. */
  .theme--showcase {
    gap: 18px;
  }
  .theme--showcase .spine {
    color: var(--soft);
  }
  .theme--showcase .theme-head-body {
    gap: 8px;
  }
  .theme--showcase .theme-name {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.02em;
  }
  .theme--showcase .theme-desc {
    font-size: 15px;
    line-height: 1.5;
    color: var(--muted);
  }

  .card {
    gap: 14px;
    padding: 20px 22px;
  }
  .card-main {
    gap: 11px;
  }
  .card-main--image {
    grid-template-columns: minmax(0, 1fr) 220px;
    column-gap: 22px;
    row-gap: 11px;
  }
  .card-head {
    gap: 10px;
  }
  .card-name {
    font-size: 20px;
  }
  .card .label {
    font-size: 10.5px;
    padding: 3px 7px;
  }
  .card-tagline {
    font-size: 15.5px;
  }
  .card-why p {
    font-size: 14.5px;
  }
  .why-toggle {
    font-size: 11.5px;
  }
  .card-foot {
    gap: 18px;
    padding-top: 4px;
  }
  .card-links {
    column-gap: 16px;
  }
  .card-links .link-rule {
    font-size: 14.5px;
  }
  .card-meta {
    gap: 16px;
    font-size: 11.5px;
  }

  .tile {
    gap: 7px;
    padding: 15px 16px;
  }
  .tile-name {
    font-size: 15.5px;
    letter-spacing: 0;
  }
  .tile-desc {
    font-size: 13px;
    line-height: 1.45;
  }
  .tile-foot {
    padding-top: 0;
  }
  .tile-foot .link-rule {
    font-size: 13.5px;
  }

  .articles {
    padding-bottom: 72px;
  }

  .numbered-page {
    padding-top: 64px;
  }
  .numbered-list {
    gap: 48px;
  }
  .numbered {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 18px;
    padding-top: 16px;
  }
  .numbered .spine {
    font-size: 18px;
  }
  .numbered-body {
    gap: 16px;
  }
  .numbered-heading {
    font-size: 30px;
    line-height: 1.1;
  }
  .numbered .prose {
    max-width: 620px;
  }
  .numbered .prose p {
    font-size: 16px;
  }
  .portrait {
    max-width: 360px;
  }

  .summary {
    gap: 18px;
    padding: 22px;
  }
  .summary-source .label {
    font-size: 10.5px;
    padding: 4px 8px;
  }
  .summary-line {
    font-size: 14.5px;
  }
  .counts li {
    flex-basis: 120px;
    gap: 3px;
    padding: 12px 14px;
  }
  .count-n {
    font-size: 22px;
  }
  .count-type,
  .summary-eyebrow {
    font-size: 10.5px;
  }
  .summary-cols {
    gap: 20px;
  }
  .summary-col {
    gap: 10px;
  }
  .fields div {
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 10px;
    padding: 7px 0;
  }
  .fields dt {
    font-size: 11.5px;
  }
  .fields dd {
    font-size: 13.5px;
  }
  .raw {
    padding: 12px 14px;
    font-size: 11.5px;
  }
  .summary-link {
    font-size: 14.5px;
  }
}

/* ------------------------------------------------------------------------------------
   600px: one column throughout */

@media (max-width: 600px) {
  :root {
    --gutter: 20px;
    --header-h: 109px;
  }

  /* The header becomes two rows: wordmark and mode button, then four equal nav cells. */
  .site-header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
  }
  .site-header .wrap {
    padding-inline: 0;
  }
  .wordmark {
    padding-left: 20px;
  }
  .site-header-controls {
    display: contents;
  }
  .site-header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "mark toggle" "nav nav";
  }
  .wordmark {
    grid-area: mark;
    min-height: 64px;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
  }
  .wordmark-strapline {
    font-size: 12px;
  }
  .mode-toggle {
    grid-area: toggle;
    align-self: center;
    margin-right: 20px;
  }
  .site-nav {
    grid-area: nav;
    gap: 0;
    border-top: 1px solid var(--hair);
    font-size: 13px;
    font-weight: 400;
  }
  .site-nav a {
    flex: 1;
    justify-content: center;
  }
  .site-nav a[aria-current="page"] {
    font-weight: 600;
  }

  .site-footer {
    font-size: 13px;
  }
  .site-footer .wrap {
    padding-block: 18px 24px;
  }

  .lede {
    gap: 22px;
    padding-block: 56px 48px;
  }
  .lede-line {
    font-size: 34px;
    line-height: 1.1;
  }
  .lede-sub {
    font-size: 16px;
  }

  .teasers-block {
    gap: 18px;
    padding-bottom: 48px;
  }
  .eyebrow {
    font-size: 11px;
  }
  .teasers {
    grid-template-columns: minmax(0, 1fr);
  }
  .teaser a,
  .teaser--quiet a {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 12px;
    align-items: baseline;
    min-height: 0;
    padding: 16px 18px;
  }
  .teaser-text,
  .teaser--quiet .teaser-text {
    gap: 6px;
  }
  .teaser-name,
  .teaser--quiet .teaser-name {
    font-size: 18px;
    line-height: 1.2;
    letter-spacing: -0.015em;
  }
  .teaser-desc,
  .teaser--quiet .teaser-desc {
    font-size: 14px;
  }

  .contact-block {
    gap: 16px;
    padding-bottom: 44px;
  }
  .contact-heading {
    font-size: 24px;
  }
  .channel {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "name handle" "desc desc";
    gap: 4px 12px;
    padding: 14px 0;
  }
  .channel-desc {
    font-size: 14px;
    line-height: 1.5;
  }
  .channel-handle {
    font-size: 12px;
  }

  .intro {
    gap: 18px;
    padding-block: 44px 32px;
  }
  .intro:not(.intro--lead) {
    gap: 16px;
    padding-bottom: 28px;
  }
  .page-title {
    font-size: 38px;
  }
  .intro-lead {
    font-size: 17px;
  }
  .intro-p,
  .intro--lead .intro-p {
    font-size: 15px;
  }
  .theme-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .rail-layout {
    padding-bottom: 40px;
  }
  .themes {
    gap: 36px;
  }
  .theme {
    gap: 20px;
  }
  .theme-head {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 14px;
  }
  .theme-head .spine {
    font-size: 16px;
    line-height: 1.2;
  }
  .theme-head-body {
    gap: 12px;
  }
  .theme-name {
    font-size: 26px;
  }
  .theme-desc {
    font-size: 16px;
  }
  .theme-intro p {
    font-size: 14.5px;
  }
  .theme--showcase .theme-head {
    gap: 10px;
  }
  .theme--showcase .theme-head-body {
    gap: 10px;
  }
  .theme--showcase .theme-name {
    font-size: 22px;
    line-height: 1.12;
  }
  .theme--showcase .theme-desc {
    font-size: 14.5px;
  }

  /* Labels wrap above the name; the image follows the tagline at 16:9. */
  .card {
    gap: 11px;
    padding: 18px;
  }
  .card-main,
  .card-main--image {
    display: flex;
    flex-direction: column;
    gap: 11px;
  }
  .card-head {
    gap: 8px;
  }
  .card-name {
    order: 1;
    flex-basis: 100%;
    line-height: 1.2;
  }
  .card-tagline {
    font-size: 15px;
  }
  .card-why,
  .why-rest {
    gap: 11px;
  }
  .card-foot {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .card-meta {
    margin-left: 0;
  }

  /* Two across, not one, so the group stays denser and lighter than the cards above it. */
  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tile {
    gap: 6px;
    padding: 14px;
  }
  .tile-name {
    font-size: 14.5px;
  }
  .tile-desc {
    font-size: 12.5px;
  }
  .tile-foot .link-rule {
    font-size: 13px;
  }

  .articles {
    padding-bottom: 40px;
  }
  .entry-link,
  .series-head {
    grid-template-columns: 96px minmax(0, 1fr);
    grid-template-areas: "figure main" "figure meta";
    gap: 6px 14px;
    padding: 18px 0;
  }
  .entry-link .entry-figure,
  .series-head .entry-figure {
    grid-area: figure;
  }
  .entry-main,
  .series-main {
    grid-area: main;
  }
  .entry-meta {
    grid-area: meta;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 11.5px;
    text-align: left;
  }
  .entry-title {
    font-size: 19px;
    line-height: 1.22;
  }
  .entry-desc {
    font-size: 14.5px;
  }
  .series {
    gap: 14px;
    padding: 18px 0;
  }
  .series-head {
    padding: 0;
  }
  .series-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .series-head .label {
    font-size: 11.5px;
    padding: 3px 7px;
  }
  .series-head .entry-meta {
    gap: 10px;
  }
  .parts {
    margin-left: 10px;
  }
  .part {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "label date" "desc desc";
    gap: 5px 12px;
    padding: 10px 0 10px 16px;
  }
  .part-label {
    grid-area: label;
    font-size: 11.5px;
  }
  .part-date {
    grid-area: date;
    font-size: 11.5px;
  }
  .part-desc {
    grid-area: desc;
    font-size: 14px;
  }

  .numbered-page {
    padding-top: 44px;
  }
  .numbered-list {
    gap: 40px;
  }
  .numbered,
  .numbered--panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--ink);
  }
  .numbered .spine {
    font-size: 16px;
    line-height: 1.2;
  }
  .numbered-body,
  .numbered--contact .numbered-body {
    gap: 16px;
  }
  .numbered-heading {
    font-size: 26px;
  }
  .numbered--panel .numbered-heading {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -0.02em;
  }
  .numbered .prose p {
    font-size: 15.5px;
  }
  .portrait {
    max-width: none;
  }

  .summary {
    gap: 16px;
    padding: 16px;
  }
  .summary-source {
    flex-direction: column;
    align-items: flex-start;
    gap: 9px;
  }
  .summary-line {
    font-size: 14px;
    line-height: 1.55;
  }
  .counts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .counts li {
    padding: 11px 13px;
  }
  .counts li:last-child:nth-child(odd) {
    grid-column: span 2;
  }
  .count-n {
    font-size: 21px;
  }
  .summary-cols {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  .summary-col {
    gap: 9px;
  }
  .fields div {
    grid-template-columns: 82px minmax(0, 1fr);
  }
  .fields dd {
    font-size: 13px;
  }
  .raw {
    padding: 12px;
  }
  .summary-link {
    font-size: 14px;
  }
}
