/* ==========================================================================
   ROBISK87 — style.css
   Index
     1. Fonts
     2. Tokens (colours, type, spacing)   <-- change colours here
     3. Base
     4. Chrome: top bar, rail, index dialog
     5. Layout helpers
     6. Chapter heads
     7. Hero + intro
     8. Components (quote, timeline, ledger, case, flow, lists…)
     9. Plates (photos + placeholders)
    10. Chapter-specific
    11. Footer
    12. Motion (reveals)  <-- change animations here
    13. Responsive
   ========================================================================== */


/* 1. FONTS ---------------------------------------------------------------- */
@font-face {
  font-family: "Newsreader";
  src: url("../assets/fonts/newsreader-var.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("../assets/fonts/newsreader-var-italic.woff2") format("woff2");
  font-weight: 200 800; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Plex Sans";
  src: url("../assets/fonts/plex-sans-400.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "Plex Sans";
  src: url("../assets/fonts/plex-sans-500.woff2") format("woff2");
  font-weight: 500; font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("../assets/fonts/plex-mono-400.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("../assets/fonts/plex-mono-500.woff2") format("woff2");
  font-weight: 500; font-display: swap;
}


/* 2. TOKENS --------------------------------------------------------------- */
/* light-dark(LIGHT, DARK): one place, both themes.
   The theme is chosen by [data-theme] on <html>, else by the OS setting. */
:root {
  color-scheme: light dark;

  --paper:   light-dark(#F1EFE8, #1B1B19);   /* page */
  --paper-2: light-dark(#E8E5DA, #232321);   /* slightly deeper sections */
  --ink:     light-dark(#1C1C1A, #ECE9DF);   /* text */
  --grey:    light-dark(#66645E, #A19E94);   /* secondary text (AA on paper) */
  --rule:    light-dark(rgb(28 28 26 / .20), rgb(236 233 223 / .20));
  --rule-2:  light-dark(rgb(28 28 26 / .09), rgb(236 233 223 / .09));
  --green:   light-dark(#18392B, #7DB394);   /* British racing green (accent) */
  --brass:   light-dark(#7C5E2E, #C7A770);   /* muted brass (accent) */
  --night:   light-dark(#1C1C1A, #131312);   /* always-dark panel (Space) */
  --night-ink: #E9E6DC;
  --night-grey: #A7A49A;

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans:  "Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:  "Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --gutter: clamp(20px, 4.2vw, 64px);
  --gap:    clamp(14px, 2vw, 32px);
  --max:    1360px;
  --section-y: clamp(96px, 14vw, 200px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --bar-h: 56px;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

/* Browsers without light-dark(): fall back to the light palette. */
@supports not (color: light-dark(#000, #fff)) {
  :root {
    --paper:#F1EFE8; --paper-2:#E8E5DA; --ink:#1C1C1A; --grey:#66645E;
    --rule:rgb(28 28 26 / .20); --rule-2:rgb(28 28 26 / .09);
    --green:#18392B; --brass:#7C5E2E; --night:#1C1C1A;
  }
}


/* 3. BASE ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--bar-h) + 12px);
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(1rem, .96rem + .2vw, 1.125rem);
  line-height: 1.65;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
/* Smooth colour change only while the user toggles the theme */
html.theming, html.theming *, html.theming *::before, html.theming *::after {
  transition: background-color .45s ease, color .45s ease, border-color .45s ease !important;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

/* Links never use the browser's default blue: they take the text colour,
   and turn racing green on hover/focus. */
a { color: inherit; text-decoration: none; }
a:visited { color: inherit; }

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

/* Focus: visible, quiet */
:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 4px;
  border-radius: 2px;
}
.skip {
  position: fixed; left: var(--gutter); top: 8px; z-index: 100;
  padding: 8px 12px; background: var(--ink); color: var(--paper);
  font: 500 .75rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* Type roles */
.mono, .label {
  font-family: var(--mono);
  font-size: .72rem;
  line-height: 1.5;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 400;
}
.label { color: var(--grey); }
.serif { font-family: var(--serif); }
.accent { color: var(--green); }
.brass  { color: var(--brass); }
.muted  { color: var(--grey); }

/* Links: static hairline + underline that draws on hover/focus */
.link {
  color: inherit;
  text-decoration: none;
  background:
    linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat,
    linear-gradient(var(--rule), var(--rule)) 0 100% / 100% 1px no-repeat;
  padding-bottom: 2px;
  transition: background-size .45s var(--ease), color .25s;
}
.link:hover, .link:focus-visible { background-size: 100% 1px, 100% 1px; color: var(--green); }

.prose p + p { margin-top: 1.1em; }
.prose { max-width: 38em; color: color-mix(in srgb, var(--ink) 88%, var(--paper)); }
.prose strong { font-weight: 500; color: var(--ink); }
.prose em { font-family: var(--serif); font-size: 1.06em; }

.lead {
  font-family: var(--serif);
  font-size: clamp(1.2rem, 1rem + .8vw, 1.55rem);
  line-height: 1.32;
  font-weight: 350;
  letter-spacing: -.005em;
  max-width: 28em;
}

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.tags li {
  font: 400 .68rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  padding: 6px 8px; border: 1px solid var(--rule); border-radius: 2px; color: var(--grey);
}

/* Status stamp. Never colour-only: the word is always there. */
.stamp {
  display: inline-block;
  font: 500 .68rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
  padding: 6px 9px 5px;
  border: 1px solid var(--brass); color: var(--brass);
  border-radius: 2px;
}
.stamp--solid { background: var(--brass); color: var(--paper); }


/* 4. CHROME ---------------------------------------------------------------- */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--bar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-inline: var(--gutter);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, transform .4s var(--ease);
}
.bar.is-scrolled { border-bottom-color: var(--rule-2); }
.bar__mark { font: 500 .78rem/1 var(--mono); letter-spacing: .16em; text-decoration: none; }
.bar__now {
  flex: 1; text-align: left; color: var(--grey);
  display: flex; gap: .7em; align-items: baseline;
  overflow: hidden; white-space: nowrap;
}
.bar__now .n { color: var(--green); }
.bar__now .t { transition: opacity .3s; }
.bar__tools { display: flex; align-items: center; gap: 4px; }
.bar__btn {
  min-height: 44px; min-width: 44px; padding-inline: 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 500 .72rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink); text-decoration: none;
  transition: color .25s;
}
.bar__btn:hover { color: var(--green); }
.bar__progress {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: var(--green); transform-origin: left; transform: scaleX(var(--p, 0));
}

/* Translatable text: <t-i data-i="KEY">Italian</t-i>. JS swaps the content for the English version.
   display:contents keeps the surrounding layout exactly as if the text were direct. */
t-i { display: contents; }

/* Language switch: IT / EN, same voice as the rest of the monospace chrome */
.lang {
  display: inline-flex; align-items: center;
  font: 500 .72rem/1 var(--mono); letter-spacing: .12em;
  margin-right: 2px;
}
.lang button {
  min-height: 44px; min-width: 32px; padding-inline: 5px;
  color: var(--grey); letter-spacing: inherit;
  text-decoration: underline; text-decoration-color: transparent;
  text-decoration-thickness: 1px; text-underline-offset: 6px;
  transition: color .25s, text-decoration-color .25s;
}
.lang button:hover { color: var(--ink); }
.lang button[aria-pressed="true"] { color: var(--ink); text-decoration-color: var(--brass); }
.lang > span { color: var(--brass); }

/* Theme toggle: a circle, half filled */
.theme-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
  transition: transform .5s var(--ease);
}
html[data-theme="dark"] .theme-dot { transform: rotate(180deg); }
.no-js-hide { display: none; }
.js .no-js-hide { display: inline-flex; }

/* Rail: tiny chapter numbers on the right edge (desktop only) */
.rail {
  position: fixed; right: clamp(10px, 1.6vw, 28px); top: 50%; z-index: 40;
  transform: translateY(-50%);
  display: none;
}
.rail ol { display: grid; gap: 2px; }
.rail a {
  position: relative; display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  min-height: 28px; padding-inline: 4px;
  font: 400 .66rem/1 var(--mono); letter-spacing: .1em;
  color: var(--grey); text-decoration: none;
  transition: color .25s;
}
.rail a .t {
  position: absolute; right: 100%; margin-right: 6px; white-space: nowrap;
  opacity: 0; transform: translateX(6px);
  transition: opacity .25s, transform .35s var(--ease);
  pointer-events: none; background: var(--paper); padding: 4px 6px;
}
.rail a:hover .t, .rail a:focus-visible .t, .rail a[aria-current="true"] .t { opacity: 1; transform: none; }
.rail a::after {
  content: ""; width: 6px; height: 1px; background: currentColor;
  transition: width .35s var(--ease);
}
.rail a[aria-current="true"] { color: var(--green); }
.rail a[aria-current="true"]::after { width: 18px; }
.rail a:hover { color: var(--ink); }
@media (min-width: 1180px) { .rail { display: block; } }

/* Index dialog */
.index {
  width: 100%; max-width: none; height: 100%; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: var(--paper); color: var(--ink);
}
.index::backdrop { background: transparent; }
.index[open] { animation: index-in .45s var(--ease); }
@keyframes index-in { from { opacity: 0; transform: translateY(-10px); } }
.index__inner {
  min-height: 100%; max-width: var(--max); margin-inline: auto;
  padding: calc(var(--bar-h) + 24px) var(--gutter) 40px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
}
.index__close {
  position: fixed; top: 6px; right: calc(var(--gutter) - 10px);
  min-height: 44px; padding-inline: 10px; z-index: 2;
  font: 500 .72rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
}
.index__list a {
  display: grid; grid-template-columns: 3.2rem 1fr auto; align-items: baseline; gap: 12px;
  padding: clamp(10px, 1.6vh, 18px) 0; border-top: 1px solid var(--rule-2);
  text-decoration: none; transition: padding-left .4s var(--ease), color .25s;
}
.index__list li:last-child a { border-bottom: 1px solid var(--rule-2); }
.index__list .n { font: 400 .75rem/1 var(--mono); letter-spacing: .1em; color: var(--green); }
.index__list .t { font-family: var(--serif); font-size: clamp(1.5rem, 1.1rem + 2vw, 2.6rem); line-height: 1.05; font-weight: 350; letter-spacing: -.01em; }
.index__list .d { font: 400 .68rem/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--grey); text-align: right; }
.index__list a:hover, .index__list a:focus-visible { padding-left: 12px; color: var(--green); }
.index__list a[aria-current="true"] .t { font-style: italic; }
@media (max-width: 640px) {
  .index__list a { grid-template-columns: 2.4rem 1fr; }
  .index__list .d { display: none; }
}


/* 5. LAYOUT HELPERS -------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); }
.chapter { position: relative; padding-block: var(--section-y); }
.chapter--tint { background: var(--paper-2); }
.chapter--night {
  background: var(--night); color: var(--night-ink);
  --ink: var(--night-ink); --grey: var(--night-grey);
  --rule: rgb(233 230 220 / .22); --rule-2: rgb(233 230 220 / .10);
  --green: #8CC4A3; --brass: #CBAE78;
  color-scheme: dark;
}
.stack > * + * { margin-top: var(--stack, 1.4rem); }
.rule { height: 1px; background: var(--rule); border: 0; }
.mt-l { margin-top: clamp(48px, 7vw, 112px); }
.mt-m { margin-top: clamp(32px, 4vw, 64px); }


/* 6. CHAPTER HEADS --------------------------------------------------------- */
.chead { margin-bottom: clamp(48px, 7vw, 112px); }
.chead__meta {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px;
  margin-bottom: clamp(24px, 4vw, 56px);
}
.chead__meta .n { color: var(--green); }
.chead__meta .rule { transform-origin: left; }
.chead__title {
  font-family: var(--serif);
  font-weight: 340;
  font-size: clamp(1.95rem, 1.1rem + 3.4vw, 4.2rem);
  line-height: .98;
  letter-spacing: -.022em;
  max-width: 13em;
  text-wrap: balance;
}
.chead__title em { font-style: italic; color: var(--green); font-weight: 300; }


/* 7. HERO + INTRO ---------------------------------------------------------- */
.hero {
  min-height: 100svh;
  padding: calc(var(--bar-h) + clamp(20px, 4vw, 48px)) 0 clamp(24px, 4vw, 48px);
  display: flex; flex-direction: column;
}
.hero > .wrap { flex: 1; display: flex; flex-direction: column; }
.hero__top {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap;
  padding-bottom: 14px; border-bottom: 1px solid var(--rule);
}
.hero__id { font-size: 1rem; line-height: 1.2; font-weight: 400; }
.hero__nick { font: 500 clamp(.95rem, .8rem + .6vw, 1.2rem)/1 var(--mono); letter-spacing: .22em; }
.hero__name {
  display: block; margin-top: 8px;
  font-family: var(--serif); font-style: italic; font-size: clamp(1.1rem, 1rem + .5vw, 1.4rem); font-weight: 350; color: var(--grey);
}
.hero__meta { text-align: right; color: var(--grey); }
.hero__meta span { display: block; transition: color .25s; }
.hero__meta:hover span { color: var(--ink); }

.hero__body { flex: 1; display: grid; align-content: center; padding-block: clamp(40px, 8vh, 96px); }
.display {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2rem, 1rem + 4.4vw, 4.9rem);
  line-height: .98;
  letter-spacing: -.028em;
  grid-column: 1 / span 9;
}
.display .ln { display: block; }
.display .gap { display: block; height: .38em; }
.display em { font-style: italic; color: var(--green); font-weight: 280; }
.hero__plate { grid-column: 10 / span 3; align-self: end; }

.hero__foot {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap;
  padding-top: 14px; border-top: 1px solid var(--rule);
}
.cats { display: flex; flex-wrap: wrap; gap: 2px 0; }
.cats li { display: flex; align-items: center; }
.cats li + li::before { content: "/"; color: var(--brass); padding-inline: .7em; }
.cats a { text-decoration: none; padding-block: 8px; transition: color .25s; }
.cats a:hover { color: var(--green); }
.scrollcue { display: inline-flex; align-items: center; gap: 12px; color: var(--grey); }
.scrollcue::after {
  content: ""; width: 44px; height: 1px; background: currentColor; transform-origin: left;
}

.intro { padding-block: var(--section-y) calc(var(--section-y) * .8); border-top: 1px solid var(--rule-2); }
.intro__text { grid-column: 4 / span 7; }
.intro__label { grid-column: 1 / span 3; }
.toc { grid-column: 4 / span 9; margin-top: clamp(40px, 6vw, 88px); }
.toc a {
  display: grid; grid-template-columns: 3rem minmax(0, 1fr) minmax(0, 1.2fr); gap: var(--gap); align-items: baseline;
  padding-block: 14px; border-top: 1px solid var(--rule-2); text-decoration: none;
  transition: padding-left .4s var(--ease), color .25s;
}
.toc li:last-child a { border-bottom: 1px solid var(--rule-2); }
.toc .n { color: var(--green); font: 400 .72rem/1 var(--mono); letter-spacing: .1em; }
.toc .t { font-family: var(--serif); font-size: clamp(1.25rem, 1rem + .9vw, 1.7rem); line-height: 1.15; }
.toc .d { color: var(--grey); font-size: .92rem; }
.toc a:hover, .toc a:focus-visible { padding-left: 10px; color: var(--green); }


/* 8. COMPONENTS ------------------------------------------------------------ */
/* Pull quote */
.pull {
  position: relative;
  font-family: var(--serif); font-style: italic; font-weight: 300;
  font-size: clamp(1.4rem, 1rem + 1.7vw, 2.3rem);
  line-height: 1.12; letter-spacing: -.015em;
  padding-top: 28px; text-wrap: balance;
}
.pull::before { /* short brass rule above */
  content: ""; position: absolute; left: 0; top: 0; width: 44px; height: 2px; background: var(--brass);
}
.pull cite {
  display: block; margin-top: 18px;
  font: 400 .72rem/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; font-style: normal; color: var(--grey);
}

/* Software layout */
.two { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.col-a { grid-column: 1 / span 4; }
.col-b { grid-column: 5 / span 8; }
.col-b--wide { grid-column: 5 / span 8; }

/* Timeline: three stages */
.tl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; position: relative; }
.tl__step { position: relative; padding: 28px var(--gap) 8px 0; }
.tl__step::before { /* node */
  content: ""; position: absolute; top: -4px; left: 0; width: 9px; height: 9px;
  background: var(--paper); border: 1px solid var(--ink); border-radius: 50%;
}
.chapter--tint .tl__step::before { background: var(--paper-2); }
.tl__step:last-child::before { background: var(--green); border-color: var(--green); }
.tl__line { position: relative; border-top: 1px solid var(--rule); margin-top: 4px; }
.tl__roman { color: var(--green); }
.tl__name { font-family: var(--serif); font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem); font-weight: 350; line-height: 1.05; margin: 10px 0 6px; letter-spacing: -.01em; }
.tl__sub { font: 400 .74rem/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--brass); margin-bottom: 12px; }
.tl__txt { color: var(--grey); font-size: .95rem; max-width: 24em; }
.tl__coda {
  margin-top: clamp(28px, 4vw, 48px); display: flex; gap: 16px; align-items: baseline; flex-wrap: wrap;
  font-family: var(--serif); font-size: clamp(1.15rem, 1rem + .6vw, 1.5rem); font-style: italic;
}
.tl__coda span { color: var(--green); }

/* Ledger: the bill / the return */
.ledger { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--ink); }
.ledger > div { padding: 18px var(--gap) 22px 0; }
.ledger > div + div { padding-left: var(--gap); border-left: 1px solid var(--rule); }
.ledger h3 { margin-bottom: 14px; }
.ledger li { padding: 8px 0; border-top: 1px solid var(--rule-2); display: flex; gap: 12px; align-items: baseline; }
.ledger li::before { content: "–"; color: var(--brass); font-family: var(--mono); }
.ledger .ret { font-family: var(--serif); font-size: clamp(1.2rem, 1rem + .6vw, 1.6rem); line-height: 1.2; padding-top: 4px; font-weight: 350; }

/* Case history blocks */
.case {
  position: relative;
  border-top: 2px solid var(--ink);
  padding-top: 16px;
}
.case__head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: clamp(24px, 4vw, 48px); }
.case__title {
  font-family: var(--serif); font-weight: 320; letter-spacing: -.02em; line-height: 1;
  font-size: clamp(1.8rem, 1.1rem + 2.7vw, 3.4rem);
}
.case__title em { font-style: italic; color: var(--green); font-weight: 300; }
.facts { display: grid; grid-template-columns: 8.5rem 1fr; border-top: 1px solid var(--rule); }
.facts dt, .facts dd { padding: 11px 0; border-bottom: 1px solid var(--rule-2); }
.facts dt { color: var(--grey); }
.facts dd { font-size: .98rem; }

/* Flow (breadstick system) */
.flow { counter-reset: step; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--rule); }
.flow li { position: relative; padding: 18px var(--gap) 18px 0; border-bottom: 1px solid var(--rule-2); }
.flow li:not(:last-child)::after { /* arrow */
  content: "→"; position: absolute; right: calc(var(--gap) * .1); top: 16px;
  font-family: var(--mono); color: var(--brass);
}
.flow .k { color: var(--green); }
.flow .h { font-family: var(--serif); font-size: clamp(1.2rem, 1rem + .8vw, 1.6rem); line-height: 1.15; margin: 6px 0; }
.flow .p { font-size: .9rem; color: var(--grey); max-width: 16em; }
.stamps { display: flex; flex-wrap: wrap; gap: 8px; }
.sign-off {
  font-family: var(--serif); font-weight: 300; font-style: italic;
  font-size: clamp(1.4rem, 1rem + 1.6vw, 2.2rem); line-height: 1.15; letter-spacing: -.012em;
}
.sign-off span { display: block; }
.sign-off .last { color: var(--green); }

/* Field notes: projects as an index */
.notes li {
  display: grid; grid-template-columns: 3rem minmax(0, 1.1fr) minmax(0, 1.5fr) auto; gap: var(--gap); align-items: baseline;
  padding-block: 22px; border-top: 1px solid var(--rule);
}
.notes li:last-child { border-bottom: 1px solid var(--rule); }
.notes .id { color: var(--green); }
.notes h3 { font-family: var(--serif); font-weight: 350; font-size: clamp(1.25rem, 1rem + .8vw, 1.7rem); line-height: 1.1; letter-spacing: -.01em; }
.notes p { color: var(--grey); font-size: .98rem; }
.notes .tags { margin-top: 12px; }

/* Under-the-abstraction diagram */
.under { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--gap); align-items: stretch; }
.under__col { border-top: 1px solid var(--ink); }
.under__row { padding: 14px 0; border-bottom: 1px solid var(--rule-2); display: grid; gap: 4px; }
.under__row:last-child { border-bottom: 0; }
.under__row .h { font-family: var(--serif); font-size: clamp(1.15rem, 1rem + .6vw, 1.5rem); line-height: 1.2; }
.under__row--dig { background: linear-gradient(to right, transparent, color-mix(in srgb, var(--brass) 10%, transparent)); border-left: 2px solid var(--brass); padding-left: 14px; }
.under__row--abs { opacity: .75; }
.under__eq { align-self: center; font-family: var(--serif); font-style: italic; font-size: 2rem; color: var(--brass); text-align: center; }
.under__cap { margin-top: 16px; color: var(--grey); }

/* Big typographic list (AI topics) */
.bigs { counter-reset: b; border-top: 1px solid var(--rule); }
.bigs li {
  counter-increment: b;
  display: grid; grid-template-columns: 3rem 1fr; align-items: baseline; gap: 12px;
  padding-block: clamp(8px, 1.4vw, 16px); border-bottom: 1px solid var(--rule-2);
  font-family: var(--serif); font-weight: 320; font-size: clamp(1.4rem, 1rem + 1.6vw, 2.2rem); line-height: 1.08; letter-spacing: -.015em;
  transition: padding-left .45s var(--ease), color .25s;
}
.bigs li::before { content: counter(b, decimal-leading-zero); font: 400 .72rem/1 var(--mono); letter-spacing: .1em; color: var(--green); }
.bigs li:hover { padding-left: 10px; color: var(--green); }
.bigs li:last-child { font-style: italic; }

/* Quote placeholder (Churchill) */
.slot {
  border: 1px dashed var(--brass); padding: clamp(20px, 3vw, 36px);
  color: var(--brass);
}
.slot p:last-child { margin-top: 10px; color: var(--grey); font-family: var(--sans); font-size: .9rem; text-transform: none; letter-spacing: 0; }

/* Interest index (history, space) */
.index-list { border-top: 1px solid var(--rule); counter-reset: il; }
.index-list li { counter-increment: il; display: grid; grid-template-columns: 2.6rem 1fr; padding: 11px 0; border-bottom: 1px solid var(--rule-2); transition: padding-left .4s var(--ease), color .25s; }
.index-list li::before { content: counter(il, decimal-leading-zero); font: 400 .72rem/1.9 var(--mono); letter-spacing: .1em; color: var(--green); }
.index-list li:hover { padding-left: 8px; }

/* Space */
.flightnum {
  font-family: var(--mono); font-weight: 400; letter-spacing: -.02em; line-height: 1;
  font-size: clamp(1.7rem, 1rem + 3.4vw, 4rem);
}
.flightnum .arrow { color: var(--brass); padding-inline: .15em; }
.flightnum + p { margin-top: 18px; }

/* Stories */
.authors { border-top: 1px solid var(--rule); }
.authors li {
  padding-block: clamp(8px, 1.4vw, 18px); border-bottom: 1px solid var(--rule-2);
  font-family: var(--serif); font-weight: 320; font-size: clamp(1.6rem, 1.1rem + 2.2vw, 3.1rem); line-height: 1.04; letter-spacing: -.02em;
  transition: padding-left .45s var(--ease), color .25s, font-style .25s;
}
.authors li:hover { padding-left: 12px; color: var(--green); font-style: italic; }
.worlds { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.world { border-top: 2px solid var(--ink); padding-top: 14px; }
.world h3 { font-family: var(--serif); font-weight: 320; font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.2rem); line-height: 1.05; letter-spacing: -.015em; margin: 8px 0 10px; }
.world p { color: var(--grey); }

/* Spec sheet (LEGO) */
.spec { border-top: 1px solid var(--ink); }
.spec div { display: grid; grid-template-columns: 7rem 1fr; padding: 11px 0; border-bottom: 1px solid var(--rule-2); gap: 12px; }
.spec dt { color: var(--green); }
.spec dd { color: var(--grey); font-size: .96rem; }

/* Currently */
.now { border-top: 2px solid var(--ink); }
.now > div {
  display: grid; grid-template-columns: minmax(7.5rem, 11rem) 1fr; align-items: baseline; gap: 16px;
  padding: clamp(12px, 1.8vw, 20px) 0; border-bottom: 1px solid var(--rule-2);
  transition: padding-left .4s var(--ease);
}
.now > div:hover { padding-left: 8px; }
.now dt { color: var(--green); transition: color .25s; }
.now dd { font-family: var(--serif); font-size: clamp(1.2rem, 1rem + .9vw, 1.7rem); line-height: 1.15; font-weight: 350; letter-spacing: -.01em; }
.now > div:hover dt { color: var(--brass); }
.now dd small { font: 400 .72rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--grey); margin-left: .6em; }


/* 9. PLATES — photos and their placeholders -------------------------------- */
/*  <figure class="plate ar-landscape" data-photo="key">
      <div class="plate__frame"> …placeholder… </div>
      <figcaption>…</figcaption>
    </figure>
    JS fills the frame with a real <img> when PHOTOS["key"].src is set.        */
.plate { position: relative; }
.plate__frame {
  position: relative; overflow: hidden;
  aspect-ratio: var(--ar, 3 / 2);
  background: var(--paper-2);
  border: 1px solid var(--rule);
}
.chapter--tint .plate__frame { background: var(--paper); }
.chapter--night .plate__frame { background: rgb(255 255 255 / .03); }
.ar-landscape { --ar: 3 / 2; }
.ar-wide      { --ar: 16 / 9; }
.ar-pano      { --ar: 21 / 9; }
.ar-portrait  { --ar: 4 / 5; }
.ar-tall      { --ar: 3 / 4; }
.ar-square    { --ar: 1 / 1; }

/* Placeholder: a plate waiting for its photograph */
.ph {
  position: absolute; inset: 0;
  display: grid; place-items: center; text-align: center; padding: 12%;
  color: var(--grey);
  background:
    repeating-linear-gradient(135deg, transparent 0 11px, var(--rule-2) 11px 12px);
}
/* crop marks in the four corners */
.ph::before, .ph::after {
  content: ""; position: absolute; inset: 12px; pointer-events: none;
  background:
    linear-gradient(var(--grey), var(--grey)) 0 0 / 14px 1px no-repeat,
    linear-gradient(var(--grey), var(--grey)) 0 0 / 1px 14px no-repeat,
    linear-gradient(var(--grey), var(--grey)) 100% 0 / 14px 1px no-repeat,
    linear-gradient(var(--grey), var(--grey)) 100% 0 / 1px 14px no-repeat,
    linear-gradient(var(--grey), var(--grey)) 0 100% / 14px 1px no-repeat,
    linear-gradient(var(--grey), var(--grey)) 0 100% / 1px 14px no-repeat,
    linear-gradient(var(--grey), var(--grey)) 100% 100% / 14px 1px no-repeat,
    linear-gradient(var(--grey), var(--grey)) 100% 100% / 1px 14px no-repeat;
  opacity: .55;
}
.ph::after { /* registration cross at centre */
  inset: 0;
  background:
    linear-gradient(var(--brass), var(--brass)) 50% 50% / 15px 1px no-repeat,
    linear-gradient(var(--brass), var(--brass)) 50% 50% / 1px 15px no-repeat;
  opacity: .8;
}
.ph__inner { position: relative; z-index: 1; background: var(--paper-2); padding: 10px 14px; max-width: 100%; }
.chapter--tint .ph__inner { background: var(--paper); }
.chapter--night .ph__inner { background: var(--night); }
.ph__label { display: block; color: var(--ink); }
.ph__file  { display: block; margin-top: 6px; color: var(--grey); font-size: .64rem; letter-spacing: .06em; text-transform: none; overflow-wrap: anywhere; }
.ph__no { position: absolute; left: 22px; top: 20px; z-index: 1; color: var(--brass); font-size: .64rem; }
.plate--sm .ph { padding: 8%; }
.plate--sm .ph__file { display: none; }
.plate--sm .ph__label { font-size: .62rem; }

/* Real photograph */
.plate__frame img {
  width: 100%; height: 100%; object-fit: cover;
  transform: scale(1.04); will-change: transform; /* room for parallax */
  transition: filter .5s;
}
.plate.has-photo .ph { display: none; }
.plate.has-photo .plate__frame { border-color: transparent; cursor: zoom-in; }
.plate.has-photo .plate__frame:hover img { filter: contrast(1.03); }

.plate figcaption {
  display: flex; gap: 12px; align-items: baseline; justify-content: space-between;
  margin-top: 10px; color: var(--grey);
}
.plate figcaption .fig { color: var(--brass); white-space: nowrap; }
.plate figcaption .cap { font: 400 .72rem/1.5 var(--mono); letter-spacing: .06em; text-transform: uppercase; }

/* Full-bleed plate */
.bleed { width: 100%; padding-inline: 0; }
.bleed .plate__frame { border-inline: 0; }
.bleed figcaption { padding-inline: var(--gutter); max-width: var(--max); margin-inline: auto; }

/* Overlap with the editorial grid */
.overlap-up { margin-top: calc(var(--section-y) * -.45); position: relative; z-index: 2; }

/* Gallery (electronics) */
.gallery { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.g1 { grid-column: 1 / span 7; }
.g2 { grid-column: 8 / span 5; margin-top: clamp(40px, 8vw, 120px); }
.g3 { grid-column: 2 / span 4; }
.g4 { grid-column: 6 / span 3; margin-top: clamp(24px, 5vw, 72px); }
.g5 { grid-column: 9 / span 4; }

/* Lightbox */
.lightbox { max-width: min(96vw, 1400px); max-height: 94vh; padding: 0; border: 0; background: transparent; color: var(--ink); }
.lightbox::backdrop { background: rgb(20 20 18 / .88); }
.lightbox figure { background: var(--paper); padding: 10px 10px 14px; }
.lightbox img { max-height: 80vh; width: auto; margin-inline: auto; }
.lightbox figcaption { margin-top: 10px; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.lightbox button { min-height: 44px; padding-inline: 8px; }


/* 10. CHAPTER-SPECIFIC ----------------------------------------------------- */
#software .col-b > * + * { margin-top: clamp(40px, 5vw, 72px); }
#history .grid .stack { --stack: 1.1rem; }
#space .prose { color: var(--night-grey); }
#space .prose strong { color: var(--night-ink); }
#space .lead { color: var(--night-ink); }


/* 11. FOOTER --------------------------------------------------------------- */
.foot { padding-block: var(--section-y) 40px; border-top: 1px solid var(--rule); }
.foot__big {
  font-family: var(--serif); font-weight: 300; letter-spacing: -.03em; line-height: .96;
  font-size: clamp(2.2rem, 1rem + 5vw, 5.8rem);
}
.foot__big em { display: block; font-style: italic; color: var(--green); font-weight: 280; }
.foot__cols { margin-top: clamp(48px, 8vw, 112px); padding-top: 20px; border-top: 1px solid var(--ink); }
.foot__who { grid-column: 1 / span 4; }
.foot__links { grid-column: 5 / span 4; }
.foot__colophon { grid-column: 9 / span 4; }
.foot__who strong { display: block; font: 500 .9rem/1.4 var(--mono); letter-spacing: .2em; }
.foot__who span { display: block; font-family: var(--serif); font-style: italic; font-size: 1.3rem; color: var(--grey); }
.foot__links li { padding-block: 4px; }
.foot__links a { font-family: var(--serif); font-size: 1.5rem; }
.foot__links .ph-note { display: block; color: var(--brass); font-size: .62rem; margin-top: 2px; }
.foot__colophon p { color: var(--grey); }
.foot__colophon p + p { margin-top: 1em; }
.foot__base { margin-top: clamp(40px, 6vw, 80px); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--grey); }
.foot__base a, .foot__base button { text-decoration: none; padding-block: 12px; transition: color .25s; }
.foot__base a:hover, .foot__base button:hover { color: var(--green); }


/* 12. MOTION --------------------------------------------------------------- */
/* Five gestures, reused everywhere:
     1  rule draws         (.rule)
     2  number enters      (data-reveal)
     3  title rises        (.lines  > .ln > span)
     4  text fades up      (data-reveal)
     5  photo emerges      (.plate)
   Hidden states only apply when JS is running (.js), and never under
   prefers-reduced-motion. Without JS everything is simply visible. */

@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] {
    opacity: 0; transform: translateY(14px);
    transition: opacity .9s var(--ease), transform .9s var(--ease);
    transition-delay: calc(var(--i, 0) * 70ms);
  }
  .js [data-reveal].in { opacity: 1; transform: none; }

  .js .rule { transform: scaleX(0); transform-origin: left; transition: transform 1.2s var(--ease); }
  .js .rule.in { transform: scaleX(1); }

  /* Titles: each line rises from behind a mask */
  .js .lines .ln { display: block; overflow: hidden; padding-bottom: .14em; margin-bottom: -.14em; }
  .js .lines .ln > span {
    display: block; transform: translateY(108%);
    transition: transform 1.05s var(--ease); transition-delay: calc(var(--i, 0) * 110ms);
  }
  .js .lines.in .ln > span { transform: none; }

  /* Photographs: fade on small screens… */
  .js .plate .plate__frame { opacity: 0; transition: opacity 1s var(--ease), clip-path 1.2s var(--ease); }
  .js .plate.in .plate__frame { opacity: 1; }
  .js .plate figcaption { opacity: 0; transition: opacity .8s .5s; }
  .js .plate.in figcaption { opacity: 1; }
  .js .plate.has-photo img { transition: transform 1.6s var(--ease); }
  .js .plate.has-photo:not(.in) img { transform: scale(1.12); }

  /* …emerge through a mask on larger ones. */
  @media (min-width: 900px) {
    .js [data-reveal="left"]  { transform: translateX(-20px); }
    .js [data-reveal="right"] { transform: translateX(20px); }
    .js .plate .plate__frame { clip-path: inset(0 100% 0 0); opacity: 1; }
    .js .plate.in .plate__frame { clip-path: inset(0 0 0 0); }
    .js .plate.alt .plate__frame { clip-path: inset(100% 0 0 0); }
    .js .plate.alt.in .plate__frame { clip-path: inset(0 0 0 0); }
  }

  /* Hero cue line extends once */
  .js .scrollcue::after { transform: scaleX(0); transition: transform 1.4s .9s var(--ease); }
  .js .scrollcue.in::after { transform: scaleX(1); }
}


/* 13. RESPONSIVE ----------------------------------------------------------- */
@media (max-width: 1100px) {
  .hero__plate { display: none; }
  .display { grid-column: 1 / -1; }
  .notes li { grid-template-columns: 2.4rem 1fr auto; }
  .notes li > p { grid-column: 2 / -1; grid-row: 2; }
  .notes li .stamp { grid-column: 3; grid-row: 1; }
}
@media (max-width: 900px) {
  .intro__label, .intro__text, .toc { grid-column: 1 / -1; }
  .intro__label { margin-bottom: 16px; }
  .col-a, .col-b, .col-b--wide { grid-column: 1 / -1; }
  .col-a { margin-bottom: 28px; }
  .tl { grid-template-columns: 1fr; }
  .tl__step { padding: 0 0 28px 28px; border-left: 1px solid var(--rule); margin-left: 4px; }
  .tl__step::before { top: 2px; left: -5px; }
  .tl__line { display: none; }
  .flow { grid-template-columns: 1fr; }
  .flow li::after { display: none !important; }
  .under { grid-template-columns: 1fr; }
  .under__eq { transform: rotate(90deg); padding-block: 8px; }
  .worlds { grid-template-columns: 1fr; }
  .toc a { grid-template-columns: 2.6rem 1fr; }
  .toc .d { grid-column: 2; }
  .gallery > * { grid-column: auto; margin-top: 0; }
  .gallery { grid-template-columns: 1fr 1fr; }
  .g1 { grid-column: 1 / -1; }
  .g2 { grid-column: 1 / 2; } .g3 { grid-column: 2 / 3; }
  .g4 { grid-column: 1 / 2; } .g5 { grid-column: 2 / 3; }
  .foot__who, .foot__links, .foot__colophon { grid-column: 1 / -1; margin-bottom: 28px; }
  .overlap-up { margin-top: 0; }
  .grid { row-gap: 28px; }
  .grid > [style*="grid-column"] { grid-column: 1 / -1 !important; margin-top: 0 !important; padding-bottom: 0 !important; }
}
@media (max-width: 640px) {
  :root { --bar-h: 52px; }
  .bar__now .t { display: none; }
  .bar { gap: 8px; }
  .bar__tools { gap: 0; }
  .bar__btn { padding-inline: 8px; }
  .lang { margin-right: 0; }
  .lang button { min-width: 30px; padding-inline: 4px; }
  .bar__now { justify-content: center; }
  .hero__meta { text-align: left; }
  .hero__foot { flex-direction: column; align-items: flex-start; }
  .cats li + li::before { padding-inline: .5em; }
  .ledger { grid-template-columns: 1fr; }
  .ledger > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--ink); }
  .facts { grid-template-columns: 6.5rem 1fr; }
  .flow { grid-template-columns: 1fr; }
  .flow li::after { display: none !important; }
  .notes li { grid-template-columns: 2rem 1fr; }
  .notes li .stamp { grid-column: 2; grid-row: 2; justify-self: start; margin-top: 8px; }
  .notes li > p { grid-row: 3; grid-column: 2; }
  .chead__meta { grid-template-columns: auto 1fr; }
  .chead__meta .label:last-child { display: none; }
  .now > div { grid-template-columns: 1fr; gap: 4px; }
  .now > div:hover { padding-left: 0; }
  .spec div { grid-template-columns: 6.8rem 1fr; }
  .plate figcaption { flex-direction: column; gap: 2px; }
  .ph { padding: 14% 10%; }
  .ph__no { left: 16px; top: 14px; }
}
@media (min-width: 1500px) { html { font-size: 17px; } }

/* Print: just the words */
@media print {
  .bar, .rail, .index, .skip { display: none !important; }
  [data-reveal], .plate .plate__frame, .lines .ln > span { opacity: 1 !important; transform: none !important; clip-path: none !important; }
}
