/* Mini City Rail: site styles. Hand-written, no build step.
   Tokens follow the app mockups (mockups/build2.py). */

/* Self-hosted fonts (Latin subset, variable weight), SIL Open Font License. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-latin-var.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("../fonts/space-grotesk-latin-var.woff2") format("woff2");
}

:root {
  --bg: #14161a;
  --panel: #1b1e23;
  --panel-2: #20242a;
  --text: #e8eaed;
  --muted: #a9b0b8;
  --border: #2a2e33;
  --border-strong: #3a3f45;
  --accent: #2b5d2b;
  --accent-hover: #357035;
  --accent-hi: #9be59b;
  --amber: #f0b450;
  --blue: #8cc4f2;
  --paper: #ffffff;
  --paper-grey: #d9dde2;

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Space Grotesk", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --maxw: 1160px;
  --gutter: clamp(16px, 4vw, 40px);
  --section-gap: clamp(72px, 10vw, 128px);
  --bar-h: 56px;

  color-scheme: dark;
}

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

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--bar-h) + 16px);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

html:has(dialog[open]) { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg { display: block; max-width: 100%; }

img { height: auto; }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
  text-wrap: balance;
}

h2 { font-size: clamp(1.9rem, 1.3rem + 2.2vw, 2.75rem); }
h3 { font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem); }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent-hi); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

strong { font-weight: 600; color: var(--text); }

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

code {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.08em 0.35em;
  overflow-wrap: anywhere;
}

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

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

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

.wrap {
  width: 100%;
  max-width: calc(var(--maxw) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(20, 22, 26, 0.88);
  border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  backdrop-filter: saturate(140%) blur(10px);
}

.topbar .wrap {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: var(--bar-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}
.brand img { width: 24px; height: 24px; }

.nav {
  margin-left: auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
}
.nav::-webkit-scrollbar { display: none; }

.nav ul {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 6px 12px;
  list-style: none;
  white-space: nowrap;
}

.nav a {
  display: block;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: none;
}
.nav a:hover { color: var(--text); background: var(--panel-2); }

/* Phones: the bar is not sticky, keeps the name, and wraps every section link onto rows
   below it with 44 px targets, so nothing is hidden off the side. */
@media (max-width: 720px) {
  .topbar { position: static; }
  html { scroll-padding-top: 16px; }
  .topbar .wrap { flex-wrap: wrap; gap: 0 8px; padding-block: 4px 6px; }
  .brand { min-height: 44px; }
  .nav {
    flex-basis: 100%;
    margin-left: 0;
    overflow: visible;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .nav ul { flex-wrap: wrap; white-space: normal; gap: 0 2px; padding: 0; margin-left: -10px; }
  .nav a { display: flex; align-items: center; min-height: 44px; padding: 0 10px; }
}

/* Short viewports (landscape phones, high zoom): do not let the bar take the screen. */
@media (max-height: 480px) {
  .topbar { position: static; }
  html { scroll-padding-top: 16px; }
}

/* ---------- Sections ---------- */

.section { padding-block: var(--section-gap) 0; }
.section:last-of-type { padding-bottom: var(--section-gap); }

.section-head { max-width: 46rem; margin-bottom: clamp(32px, 5vw, 56px); }
.section-head .lead { color: var(--muted); font-size: 1.125rem; }

.kicker {
  display: inline-block;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-hi);
}

.prose { max-width: 42rem; }
.prose p { color: #d4d8dd; }

/* ---------- Hero ---------- */

.hero { padding-top: clamp(28px, 3.5vw, 44px); }

.hero-grid {
  display: grid;
  gap: 28px 56px;
  align-items: start;
}

@media (min-width: 900px) {
  .hero-grid { grid-template-columns: 1.05fr 1fr; }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.92rem;
}
.eyebrow::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--amber);
}

