/* ——————————————————————————————————————————
   NGMA project page. Extends static/css/style.css: same tokens, same fonts.
—————————————————————————————————————————— */

.ngma {
  --wide: 1080px;
  --text-w: 680px;
  --col: 820px;
  --dim: #8a8781;
  --faint: #24241f;
  --ok: #f0ede8;
  --near: #8a8781;
  --mirror: #d9a441;
  --align: #9085e9;   /* the alignment map A, as in the diagrams (COL.A in overview.js) */
  padding-bottom: 8rem;
}

.ngma [hidden] { display: none !important; }
.ngma section { padding: 0 var(--pad); }
.ngma .col { max-width: var(--text-w); margin: 0 auto; }
.ngma .wide { max-width: var(--wide); margin: 0 auto; }

/* ——— Header ——— */

.ngma-head {
  padding: 18vh var(--pad) 3rem;
  max-width: calc(var(--wide) + 2 * var(--pad));
  margin: 0 auto;
}

.eyebrow {
  font-family: 'Roboto Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ngma-head .eyebrow { margin-bottom: 1.6rem; display: flex; align-items: center; gap: 0.6rem; }
.ngma-head .eyebrow::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
}

.ngma-title {
  font-size: clamp(2.2rem, 6vw, 4.4rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.03em;
  max-width: 20ch;
  margin-bottom: 2rem;
}

.ngma-subtitle {
  font-size: clamp(1.1rem, 2.2vw, 1.45rem);
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--text-muted);
  max-width: 34ch;
  margin-top: -0.6rem;
  margin-bottom: 2.6rem;
}
.ngma-subtitle .hl { color: var(--text); }
.ngma-paper-label {
  font-family: 'Roboto Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}
.ngma-paper { color: var(--text); font-size: 0.95rem; font-weight: 500; margin-bottom: 0.2rem; }
.ngma-authors { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 0.2rem; }
.ngma-authors b { color: var(--text); font-weight: 500; }
.ngma-affil { font-family: 'Roboto Mono', monospace; font-size: 11px; color: var(--dim); letter-spacing: 0.04em; }

.ngma-links { display: flex; gap: 0.6rem 2.2rem; margin-top: 2.2rem; flex-wrap: wrap; }
.ngma-links a {
  font-family: 'Roboto Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.15rem;
  transition: border-color 0.15s, color 0.15s;
}
.ngma-links a:hover { border-color: var(--accent); color: var(--accent); }
.ngma-links a.primary { color: var(--text); border-color: var(--accent); }

/* ——— Lede and numbers ——— */

.intro-wrap { border-top: 1px solid var(--border); padding-top: 3rem; margin-top: 1rem; }
.intro { font-size: 1.02rem; line-height: 1.8; color: #d8d5cf; max-width: var(--col); margin: 0 auto; }
.intro + .intro { margin-top: 1.2rem; }
.intro-quote { max-width: var(--col); margin: 1.6rem auto; padding: 0.2rem 0 0.2rem 1.3rem; border-left: 2px solid var(--accent); color: var(--text); font-size: 1.12rem; line-height: 1.65; }
.roadmap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 2rem; max-width: var(--col); margin: 1.8rem auto 0; }
.road { display: flex; flex-direction: column; gap: 0.7rem; padding: 1.1rem 0 1.4rem; border-top: 1px solid var(--border); transition: border-color 0.15s; }
.road:hover { border-color: var(--accent); }
.road .chapter-no { padding-top: 0; }
.road b { text-wrap: balance; font-size: 1.02rem; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; color: var(--text); }
.road-text { font-size: 0.82rem; line-height: 1.6; color: var(--text-muted); }
.intro a { color: var(--text); border-bottom: 1px solid var(--border); transition: border-color 0.15s; }
.intro a:hover { border-color: var(--accent); }

.lede {
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  line-height: 1.5;
  letter-spacing: -0.01em;
  max-width: 34ch;
}
.lede-wrap { border-top: 1px solid var(--border); padding-top: 3rem; margin-top: 1rem; display: grid;
             grid-template-columns: 1.1fr 1fr; gap: 3rem; align-items: start; }
.numbers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-left: 1px solid var(--border); }
.number { padding: 0 1.2rem; border-right: 1px solid var(--border); }
.number .n { font-size: clamp(1.7rem, 3.6vw, 2.6rem); font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.number .n small { font-size: 0.5em; color: var(--text-muted); font-weight: 500; }
.number p { font-size: 0.78rem; color: var(--text-muted); line-height: 1.45; margin-top: 0.8rem; }
/* the same row under an experiment's subheading: the numbers first, the paragraph after them */
.chapter .prose .numbers { margin: 1.1rem 0 1.5rem; }

/* ——— Sections ——— */

.chapter { margin-top: 9rem; }
.ngma .chapter, .ngma .chapter h3[id] { scroll-margin-top: 6rem; }
.chapter .note + .prose { margin-top: 3.5rem; }
.chapter-head { max-width: var(--col); margin: 0 auto 2.2rem; }
.chapter-head .chapter-no { display: block; padding-top: 0; margin-bottom: 0.7rem; }
.chapter-no { font-family: 'Roboto Mono', monospace; font-size: 11px; color: var(--accent); letter-spacing: 0.1em; padding-top: 0.55rem; }
.chapter h2 { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; max-width: 34em; text-wrap: balance; }
.chapter .prose { margin-left: auto; margin-right: auto; max-width: var(--col); color: #d8d5cf; font-size: 0.98rem; line-height: 1.8; }
.chapter .prose p + p { margin-top: 1rem; }
.chapter .prose em { color: var(--text); font-style: normal; border-bottom: 1px solid var(--border); }
.note { font-size: 0.8rem; color: var(--text-muted); line-height: 1.6; margin-top: 1rem; }

/* ——— Widgets. Same language as the rest of the site: no boxes or fills, hairlines only,
   mono uppercase for labels, mono mixed case for values, the accent marks the current choice. ——— */

.instrument { margin-top: 2.5rem; }
.controls { display: flex; flex-wrap: wrap; gap: 0.8rem 2.6rem; align-items: baseline; margin-bottom: 1.1rem; }
.control { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 1rem; }
.control-label { font-family: 'Roboto Mono', monospace; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); }

/* options: plain words, the chosen one underlined in the accent */
.seg { display: inline-flex; flex-wrap: wrap; gap: 0.3rem 1rem; }
.seg button { font-family: 'Roboto Mono', monospace; font-size: 11px; letter-spacing: 0.02em; color: var(--text-muted); background: none; border: 0; border-bottom: 1px solid transparent;
  padding: 0 0 0.2rem; border-radius: 0; cursor: pointer; transition: color 0.15s, border-color 0.15s; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { color: var(--text); border-bottom-color: var(--accent); }

/* on/off: a small square, filled when on */
.switch { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; user-select: none; font-family: 'Roboto Mono', monospace; font-size: 11px; letter-spacing: 0.02em; color: var(--text-muted); transition: color 0.15s; }
.switch input { appearance: none; -webkit-appearance: none; width: 9px; height: 9px; flex: none; margin: 0; border-radius: 0;
  background: none; border: 1px solid var(--text-muted); cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.switch input:checked { background: var(--text); border-color: var(--text); }
.switch:has(input:checked) { color: var(--text); }
.switch input:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
.switch:hover { color: var(--text); }

/* actions: underlined words, as the links elsewhere on the site */
.btn { font-family: 'Roboto Mono', monospace; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-muted); background: none; border: 0; border-bottom: 1px solid var(--border); border-radius: 0;
  padding: 0 0 0.15rem; cursor: pointer; transition: color 0.15s, border-color 0.15s; }
.btn:hover { color: var(--accent); border-color: var(--accent); }

input[type="range"].scrub { -webkit-appearance: none; appearance: none; width: 180px; height: 1px; background: var(--border); outline: none; }
input[type="range"].scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 3px; height: 13px; border-radius: 0; background: var(--text); cursor: pointer; border: 0; }
input[type="range"].scrub::-moz-range-thumb { width: 3px; height: 13px; border-radius: 0; background: var(--text); cursor: pointer; border: 0; }

canvas.viz { display: block; width: 100%; touch-action: none; }

.readout { display: flex; flex-wrap: wrap; gap: 0.35rem 2.2rem; margin-top: 0.9rem; font-family: 'Roboto Mono', monospace; font-size: 11px; letter-spacing: 0.02em; color: var(--dim); }
.readout b { color: var(--text); font-weight: 400; }
.readout .acc { color: var(--accent); }

.legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1.4rem; margin-top: 0.9rem; font-size: 0.76rem; color: var(--text-muted); }
.legend span { display: inline-flex; align-items: center; gap: 0.45rem; }
.legend i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.legend i.sq { border-radius: 0; }

