/* Vietnam 90s — home. On landscape screens the 1920 × 1211 Figma frame is scaled so
   that everything above the footer (1080 design px) is exactly one viewport tall:
   every length is "design px × --u"; the screen and nav stretch to fill the width.
   Phones and portrait tablets get a stacked layout below. */

@font-face { font-family: "BT Danta"; src: url("fonts/BTDanta-ExtraBold.otf") format("opentype"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Phudu"; src: url("fonts/Phudu-VF.ttf") format("truetype"); font-weight: 300 900; font-display: swap; }
@font-face { font-family: "TCA Minhon"; src: url("fonts/TCAMinhonNonCommercial-SemiBold.otf") format("opentype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "TCA Minhon"; src: url("fonts/TCAMinhonNonCommercial-Bold.otf") format("opentype"); font-weight: 700; font-display: swap; }

/* registered so they resolve to px where declared and inherit as plain lengths */
@property --u { syntax: "<length>"; inherits: true; initial-value: 1px; }
@property --dp { syntax: "<length>"; inherits: true; initial-value: 1px; }

:root {
  --bg: #0c1613;
  --ink: #2a0e0c;
  --cream: #f7ebd0;
  --paper: #fef5d2;
  --mustard: #ffb22b;
  --orange: #fb8405;
  --red: #dc0000;
  --brown: #471006;
  --moss: #1e4538;
  --moss-deep: #153027;  /* the screen's moss, 30% darker */
  --blue: #006599;
  --olive: #968243;
  --sand: #e1c282;
  --navy: #030356;
  --rule: rgb(255 255 255 / 0.105);  /* Figma 15%, lowered 30% */
  --rule-soft: rgb(255 255 255 / 0.06);
  --rule-faint: rgb(255 255 255 / 0.0525);  /* the still picture's reveal outlines (main.js) */
  --rule-mark: rgb(255 255 255 / 0.134);  /* --rule-faint 50% then 70% brighter: the poster name's outline, the pager */
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--cream);
  container-type: inline-size;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* Lenis smooth scroll (its recommended base styles) */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-stopped { overflow: clip; }
.lenis [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-smooth iframe { pointer-events: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
p, figure { margin: 0; }
:focus-visible { outline: 2px solid var(--mustard); outline-offset: 2px; }

.page {
  --u: calc(100vh / 1080);
  --u: calc(100svh / 1080);
  --dp: var(--u);
  /* area edges snap to whole pixels, so neighbours never share a blended seam */
  --top: round(calc(129.5 * var(--u)), 1px);
  --mid: round(calc(796 * var(--u)), 1px);
  display: grid;
  grid-template-columns: round(calc(617.822 * var(--u)), 1px) minmax(0, 1fr);
  grid-template-rows: var(--top) var(--mid) calc(100vh - var(--top) - var(--mid)) auto auto auto auto auto auto;
  grid-template-rows: var(--top) var(--mid) calc(100svh - var(--top) - var(--mid)) auto auto auto auto auto auto;
  grid-template-areas:
    "side nav"
    "side screen"
    "side info"
    "side still"
    "side memory"
    "photo photo"
    "foot foot"
    "tail tail"
    "finale finale";
  overflow: clip;  /* not hidden: that would make it a scroll box and stop .side sticking */
}

/* The left column (logo over poster) stays put while the right column scrolls on to the
   picture under the info row and the memory block under that; it lets go when the
   block's bottom meets its own (Figma "Home": right column moved up 924; the picture
   was 1302 × 926 there, now as tall as the picture itself; "Frame 798" under it).
   .side spans those rows; the pin inside sticks within it. */
.side { grid-area: side; }
.side-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  display: grid;
  grid-template-rows: var(--top) minmax(0, 1fr);
  grid-template-areas: "brand" "poster";
}
.still { grid-area: still; position: relative; margin: 0; overflow: hidden; }
.still .pixel-reveal, .wide-frame .pixel-reveal { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.still img {  /* the whole picture: the frame (its grid row) is as tall as the picture is at this width */
  width: 100%;
  height: auto;
  display: block;
}

/* two-line caps label: a dim index over a bright word */
.kicker {
  font: 700 max(12px, calc(16 * var(--u)))/0.8 "Phudu", sans-serif;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  text-box: trim-both cap alphabetic;
  white-space: nowrap;
}
.kicker > span { display: block; color: rgb(247 235 208 / 0.3); }

/* ---------- header ---------- */

.brand {
  grid-area: brand;
  position: relative;
  display: flex;
  align-items: center;  /* the logo sits midway down, as much room above it as below */
  padding-left: calc(28.789 * var(--u));
}
/* the block's colour on a layer of its own with the poster's grain, so the logo
   over it can take its own grain */
.brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #ffb72f;
  filter: url(#dither-4);
}
/* Figma "Logo" (63:25682): the mark, then three lines of type over a two-colour bar,
   dithered like Figma: the mark at 4 levels, the type and bar at 8 */
.brand .logo {
  position: relative;  /* over the colour layer */
  display: flex;
  align-items: center;
  gap: calc(13 * var(--u));
}
.logo-mark {
  display: block;
  width: calc(92.632 * var(--u));
  height: calc(64 * var(--u));
  filter: url(#dither-4);
}
.logo-type {
  display: flex;
  flex-direction: column;
  gap: calc(6 * var(--u));
  width: calc(110 * var(--u));
  filter: url(#dither-8);
}
.logo-words {
  font: 700 calc(21.386 * var(--u))/0.8 "Phudu", sans-serif;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  text-box: trim-both cap alphabetic;
  color: var(--bg);
}
.logo-bar { height: calc(9 * var(--u)); background: linear-gradient(to right, var(--orange) calc(40 * var(--u)), var(--cream) 0); }

.nav {
  grid-area: nav;
  display: grid;
  /* clock + menu span the screen's last two of seven columns, so the clock lines up with a band edge */
  grid-template-columns: 1fr 1fr calc(200% / 7 - 129.5 * var(--u)) calc(129.5 * var(--u));
  align-items: start;
  background: var(--bg);  /* same as the info row below */
}
.nav-link {
  height: calc(66 * var(--u));
  padding: calc(21 * var(--u)) calc(20 * var(--u));
  border-bottom: 1px solid var(--rule-soft);
  transition: color 0.2s;
}
.nav-link:first-child { border-right: 1px solid var(--rule-soft); }
.nav-link:hover { color: var(--mustard); }
.clock {
  align-self: stretch;
  padding: calc(21 * var(--u)) calc(20 * var(--u));
  background: linear-gradient(var(--olive) 0 calc(65 * var(--u)), var(--cream) 0);
}
.clock > span { color: rgb(247 235 208 / 0.4); }
.clock time { display: block; font-variant-numeric: tabular-nums; }
.menu {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(8.571 * var(--u));
  background: var(--mustard);
}
.menu img { width: calc(20 * var(--u)); height: calc(5.714 * var(--u)); display: block; }

/* ---------- poster ---------- */

.poster {
  grid-area: poster;
  position: relative;
  overflow: hidden;
  background: var(--ink);
  filter: url(#dither-4);
}
.art {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(950.495 * var(--dp));
  height: calc(617.822 * var(--dp));
  transform: translate(-50%, -50%) rotate(90deg) scale(1.004);  /* a hair over size: the frame clips it, no gaps at its edges */
}
.deco {
  position: absolute;
  left: 0;
  width: 100%;
  height: calc(308.911 * var(--dp));
  overflow: hidden;
  background: #fff;
}
.d1 { top: 0; }
.d2 { bottom: 0; }
.deco > * {
  position: absolute;
  left: calc(var(--x) * var(--dp));
  top: calc(var(--y) * var(--dp));
}
.s {
  width: calc(var(--w) * var(--dp));
  height: calc(var(--h, var(--w)) * var(--dp));
  background: var(--c);
}
.o { border-radius: 50%; }
img.s { background: none; display: block; }

/* the emblem's star turns slowly about the centre of its disc. It lives on a layer of
   its own over the poster (and over the footer's emblem), not in them: anything moving
   inside a dithered element has the whole element's dither worked out again every frame
   (the poster's is big, and it's on screen through the hero, the picture and the memory
   block). Here the star is dithered once and the layer is just turned. */
.poster-spin { grid-area: poster; position: relative; overflow: hidden; pointer-events: none; }
.poster-spin .deco { background: none; }
.spin { will-change: transform; animation: spin 14s linear infinite; }
.spin svg { display: block; width: 100%; height: 100%; filter: url(#dither-4); }
@keyframes spin { to { rotate: 360deg; } }

.danta {
  font: 800 calc(170.792 * var(--dp))/1.3 "BT Danta", sans-serif;
  letter-spacing: -0.08em;
  color: var(--c);
  translate: calc(-100% - 0.08em) 0;  /* --x is the right edge of the last glyph (Figma drops the trailing letter-spacing) */
  text-box: trim-both cap alphabetic;
  white-space: nowrap;
}
.label {
  font: 700 calc(21.386 * var(--dp))/0.8 "Phudu", sans-serif;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--c);
  text-box: trim-both cap alphabetic;
  white-space: nowrap;
}

/* 4 × 2 pixel block: three cells on top, two plus one at the far end below */
.pix {
  display: grid;
  grid-template-columns: repeat(4, calc(var(--cell) * var(--dp)));
  grid-template-rows: repeat(2, calc(var(--cell) * var(--dp)));
}
.pix > i:nth-child(odd) { background: var(--a); }
.pix > i:nth-child(even) { background: var(--b); }
.pix > i:nth-child(1) { grid-area: 1 / 1; }
.pix > i:nth-child(2) { grid-area: 1 / 2; }
.pix > i:nth-child(3) { grid-area: 1 / 3; }
.pix > i:nth-child(4) { grid-area: 2 / 1; }
.pix > i:nth-child(5) { grid-area: 2 / 2; }
.pix > i:nth-child(6) { grid-area: 2 / 4; }
.pix.flip { transform: scaleX(-1); }

/* ---------- screen ---------- */

.screen {
  grid-area: screen;
  position: relative;
  overflow: hidden;
  container-type: size;
  background: var(--moss-deep);
}
.screen > canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

/* ---------- poster reveal ---------- */

/* A poster and its white holed sleeve meet in the middle of the screen, the sleeve
   covering it whole, then part until they stand side by side, on the reference GIF's
   4 s loop; each time they meet the next poster goes in. The easing is the GIF's own
   motion, sampled per frame: a slow tug, a quick snap, a soft settle. main.js sets
   --x/--y/--w/--h so every edge lands on a band edge; these are the fallbacks. */
.reveal {
  --w: round(min(68.44cqh, 45.6cqw), 1px);
  --h: round(calc(var(--w) * 1.315), 1px);  /* 485.552 × 638.501 in Figma */
  --spread: calc(var(--w) / 2);  /* each one's shift when apart: they meet at the centre */
  --ease: linear(0, 0.001, 0.001, 0.003, 0.004, 0.006, 0.009, 0.012, 0.015, 0.018, 0.021, 0.025, 0.03, 0.036,
    0.042, 0.049, 0.057, 0.066, 0.076, 0.088, 0.102, 0.118, 0.136, 0.16, 0.192, 0.226, 0.312, 0.688, 0.765,
    0.808, 0.84, 0.864, 0.882, 0.898, 0.912, 0.924, 0.934, 0.943, 0.951, 0.958, 0.964, 0.97, 0.975, 0.979,
    0.982, 0.987, 0.99, 0.991, 0.994, 0.996, 0.997, 0.999, 0.999, 1);
  position: absolute;
  left: var(--x, round(calc(50cqw - var(--w) / 2), 1px));
  top: var(--y, round(calc(50cqh - var(--h) / 2), 1px));
  width: var(--w);
  height: var(--h);
}
.reveal-poster, .reveal-cover {
  position: absolute;
  display: block;
  animation: 4s var(--ease) infinite;  /* per segment; the holds don't move, so it only shapes the slides */
}
.reveal-poster { inset: 0; animation-name: reveal-poster; }
.reveal-poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  visibility: hidden;
}
.reveal-poster img.is-current { visibility: visible; }
.reveal-pixels { position: absolute; inset: 0; width: 100%; height: 100%; }  /* the pixel change between posters */
.reveal-pixels[hidden] { display: none; }
.reveal-cover {
  inset: 0;  /* same whole-pixel box as the poster, so it covers it exactly */
  width: 100%;
  height: 100%;
  animation-name: reveal-cover;
  filter: url(#dither-8);  /* the sleeve's Figma Dither: Bayer 16×16, 8 levels */
}
.reveal.is-paused .reveal-poster, .reveal.is-paused .reveal-cover { animation-play-state: paused; }
/* GIF frames: together to 3, apart 3–56, hold to 62, together 62–117, hold to 120 */
@keyframes reveal-poster {
  0%, 2.5% { translate: 0 0; }
  46.667%, 51.667% { translate: calc(-1 * var(--spread)) 0; }
  97.5%, 100% { translate: 0 0; }
}
@keyframes reveal-cover {
  0%, 2.5% { translate: 0 0; }
  46.667%, 51.667% { translate: var(--spread) 0; }
  97.5%, 100% { translate: 0 0; }
}

/* ---------- info row ---------- */

.info {
  grid-area: info;
  display: grid;
  grid-template-columns: minmax(0, 1fr) max(50%, calc(470 * var(--u)));  /* the copy and EXPLORE need ~470 */
  border-top: 1px solid var(--rule);
  color: var(--paper);
}
.info-l { position: relative; border-right: 1px solid var(--rule); }
.info-r { position: relative; }

/* the shown poster's name, over the pager */
.poster-name {
  position: absolute;
  left: calc(23 * var(--u));
  top: calc(24.5 * var(--u));
  margin: 0;
  font: 800 max(14px, calc(24 * var(--u)))/0.8 "BT Danta", sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-box: trim-both cap alphabetic;
  white-space: nowrap;
}
/* The name comes in as an outline drawn stroke by stroke, then the colour sweeps in.
   The HTML text keeps the box (cap height, so its bottom is the baseline) and stays
   for screen readers; the SVG on top draws it. */
.poster-name .pn-text { color: transparent; }
.pn-draw { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.pn-draw text { font: inherit; letter-spacing: inherit; }
.pn-line { fill: none; stroke: var(--rule-mark); stroke-width: 1px; stroke-dasharray: 6em; }  /* about the longest letter's outline */
.pn-fill { fill: var(--paper); }
.poster-name.is-drawing .pn-line { animation: pn-line 0.8s cubic-bezier(0.3, 0, 0.3, 1) both; }
.poster-name.is-drawing .pn-fill { animation: pn-fill 0.55s 0.75s cubic-bezier(0.6, 0, 0.4, 1) both; }
@keyframes pn-line { from { stroke-dashoffset: 6em; } to { stroke-dashoffset: 0; } }
@keyframes pn-fill { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

.pager {
  position: absolute;
  left: calc(23.4 * var(--u));
  bottom: calc(25 * var(--u));
  width: calc(112.725 * var(--u));
  height: calc(32 * var(--u));
}
.pager .num {
  position: absolute;
  left: calc(28.883 * var(--u));
  top: 0;
  width: calc(53.714 * var(--u));
  height: calc(32 * var(--u));
  display: grid;
  place-items: center;
  border: 1px solid var(--rule-mark);
  border-radius: 50%;  /* the pill: an ellipse */
  font: 700 max(10px, calc(18.286 * var(--u)))/1 "TCA Minhon", sans-serif;
  font-variant-numeric: tabular-nums;
}
.pager .key {
  position: absolute;
  top: calc(0.8 * var(--u));
  width: calc(30.476 * var(--u));
  height: calc(30.476 * var(--u));
  display: grid;
  place-items: center;
  border: 1px solid var(--rule-mark);
  border-radius: calc(4.571 * var(--u));
  font: 500 max(10px, calc(18.286 * var(--u)))/1 "Phudu", sans-serif;
  text-transform: uppercase;
  transition: background 0.2s, color 0.2s;
}
/* trim to the cap height so the glyphs centre optically in their boxes */
.pager .num span, .pager .key span { display: block; text-box: trim-both cap alphabetic; }
.pager .prev { left: 0; }
.pager .next { left: calc(82.25 * var(--u)); }
.pager .key:hover { background: var(--paper); color: var(--bg); }

.blurb {
  position: absolute;
  left: calc(24 * var(--u));
  top: calc(24.5 * var(--u));
  font: 600 max(12px, calc(16 * var(--u)))/0.9 "TCA Minhon", sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-box: trim-both cap alphabetic;
  white-space: nowrap;
}
.scroll {
  position: absolute;
  left: calc(24 * var(--u));
  bottom: calc(25 * var(--u));
  display: flex;
  align-items: center;
  gap: calc(10 * var(--u));
  font: 600 max(12px, calc(16 * var(--u)))/1.2 "TCA Minhon", sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-box: trim-both cap alphabetic;
  white-space: nowrap;
}
.scroll img { width: calc(16 * var(--u)); height: calc(6 * var(--u)); display: block; transition: translate 0.3s; }
.scroll:hover img { translate: 0 calc(3 * var(--u)); }
.explore {
  position: absolute;
  right: calc(12 * var(--u));
  top: 50%;
  width: calc(130 * var(--u));
  height: calc(130 * var(--u));
  translate: 0 -50%;
  display: grid;
  place-items: center;
  color: #030303;
  font: 700 max(11px, calc(16 * var(--u)))/0.8 "Phudu", sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: scale 0.3s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.explore img { position: absolute; inset: 0; width: 100%; height: 100%; }
.explore span { position: relative; text-box: trim-both cap alphabetic; }
.explore:hover { scale: 1.06; }

/* ---------- the bridge (under the memory block) ---------- */

/* Figma "Frame 811" (1920 × 260): a moss block with a pager, a label and a few blocks, olive
   beside it with four cream bars, and two cream discs in mustard rings on orange. By the
   width, design px × --g. It rises with the scroll out from behind the mockup (.lift, under
   the banners) */
.bridge {
  --g: calc(100cqw / 1920);
  grid-area: foot;
  position: relative;
  height: calc(260 * var(--g));
  color: var(--paper);
}
.bridge > *, .bridge-moss > *, .bridge-side > * { position: absolute; margin: 0; }
.bridge-moss { --lift: 100; left: 0; top: 0; width: calc(1314 * var(--g)); height: 100%; overflow: hidden; background: var(--moss); }
.bridge-side { --lift: 100; left: calc(1314 * var(--g)); top: 0; width: calc(606 * var(--g)); height: 100%; overflow: hidden; background: var(--olive); }
.bridge .bridge-pager { --u: var(--g); left: calc(32 * var(--g)); top: calc(38 * var(--g)); bottom: auto; }
.deco-pager .num, .deco-pager .key { border: calc(1.524 * var(--u)) solid var(--paper); color: var(--paper); }
.deco-pager .key:hover { background: none; color: var(--paper); }
.bridge-label {
  left: calc(32 * var(--g));
  top: calc(157 * var(--g));
  font: 800 calc(24 * var(--g))/1.1 "BT Danta", sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-box: trim-both cap alphabetic;
  white-space: nowrap;
}
.bridge-pix { --dp: var(--g); left: calc(1186 * var(--g)); top: calc(180 * var(--g)); }
.bridge-bars { left: calc(11.76 * var(--g)); top: 0; bottom: 0; display: flex; gap: calc(11.5 * var(--g)); }
.bridge-bars i { width: calc(10 * var(--g)); background: var(--cream); }
.bridge-disc { left: calc(var(--x) * var(--g)); top: 0; width: calc(260 * var(--g)); height: calc(260 * var(--g)); overflow: hidden; background: var(--orange); }
.bridge-disc i { position: absolute; inset: 0; border-radius: 50%; background: var(--mustard); }
.bridge-disc i::after { content: ''; position: absolute; inset: calc(16.5 * var(--g)); border-radius: 50%; background: var(--cream); }

/* ---------- memory pile (under the still) ---------- */

/* Figma "Section_02" (86:21507): the right column under the still picture (whose own
   1186 design px open the frame). Laid out in design px × --m, a 1302nd of the column's
   width, so it keeps the frame's proportions at any width (aspect ratio 1302 × 2783). */
.memory {
  --m: calc(100cqw / 1302);  /* resolved where it's used: against this block, the children's container */
  grid-area: memory;
  position: relative;
  container-type: inline-size;
  aspect-ratio: 1302 / 2783;
  overflow: hidden;
  background: var(--bg);
  color: var(--paper);
}
.memory > * { position: absolute; margin: 0; }
.memory p { margin: 0; }

/* the band: checkered columns either side of a line of history, all dithered (7 levels) */
.mem-band { left: 0; top: 0; width: 100%; height: calc(168 * var(--m)); color: var(--bg); }
/* each piece dithered on its own (the background, the columns, the text), so when the text
   comes in only the text has its dither worked out again, not the whole band */
.mem-band::before { content: ''; position: absolute; inset: 0; background: #ebebeb; filter: url(#dither-7); }
.mem-checks, .mem-band-copy { filter: url(#dither-7); }
.mem-checks { position: absolute; top: 0; bottom: 0; display: flex; gap: calc(24 * var(--m)); }
.mem-checks.left { left: calc(24 * var(--m)); }
.mem-checks.right { left: calc(1014 * var(--m)); }
.mem-checks i, .mem-foot i {  /* 12 px squares, the dark one first */
  --dark: #157db2;
  --light: #c9d2d8;
  display: block;
  width: calc(72 * var(--m));
  background: repeating-conic-gradient(var(--light) 0 25%, var(--dark) 0 50%) 0 0 / calc(24 * var(--m)) calc(24 * var(--m));
}
.mem-checks i.red, .mem-foot i.red { --dark: #d40028; --light: #f5c3c7; }
.mem-band-copy { position: absolute; left: calc(320 * var(--m)); top: calc(32 * var(--m)); width: calc(510 * var(--m)); display: grid; gap: calc(40 * var(--m)); }
.mem-band-copy, .mem-when, .mem-labels { font: 800 calc(24 * var(--m))/1.1 "BT Danta", sans-serif; letter-spacing: 0.02em; text-transform: uppercase; }
.mem-band-copy p, .mem-when p, .mem-labels p, .mem-born p, .mem-notes p { text-box: trim-both cap alphabetic; }

/* the headline (dithered, 6 levels), the flag set in its fifth line, a year pager by it */
.mem-title {
  left: calc(32 * var(--m));
  top: calc(208 * var(--m));
  width: calc(908 * var(--m));
  color: var(--orange);
  font: 800 calc(120 * var(--m))/0.85 "BT Danta", sans-serif;
  letter-spacing: calc(-0.8 * var(--m));
  text-transform: uppercase;
  text-box: trim-both cap alphabetic;
  filter: url(#dither-6);
}
.mem-title .y { color: var(--mustard); }
/* drawn in (title-draw.js): the HTML lines go see-through; over them the colour (an SVG,
   dithered at 6 levels as in Figma, kept still so the dither is worked out once), a cover
   per line in the background colour that shrinks away to the right to show it, and the
   outlines on top (a thin line like the rules below), drawn first and faded at the end */
.mem-title.td-ready { filter: none; color: transparent; }
.mem-title.td-ready .y { color: transparent; }
.td-mark { display: inline-block; width: 0; height: 0; vertical-align: baseline; }
.td-draw { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; will-change: transform; }
.td-draw text { font: inherit; letter-spacing: inherit; }
.td-fills { filter: url(#dither-6); }
.td-fill { fill: var(--orange); }
.td-fill.y { fill: var(--mustard); }
.td-ready .mem-flag { filter: url(#dither-6); }
.td-covers { position: absolute; inset: -6px -16px; overflow: hidden; pointer-events: none; }
.td-cover { position: absolute; left: 0; width: 100%; background: var(--bg); transform-origin: 100% 50%; will-change: transform; }
/* transitions, so it all runs backwards when the headline is scrolled back down out of
   view: the colour pulls back to the left, the outline shows again and is unwritten.
   The outlines are written one line at a time, never together: dashing six lines of
   type this big on every frame is more than a frame can take (77 fps with them all
   going at once, 120 one after another). Each line's colour sweeps in as soon as its
   outline is done, while the next one is being written. */
.td-line {
  fill: none;
  stroke: var(--rule-mark);
  stroke-width: 1px;
  stroke-dasharray: 6em;
  stroke-dashoffset: 6em;
  transition: stroke-dashoffset 0.2s linear calc(0.5s + (5 - var(--i)) * 0.2s);
}
.td-cover { transition: transform 0.45s cubic-bezier(0.6, 0, 0.4, 1) calc((5 - var(--i)) * 0.06s); }
.td-lines { transition: opacity 0.3s; }
.td-drawing .td-line { stroke-dashoffset: 0; transition: stroke-dashoffset 0.34s cubic-bezier(0.4, 0, 0.6, 1) calc(var(--i) * 0.34s); }
.td-drawing .td-cover { transform: scaleX(0); transition: transform 0.6s cubic-bezier(0.6, 0, 0.4, 1) calc((var(--i) + 1) * 0.34s); }
.td-drawing .td-lines { opacity: 0; transition: opacity 0.5s 2.7s; }
.td-flagline {  /* the flag's oblong and star, written after THE (line 5), before its colour */
  fill: none;
  stroke: var(--rule-mark);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.2s linear 0.7s;
}
.td-drawing .td-flagline { stroke-dashoffset: 0; transition: stroke-dashoffset 0.45s cubic-bezier(0.4, 0, 0.6, 1) 1.45s; }
.td-shown .td-covers, .td-shown .td-lines { display: none; }

/* the rest of the block's type (title-draw.js revealText): it starts at 30% and the full
   colour sweeps in from the left on a slant — a mask, two and a half times as wide as the
   text (and taller than it, to cover what its trimmed box leaves out), slid across */
.tx-fill {
  -webkit-mask: linear-gradient(112deg, #000 44%, rgb(0 0 0 / 0.3) 56%) 100% 50% / 250% 300% no-repeat;
  mask: linear-gradient(112deg, #000 44%, rgb(0 0 0 / 0.3) 56%) 100% 50% / 250% 300% no-repeat;
  transition: -webkit-mask-position 1.6s cubic-bezier(0.45, 0, 0.2, 1) var(--d, 0s), mask-position 1.6s cubic-bezier(0.45, 0, 0.2, 1) var(--d, 0s);
}
.tx-fill.is-in { -webkit-mask-position: 0 50%; mask-position: 0 50%; }
.mem-flag { display: inline-block; height: 0.8013em; width: auto; vertical-align: baseline; margin: -0.1em 0 0 0.01em; }  /* cap high, on the baseline, just after THE */
.memory .mem-pager { --u: var(--m); left: calc(1156 * var(--m)); top: calc(208 * var(--m)); bottom: auto; }
.mem-pager .num, .mem-pager .key { border: calc(1.524 * var(--m)) solid var(--paper); color: var(--paper); }
.mem-pager .key:hover { background: none; color: var(--paper); }

/* rules: across at 854 and 1390, and down the middle between them. They draw themselves
   in as the block between them scrolls up, done when it's centred in the window (main.js
   moves --p from 0 to 1): each rule across in two halves, split at the one down, both
   running left to right, the one down from the top. */
.mem-rule { --p: 1; left: 0; width: 100%; top: calc(var(--y) * var(--m)); height: 1px; }
.mem-rule::before, .mem-rule::after {
  content: '';
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  background: rgb(255 255 255 / 0.12);
  transform: scaleX(var(--p));
  transform-origin: 0 0;
}
.mem-rule::before { left: 0; }
.mem-rule::after { left: 50%; }
.mem-divider { --p: 1; left: calc(651 * var(--m)); top: calc(854 * var(--m)); width: 1px; height: calc(536 * var(--m)); background: rgb(255 255 255 / 0.12); transform: scaleY(var(--p)); transform-origin: 0 0; }

/* 1995 – present */
.mem-when { left: calc(32 * var(--m)); top: calc(886 * var(--m)); display: grid; gap: calc(3 * var(--m)); }
.mem-when p + p { width: calc(370 * var(--m)); line-height: 0.9; }
.mem-born, .mem-notes {
  color: #c6c2a6;
  font: 600 calc(20 * var(--m))/0.9 "TCA Minhon", sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.mem-born { left: calc(138 * var(--m)); top: calc(1165 * var(--m)); width: calc(144 * var(--m)); white-space: nowrap; }
.mem-dash { display: block; width: calc(19 * var(--m)); height: calc(3 * var(--m)); margin-bottom: calc(32 * var(--m)); background: currentColor; }
.mem-born p + p { margin-top: calc(8 * var(--m)); text-align: right; }
.mem-glyph { margin-right: 0.2em; font-family: "BT Danta", sans-serif; font-weight: 800; }
.mem-photo { left: calc(338 * var(--m)); top: calc(1109 * var(--m)); width: calc(265 * var(--m)); height: calc(233 * var(--m)); }
.mem-portrait { position: absolute; left: 0; top: 0; width: calc(177 * var(--m)); height: 100%; object-fit: cover; display: block; will-change: transform; }  /* slides on a layer of its own (main.js), so the dithered card over it isn't redrawn */
.mem-card { position: absolute; left: calc(88 * var(--m)); top: 0; width: calc(177 * var(--m)); height: calc(232.93 * var(--m)); filter: url(#dither-8); }  /* a white card punched with six holes */
.mem-notes { left: calc(881 * var(--m)); top: calc(1165 * var(--m)); width: calc(389 * var(--m)); }
.mem-notes p { color: rgb(198 194 166 / 0.8); }
.mem-note { position: relative; }  /* a paragraph with its icon beside it (the icon outside the
                                      paragraph, so the paragraph's fill-in mask doesn't hide it) */
.mem-note + .mem-note { margin-top: calc(20.3 * var(--m)); }  /* a blank line between, as in Figma */
.mem-icon {
  position: absolute;
  left: calc(-43 * var(--m));
  top: 0;
  width: calc(30.476 * var(--m));
  height: calc(30.476 * var(--m));
  display: grid;
  place-items: center;
  border: calc(1.524 * var(--m)) solid rgb(161 160 137 / 0.3);
  border-radius: calc(4.571 * var(--m));
  color: #a1a089;
  font: 800 calc(18.286 * var(--m))/1 "BT Danta", sans-serif;
}
.mem-icon.small { font-size: calc(16 * var(--m)); }
.mem-icon span { display: block; text-box: trim-both cap alphabetic; }

/* old Hanoi, a strip running off both sides (the last picture dithered, 7 levels). It
   runs left in a loop: the six photos are there twice, and one set (5 × 301 + 300 wide,
   6 gaps of 12: 1877 design px) slides by before it starts again, unnoticed. */
.mem-strip {
  left: calc(-281 * var(--m));
  top: calc(1406 * var(--m));
  display: flex;
  gap: calc(12 * var(--m));
  animation: mem-strip 60s linear infinite;
}
@keyframes mem-strip { to { transform: translateX(calc(-1877 * var(--m))); } }
.mem-strip img { flex: none; width: calc(301 * var(--m)); height: calc(219 * var(--m)); object-fit: cover; display: block; }
.mem-strip img:nth-child(6n + 3) { width: calc(300 * var(--m)); }
.mem-strip img.dither { filter: url(#dither-7); }
.mem-ruler { left: 0; top: calc(1641 * var(--m)); width: 100%; height: calc(12 * var(--m)); overflow: visible; }
.mem-labels { left: 0; top: calc(1669 * var(--m)); width: 100%; }
.mem-labels p { position: absolute; top: 0; }
.mem-labels p:nth-child(1) { left: calc(32 * var(--m)); }
.mem-labels p:nth-child(2) { left: calc(657 * var(--m)); }
.mem-labels p:nth-child(3) { right: calc(32 * var(--m)); }

/* the pile (pile.js), between the labels and two checkered rows at the foot. The rows line
   up with the last block of the poster in the left column (its bottom 154.455 design px,
   by the window's height, --u), which comes to rest beside them as the column lets go:
   the blue row starts level with that block's top, the red one ends at its foot, with a
   thin gap between them (Figma had 16 above, between and below). */
.memory { --foot: calc(154.455 * var(--u)); }
.pile { left: 0; right: 0; top: calc(1642 * var(--m)); bottom: var(--foot); }  /* from the ruler's line down: things come into view there, over the labels */
.pile canvas { display: block; width: 100%; height: 100%; }
.mem-foot {
  --gap: calc(8 * var(--u));
  left: 0;
  bottom: 0;
  width: 100%;
  height: var(--foot);
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: var(--gap);
  background: #ebebeb;
  filter: url(#dither-7);
}
.mem-foot i { width: 100%; background-size: calc((var(--foot) - var(--gap)) / 3) calc((var(--foot) - var(--gap)) / 3); }  /* six squares a row */

/* ---------- the tail (Figma "Frame 877", from the mockup on) ---------- */

/* One run of blocks by the width, design px × --g: a billboard mockup, a banner, checks,
   a story beside the posters, checks, a banner, three rings, checks. */
.tail { --g: calc(100cqw / 1920); grid-area: tail; background: var(--bg); }
.tail > * { display: block; }

/* the mockup (Figma "Update section", 153:25615): a header on the sky, then the series'
   posters as billboards on a city street, the motto at its foot in white */
/* Like the tram photo above it, the mockup stays put once it is all in view (its foot on the
   window's, or its head on the window's top when it is the shorter) while the 90s. Viet
   banner and the photo under it come up over it: its stage runs on under them by as much
   as there is of it to cover and gives that back below */
.mockup-stage {
  --h: calc(3312 * var(--g));
  --cover: min(var(--h), 100vh);
  --cover: min(var(--h), 100svh);
  height: calc(var(--h) + var(--cover));
  margin-bottom: calc(-1 * var(--cover));
}
.mockup {
  position: sticky;
  top: min(0px, calc(100vh - var(--h)));
  top: min(0px, calc(100svh - var(--h)));
  height: var(--h);
  overflow: hidden;
  background: #c3d5f3;
}
.mockup > * { position: absolute; margin: 0; }
.mockup-photo, .mockup-shade { left: 0; top: calc(440 * var(--g)); width: 100%; height: calc(2872 * var(--g)); }
.mockup-photo { object-fit: cover; }
/* the picture darkens by 40% as its foot comes down to the window's, where it stops (main.js) */
.mockup-shade { background: rgb(0 0 0 / 0.4); opacity: 0; will-change: opacity; }
/* the sky over its top: a fade into the picture's own */
.mockup-sky { left: 0; top: 0; width: 100%; height: calc(771 * var(--g)); background: linear-gradient(#dde7f8 50.065%, #c3d5f3); }
/* rules: across at 388 and 804, down the middle between them */
.mockup-rules {
  left: 0;
  top: calc(388 * var(--g) - 1px);
  width: 100%;
  height: calc(416 * var(--g) + 1px);
  box-sizing: border-box;
  border-block: 1px solid rgb(30 33 55 / 0.12);
}
.mockup-rules::after { content: ""; position: absolute; left: calc(960 * var(--g) - 1px); top: 0; bottom: 0; width: 1px; background: rgb(30 33 55 / 0.12); }
/* the big type, dithered (6 levels) as in Figma, a line to a box trimmed to its capitals
   (0.8 high, 0.9 apart), each drawn in on its own (title-draw.js drawLine) */
.mockup-title, .mockup-year, .mockup-mark, .mockup-motto, .mockup-place {
  --ink: #1a1e47;
  color: var(--ink);
  font: 800 calc(120 * var(--g))/0.9 "BT Danta", sans-serif;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}
.mk-ln { position: relative; display: block; text-box: trim-both cap alphabetic; filter: url(#dither-6); }
.mk-ln + .mk-ln { margin-top: 0.1em; }
.mockup-title { left: calc(32 * var(--g)); top: calc(32 * var(--g)); }
.mockup-year, .mockup-mark { letter-spacing: -0.06em; }
.mockup-year { left: calc(1527 * var(--g)); top: calc(32 * var(--g)); }
.mockup-mark { left: calc(1368 * var(--g)); top: calc(240 * var(--g)); }
/* drawn in (title-draw.js drawLine): the HTML text goes see-through; the colour is the text
   again, dithered, in a layer behind an edge that slides in from the left (the edge's box
   one way, the layer the other, so the colour stays put); over it the outline, a thin line
   in the ink, written first and faded at the end. Transitions, so it runs backwards too */
.tl-ready { color: transparent; filter: none; }
.tl-clip {
  position: absolute;
  inset: -0.3em -0.2em;
  overflow: hidden;
  pointer-events: none;
  transform: translateX(-101%);
  will-change: transform;
}
.tl-hold { position: absolute; inset: 0; transform: translateX(101%); will-change: transform; }
.tl-ink {
  position: absolute;
  left: 0.2em;
  top: 0.3em;
  display: block;
  color: var(--ink);
  text-box: trim-both cap alphabetic;
  white-space: nowrap;
  filter: url(#dither-6);
}
.tl-clip, .tl-hold { transition: transform 0.45s cubic-bezier(0.6, 0, 0.4, 1); }
.tl-drawing .tl-clip, .tl-drawing .tl-hold { transform: none; transition: transform 0.7s cubic-bezier(0.6, 0, 0.4, 1) calc(var(--td, 0s) + 0.55s); }
.tl-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; transition: opacity 0.3s; }
.tl-line {
  font: inherit;
  letter-spacing: inherit;
  fill: none;
  stroke: var(--ink);
  stroke-opacity: 0.55;
  stroke-width: 1px;
  stroke-dasharray: 6em;
  stroke-dashoffset: 6em;
  transition: stroke-dashoffset 0.2s linear 0.4s;
}
.tl-drawing .tl-line { stroke-dashoffset: 0; transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.6, 1) var(--td, 0s); }
.tl-drawing .tl-lines { opacity: 0; transition: opacity 0.5s calc(var(--td, 0s) + 1.5s); }
.tl-shown .tl-clip, .tl-shown .tl-hold { transform: none; }
.tl-shown .tl-lines { display: none; }
.mockup-dots { left: calc(32 * var(--g)); top: calc(252 * var(--g)); display: flex; }
.mockup-dots i { width: calc(96 * var(--g)); height: calc(96 * var(--g)); border-radius: 50%; background: var(--blue); }
.mockup-dots i:nth-child(2) { background: var(--red); }
.mockup-dots i:nth-child(3) { background: var(--mustard); }
/* two little steps (Figma "Frame 895"), flipped upside down, or turned round */
.mk-steps {
  display: block;
  width: calc(27 * var(--g));
  height: calc(12 * var(--g));
  background: currentColor;
  -webkit-mask: url("assets/steps.svg") 0 0 / 100% 100% no-repeat;
  mask: url("assets/steps.svg") 0 0 / 100% 100% no-repeat;
  transform: scaleY(-1);
}
.mk-steps.r { transform: rotate(180deg); }
/* under the header's first rule: the steps over a few words with the font's own bird and
   flag in them, set out as in Figma; a portrait; a line, a note and a signature */
.mockup-joy { left: calc(32 * var(--g)); top: calc(420 * var(--g)); width: calc(234 * var(--g)); color: rgb(19 20 69 / 0.2); }
.mockup-joy p {
  margin-top: calc(16 * var(--g));
  color: rgb(3 3 54 / 0.92);
  font: 800 calc(20 * var(--g))/1.02 "BT Danta", sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: pre;
  text-box: trim-both cap alphabetic;
}
.mockup-portrait { left: calc(688 * var(--g)); top: calc(404 * var(--g)); width: calc(256 * var(--g)); height: calc(384 * var(--g)); object-fit: cover; }
.mockup-kicker, .mockup-copy, .mockup-sign, .mockup-story, .story-copy {
  font: 600 calc(20 * var(--g))/0.9 "TCA Minhon", sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.mockup-kicker, .mockup-copy, .mockup-sign { color: rgb(33 33 49 / 0.69); }
.mockup-kicker, .mockup-sign { left: calc(992 * var(--g)); text-box: trim-both cap alphabetic; white-space: nowrap; }
.mockup-kicker { top: calc(420 * var(--g)); }
.mockup-sign { top: calc(757 * var(--g)); }
.mockup-copy { left: calc(1368 * var(--g)); top: calc(420 * var(--g)); width: calc(206 * var(--g)); }
.mockup-copy p:last-child { white-space: pre-wrap; }  /* the name set off from the end */
.mockup-copy p, .story-copy p { margin: 0; text-box: trim-both cap alphabetic; }
.mockup-copy p + p, .story-copy p + p { margin-top: calc(20.3 * var(--g)); }  /* a blank line between */
/* the foot, in white over the picture: two steps, a rule, the motto; a white box with a
   link in it, and the place. Placed for where the mockup stops (its foot on the window's):
   32 from the window's top then, or on the mockup's foot when the window is too short */
.mockup-foot {
  left: 0;
  top: calc(var(--h) - max(100vh - 32 * var(--g), 620 * var(--g)));
  top: calc(var(--h) - max(100svh - 32 * var(--g), 620 * var(--g)));
  width: 100%;
  height: calc(620 * var(--g));
  color: rgb(255 255 255 / 0.5);
}
.mockup-foot > * { position: absolute; margin: 0; }
.mockup-foot::before { content: ""; position: absolute; left: 0; top: calc(36 * var(--g) - 1px); width: 100%; height: 1px; background: rgb(255 255 255 / 0.12); }
.mockup-foot .mk-steps { left: calc(32 * var(--g)); top: 0; }
.mockup-foot .mk-steps.r { left: calc(293 * var(--g)); }
.mockup-motto, .mockup-place { --ink: #fff; }
.mockup-motto { left: calc(32 * var(--g)); top: calc(68 * var(--g)); }
.mockup-place { right: calc(32 * var(--g)); top: calc(380 * var(--g)); letter-spacing: -0.04em; }
.mockup-place .mk-ln { width: fit-content; margin-left: auto; }  /* to the right */
.mockup-place .mk-ln + .mk-ln { margin-top: calc(16 * var(--g)); }
.mockup-story {
  left: calc(32 * var(--g));
  bottom: calc(32 * var(--g));
  padding: calc(33 * var(--g)) calc(64 * var(--g)) calc(32 * var(--g));
  background: #fff;
  color: #212131;
  text-decoration: none;
  white-space: nowrap;
  text-box: trim-both cap alphabetic;
  transition: background-color 0.2s;
}
.mockup-story:hover { background: #dde7f8; }

/* the photos across the page (Figma 1920 × 1200): one between the memory block and the
   bridge, one under the first banner */
.wide-photo { display: block; width: 100%; height: auto; aspect-ratio: 1920 / 1200; object-fit: cover; }
.wide-frame { position: relative; }  /* holds the photo and the canvas of its pixel reveal (main.js) */
/* The first one stays put once it is all in view (its foot on the window's, or its head on
   the window's top when it is the shorter) while the bridge and the mockup rise over it: its
   stage runs on under them by as much as there is of it to cover (the photo, or the window
   when the photo is taller) and gives that back below, so the rows keep their place */
.photo-stage {
  --h: calc(100cqw * 1200 / 1920);
  --cover: min(var(--h), 100vh);
  --cover: min(var(--h), 100svh);
  grid-area: photo;
  height: calc(var(--h) + var(--cover));
  margin-bottom: calc(-1 * var(--cover));
}
.wide-photo-top { position: sticky; top: min(0px, calc(100vh - var(--h))); top: min(0px, calc(100svh - var(--h))); overflow: clip; }  /* its line, pushed up, goes no further than its top */
/* the first one darkens (to 55% black) while the bridge pushes its line up (main.js) */
.wide-shade { position: absolute; inset: 0; background: rgb(0 0 0 / 0.55); opacity: 0; pointer-events: none; }
/* a line over the road in the first one (Figma "Frame 907"), centred, a blank line before
   the name */
.wide-note {
  --g: calc(100cqw / 1920);  /* design px, as in the tail */
  position: absolute;
  left: calc(50% + 0.5px);
  top: calc(959 * var(--g));
  width: calc(321 * var(--g));
  transform: translateX(-50%);
  color: #fef5d2;
  font: 800 calc(24 * var(--g))/0.9 "BT Danta", sans-serif;
  letter-spacing: 0.02em;
  text-align: center;
  text-transform: uppercase;
}
.wide-note p { margin: 0; text-box: trim-both cap alphabetic; }
.wide-note p + p { margin-top: 1em; }  /* lines 0.9 apart, the caps 0.8 high: a blank line between */
.tail { position: relative; }  /* over the photo's stage, like the bridge */

/* the banners: the series' blocks, exported from Figma with their dither */
.banner { width: 100%; height: auto; }

/* Bands that rise (Figma Frame 891, after monument.tv's contact bands): with the scroll they
   come up from behind what follows them, the first from furthest down, each over the
   last one's foot on the way, and settle in place. --lift is how far down a band starts
   (design px), --p how far it has come (main.js, 0 to 1; 1 when motion is reduced). The
   bridge's two blocks come up from behind the mockup, the 90s. Viet banner's rows from
   behind the photo under it (200 and 100 down) */
.bridge-moss, .bridge-side, .vb-row {
  transform: translateY(calc(var(--lift, 0) * (1 - var(--p, 1)) * var(--g)));
  will-change: transform;
}
.vb-row { --lift: 200; }
.vb-row-2 { --lift: 100; }
.wide-photo-under { position: relative; }  /* over the rows as they come up */
.vb-row { position: relative; height: calc(312 * var(--g)); overflow: hidden; }  /* over the mockup, the second over the first */
.vb-row img { display: block; width: 100%; height: auto; }
.vb-row-2 img { margin-top: calc(-312 * var(--g)); }

/* six photos in turn under the banner (Figma "Image update", 156:27833): the photo across
   the page, a canvas over it where the next comes in cell by cell (slides.js), and over its
   foot (302 high, fading a little darker) the number, a rule, a line about the photo, and
   the small photos that pick one */
.slides-swap { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.slides-photo { cursor: pointer; }
/* the photos dithered (Bayer 16×16, 6 levels): the photo and the canvas the next one comes
   in on, each on its own (their grain lines up, both from the frame's top left), so the
   still photo has its dither worked out once; the small ones too */
.slides-photo, .slides-swap, .slides-thumbs img { filter: url(#dither-6); }
.slides-foot {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: calc(302 * var(--g));
  background: linear-gradient(rgb(22 24 36 / 0), rgb(34 37 46 / 0.2));
  color: #fff;
  pointer-events: none;
}
.slides-foot > * { position: absolute; margin: 0; }
.slides-foot::before { content: ""; position: absolute; left: calc(32 * var(--g)); right: calc(32 * var(--g)); top: calc(173 * var(--g) - 1px); height: 1px; background: rgb(255 255 255 / 0.12); }
.slides-num {  /* dithered, 6 levels, as in Figma */
  left: calc(32 * var(--g));
  top: calc(53 * var(--g));
  font: 800 calc(120 * var(--g))/0.9 "BT Danta", sans-serif;
  letter-spacing: -0.02em;
  text-box: trim-both cap alphabetic;
  filter: url(#dither-6);
}
.slides-cap { left: calc(32 * var(--g)); top: calc(201 * var(--g)); }
.slides-cap p {
  margin-top: calc(24 * var(--g));
  font: 600 calc(20 * var(--g))/0.9 "TCA Minhon", sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  text-box: trim-both cap alphabetic;
}
.slides-num, .slides-cap p { transition: opacity 0.3s; }
.slides.is-changing .slides-num, .slides.is-changing .slides-cap p { opacity: 0; transition-duration: 0.2s; }
.slides-thumbs { left: calc(617 * var(--g)); top: calc(189 * var(--g)); display: flex; gap: calc(16 * var(--g)); padding: 0; list-style: none; pointer-events: auto; }
.slides-thumbs button {
  display: grid;
  gap: calc(8 * var(--g));
  padding: 0;
  border: 0;
  background: none;
  color: #f5f5f5;
  font: 600 calc(14 * var(--g))/0.9 "TCA Minhon", sans-serif;
  letter-spacing: 0.02em;
  text-align: left;
  cursor: pointer;
}
.slides-thumbs span { display: block; text-box: trim-both cap alphabetic; }
.slides-thumbs img { display: block; width: calc(101 * var(--g)); height: calc(63 * var(--g)); object-fit: cover; transition: opacity 0.2s; }
.slides-thumbs button:hover img { opacity: 0.8; }
.slides-thumbs button:focus-visible { outline: 1px solid #fff; outline-offset: calc(4 * var(--g)); }

/* checks: a blue row and a red one, 12 px squares, on light grey, dithered (7 levels).
   The rows run in a loop, the blue one left and the red one right: each is a strip one
   square pair longer at both ends, dithered once on a layer of its own that slides by a
   pair (24 px) and starts over, so nothing is dithered again while it runs */
.checks {
  position: relative;
  height: calc(192 * var(--g));
  padding: calc(16 * var(--g)) 0;
  display: grid;
  grid-template-rows: calc(72 * var(--g)) calc(72 * var(--g));
  gap: calc(16 * var(--g));
}
.checks::before { content: ""; position: absolute; inset: 0; background: #ebebeb; filter: url(#dither-7); }
.checks i {
  --dark: #157db2;
  --light: #c9d2d8;
  position: relative;
  display: block;
  overflow: hidden;
}
.checks i.red { --dark: #d40028; --light: #f5c3c7; }
.checks b {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(-24 * var(--g));
  right: calc(-24 * var(--g));
  will-change: transform;
  animation: checks-run 0.8s linear infinite;
}
.checks i.red b { animation-direction: reverse; }
.checks b::before {  /* the squares sit where they did before the strip grew: 22 px in */
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-conic-gradient(var(--light) 0 25%, var(--dark) 0 50%) calc(2 * var(--g)) 0 / calc(24 * var(--g)) calc(24 * var(--g));
  filter: url(#dither-7);
}
@keyframes checks-run { to { transform: translateX(calc(-24 * var(--g))); } }

/* the story: a card on the left that stays put while the right side goes by (a billboard,
   the paper's masthead, two posters, a line of type, a strip of photos), then the posters
   on a grid */
.stories { position: relative; height: calc(3961 * var(--g)); }
.stories > * { position: absolute; margin: 0; display: block; }
.story-rail { left: 0; top: 0; width: calc(640 * var(--g)); height: 100%; }  /* the card stays on down the empty left column, to rest with its foot on the posters' */
.story-card {
  --ph: min(calc(640 * var(--g)), calc(100svh - 440 * var(--g)));  /* the photo: square, less of it in a short window */
  position: sticky;
  top: 0;
  height: 100svh;  /* the whole window, always: the title under the photo, the copy and the pager on the foot */
  background: #d40028;
  color: var(--paper);
}
.story-card > * { position: absolute; margin: 0; }
.story-photo {
  left: 0;
  top: 0;
  width: calc(640 * var(--g));
  height: var(--ph);
  box-sizing: border-box;
  border: calc(6 * var(--g)) solid var(--mustard);
  object-fit: cover;
  display: block;
}
.story-title {
  left: calc(24 * var(--g));
  top: calc(var(--ph) + 32 * var(--g));
  font: 800 calc(48 * var(--g))/0.88 "BT Danta", sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-box: trim-both cap alphabetic;
  white-space: nowrap;
}
.story-copy { left: calc(24 * var(--g)); top: calc(100% - 201 * var(--g)); width: calc(389 * var(--g)); opacity: 0.8; }
.stories .story-pager { --u: var(--g); left: calc(503 * var(--g)); top: calc(100% - 56 * var(--g)); bottom: auto; }
.story-billboard { left: calc(640 * var(--g)); top: 0; width: calc(1280 * var(--g)); height: calc(842 * var(--g)); object-fit: cover; }
.wall-cell {
  left: calc(var(--x) * var(--g));
  top: calc(var(--y) * var(--g));
  width: calc(640 * var(--g));
  height: calc(842 * var(--g));
}
.wall-mast {  /* a newspaper masthead: green and mustard rules over a red square and the paper's name */
  left: calc(var(--x) * var(--g));
  top: calc(var(--y) * var(--g));
  width: calc(640 * var(--g));
  height: calc(226 * var(--g));
  background:
    linear-gradient(#009500 0 calc(32 * var(--g)), #ffb22b 0 calc(40 * var(--g)), transparent 0),
    linear-gradient(90deg, #eb1b27 0 calc(186 * var(--g)), #fff 0);
}
.wall-mast img { position: absolute; right: 0; bottom: 0; width: calc(454 * var(--g)); height: calc(186 * var(--g)); }
.story-big {  /* dithered, 6 levels */
  left: calc(1304 * var(--g));
  top: calc(1747 * var(--g));
  color: #fff4db;
  font: 800 calc(96 * var(--g))/0.9 "BT Danta", sans-serif;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  text-box: trim-both cap alphabetic;
  white-space: nowrap;
  filter: url(#dither-6);
}
.story-ruler { left: calc(640 * var(--g)); top: calc(1926 * var(--g)); width: calc(1280 * var(--g)); height: calc(12 * var(--g)); overflow: visible; }
/* the photos run left in a loop, like the memory block's: one set (5 × 301 + 300, six gaps
   of 12: 1877 design px) slides by and the second set is where the first began */
.story-strip { left: calc(640 * var(--g)); top: calc(2058 * var(--g)); width: calc(1280 * var(--g)); height: calc(219 * var(--g)); overflow: hidden; }
.story-track { display: flex; gap: calc(12 * var(--g)); animation: story-strip 60s linear infinite; }
@keyframes story-strip { to { transform: translateX(calc(-1877 * var(--g))); } }
.story-track img { flex: none; width: calc(301 * var(--g)); height: calc(219 * var(--g)); object-fit: cover; display: block; }
.story-track img:nth-child(6n + 3) { width: calc(300 * var(--g)); }

/* three cream discs in mustard rings over an orange band (dithered, 5 levels) */
.rings { position: relative; height: calc(672 * var(--g)); }
.rings > * { position: absolute; }
.rings-band { left: 0; right: 0; top: 0; height: calc(346 * var(--g)); background: var(--orange); filter: url(#dither-5); }
.rings i {
  left: calc(var(--x) * var(--g));
  top: 0;
  width: calc(640 * var(--g));
  height: calc(640 * var(--g));
  box-sizing: border-box;
  border: calc(31 * var(--g)) solid var(--mustard);
  border-radius: 50%;
  background: var(--cream);
}

/* ---------- the end (finale.js) ---------- */

/* Without its script (or with motion reduced) the end is just the photo. With it, the
   section is the scroll the run takes and the photo, the disc, the bands and the cells'
   lines are drawn on a layer fixed over the window, shown while it runs */
.finale { grid-area: finale; position: relative; background: var(--bg); }
.finale-photo { display: block; width: 100%; height: auto; }
.finale-disc, .finale-bands, .finale-lines { display: none; }
.finale.is-live { height: calc(var(--finale-len, 3.6) * 100vh); height: calc(var(--finale-len, 3.6) * 100svh); }
.finale.is-live .finale-view { display: none; position: fixed; inset: 0; z-index: 40; overflow: hidden; pointer-events: none; }
.finale.is-live .finale-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.finale.is-live .finale-disc {
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  box-sizing: border-box;
  border: 0 solid var(--mustard);
  border-radius: 50%;
  background: var(--cream);
  transform-origin: 50% 50%;
  will-change: transform;
}
.finale.is-live .finale-bands, .finale.is-live .finale-lines { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }

/* ---------- picture CMS (cms.js; H opens it) ---------- */

/* the posters and sleeve wait for the CMS's pictures, so the page's own don't flash first */
.reveal.cms-wait .reveal-poster, .reveal.cms-wait .reveal-cover { visibility: hidden; }

.cms {
  position: fixed;
  z-index: 100;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(400px, 100vw);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px;
  background: var(--bg);
  border-left: 1px solid var(--rule);
  color: var(--paper);
  font: 600 14px/1.2 "Phudu", sans-serif;
}
.cms[hidden] { display: none; }
.cms.is-busy { cursor: progress; }
.cms.is-busy .cms-slots { opacity: 0.5; pointer-events: none; }
.cms-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.cms-head h2 {
  margin: 0;
  font: 800 28px/0.8 "BT Danta", sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-box: trim-both cap alphabetic;
}
.cms-close, .cms-btn {
  display: inline-grid;
  place-items: center;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--rule-mark);
  border-radius: 4px;
  background: none;
  color: inherit;
  font: inherit;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.cms-close { width: 32px; padding: 0; }
.cms-close:hover, .cms-btn:hover { background: var(--paper); color: var(--bg); }
.cms-btn:disabled { opacity: 0.35; pointer-events: none; }
.cms-name {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--rule-mark);
  border-radius: 4px;
  background: rgb(255 255 255 / 0.04);
  color: inherit;
  font: inherit;
  text-transform: none;
}
.cms input:focus-visible, .cms-btn:focus-within, .cms-close:focus-visible { outline: 1px solid var(--mustard); outline-offset: 2px; }
.cms-slots { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.cms-slot { display: grid; grid-template-columns: 72px 1fr; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.cms-thumb { width: 72px; aspect-ratio: 4 / 3; object-fit: cover; background: rgb(255 255 255 / 0.04); }
.cms-thumb.is-poster { aspect-ratio: 485.552 / 638.501; }
.cms-body { display: grid; gap: 10px; align-content: start; min-width: 0; }
.cms-label { margin: 0; text-transform: uppercase; }
.cms-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cms-status { min-height: 1.2em; margin: 16px 0 0; color: rgb(254 245 210 / 0.7); }
.cms-tabs { display: flex; gap: 4px; }
.cms-tab {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--rule-mark);
  border-radius: 4px;
  background: none;
  color: rgb(254 245 210 / 0.6);
  font: 800 16px/1 "BT Danta", sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
}
.cms-tab[aria-selected="true"] { background: var(--paper); color: var(--bg); border-color: var(--paper); }
.cms-tab:focus-visible { outline: 1px solid var(--mustard); outline-offset: 2px; }
.cms-motion { display: grid; gap: 12px; }
.cms-note { margin: 0; color: rgb(254 245 210 / 0.6); font-weight: 400; line-height: 1.35; }
.cms-preview { justify-self: start; border-color: var(--mustard); color: var(--mustard); }
.cms-motion-parts { display: grid; gap: 12px; }
.cms-motion-part { display: grid; gap: 10px; margin: 0; padding: 12px; border: 1px solid var(--rule); }
.cms-motion-part legend { padding: 0 6px; text-transform: uppercase; color: var(--mustard); }
.cms-range { display: grid; grid-template-columns: 1fr 44px; gap: 4px 10px; align-items: center; }
.cms-range span { grid-column: 1 / -1; color: rgb(254 245 210 / 0.75); }
.cms-range input[type=range] { width: 100%; accent-color: var(--mustard); }
.cms-range output { text-align: right; font-variant-numeric: tabular-nums; }
.cms-range select { grid-column: 1 / -1; padding: 6px 8px; background: transparent; color: var(--paper); border: 1px solid var(--rule); font: inherit; }
.cms-range select option { color: #000; }
.cms-status.is-bad { color: #ff8a6b; }

/* ---------- phones & small tablets ---------- */

/* Header, screen and info still make up the first viewport; the poster follows. */
@media not all and (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .page {
    --u: 0.5px;
    --dp: calc(min(100cqw, 560px) / 617.822);
    grid-template-columns: 64px 1fr;
    grid-template-rows: 64px auto auto auto auto auto auto auto auto auto;
    grid-template-areas:
      "brand  nav"
      "screen screen"
      "info   info"
      "poster poster"
      "still  still"
      "memory memory"
      "photo  photo"
      "foot   foot"
      "tail   tail"
      "finale finale";
  }
  .side, .side-pin { display: contents; }  /* logo and poster go back into the page grid */
  /* the memory block: one column, read top to bottom, its pieces at half their design size
     and its type made readable */
  .memory { --m: 0.5px; aspect-ratio: auto; display: flex; flex-direction: column; padding-bottom: 0; }
  .memory > * { position: relative; left: auto; top: auto; right: auto; bottom: auto; }
  .mem-band { height: auto; padding: 18px 16px 18px 124px; }
  .mem-checks.left { --m: 0.35px; left: 16px; }
  .mem-checks.right { display: none; }
  .mem-band-copy { position: relative; left: auto; top: auto; width: auto; gap: 12px; font-size: 11px; }  /* over the band's background */
  .mem-band-copy br { display: none; }  /* its lines wrap where they fit here */
  .memory .mem-pager { --u: 1px; position: relative; left: auto; top: auto; align-self: flex-end; margin: 24px 16px 0; }
  .mem-title { width: auto; margin: 16px 16px 0; font-size: 10.6vw; letter-spacing: -0.006em; }
  .mem-rule { top: auto; margin-top: 32px; }
  .mem-divider { display: none; }
  .mem-when { margin: 24px 16px 0; font-size: 15px; gap: 4px; }
  .mem-when p + p { width: auto; }
  .mem-born { width: auto; margin: 24px 16px 0; font-size: 13px; align-self: flex-start; }
  .mem-photo { --m: 1px; align-self: center; margin-top: 24px; }
  .mem-notes { --m: 1px; width: auto; margin: 24px 16px 0 59px; font-size: 12px; }
  .mem-strip { left: -140px; align-self: flex-start; margin-top: 32px; }
  .mem-ruler { margin-top: 16px; }
  .mem-labels { display: flex; justify-content: space-between; align-items: flex-start; margin: 14px 16px 0; width: auto; font-size: 12px; }
  .mem-labels p { position: static; }
  .pile { height: calc(90vw + 42px); margin-top: -42px; }  /* from the ruler down, over the labels */
  .mem-foot { --foot: 96px; --gap: 8px; height: auto; padding: 8px 0; grid-template-rows: 36px 36px; }
  .mem-foot i { background-size: 12px 12px; }

  .brand { justify-content: center; padding-left: 0; }
  .logo-type { display: none; }  /* the square corner only has room for the mark */

  .nav { grid-template-columns: 1fr 1fr calc(300cqw / 7 - 64px) 64px; }  /* full-width screen: last three columns */
  .nav-link { height: 33px; padding: 11px 12px; }
  .clock { padding: 11px 12px; background: linear-gradient(var(--olive) 0 33px, var(--cream) 0); }
  .menu { --u: 0.8px; }

  .poster, .poster-spin {
    width: min(100%, 560px);
    justify-self: center;
    aspect-ratio: 617.822 / 950.495;
  }

  .screen { height: max(240px, calc(100svh - 64px - 226px)); }  /* 226 = the info block */

  .info {
    --u: 1px;
    grid-template-columns: 1fr;
    border-top: 0;
  }
  .info-r { order: -1; height: 154px; border-bottom: 1px solid var(--rule); }
  .info-l { height: 72px; border-right: 0; }
  .blurb { left: 16px; top: 24px; font-size: 13px; line-height: 1; white-space: normal; padding-right: 128px; }
  .scroll { left: 16px; bottom: 24px; font-size: 13px; }
  .explore { --u: 0.84px; right: 16px; }
  .pager { left: 16px; bottom: 20px; }
  .poster-name { left: 145px; top: auto; bottom: 29px; font-size: 18px; }  /* beside the pager */


  /* the bridge and the tail keep their layout by the width; their smallest type is held
     readable, and the long copy, too small for the columns here, is left to the desktop */
  .bridge .bridge-pager, .stories .story-pager { display: none; }
  .bridge-label { font-size: max(8px, calc(24 * var(--g))); top: auto; bottom: calc(32 * var(--g)); }  /* its three lines on the panel's foot */
  .mockup-joy, .mockup-kicker, .mockup-copy, .mockup-sign, .story-copy { display: none; }
  .mockup-foot { top: calc(2692 * var(--g)); }  /* the mockup is all in the window here: on its foot */
  .slides-cap, .slides-thumbs { display: none; }  /* too small here: a tap on the photo moves on */
  .wide-note { width: max-content; font-size: max(9px, calc(24 * var(--g))); }  /* held readable, on one line */
  .mockup-story { font-size: max(8px, calc(20 * var(--g))); padding: max(6px, calc(33 * var(--g))) max(10px, calc(64 * var(--g))) max(6px, calc(32 * var(--g))); }
  .story-title { font-size: max(11px, calc(48 * var(--g))); }
  .story-card { --ph: calc(640 * var(--g)); height: calc(1080 * var(--g)); }  /* by the width: a window's height is far too tall for its column */
}

@media (prefers-reduced-motion: reduce) {
  .mem-strip { animation: none; }
  .story-track { animation: none; }
  .checks b { animation: none; }
  .explore, .scroll img, .nav-link { transition: none; }
  .spin { animation: none; }
  .poster-name.is-drawing .pn-line, .poster-name.is-drawing .pn-fill { animation: none; }
  .reveal-poster, .reveal-cover { animation: none; }  /* rest apart; a click shows the next poster */
  .reveal-poster { translate: calc(-1 * var(--spread)) 0; }
  .reveal-cover { translate: var(--spread) 0; }
}