.hero h1 {
  font-size: clamp(2.75rem, 1.6rem + 5vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 0.3em;
}

.pitch {
  font-size: clamp(1.2rem, 1rem + 0.9vw, 1.55rem);
  line-height: 1.45;
  color: var(--text);
  margin: 0;
  text-wrap: pretty;
}

.hero-body > p { color: #d4d8dd; }

.status {
  display: flex;
  gap: 12px;
  margin: 18px 0 22px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.97rem;
}
.status::before {
  content: "";
  flex: none;
  width: 10px; height: 10px;
  margin-top: 0.5em;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(240, 180, 80, 0.15);
}

.buttons { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid #6b737c;
  border-radius: 8px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.97rem;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--panel-2); border-color: #8a929b; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.hero .hero-figure { margin-top: clamp(28px, 3vw, 32px); }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr));
  gap: 12px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}
.facts li {
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}
.facts b {
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-head);
  font-size: clamp(1.2rem, 1rem + 0.8vw, 1.5rem);
  font-weight: 600;
  color: var(--text);
}

/* ---------- Figures ---------- */

.fig { margin: 0; position: relative; }

.fig-media {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel);
  transition: border-color 0.15s;
}
a.fig-media:hover { border-color: #5a616a; }
a.fig-media:focus-visible { outline-offset: 4px; }

.fig-media picture { display: block; }
.fig-media img { width: 100%; }

.fig-media--paper { background: var(--paper); padding: clamp(8px, 1.5vw, 14px); border-color: var(--paper); }
.fig-media--grey { background: var(--paper-grey); padding: clamp(10px, 2vw, 20px); border-color: var(--paper-grey); }
.fig-media--paper img,
.fig-media--grey img { border-radius: 2px; }

.fig-media--shadow { box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.02); }

.chip {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 8px;
  vertical-align: 0.1em;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: rgba(20, 22, 26, 0.9);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
  white-space: nowrap;
}
.chip--mockup { color: var(--accent-hi); }
.chip--drawing { color: #e8eaed; }
.chip--prototype { color: var(--amber); }
.chip--render { color: var(--blue); }
.chip--diagram { color: var(--muted); }

.fig figcaption {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}
.fig figcaption strong { color: var(--text); }

/* ---------- The idea ---------- */

.idea-grid { display: grid; gap: 32px 64px; }
@media (min-width: 900px) {
  .idea-grid { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); }
}

/* ---------- How it plays ---------- */