.tooltip { position: absolute; pointer-events: none; background: var(--bg); border: 1px solid var(--border);
  padding: 0.5rem 0.7rem; font-size: 0.76rem; line-height: 1.45; color: var(--text); max-width: 260px; opacity: 0; transition: opacity 0.12s; z-index: 5; }
.tooltip .t-muted { color: var(--text-muted); }
.stage { position: relative; }

/* the widget's one-line result, then its explanation in the caption voice */
.verdict { margin-top: 1rem; font-size: 0.95rem; color: var(--text); min-height: 1.6em; }
.verdict:empty { display: none; }
.verdict .tag, .step-text .tag { font-family: 'Roboto Mono', monospace; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); margin-right: 0.8rem; }

.control.stack { flex-direction: column; align-items: flex-start; gap: 0.45rem; }
input[type="range"].wide-scrub { width: 220px; }
canvas.mini { width: 260px; height: 64px; display: block; }
.controls.top { align-items: flex-start; }
.meter { display: flex; align-items: center; gap: 1rem; margin-top: 0.6rem; }
.meter-bar { position: relative; flex: 1; max-width: 420px; height: 2px; background: var(--border); overflow: visible; }
.meter-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--text-muted); transition: width 0.08s; }
.meter-bar b { position: absolute; top: -4px; bottom: -4px; width: 1px; background: var(--text); }
.meter-val { font-family: 'Roboto Mono', monospace; font-size: 11px; letter-spacing: 0.02em; color: var(--text); min-width: 3.5em; }

