/* Fun facts: Swiss style like /simulation. Black on white, one red accent, Helvetica, a strict grid. */
:root {
  --paper: #ffffff; --ink: #111111; --muted: #5c5c5c; --red: #d0021b; --hair: #d9d9d9; --tint: #f2f2f2;
  --font: "Helvetica Neue", Helvetica, "Nimbus Sans", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #111111; --ink: #f2f2f2; --muted: #a8a8a8; --red: #ff5c50; --hair: #333333; --tint: #1c1c1c; color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.5 var(--font); }
.ff { max-width: 76rem; margin: 0 auto; padding: 1rem 16px 4rem; }
a { color: inherit; text-underline-offset: 0.18em; }
a:hover { color: var(--red); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
h1, h2, p, ol, figure { margin: 0; }
.crumbs { font-size: 0.85rem; padding-bottom: 1.5rem; }
.crumbs a { display: inline-block; padding-block: 0.6rem; }
.ff-head { border-top: 2px solid var(--ink); padding-top: 0.6rem; margin-bottom: 2.5rem; }
.kick { font-size: 0.82rem; font-weight: 700; }
h1 { font-size: clamp(3rem, 11vw, 8rem); font-weight: 700; line-height: 0.92; letter-spacing: -0.04em; margin: 1.2rem 0 1rem; }
h1 span { color: var(--red); }
.lede { font-size: clamp(1.1rem, 2vw, 1.4rem); line-height: 1.3; max-width: 40rem; }

.show { border-top: 2px solid var(--ink); padding-top: 0.6rem; overflow-x: clip; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.controls { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.controls button { font: 700 0.95rem var(--font); min-height: 44px; min-width: 44px; padding: 0.6rem 1.1rem; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 0; cursor: pointer; }
.controls button:hover { background: var(--ink); color: var(--paper); }
.controls button:disabled { opacity: 0.4; cursor: default; background: var(--paper); color: var(--ink); }
.counter { text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.slides { list-style: none; padding: 0; touch-action: pan-y; }
.slides img { -webkit-user-drag: none; user-select: none; }
.slide { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 1.25rem; padding-bottom: 2rem; }
.slide[hidden] { display: none; }
.slide + .slide { border-top: 1px solid var(--hair); padding-top: 2rem; }   /* without script: all slides as a list */
.js .slide + .slide { border-top: 0; padding-top: 0; }
@media (max-width: 48rem) { .slide { grid-template-columns: 1fr; } }
.slide figure { min-width: 0; }
.slide img { display: block; width: 100%; aspect-ratio: 4 / 3; background: var(--tint); }
.fit-cover img { object-fit: cover; }
.fit-contain img { object-fit: contain; }
figcaption { font-size: 0.75rem; line-height: 1.35; color: var(--muted); margin-top: 0.45rem; }
.words { border-top: 1px solid var(--ink); padding-top: 0.6rem; min-width: 0; }
.no { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.82rem; font-weight: 700; }
.no .num { font-size: clamp(3rem, 7vw, 5rem); line-height: 0.9; letter-spacing: -0.05em; color: var(--red); }
.no .cat { text-transform: uppercase; letter-spacing: 0.05em; }
.words h2 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); line-height: 1.05; letter-spacing: -0.025em; margin: 1.2rem 0 1rem; }
.words p + p { margin-top: 0.8em; }
.words .src { font-size: 0.8rem; color: var(--muted); border-top: 1px solid var(--hair); padding-top: 0.5rem; margin-top: 1.4rem; }
.hint { font-size: 0.8rem; color: var(--muted); }

.toc { border-top: 2px solid var(--ink); margin-top: 3rem; padding-top: 0.3rem; }
.toc summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.toc ol { columns: 2 16rem; padding-left: 1.5rem; margin: 0.5rem 0 0; }
.toc li { padding-block: 0.25rem; break-inside: avoid; }
.credits { font-size: 0.8rem; color: var(--muted); margin-top: 2rem; }

@media (prefers-reduced-motion: no-preference) {
  .js .slide.is-current { animation: in 0.35s ease-out both; }
  @keyframes in { from { opacity: 0; transform: translateX(var(--from, 1.5rem)); } to { opacity: 1; transform: none; } }
}

/* Portrait 9:16 frame (with script). The frame fills the screen height; text scales with the frame width. */
.js .ff { padding-top: 0.5rem; padding-bottom: 2rem; }
.js .crumbs { padding-bottom: 0.25rem; }
.js .ff-head { border-top: 0; padding-top: 0; margin-bottom: 0.75rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; }
.js .ff-head h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 0; letter-spacing: -0.03em; }
.js .ff-head .kick { order: 2; }
.js .ff-head .lede { display: none; }
.js .show { border-top: 0; padding-top: 0; }
.js .stage {
  --h: calc(100svh - 9.5rem);
  width: min(100%, calc(var(--h) * 9 / 16));
  min-width: min(100%, 18rem);
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  container-type: inline-size;
  border: 2px solid var(--ink);
  background: var(--paper);
  overflow: hidden;
}
.js .slides { height: 100%; }
.js .slide { height: 100%; display: grid; grid-template-columns: 1fr; grid-template-rows: 50% minmax(0, 1fr); gap: 0; padding: 0; }
.js .slide[hidden] { display: none; }
.js .slide figure { position: relative; min-height: 0; display: flex; flex-direction: column; }
.js .slide img { aspect-ratio: auto; flex: 1; min-height: 0; height: 100%; }
.js .slide figcaption { margin: 0; padding: 0.35rem 5cqw 0; font-size: max(0.65rem, 2.3cqw); }
.js .words { border-top: 0; padding: 3cqw 5cqw 4cqw; display: flex; flex-direction: column; min-height: 0; }
.js .no { border-top: 1px solid var(--ink); padding-top: 1.5cqw; font-size: max(0.7rem, 2.6cqw); }
.js .no .num { font-size: max(2rem, 12cqw); }
.js .words h2 { font-size: max(1.15rem, 6.6cqw); margin: 2.5cqw 0 2.5cqw; }
.js .words p:not(.no):not(.src) { font-size: max(0.92rem, 3.7cqw); line-height: 1.38; }
.js .words .src { margin-top: auto; padding-top: 1.5cqw; font-size: max(0.65rem, 2.3cqw); }
.js .controls { width: min(100%, calc((100svh - 9.5rem) * 9 / 16)); min-width: min(100%, 18rem); margin: 0.75rem auto 0; }
.js .hint { text-align: center; margin-top: 0.4rem; }
.js .words { overflow-y: auto; }   /* last resort on very small screens: scroll, never cut off */
@container (max-width: 320px) {
  .js .slide { grid-template-rows: 40% minmax(0, 1fr); }
  .js .words h2 { font-size: 1.05rem; }
  .js .words p:not(.no):not(.src) { font-size: 0.875rem; line-height: 1.32; }
  .js .no .num { font-size: 1.7rem; }
}