.steps {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
@media (min-width: 820px) {
  .steps { grid-template-columns: 1fr 1fr; }
}

.steps li {
  position: relative;
  padding: 18px 20px 18px 64px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: #d4d8dd;
  font-size: 0.98rem;
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 18px;
  top: 17px;
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: rgba(43, 93, 43, 0.25);
  color: var(--accent-hi);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.95rem;
}
.steps li:last-child:nth-child(odd) { grid-column: 1 / -1; border-color: var(--accent); }
.steps li strong { display: block; margin-bottom: 2px; font-family: var(--font-head); font-size: 1.08rem; }

.how-visual {
  display: grid;
  gap: 24px 40px;
  margin-top: clamp(32px, 5vw, 56px);
  align-items: start;
}
@media (min-width: 960px) {
  .how-visual { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
}

.keys {
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.92rem;
}
.keys h3 { font-size: 1rem; margin-bottom: 12px; color: var(--text); }
.keys ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.keys li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.keys p { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 0.86rem; }

kbd {
  display: inline-block;
  min-width: 1.9em;
  padding: 2px 7px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: center;
}

/* ---------- Principles ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr));
  gap: 18px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: clamp(20px, 2.4vw, 28px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 0;
}
.card p { color: #cfd3d8; font-size: 0.98rem; }
.card h3 { margin-bottom: 0.5em; }
.card .note { margin-top: 0.4em; color: var(--muted); font-size: 0.88rem; border-left: 2px solid var(--amber); padding-left: 12px; }

.card-num {
  display: block;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-hi);
}

.cards--principles { grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) {
  .cards--principles { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

.card--wide,
.card--full { grid-column: 1 / -1; }
.card--full .card-text p { max-width: 52rem; }
@media (min-width: 900px) {
  .card--wide { flex-direction: row; align-items: flex-start; gap: 32px; }
  .card--wide > .card-text { flex: 0 0 34%; }
  .card--wide > .card-figs { flex: 1; min-width: 0; }
}
.card-figs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }

/* Principle 04: an example of export rows. */
.sample-code {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.75;
}
.sample-code code { padding: 0; border: 0; background: none; font-size: inherit; overflow-wrap: normal; }
.sample-head { color: var(--muted); }

/* ---------- Pipeline diagram ---------- */

.pipeline {
  margin: 0;
  padding: clamp(16px, 3vw, 32px);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.pipeline .chip { position: static; display: inline-block; margin-bottom: 18px; }
.pipeline svg { width: 100%; height: auto; }
.pipeline-v { display: none; margin: 0; padding: 0; list-style: none; }
@media (max-width: 1023px) {
  .pipeline-h { display: none; }
  .pipeline-v { display: grid; gap: 0; max-width: 34rem; }
}
@media (max-width: 600px) {
  .card--full .pipeline { padding: 0; border: 0; background: none; }
}
.pl-step > p { margin: 0; }
.pl-step-title,
.pl-step-note,
.pl-step ul {
  margin: 0;
  padding-inline: 16px;
  border: 1.5px solid var(--border-strong);
  border-block: 0;
  background: var(--bg);
}
.pipeline-v .pl-step-title { padding-top: 14px; border-top: 1.5px solid var(--border-strong); border-radius: var(--radius) var(--radius) 0 0; font-family: var(--font-head); font-weight: 600; font-size: 1.15rem; color: var(--text); }
.pipeline-v .pl-step-note { padding-bottom: 6px; font-family: var(--font-mono); font-size: 0.82rem; color: var(--accent-hi); }
.pl-step ul { padding-block: 4px 14px; border-bottom: 1.5px solid var(--border-strong); border-radius: 0 0 var(--radius) var(--radius); list-style: none; color: var(--muted); font-size: 0.95rem; line-height: 1.6; }
.pl-step--in > :is(.pl-step-title, .pl-step-note, ul) { border-color: var(--accent-hi); }
.pl-step--out > :is(.pl-step-title, .pl-step-note, ul) { border-color: var(--accent); background: rgba(43, 93, 43, 0.18); }
.pipeline-v .pl-link { padding: 10px 0 10px 18px; color: var(--muted); font-family: var(--font-mono); font-size: 0.85rem; }
.pipeline-v .pl-link span { margin-right: 6px; color: var(--accent-hi); font-size: 1.1rem; }
.pipeline figcaption { margin-top: 18px; color: var(--muted); font-size: 0.92rem; }

.pl-box { fill: var(--bg); stroke: var(--border-strong); stroke-width: 1.5; }
.pl-box--in { stroke: var(--accent-hi); }
.pl-box--out { stroke: var(--accent); fill: rgba(43, 93, 43, 0.18); }
.pl-title { fill: var(--text); font-family: var(--font-head); font-weight: 600; font-size: 20px; }
.pl-note { fill: var(--accent-hi); font-family: var(--font-mono); font-size: 12.5px; }
.pl-item { fill: var(--muted); font-family: var(--font-body); font-size: 14.5px; }
.pl-arrow { stroke: var(--accent-hi); stroke-width: 2; fill: none; }
.pl-head { fill: var(--accent-hi); }
.pl-label { fill: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.pl-loop { stroke: var(--border-strong); stroke-width: 1.5; stroke-dasharray: 5 5; fill: none; }

/* ---------- What it makes ---------- */

.outputs {
  display: grid;
  gap: 18px;
  margin-bottom: clamp(48px, 7vw, 80px);
}
@media (min-width: 820px) {
  .outputs { grid-template-columns: 1fr 1fr; }
}
.output {
  padding: clamp(20px, 2.4vw, 28px);
  border: 1px solid var(--border-strong);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--panel);
}
.output h3 { font-size: 1.3rem; }
.output p { color: #cfd3d8; font-size: 0.98rem; }

.families-head { max-width: 46rem; margin-bottom: 28px; }
.families-head p { color: var(--muted); }

.family { gap: 16px; padding: 14px 14px 22px; }
.family-text { padding-inline: 6px; }
.family h4 { font-size: 1.15rem; margin-bottom: 0.45em; }
.family .fig figcaption { padding-inline: 6px; font-size: 0.86rem; }
.family .fig-media,
.card-figs--stack .fig-media { aspect-ratio: 16 / 10; display: grid; place-items: center; }
.family .fig-media img,
.card-figs--stack .fig-media img { width: 100%; height: 100%; object-fit: contain; }
.card-figs--stack .fig-media { aspect-ratio: 3 / 1; }
/* Line the drawings up across a row: each card's text and figure sit on shared rows. */
@supports (grid-template-rows: subgrid) {
  .cards--families .card { display: grid; grid-row: span 2; grid-template-rows: subgrid; row-gap: 16px; }
}

/* ---------- Mockups gallery ---------- */

.gallery {
  display: grid;
  gap: 36px 22px;
  grid-template-columns: 1fr;
}
/* Five mockups: one wide then two by two on tablets; two large then three on desktops. */
@media (min-width: 640px) {
  .gallery { grid-template-columns: 1fr 1fr; }
  .gallery > :first-child { grid-column: 1 / -1; }
}
@media (min-width: 1000px) {
  .gallery { grid-template-columns: repeat(6, 1fr); }
  .gallery > :nth-child(-n+2) { grid-column: span 3; }
  .gallery > :nth-child(n+3) { grid-column: span 2; }
}

/* ---------- Under the hood ---------- */

.hood-grid { display: grid; gap: 40px 56px; }
@media (min-width: 1000px) {
  .hood-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; }
}

.crates {
  margin: 0;
  padding: clamp(16px, 2.5vw, 24px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.crates .chip { position: static; display: inline-block; margin-bottom: 14px; }

.layers { margin: 0; padding: 0; list-style: none; }

.layer {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.layer:first-child { border-top: 0; padding-top: 0; }
.layer:last-child { padding-bottom: 0; }

.layer-n {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.2;
}
.layer-n b { color: var(--text); font-size: 1.05rem; font-weight: 600; }

.layer-crates { display: grid; gap: 8px; }
@media (min-width: 560px) {
  .layer-crates { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
}

.crate {
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--bg);
  font-size: 0.84rem;
  line-height: 1.4;
  color: var(--muted);
}
.crate > code:first-child {
  display: block;
  margin-bottom: 2px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-hi);
  font-size: 0.88rem;
}
.crate--base { border-color: var(--accent); }

.crates figcaption { margin-top: 14px; color: var(--muted); font-size: 0.88rem; }

.points {
  display: grid;
  gap: 18px;
  margin: clamp(40px, 6vw, 64px) 0 0;
  padding: 0;
  list-style: none;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 900px) {
  .points { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.points li {
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: #cfd3d8;
  font-size: 0.96rem;
}
.points .test-name {
  display: block;
  margin: 6px 0;
  padding: 4px 8px;
  width: fit-content;
  max-width: 100%;
  overflow-wrap: normal;
  font-size: 0.8rem;
}
.points .test-name:last-of-type { margin-bottom: 10px; }
.points strong { display: block; margin-bottom: 6px; font-family: var(--font-head); font-size: 1.15rem; }

.stack {
  margin-top: 28px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.8;
}

/* ---------- Roadmap ---------- */

.timeline {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: 62rem;
}

.stop {
  position: relative;
  padding: 0 0 clamp(36px, 5vw, 52px) 52px;
}
.stop::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 34px;
  bottom: 0;
  width: 2px;
  background: var(--border-strong);
}
.stop:last-child::before { display: none; }
.stop:last-child { padding-bottom: 0; }

.stop-dot {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: var(--bg);
}
.stop-dot svg { width: 16px; height: 16px; }
.stop--done .stop-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.stop--done::before { background: var(--accent); }
.stop--next .stop-dot { border-color: var(--accent-hi); }
.stop--next .stop-dot::after {
  content: "";
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent-hi);
}

.stop-tag {
  display: inline-block;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.stop--done .stop-tag,
.stop--next .stop-tag { color: var(--accent-hi); }

.stop h3 { margin-bottom: 0.4em; padding-top: 2px; }
.stop > p,
.stop-body > p { color: #cfd3d8; max-width: 46rem; }

.stop--big .stop-body {
  padding: clamp(20px, 3vw, 32px);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}
.stop--big h3 { font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); }

.features {
  display: grid;
  gap: 14px 28px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 820px) {
  .features { grid-template-columns: 1fr 1fr; }
}
.features li {
  padding-left: 16px;
  border-left: 2px solid var(--accent);
  color: #cfd3d8;
  font-size: 0.96rem;
}
.features li > strong:first-child { display: block; margin-bottom: 2px; }

.trains {
  display: grid;
  gap: 24px;
  margin-top: 28px;
  align-items: start;
}
@media (min-width: 760px) {
  .trains { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

.formula {
  margin-top: 28px;
  padding: 20px 22px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
}
.formula code {
  display: block;
  margin-bottom: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-hi);
  font-size: clamp(1rem, 0.85rem + 1vw, 1.45rem);
  font-weight: 600;
  overflow-wrap: normal;
}
.formula p { color: var(--muted); font-size: 0.95rem; }

/* Phones: the big Phase 2 card runs full width under the timeline line, with less nesting. */
@media (max-width: 640px) {
  .stop { padding-left: 44px; }
  .stop--big .stop-dot { position: static; margin-bottom: 10px; }
  .stop--big { padding-left: 0; }
  .stop--big .stop-body { padding: 16px; }
  .formula { padding: 14px 16px; }
  .features li { padding-left: 12px; }
}

.after {
  display: grid;
  gap: 18px;
  margin-top: clamp(36px, 5vw, 52px);
  max-width: 62rem;
}
@media (min-width: 820px) {
  .after { grid-template-columns: 1fr 1fr; }
}
.after > div {
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.94rem;
}
.after h3 { font-size: 1rem; color: var(--text); margin-bottom: 6px; }

/* ---------- Credits and footer ---------- */

.h-small { font-size: clamp(1.5rem, 1.2rem + 1vw, 1.9rem); }
.credits { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
@media (min-width: 900px) {
  .credits { grid-template-columns: 1fr 1fr; }
}
.credits li {
  padding: 14px 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.94rem;
}
.credits strong { color: var(--text); }

.footer {
  border-top: 1px solid var(--border);
  padding-block: 32px 40px;
  color: var(--muted);
  font-size: 0.88rem;
}
.footer p { margin: 0 0 4px; }

/* ---------- 404 ---------- */

.notfound {
  display: grid;
  place-items: center;
  min-height: calc(100vh - var(--bar-h) - 140px);
  padding-block: 64px;
  text-align: center;
}
.notfound h1 { font-size: clamp(2.2rem, 1.5rem + 3vw, 3.5rem); }
.notfound p { max-width: 34rem; margin-inline: auto; margin-bottom: 28px; color: #cfd3d8; }
.notfound .buttons { justify-content: center; }

/* ---------- Lightbox ---------- */

.lightbox {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}
.lightbox::backdrop { background: rgba(8, 9, 11, 0.97); }

.lightbox figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 100%;
  margin: 0;
  padding: 56px 64px 24px;
  cursor: zoom-out;
}
.lightbox figure > * { cursor: auto; }
.lightbox img {
  max-width: min(100%, 1600px);
  max-height: calc(100% - 90px);
  width: auto;
  height: auto;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
}
.lightbox figcaption {
  max-width: 56rem;
  max-height: 30vh;
  overflow-y: auto;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: center;
}
.lightbox figcaption strong { color: var(--text); }
.lightbox figcaption .chip { margin-bottom: 2px; }

.lb-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: rgba(27, 30, 35, 0.9);
  color: var(--text);
  font: inherit;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.lb-btn:hover { background: var(--panel-2); }
.lb-close { top: 10px; right: 12px; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
@media (max-width: 640px) {
  .lightbox figure { padding: 56px 16px 76px; }
  .lb-prev, .lb-next { top: auto; bottom: 16px; transform: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .lightbox[open] { animation: lb-in 0.18s ease-out; }
  @keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

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

@media print {
  .topbar, .buttons, .skip-link { display: none; }
  body { background: #fff; color: #000; }
}