/* ——— Mirror ——— */

.mirror { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr); gap: 2rem; align-items: start; }
.gallery { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.gallery button { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 4px; overflow: hidden; outline: 2px solid transparent; outline-offset: 1px; transition: outline-color 0.15s, opacity 0.15s; opacity: 0.6; }
.gallery button:hover { opacity: 0.9; }
.gallery button[aria-pressed="true"] { outline-color: var(--accent); opacity: 1; }
.tile { display: block; width: 100%; aspect-ratio: 1; background-repeat: no-repeat; image-rendering: auto; }
.tile.flip { transform: scaleX(-1); }
.pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; }
.pair figure { margin: 0; }
.pair figcaption { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.6rem; }
.pair .arrow { color: var(--dim); font-size: 1.4rem; }
.card { perspective: 900px; }
.card .face { border-radius: 6px; overflow: hidden; transition: transform 0.55s cubic-bezier(.6,.1,.3,1); transform-style: preserve-3d; }
.card .face.turn { transform: rotateY(180deg); }
.outcome { margin-top: 0.75rem; font-size: 0.86rem; display: flex; align-items: center; gap: 0.5rem; min-height: 1.4em; }
.outcome i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.mirror-side .controls { margin-top: 1.6rem; margin-bottom: 0; }

/* ——— Steps ——— */

/* views and steps: the same plain words one level up, in capitals */
.steps-nav { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1.6rem; }
.steps-nav button { font-family: 'Roboto Mono', monospace; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-muted); background: none; border: 0; border-bottom: 1px solid transparent;
  padding: 0 0 0.3rem; border-radius: 0; cursor: pointer; transition: color 0.15s, border-color 0.15s; white-space: nowrap; }
.steps-nav button:hover { color: var(--text); }
.steps-nav button[aria-pressed="true"] { color: var(--text); border-bottom-color: var(--accent); }
.steps-nav .arrow { font-family: 'Roboto Mono', monospace; font-size: 10px; color: var(--dim); margin: 0 -0.7rem; }
.panel-tabs > .steps-nav { margin-bottom: 1.6rem; }
.steps-grid { display: grid; grid-template-columns: 1fr 1fr 0.82fr; gap: 1.4rem; margin-top: 1.2rem; }
.panel-title { font-family: 'Roboto Mono', monospace; font-size: 11px; letter-spacing: 0.02em; font-size: 10px; color: var(--text-muted); margin-bottom: 0.5rem; display: flex; justify-content: space-between; gap: 0.6rem; }
.step-text { margin-top: 1rem; font-size: 0.9rem; color: var(--text-muted); max-width: 70ch; min-height: 3.2em; }
.step-text:empty { display: none; }
.steps-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 2.2rem; }
.steps-head .method { font-size: 1rem; font-weight: 500; color: var(--text); min-width: 5.5rem; }
.steps-head .method.m-ngma { color: var(--accent); }
.steps-widget + .steps-widget { margin-top: 2.2rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.steps-widget:has(+ .steps-widget) .legend { display: none; }   /* one legend for both rows, under the second */
.sphere-now { font-size: 0.88rem; line-height: 1.6; color: var(--text-muted); margin-top: 0.7rem; min-height: 2.9em; }
.sphere-now b { color: var(--text); font-weight: 500; }

/* ——— Overview ——— */

.ov-bars { display: grid; grid-template-columns: auto minmax(0, 300px) auto; gap: 0.7rem 1.2rem; align-items: center; margin-top: 1rem;
  font-size: 0.82rem; color: var(--text-muted); width: fit-content; max-width: 100%; }
.ov-bars .meter-bar { max-width: none; width: 100%; min-width: 120px; }
.ov-bars sub, .ov-bars sup, .step-text sub, .step-text sup { font-size: 0.7em; line-height: 0; }
.ov-widget > .steps-nav { margin-bottom: 1.6rem; }
.ov-widget .controls { margin-top: 0; }
.ov-widget .ov-btns { gap: 1.6rem; }
.readout .ov-break { flex-basis: 100%; height: 0; }
.ov-widget .ov-show { gap: 0.6rem 1.6rem; }
@media (max-width: 560px) { .ov-bars { grid-template-columns: auto minmax(0, 1fr) auto; } }

/* ——— Results and citation ——— */

.indent { max-width: var(--col); margin-left: auto; margin-right: auto; min-width: 0; }
.table-scroll { overflow-x: auto; }
.results { min-width: 520px; }

.results { width: 100%; border-collapse: collapse; font-size: 0.86rem; margin-top: 2rem; }
.results th { font-family: 'Roboto Mono', monospace; font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); font-weight: 400; text-align: right; padding: 0 0 0.7rem; border-bottom: 1px solid var(--border); }
.results th:first-child, .results td:first-child, .results th:nth-child(2), .results td:nth-child(2) { text-align: left; }
.results td { text-align: right; padding: 0.55rem 0; border-bottom: 1px solid var(--faint); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.results td.ngma { color: var(--text); font-weight: 600; }
.results tr.grp td { border-top: 1px solid var(--border); }
.results td small { color: var(--dim); font-size: 0.78em; }

.bib { max-width: 100%; background: var(--bg-raised); border: 1px solid var(--border); padding: 1.2rem 1.4rem; font-family: 'Roboto Mono', monospace; font-size: 11.5px; line-height: 1.7; color: var(--text-muted); white-space: pre; overflow-x: auto; margin-top: 1.5rem; }

/* ——— Chapter 01: hypothesis boxes, displayed equations, the neighbour chart ——— */
.chapter .prose a { color: var(--text); border-bottom: 1px solid var(--border); transition: border-color 0.15s; }
.chapter .prose a:hover { border-color: var(--accent); }
.hyp { margin: 1.6rem 0; padding: 0.15rem 0 0.15rem 1.3rem; border-left: 1px solid var(--text-muted); }
.hyp .hyp-label { font-family: 'Roboto Mono', monospace; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.6rem; }
.hyp p + p, .hyp p + ol { margin-top: 0.5rem; }
.hyp ol { list-style: none; counter-reset: hyp; }
.hyp li { counter-increment: hyp; position: relative; padding-left: 2.8rem; }
.hyp li + li { margin-top: 0.35rem; }
.hyp li::before { content: '(' counter(hyp, lower-roman) ')'; position: absolute; left: 0; color: var(--text-muted); font-family: 'Roboto Mono', monospace; font-size: 0.82em; top: 0.15em; }
.chapter .prose .hyp.def .eq { color: var(--align); }
.chapter .prose h3 { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; color: var(--text); line-height: 1.3; margin-top: 2.4rem; margin-bottom: 0.5rem; }
.chapter .prose > h3:first-child { margin-top: 0; }
/* a subheading right after a figure row starts a new part: more space above it than between text and figure */
.chapter details.fig + .prose:has(> h3:first-child) { margin-top: 4rem; }
.chapter .indent + .prose { margin-top: 2.8rem; }
.chapter .prose h3 + p { margin-top: 0; }
.chapter .prose ul { list-style: disc; padding-left: 1.2rem; margin-top: 0.6rem; }
.chapter .prose li + li { margin-top: 0.5rem; }
.chapter .prose li::marker { color: var(--dim); }
.chapter .prose b { color: var(--text); font-weight: 600; }
.chapter .prose .aside { font-size: 0.86rem; color: var(--text-muted); }
.chapter .prose blockquote { margin: 1.4rem 0; padding: 0.15rem 0 0.15rem 1.2rem; border-left: 2px solid var(--accent); color: var(--text); font-size: 1.04rem; line-height: 1.7; }
.chapter .prose .eq { margin: 1rem 0; color: var(--text); overflow-x: auto; overflow-y: hidden; }
.chapter .prose .katex { font-size: 1.05em; }
.chapter .prose .eq.big { margin: 0.6rem 0 0.9rem; }
.knn { position: relative; margin-top: 1.6rem; }
.knn svg { display: block; overflow: visible; }
.knn text { font-family: 'Roboto Mono', monospace; font-size: 10.5px; fill: var(--text-muted); }
.knn .knn-legend text { fill: var(--text); font-family: 'Space Grotesk', sans-serif; font-size: 12.5px; }
.knn .knn-ds { fill: var(--text); font-family: 'Space Grotesk', sans-serif; font-size: 13px; font-weight: 500; }
.knn .knn-prior { font-family: 'Space Grotesk', sans-serif; font-size: 12.5px; }
.knn .knn-direct { font-size: 10px; fill: var(--text-muted); }
.knn .knn-tick { font-size: 10px; fill: var(--dim); }
.knn .knn-grid { stroke: var(--border); stroke-width: 1; }
.knn .knn-link { stroke: #4a4945; stroke-width: 2; }
.knn .knn-row { cursor: default; outline: none; }
.knn .knn-row.on .knn-link { stroke: var(--text-muted); }
.knn .knn-row.on .knn-prior { fill: var(--text); }
.knn-tip { position: absolute; z-index: 2; pointer-events: none; display: flex; flex-direction: column; gap: 0.2rem; padding: 0.55rem 0.75rem;
  background: var(--bg); border: 1px solid var(--border); font-family: 'Roboto Mono', monospace; font-size: 10.5px; color: var(--text-muted); white-space: nowrap; }
.knn-tip b { color: var(--text); font-weight: 500; }
.knn-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.45rem; vertical-align: 0; }
.knn-tip .knn-n { color: var(--dim); }
.knn-table { margin-top: 0.8rem; }
.knn-table summary { font-family: 'Roboto Mono', monospace; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-muted); cursor: pointer; }
.knn-table summary:hover { color: var(--accent); }
.knn-table .results { margin-top: 0.8rem; }
/* ——— Diagrams: in the text column, closed until opened ——— */
/* ——— Figures: a hairline row that opens, closed until asked for ——— */
details.fig { max-width: var(--col); margin: 2rem auto 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
details.fig > summary { list-style: none; display: flex; align-items: baseline; gap: 1rem; padding: 0.95rem 0; cursor: pointer;
  color: var(--text-muted); font-size: 0.9rem; font-weight: 400; transition: color 0.15s; }
details.fig[open] > summary { color: var(--text); }
details.fig > summary::-webkit-details-marker { display: none; }
details.fig > summary::after { content: '+'; margin-left: auto; font-family: 'Roboto Mono', monospace; font-size: 0.95rem; font-weight: 400; color: var(--text-muted); }
details.fig[open] > summary::after { content: '−'; }
details.fig > summary:hover, details.fig > summary:focus-visible { color: var(--accent); outline: none; }
details.fig > summary:hover::after { color: var(--accent); }
details.fig[open] { padding-bottom: 1.6rem; }
details.fig .fig-hide, details.fig[open] .fig-show { display: none; }
details.fig[open] .fig-hide { display: inline; }
details.fig > .instrument { margin-top: 0.6rem; }
details.fig + .prose, details.fig + .indent { margin-top: 2.2rem; }
/* ——— Chapter 02: the sphere animation, collapsed until opened ——— */
.sphere-open { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.sphere-hint { font-size: 0.86rem; color: var(--text-muted); }
.sphere-box #sphere-widget { margin-top: 1.2rem; }
.ldd-box { max-width: 560px; margin-top: 0.8rem; }

@media (max-width: 860px) {
  .lede-wrap { grid-template-columns: 1fr; }
  .mirror { grid-template-columns: 1fr; }
  .steps-grid { grid-template-columns: 1fr 1fr; }
  .steps-grid > :last-child { grid-column: span 2; }
  .roadmap { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .roadmap { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .numbers { grid-template-columns: 1fr; border-left: 0; }
  .number { border-right: 0; border-top: 1px solid var(--border); padding: 1rem 0; }
  .steps-grid { grid-template-columns: 1fr; }
  .steps-grid > :last-child { grid-column: auto; }
  .gallery { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .card .face { transition: none; }
}

/* Footnotes: <span class="fn" tabindex="0"><span class="fn-body" role="note">…</span></span> after a word.
   The marker numbers itself; the note opens on hover, keyboard focus or tap, and stays open while the
   pointer is on it, so its links can be clicked. On narrow screens the note sits at the bottom of the screen. */
.ngma { counter-reset: fn; }
.fn { position: relative; counter-increment: fn; cursor: help; }
.fn::before { content: counter(fn); font-family: 'Roboto Mono', monospace; font-size: 0.68em; line-height: 0; vertical-align: super; color: var(--accent); padding: 0 0.12em 0 0.08em; }
.fn:focus { outline: none; }
.fn:focus-visible::before { outline: 1px solid var(--accent); outline-offset: 2px; }
.fn-body { position: absolute; z-index: 30; left: 50%; bottom: calc(100% + 0.45rem); transform: translateX(-50%);
  display: block; width: min(22rem, calc(100vw - 2rem)); padding: 0.75rem 0.9rem; background: var(--bg-raised);
  border: 1px solid var(--border); color: var(--text-muted); font-size: 0.82rem; line-height: 1.55; font-style: normal;
  font-weight: 400; text-align: left; white-space: normal; visibility: hidden; opacity: 0; transition: opacity 0.12s, visibility 0.12s; }
.fn-body::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 0.6rem; }
.fn:hover .fn-body, .fn:focus .fn-body, .fn:focus-within .fn-body { visibility: visible; opacity: 1; }
@media (max-width: 760px) {
  .fn-body { position: fixed; left: 1rem; right: 1rem; bottom: 1rem; top: auto; width: auto; transform: none; }
  .fn-body::after { display: none; }
}
