@font-face {
  font-family: Svetze;
  src: url("assets/fonts/Svetze-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

/* Latin subset (Google Fonts' "latin" range), opsz + wght axes and all features kept. */
@font-face {
  font-family: "DM Sans";
  src: url("assets/fonts/DMSans-Variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Aref Ruqaa Ink (OFL), subset to what Period II sets in it: the timeline's intro, and the Hijri
   years and numerals (Arabic-Indic digits, heh and tatweel, basic Latin, quotes and dashes). Its
   colour tables (COLR, CPAL, SVG) are dropped, so the glyphs take the CSS colour as Figma shows
   them, not the font's own red ink. Fetched only when such text is about to show. */
@font-face {
  font-family: "Aref Ruqaa Ink";
  src: url("assets/fonts/ArefRuqaaInk-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0020-007E, U+00A0, U+0640, U+0647, U+0660-0669, U+2013-2014, U+2018-2019, U+201C-201D;
}

:root {
  color-scheme: light;
  --color-copy: #dbc6b4;
  --color-hero: #1e0701;
  --color-hero-kicker: rgb(255 229 189 / .8);
  --color-story: #170601;
  --color-story-copy: #f0dfd3;
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  /* Svetze for display type, DM Sans for everything else; Period II adds Aref Ruqaa Ink (self-hosted above). */
  --font-display: Svetze, Georgia, "Times New Roman", serif;
  --font-label: "DM Sans", Arial, sans-serif;
  /* Period II's timeline intro, Hijri years and numerals (Figma: Aref Ruqaa Ink). */
  --font-ruqaa: "Aref Ruqaa Ink", "Geeza Pro", "Noto Naskh Arabic", var(--font-display);
  /* Scroll the Round City plan rests on Palace, then the scroll scene 4 takes to open over it
     (lib/city.js HOLD is their sum in viewports). */
  --capital-rest: 60vh;
  --capital-wipe: 130vh;
}

* { box-sizing: border-box; }

/* #13100e behind everything so overscroll never flashes a light edge. */
html {
  background: var(--color-story);
  overscroll-behavior: none;
}

body {
  margin: 0;
  color: var(--color-copy);
  font-family: var(--font-label);
  -webkit-font-smoothing: antialiased;
}

img { display: block; }

/*
 * Navbar, set as in Figma 219:638: "Baghdad" and "Menu" at either end of a 1276px row at
 * (80, 44), DM Sans Regular 16, 5% tracking, uppercase, trimmed to the cap height. Hidden
 * until lib/navbar.js finds scene 1 uncovered; it then drops in, and hides again above it, and
 * from the three ages' map until Period II's timeline. White
 * with difference blending, so it reads dark on the light scenes and light on the dark ones.
 */
.navbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 44px 84px 0 80px;
  color: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
  opacity: 0;
  translate: 0 -16px;
  visibility: hidden;
  transition: opacity .5s var(--ease-out), translate .6s var(--ease-out), visibility 0s .6s;
}

.navbar.is-visible {
  pointer-events: auto;
  opacity: 1;
  translate: 0 0;
  visibility: visible;
  transition: opacity .5s var(--ease-out), translate .6s var(--ease-out);
}

.navbar__home,
.navbar__menu {
  color: inherit;
  font-family: var(--font-label);
  font-size: 16px;
  font-weight: 400;
  font-variation-settings: "opsz" 14;
  line-height: normal;
  letter-spacing: .8px;
  text-transform: uppercase;
  text-decoration: none;
  text-box: trim-both cap alphabetic;
}

.navbar__menu {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.navbar__home:focus-visible,
.navbar__menu:focus-visible { outline: 1px solid currentColor; outline-offset: 6px; }

/* While the menu is open the navbar stays, wherever the page is (lib/menu.js). */
.navbar.is-menu-open {
  pointer-events: auto;
  opacity: 1;
  translate: 0 0;
  visibility: visible;
}

/*
 * Menu — Figma 218:375, a 1440 × 1024 frame on the story's #170601 with the hero's atmosphere
 * texture colour-dodged into it (219:652: 1622 × 1081 at (−45, 66), 80%). The frame is laid out
 * at the page's shared scale, centred in the view; the texture is sized to the view like the
 * hero's, so its edge never shows. Its top row (219:638) is the navbar's own, with "Close".
 *
 * Motion (not in Figma, lib/menu.js): the menu is a sheet let down from above the page like a
 * sheet of paper, its straight lower edge catching a little light and casting a soft shadow on
 * the page beneath, which it covers as it settles. Its top row comes down
 * with it, so its "Close" covers the navbar's "Menu" in the same spot. Once it has landed the
 * chapters rise in one after another and the painting opens from its left edge. Pointing at a
 * chapter sets the others back, raises that chapter's own painting into the frame
 * (.menu__picture img[data-for]) and shows its name very large behind (.menu__echo). Closing
 * lifts the sheet back up, the page coming back from below. With reduced motion it only fades.
 */
.menu {
  position: fixed;
  inset: 0;
  z-index: 21;
  overflow: clip;
  pointer-events: none;
}

.menu.is-open { pointer-events: auto; }
.menu:focus { outline: none; }

/* Raised, it waits above the view with its shadow; down, it fills the view. */
.menu__sheet {
  position: absolute;
  inset: 0;
  overflow: clip;
  isolation: isolate;
  background: var(--color-story);
  box-shadow: 0 calc(30px * var(--stage-scale, 1)) calc(90px * var(--stage-scale, 1)) rgb(8 2 0 / .55);
  translate: 0 calc(-100% - 160px);
  transition: translate .95s cubic-bezier(.7, 0, .2, 1);
}

/* The sheet's lower edge, catching the light. */
.menu__sheet::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  height: 1px;
  background: rgb(255 214 170 / .14);
  pointer-events: none;
}

.menu.is-open .menu__sheet {
  translate: 0 0;
  transition: translate 1.05s cubic-bezier(.65, 0, .15, 1);
}

.menu__atmosphere {
  position: absolute;
  top: 59.23%;
  left: 53.19%;
  width: max(112.64%, 158.35vh);
  height: auto;
  aspect-ratio: 1622 / 1081;
  opacity: .8;
  mix-blend-mode: color-dodge;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* The navbar's row, on the sheet: same type and place (219:638). */
.menu__bar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 44px 84px 0 80px;
  color: #fff;
}

.menu__bar .navbar__home:focus-visible,
.menu__bar .navbar__menu:focus-visible { outline: 1px solid currentColor; outline-offset: 6px; }

.menu__stage {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1440px;
  height: 1024px;
  transform: translate(-50%, -50%) scale(var(--stage-scale, 1));
}

/* 220:61: 553 × 369 at (−224, 293), running off the frame's left edge. */
.menu__picture {
  position: absolute;
  top: 293px;
  left: -224px;
  width: 553px;
  height: 369px;
  overflow: clip;
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0s .95s;
}

.menu__picture img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.menu__picture > img:first-child {
  scale: 1.12;
  transition: scale 0s .95s;
}

.menu.is-open .menu__picture {
  clip-path: inset(0);
  transition: clip-path 1.2s cubic-bezier(.65, 0, .35, 1) .75s;
}

.menu.is-open .menu__picture > img:first-child {
  scale: 1;
  transition: scale 1.6s var(--ease-out) .75s;
}

/*
 * A chapter's own painting waits below the frame, rises into it while its chapter is pointed at
 * (.is-in), and carries on up out of it when let go or replaced (.is-out), before lib/menu.js
 * puts it back below, unseen. Moving from one chapter to the next, the two pass in the frame.
 */
/* Scaled from its top edge, so while it waits below the frame no part of it reaches back in. */
.menu__picture img[data-for] {
  z-index: 1;
  transform-origin: 50% 0;
  translate: 0 101%;
  scale: 1.1;
}

.menu__picture img[data-for].is-in {
  z-index: 2;
  translate: 0 0;
  scale: 1;
  transition: translate .9s cubic-bezier(.65, 0, .35, 1), scale 1.4s var(--ease-out);
}

.menu__picture img[data-for].is-out {
  translate: 0 -100%;
  scale: 1;
  transition: translate .9s cubic-bezier(.65, 0, .35, 1);
}

/* The painting morph (lib/menu-morph.js): over the frame's pictures from the first change after
   the menu opens until it is put away; the chapters' own paintings no longer slide in under it. */
.menu__morph {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  visibility: hidden;
}
.menu__morph.is-on { visibility: visible; }
.menu.has-morph .menu__picture img[data-for] { visibility: hidden; }

/*
 * The pointed chapter's name, very large behind everything at 5% (not in Figma): its letters
 * rise in one after another out of a blur, and drift up and away when it goes. Svetze 300 on the
 * artboard, from (64, 712), running off the bottom of the frame.
 */
.menu__echo {
  position: absolute;
  top: 712px;
  left: 64px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 300px;
  line-height: 1;
  letter-spacing: -6px;
  white-space: nowrap;
  opacity: .05;
  pointer-events: none;
}

.menu__echo-word {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
}

.menu__echo-word span {
  display: block;
  opacity: 0;
  translate: 0 .3em;
  filter: blur(18px);
}

.menu__echo-word.is-in span {
  opacity: 1;
  translate: 0 0;
  filter: blur(0);
  transition:
    opacity .9s var(--ease-out) calc(var(--n) * 40ms),
    translate 1.3s cubic-bezier(.16, 1, .3, 1) calc(var(--n) * 40ms),
    filter 1s var(--ease-out) calc(var(--n) * 40ms);
}

.menu__echo-word.is-out span {
  opacity: 0;
  translate: 0 -.2em;
  filter: blur(12px);
  transition:
    opacity .5s ease-in calc(var(--n) * 20ms),
    translate .7s cubic-bezier(.5, 0, .75, 0) calc(var(--n) * 20ms),
    filter .5s ease-in calc(var(--n) * 20ms);
}

/* 219:645: Svetze 80 / 1.2, −1.6px, white, 44 apart; the column is centred 25px below the middle. */
.menu__list {
  position: absolute;
  top: 279px;
  left: 631px;
}

.menu__list ol {
  display: flex;
  flex-direction: column;
  gap: 44px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu__list li {
  opacity: 0;
  translate: 0 40px;
  transition: opacity 0s .95s, translate 0s .95s;
}

.menu.is-open .menu__list li {
  opacity: 1;
  translate: 0 0;
  transition:
    opacity .8s var(--ease-out) calc(.7s + var(--i) * .08s),
    translate 1s cubic-bezier(.16, 1, .3, 1) calc(.7s + var(--i) * .08s);
}

.menu__link {
  display: block;
  color: #fff;
  font-family: var(--font-display);
  font-size: 80px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -1.6px;
  white-space: nowrap;
  text-decoration: none;
  transition: opacity .5s var(--ease-out);
}

.menu__link[aria-disabled] { cursor: default; }

.menu__list.has-pointed .menu__link:not(.is-pointed) { opacity: .3; }

a.menu__link:focus-visible {
  outline: 1px solid #fff;
  outline-offset: 8px;
}

@media (prefers-reduced-motion: reduce) {
  .menu__sheet,
  .menu.is-open .menu__sheet {
    translate: none;
    opacity: 0;
    transition: opacity .4s ease-out;
  }
  .menu.is-open .menu__sheet { opacity: 1; }
  .menu__picture,
  .menu.is-open .menu__picture { clip-path: none; }
  .menu__picture > img:first-child,
  .menu.is-open .menu__picture > img:first-child { scale: 1; }
  .menu__list li,
  .menu.is-open .menu__list li { opacity: 1; translate: none; }
  .menu__link { transition: none; }
  .menu__picture img[data-for],
  .menu__picture img[data-for].is-out { translate: none; scale: none; opacity: 0; transition: none; }
  .menu__picture img[data-for].is-in { opacity: 1; }
  .menu__echo-word span,
  .menu__echo-word.is-out span { translate: none; filter: none; transition: opacity .3s; }
}

/* The compact menu's chapter labels; desktop shows the numeral before the name instead. */
.menu__kicker { display: none; }

/*
 * Compact navbar and menu (Figma 671:1076 phone, 692:5556 tablet). The bar on the 20px (60px)
 * gutters, Mobile/kicker 12 at 40%. The menu is one column from the top: the chapter painting
 * across the column, then the four chapters as kicker + name, the reader's chapter bright
 * (lib/menu.js), and its name very large at 5% running off the foot.
 */
@media (max-aspect-ratio: 4/5) {
  .navbar,
  .menu__bar { padding: 32px 20px 0; }

  .navbar__home,
  .navbar__menu {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: .4em;
    margin-right: -.4em;
  }

  .menu__stage {
    --picture: clamp(120px, 100vh - 611px, (100vw - 40px) * 233 / 350);
    inset: 0;
    width: auto;
    height: auto;
    transform: none;
  }

  .menu__picture {
    top: 88px;
    left: 20px;
    width: calc(100% - 40px);
    height: var(--picture);
  }

  .menu__list {
    top: calc(88px + var(--picture) + 48px);
    right: 20px;
    left: 20px;
  }

  .menu__list ol { gap: 28px; }

  .menu__link {
    font-size: 40px;
    line-height: 1.05;
    letter-spacing: -.02em;
    white-space: normal;
  }

  .menu__kicker {
    display: block;
    margin-bottom: 4px;
    color: #c8a15a;
    font-family: var(--font-label);
    font-size: 11px;
    font-weight: 500;
    font-variation-settings: "opsz" 14;
    line-height: 1.4;
    letter-spacing: .3em;
    text-transform: uppercase;
  }

  .menu__numeral { display: none; }

  /* One line tall, so `bottom` sets the word's foot (its word is placed at the top of the box). */
  .menu__echo {
    top: auto;
    height: 1em;
    bottom: -38px;
    left: -30px;
    font-size: 150px;
    letter-spacing: 0;
  }
}

/* Compact layout: headings arrive whole, all words at once (quicker than word by word).
   !important overrides the per-word --i that lib/scenes.js and lib/city.js set inline. */
@media (max-aspect-ratio: 4/5) {
  .scene__word,
  .city__word { --i: 0 !important; }
}

@media (max-aspect-ratio: 4/5) and (min-width: 600px) {
  .navbar,
  .menu__bar { padding: 40px 60px 0; }
  .navbar__home,
  .navbar__menu { font-size: 14px; }
  .menu__stage { --picture: clamp(160px, 100vh - 684px, (100vw - 120px) * 340 / 648); }
  .menu__picture { top: 104px; left: 60px; width: calc(100% - 120px); }
  .menu__list { top: calc(104px + var(--picture) + 48px); right: 60px; left: 60px; }
  .menu__list ol { gap: 34px; }
  .menu__link { font-size: 56px; }
  .menu__kicker { margin-bottom: 5px; font-size: 13px; }
  .menu__echo { bottom: -44px; left: 0; font-size: 180px; }
}

/*
 * Journey: a pinned viewport driven by page scroll (lib/journey.js). Scroll lengths:
 * slide hero → story 140vh, rest on the story 30vh, dive into period I 200vh, then the
 * chapter's last 235 artboard px.
 */
:root {
  /* The chapter's height past one viewport, read after it opens (portrait screens: none). */
  --chapter-read: calc(235px * var(--stage-scale, 1));
}

.journey {
  position: relative;
  height: calc(470vh + var(--chapter-read));
}

.journey__viewport {
  position: sticky;
  top: 0;
  height: 100vh;
  /* clip, not hidden: focus and #story anchors must not scroll the track. */
  overflow: clip;
}

/* Grain (Figma noise, white 6% on the story). One layer over both panels, so it never draws a seam. */
.journey__grain {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
}

/* The same noise on the Period II chapter (226:455). */
.journey__grain,
.chapter__grain {
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1.6 -.5'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.journey__smoke {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.journey__track {
  display: flex;
  width: 200%;
  height: 100%;
  will-change: transform;
}

.panel {
  position: relative;
  flex: none;
  width: 50%;
  height: 100%;
  overflow: hidden;
}


/* Compact layout: the panels lie on top of each other and the story dissolves in over the hero
   (lib/journey.js) instead of sliding in beside it, so there is no seam to show. */
@media (max-aspect-ratio: 4/5) {
  .journey__track { position: relative; display: block; width: 100%; }
  .panel { position: absolute; inset: 0; width: 100%; }
  .journey__smoke { display: none; }
}

/* Hero — Figma 95:12552. Coordinates below are artboard pixels (1440 × 1024). */
.hero {
  background: var(--color-hero);
  isolation: isolate;
}

/*
 * Two copies of the artboard share one transform: artwork below the vignette,
 * type above it (as in Figma). Anchored to the bottom so the arch always meets
 * the bottom edge; extra height on tall screens opens up sky at the top.
 */
.hero__stage {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 1440px;
  height: 1024px;
  transform: translateX(-50%) scale(var(--stage-scale, 1));
  transform-origin: 50% 100%;
  /* Own compositor layer: the painting, frame shadow and light blurs rasterise once
     and are only moved while the track slides. */
  will-change: transform;
}

.hero__stage--type { z-index: 1; }
.hero__stage > * { position: absolute; }

/* Sky: hero colour with the atmosphere texture colour-dodged into it (108:13410). */
.hero__sky {
  top: -600px;
  left: -169px;
  width: 1870px;
  height: 1624px;
}

/*
 * Atmosphere texture (Figma 1622 × 1081 at −45, −58 → 112.6% of the frame width,
 * centred 46px right and 30px up). Sized to the viewport, never smaller than that
 * overscale, so its edge can never show on wide or tall screens.
 */
.hero__atmosphere {
  position: absolute;
  top: 47.07%;
  left: 53.19%;
  width: max(112.64%, 158.35vh);
  height: auto;
  aspect-ratio: 1622 / 1081;
  opacity: .8;
  mix-blend-mode: color-dodge;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* The flowing WebGL version takes over once it has drawn (lib/hero-smoke.js). */
.hero__atmosphere.is-replaced { visibility: hidden; }

.hero__glow {
  position: absolute;
  top: 670px;
  left: 439px;
  width: 900px;
  height: 820px;
  border-radius: 50%;
  background: rgb(255 148 64 / .3);
  filter: blur(95px);
  opacity: .6;
  mix-blend-mode: screen;
  /* Its own layer: the 95px blur is drawn once and reused, not redrawn as the hero moves. */
  will-change: transform;
}

/*
 * Arch group: the frame stays fixed; only the painting moves inside it (pointer and
 * scroll, lib/hero-interaction.js). Painting, lantern and gold sheen are positioned in
 * artboard pixels like Figma.
 */
.hero__arch { inset: 0; }

/* Figma "image 3" box (15, 85, 1410 × 940), clipped to the arch outline at x 320. */
.hero__window {
  position: absolute;
  top: 85px;
  left: 15px;
  width: 1410px;
  height: 940px;
  clip-path: path("M 585.32 33.84 C 643.11 -1.5 711.2 -9.54 774.35 11.51 C 837.15 32.35 889.89 80.25 920.87 144.58 C 926.59 156.27 931.15 167.21 934.74 179.89 C 949.85 179.85 965.76 180.07 980.8 179.67 C 980.53 193.94 979.89 207.65 983.06 221.63 C 997.97 287.39 1044.52 321.6 1103 319.82 L 1103 1141 L 305 1141 L 305 319.91 C 339.51 320.33 366.98 312.51 392.94 284.87 C 414.65 261.79 427.07 229.93 427.38 196.5 C 427.42 190.97 427.37 185.43 427.2 179.9 L 473.31 179.73 C 476.42 167.81 481.78 155.51 487.08 144.59 C 509.63 97.95 543.73 59.51 585.32 33.84 Z");
}

/* Slightly oversized so the parallax shift never reveals an edge inside the arch. */
.hero__painting {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  scale: 1.04;
  translate: var(--px, 0px) var(--py, 0px);
  will-change: translate;
}

/* Lantern held over the painting: the scene dims a little away from the cursor
   (shade, a large ring centred on the cursor) and warms where it is (glow). */
.hero__shade,
.hero__lantern {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  translate: var(--lx, 0px) var(--ly, 0px);
  transition: opacity .9s var(--ease-out);
  pointer-events: none;
  will-change: translate;
}

.hero__shade {
  top: -1500px;
  left: -1500px;
  width: 3000px;
  height: 3000px;
  /* Many eased stops so the dimming has no visible ring. */
  background: radial-gradient(circle,
    rgb(24 7 1 / 0) 3%, rgb(24 7 1 / .02) 8%, rgb(24 7 1 / .06) 13%, rgb(24 7 1 / .11) 18%,
    rgb(24 7 1 / .16) 24%, rgb(24 7 1 / .2) 31%, rgb(24 7 1 / .22) 40%);
}

.hero__lantern {
  top: -240px;
  left: -240px;
  width: 480px;
  height: 480px;
  background: radial-gradient(closest-side,
    rgb(255 200 130 / .3), rgb(255 190 120 / .26) 15%, rgb(255 180 110 / .19) 32%,
    rgb(255 172 100 / .11) 50%, rgb(255 168 95 / .05) 68%, rgb(255 168 95 / .015) 85%, rgb(255 168 95 / 0));
  mix-blend-mode: screen;
}

/* Gilded frame render (Figma "image 13"), 1437 × 1023 at (1, 0). */
.hero__frame {
  position: absolute;
  top: 0;
  left: 1px;
  width: 1437px;
  height: 1023px;
  object-fit: cover;
  /* Figma drop shadow 0 22 blur 90, #0b0200 40% (follows the frame's alpha). */
  filter: drop-shadow(0 22px 45px rgb(11 2 0 / .4));
  pointer-events: none;
}

/* Specular sheen on the gold: a soft spot masked to the frame's own shape. */
.hero__sheen {
  position: absolute;
  top: 0;
  left: 1px;
  width: 1437px;
  height: 1023px;
  overflow: hidden;
  opacity: 0;
  mix-blend-mode: color-dodge;
  -webkit-mask: url("assets/hero/frame.webp") 0 0 / 100% 100% no-repeat;
  mask: url("assets/hero/frame.webp") 0 0 / 100% 100% no-repeat;
  transition: opacity .7s var(--ease-out);
  pointer-events: none;
}

.hero__sheen-spot {
  position: absolute;
  top: -210px;
  left: -210px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(closest-side,
    rgb(255 226 170 / .36), rgb(255 218 160 / .3) 15%, rgb(255 208 145 / .2) 34%,
    rgb(255 200 130 / .1) 54%, rgb(255 200 130 / .035) 74%, rgb(255 200 130 / 0));
  translate: var(--sx, 0px) var(--sy, 0px);
  will-change: translate;
}

.hero.is-pointing .hero__shade,
.hero.is-pointing .hero__lantern,
.hero.is-pointing .hero__sheen { opacity: 1; }

.hero__doves {
  inset: 0;
  pointer-events: none;
}

/* Doves: still manuscript SVGs, no motion. */
.dove { position: absolute; }

.dove__flight {
  display: block;
  position: relative;
  left: var(--image-x);
  top: var(--image-y);
  width: var(--image-size);
  height: auto;
  filter: sepia(.12) brightness(.97) drop-shadow(0 14px 22px rgb(10 2 0 / .45));
}

.dove--near { top: 185px; left: 114px; width: 131px; }
.dove--far { top: 34px; left: 318px; width: 104px; opacity: .85; }
.dove--mid { top: 150px; left: 1222px; width: 136px; }
/* Compensate for the 1280px SVG canvases' transparent padding. Visible bird
   widths stay 131 / 104 / 136px; each pose keeps its natural proportions. */
.dove--near { --image-size: 152.30px; --image-x: -10.59px; --image-y: -11.42px; }
.dove--far { --image-size: 124.53px; --image-x: -10.22px; --image-y: -8.76px; }
.dove--mid { --image-size: 157.97px; --image-x: -10.98px; --image-y: -16.04px; }
.dove--far .dove__flight { filter: sepia(.12) brightness(.9) blur(.6px); }

.dove__flight > img { width: 100%; height: auto; }

.hero__beams {
  top: -600px;
  left: -200px;
  opacity: .4;
  mix-blend-mode: screen;
  pointer-events: none;
}

.hero__dust {
  top: 0;
  left: 0;
  overflow: visible;
  mix-blend-mode: screen;
  pointer-events: none;
}

/* Vignette sits between artwork and type, sized to the viewport rather than the artboard. */
.hero__vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 calc(250px * var(--stage-scale, 1)) calc(20px * var(--stage-scale, 1)) rgb(10 3 0 / .88);
}

.hero__label {
  top: 164px;
  left: 599px;
  width: 242px;
  margin: 0;
  color: #000;
  font-family: var(--font-label);
  font-size: 22px;
  font-weight: 500;
  font-variation-settings: "opsz" 14;
  line-height: 1.4;
  letter-spacing: .2em;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  /* Never smaller than 10px on screen. */
  scale: max(1, .455 / var(--stage-scale, 1));
  transform-origin: 50% 0;
}

.hero__title {
  /* Figma's text box starts at 442; +12 compensates for Svetze's browser baseline. */
  top: 454px;
  left: 68px;
  width: 1304px;
  margin: 0;
  color: #fff;
  font-family: var(--font-display);
  font-size: 250px;
  font-weight: 400;
  /* Figma's auto line height for Svetze at 250px; browser "normal" is taller. */
  line-height: 175px;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Text columns (Figma frames 23/24): 176px wide, both ending at y 960 so re-wrapping grows upward.
   On small screens (landscape phones, short laptop windows) the scaled artboard would shrink the
   copy below 12px, so the columns grow back from their bottom corner to keep it readable. */
.hero__cols { display: contents; }
.hero__intro { display: none; }

.hero__col {
  position: absolute;
  bottom: 64px;
  width: 176px;
  scale: max(1, .857 / var(--stage-scale, 1));
}
.hero__col--left { left: 56px; transform-origin: 0 100%; }
.hero__col--right { left: 1208px; text-align: right; transform-origin: 100% 100%; }

.hero__kicker {
  margin: 0 0 12px;
  color: var(--color-hero-kicker);
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 500;
  font-variation-settings: "opsz" 14;
  line-height: normal;
  letter-spacing: 2.4px;
  text-transform: uppercase;
}

.hero__copy {
  margin: 0;
  color: #fff;
  font-family: var(--font-label);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: .01em;
}

/* Sits 32px under the left paragraph. */
.scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 24px;
  margin-top: 32px;
  color: #fff;
  text-decoration: none;
  user-select: none;
}

.scroll-cue:focus-visible {
  outline: 1px solid #fff;
  outline-offset: 6px;
}

.scroll-cue__label {
  font-family: var(--font-label);
  font-size: 12px;
  line-height: 1.55;
}

.scroll-cue__label { transition: translate .5s var(--ease-out); }

.scroll-cue__circle {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  overflow: hidden;
  border-radius: 50%;
  background: #fff;
  transition: scale .5s var(--ease-out), background-color .5s var(--ease-out);
}

.scroll-cue:focus-visible .scroll-cue__label { translate: 3px 0; }
.scroll-cue:focus-visible .scroll-cue__circle { scale: 1.15; background-color: #ffe5bd; }

/* Hover only where there is a real hover (touch screens would leave it stuck after a tap). */
@media (hover: hover) and (min-aspect-ratio: 801/1000) {
  .scroll-cue:hover .scroll-cue__label { translate: 3px 0; }
  .scroll-cue:hover .scroll-cue__circle { scale: 1.15; background-color: #ffe5bd; }
}

/* Hero motion — entrance once, then slow ambient loops. */
@keyframes fade-in { from { opacity: 0; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(24px); } }
@keyframes draw-in { from { transform: scaleX(0); } }
@keyframes title-in { from { opacity: 0; letter-spacing: .16em; } }
@keyframes rise-in-t { from { opacity: 0; translate: 0 24px; } }
/* "Next is to the side": the arrow slides out right and re-enters from the left. */
@keyframes arrow-loop {
  0%, 28% { transform: translateX(0); opacity: 1; }
  48% { transform: translateX(16px); opacity: 0; }
  48.1% { transform: translateX(-16px); opacity: 0; }
  70%, 100% { transform: translateX(0); opacity: 1; }
}
@keyframes cue-ring {
  0%, 30% { box-shadow: 0 0 0 0 rgb(255 255 255 / .45); }
  70%, 100% { box-shadow: 0 0 0 10px rgb(255 255 255 / 0); }
}
@keyframes beam-breathe { to { opacity: .3; } }
@keyframes mote-drift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(5px, -12px); }
}

.hero__sky,
.hero__atmosphere { animation: fade-in 1.4s ease-out both; }
.hero__arch { animation: rise-in-t 1.3s var(--ease-out) .15s both; }
/* Looping animations hold while out of view (lib/offscreen.js) and carry on when back. */
.is-offscreen.is-offscreen,
.is-offscreen.is-offscreen svg { animation-play-state: paused; }

.hero__beams { animation: fade-in 2s ease-out .3s both, beam-breathe 9s ease-in-out 2.3s infinite alternate; }
.hero__dust { animation: fade-in 2.4s ease-out .6s both; }
.hero__mote-layer--fine { animation: mote-drift 11s ease-in-out infinite; }
.hero__mote-layer--soft { animation: mote-drift 15s ease-in-out -4s infinite reverse; }
.hero__mote-layer--bokeh { animation: mote-drift 19s ease-in-out -9s infinite; }
.hero__label { animation: fade-in 1s ease-out .8s both; }
.hero__title { animation: title-in 1.8s var(--ease-out) .45s both; }
.hero__col--left { animation: rise-in 1s var(--ease-out) 1s both; }
.hero__col--right { animation: rise-in 1s var(--ease-out) 1.15s both; }
.scroll-cue { animation: fade-in .8s ease-out 1.3s both; }
.scroll-cue__circle { animation: cue-ring 2.4s ease-out 2.6s infinite; }
.scroll-cue__circle svg { animation: arrow-loop 2.4s cubic-bezier(.65, 0, .35, 1) 2.6s infinite; }

/*
 * Loader (Figma 455:281; lib/loader.js). Only while html.is-loading. Until its pictures are in, it
 * is the study's dark; the canvas then draws the room and the sheet. While html.is-holding, the
 * hero's entrance waits at its first frame; it is let go as the sheet catches, so it plays as the
 * burn opens onto it.
 */
.loader { display: none; }
.is-loading { overflow: hidden; }
.is-loading .loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: block;
  background: #130200;
  cursor: default;
  /* A finger drags the lamp; it must not pan or zoom the page instead. */
  touch-action: none;
}
.is-loading .loader.is-burning { background: transparent; }
.is-holding .hero *,
.is-holding .hero *::before,
.is-holding .hero *::after,
.is-holding .navbar { animation-play-state: paused !important; }

.loader__canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

/* The gold frame's progress, quiet, under the sheet. */
.loader__count {
  position: absolute;
  bottom: 4vh;
  left: 50%;
  margin: 0;
  color: rgb(255 229 189 / .62);
  font: 500 12px/1 var(--font-label);
  font-variant-numeric: tabular-nums;
  letter-spacing: .2em;
  translate: -50% 0;
  transition: opacity .5s ease;
}
.loader.is-burning .loader__count { opacity: 0; }

/* Once the page is ready, the count becomes the way in. */
.loader.is-inviting .loader__count {
  color: rgb(255 229 189 / .7);
  font-size: 11px;
  letter-spacing: .24em;
  text-transform: uppercase;
  white-space: nowrap;
  animation: fade-in .9s ease-out both;
}

/* Compact: tap to enter. Plain text, as the count it replaces, a little brighter and breathing
   slowly, so it reads as the way in. */
.loader.is-inviting.is-tap .loader__count {
  bottom: calc(6vh + env(safe-area-inset-bottom, 0px));
  color: rgb(255 229 189 / .9);
  font-size: 12px;
  letter-spacing: .3em;
  animation: fade-in .9s ease-out both, loader-tap 2.4s ease-in-out .9s infinite;
}
@keyframes loader-tap {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

/* The flame is the pointer. */
.loader:not(.is-still):not(.is-burning) { cursor: none; }

/* Until the lamp is first moved. */
.loader__hint {
  position: absolute;
  bottom: calc(4vh + 24px);
  left: 50%;
  margin: 0;
  color: rgb(255 229 189 / .5);
  font: 500 11px/1 var(--font-label);
  letter-spacing: .24em;
  text-transform: uppercase;
  white-space: nowrap;
  translate: -50% 0;
  opacity: 0;
  transition: opacity .8s ease;
  pointer-events: none;
}
.loader__hint.is-on { opacity: 1; }

/* Without WebGL2, or with reduced motion: the sheet and the letter as they are, then a fade. */
.loader.is-still { transition: opacity .7s ease; }
.loader.is-still.is-leaving { opacity: 0; }
.loader.is-still { background: #130200 url("assets/loader/room.avif") center / cover no-repeat; }
.loader__still {
  position: absolute;
  top: 48%;
  left: 50%;
  width: min(64.6vw, 70vh * 1.546);
  aspect-ratio: 1416 / 916;
  translate: -50% -50%;
  rotate: -1.2deg;
}
/* Lighten drops the picture's dark surround into the room's dark. */
.loader__paper { width: 100%; height: 100%; mix-blend-mode: lighten; }
/* The letter (white where written) masks a brown fill, at its place on the sheet. */
.loader__letter {
  position: absolute;
  top: 17.14%;
  left: 15.58%;
  width: 68.79%;
  height: 65.61%;
  background: #3d1c0a;
  mask: url("assets/loader/letter.png") center / 100% 100% no-repeat luminance;
}

/*
 * The hero's trailing edge dissolves into the story colour. A gradient overlay scaled
 * with transform (compositor-only) instead of an animated mask-image: changing the mask
 * every frame forced the whole hero to re-rasterise, and Chrome showed missing tiles
 * (dark rectangles) mid-scroll. Stops mirror the old ease-in-out mask exactly.
 */
.hero__edge-fade {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  width: 100%;
  pointer-events: none;
  transform: scaleX(0);
  transform-origin: 100% 50%;
  will-change: transform;
  background: linear-gradient(
    to right,
    rgb(23 6 1 / 0),
    rgb(23 6 1 / .04) 15%,
    rgb(23 6 1 / .16) 30%,
    rgb(23 6 1 / .38) 45%,
    rgb(23 6 1 / .62) 60%,
    rgb(23 6 1 / .84) 75%,
    rgb(23 6 1 / .96) 90%,
    var(--color-story)
  );
}

.hero__fade {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: var(--color-story);
  opacity: 0;
  pointer-events: none;
}

/*
 * Compact hero: portrait screens (phones, upright tablets). The desktop artboard scaled to a
 * portrait screen leaves the arch a sliver at the bottom, so here the art is scaled to the
 * gilded frame instead and lifted off the bottom edge (lib/hero-layout.js sets --hero-scale
 * and --hero-art-bottom); the arch fades out at its foot and the text sits under it in one
 * column. Type is laid out in screen px, not in the artboard.
 */
@media (max-aspect-ratio: 4/5) {
  /* The atmosphere covers the portrait screen's height at 3 : 2, so it is over three screens wide:
     cut to the hero, or as the track slides it spills over the story, colour-dodged to white. */
  .panel--hero { overflow: clip; }

  .hero__stage {
    top: calc(var(--hero-art-bottom, 64%) - 1024px);
    bottom: auto;
    transform: translateX(-50%) scale(var(--hero-scale, .4));
  }

  .hero__stage--type {
    inset: 0;
    width: auto;
    height: auto;
    transform: none;
  }

  /* Doves in the sky above the arch and over its shoulders (Figma 671:980, in artboard px). */
  .dove--near { top: -66px; left: 243px; width: 190px; --from-x: -140px; }
  .dove--far { top: -208px; left: 449px; width: 142px; }
  .dove--mid { top: -114px; left: 997px; width: 195px; --from-x: 140px; }

  /* Calmer than desktop's: the smoke is over three screens wide here, so its densest middle sits
     behind the text and, colour-dodged at full strength, burns orange. The sunbeams' blur
     rasterises coarsely at this scale (hard-edged bands on a phone), so they are left out. */
  .hero__atmosphere { opacity: .5; filter: saturate(.75); }
  .hero__beams { display: none; }
  .hero__glow { opacity: .4; }

  /* The arch's foot dissolves into the smoky sky behind it (a mask, so no edge or band shows). */
  .hero__arch {
    -webkit-mask: linear-gradient(#000 55%, rgb(0 0 0 / .9) 64%, rgb(0 0 0 / .62) 76%, rgb(0 0 0 / .26) 88%, rgb(0 0 0 / .06) 95%, transparent);
    mask: linear-gradient(#000 55%, rgb(0 0 0 / .9) 64%, rgb(0 0 0 / .62) 76%, rgb(0 0 0 / .26) 88%, rgb(0 0 0 / .06) 95%, transparent);
  }

  /* A little shade under the text so the glow behind the arch never competes with it. */
  .hero__vignette {
    box-shadow: inset 0 0 calc(250px * var(--hero-scale, .4)) calc(20px * var(--hero-scale, .4)) rgb(10 3 0 / .88);
    background: linear-gradient(rgb(23 6 1 / 0) calc(var(--hero-art-bottom, 64%) - 60px), rgb(23 6 1 / .4));
  }

  /* In the arch's sky (artboard y 108), two lines, Mobile/label 10 with 30% tracking. Shown on a
     tablet only: on a phone it runs into the frame's gilding. The title still names the page. */
  .hero__label {
    display: none;
    top: calc(var(--hero-art-bottom, 64%) - 916px * var(--hero-scale, .4));
    left: 50%;
    width: auto;
    padding-left: .3em;
    font-size: 10px;
    letter-spacing: .3em;
    scale: none;
    transform: translateX(-50%);
  }

  /* Under the arch, the column's width (20px gutters): "BAGHDAD" with its tracking is 5.216em wide;
     padding-left balances the trailing .1em. lib/hero-layout.js places it over the column. */
  .hero__title {
    top: var(--hero-title-top, 60%);
    left: 0;
    width: 100%;
    padding-left: .1em;
    font-size: min(140px, (100vw - 40px) / 5.216);
    line-height: .7;
    text-align: center;
  }

  /* One centred column at the foot: the meta line, the paragraph (16px under it), then Scroll
     40px under that. 100vh − 100svh: the part of the pinned viewport a mobile browser's bottom
     bar can cover. */
  .hero__cols {
    position: absolute;
    right: 20px;
    bottom: calc(28px + 100vh - 100svh + var(--hero-lift, 0px));
    left: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 520px;
    margin-inline: auto;
    text-align: center;
    animation: rise-in 1s var(--ease-out) 1s both;
  }

  /* The desktop columns give way to the intro; only their Scroll cue stays, after it. */
  .hero__col { display: contents; }
  .hero__col > .hero__kicker,
  .hero__col > .hero__copy { display: none; }
  /* No Scroll on a phone: its room goes to the arch and the text (the tablet keeps it). */
  .scroll-cue { display: none; order: 1; margin-top: 40px; }
  .scroll-cue__label {
    font-weight: 500;
    font-variation-settings: "opsz" 14;
    line-height: 1.4;
    letter-spacing: .4em;
    text-transform: uppercase;
  }

  .hero__intro { display: block; width: 100%; }

  /* The Foundations meta line (label, star, hairline, star, label) at phone size. */
  .hero__meta {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
  }

  .hero__meta-label {
    margin: 0 -.4em 0 0;
    color: #ffebca;
    font-family: var(--font-label);
    font-size: 12px;
    font-weight: 500;
    font-variation-settings: "opsz" 14;
    line-height: 1.4;
    letter-spacing: .4em;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .hero__meta-star { width: 8px; height: 8px; opacity: .9; }

  .hero__meta-hairline {
    flex: 1 0 0;
    height: .5px;
    background: #c8a15a;
  }

  .hero__intro .hero__copy { font-size: 14px; line-height: 23px; letter-spacing: normal; }
}

/* Upright tablets (Figma 692:4936): a 648px column on 60px gutters, 48px off the foot. */
@media (max-aspect-ratio: 4/5) and (min-width: 600px) {
  .dove--near { top: 21px; left: 314px; width: 162px; }
  .dove--far { top: -57px; left: 489px; width: 121px; }
  .dove--mid { top: -19px; left: 956px; width: 166px; }
  .hero__label { display: block; top: calc(var(--hero-art-bottom, 64%) - 855px * var(--hero-scale, .4)); font-size: 15px; }
  .hero__title { font-size: min(160px, (100vw - 120px) / 5.216); }
  .hero__cols { right: 60px; bottom: calc(48px + 100vh - 100svh + var(--hero-lift, 0px)); left: 60px; max-width: 648px; }
  .scroll-cue { display: inline-flex; }
  .hero__intro .hero__copy { font-size: 18px; line-height: 30px; }
  .hero__meta { gap: 14px; margin-bottom: 19px; }
  .hero__meta-label { font-size: 14px; }
  .hero__meta-star { width: 10px; height: 10px; }
  .scroll-cue { gap: 10px; height: 29px; margin-top: 48px; }
  .scroll-cue__label { font-size: 14px; }
  .scroll-cue__circle { width: 29px; height: 29px; }
}

/* Very narrow phones (320–360px): tighter tracking so the meta line and the arch label still fit. */
@media (max-aspect-ratio: 4/5) and (max-width: 360px) {
  .hero__meta { gap: 9px; }
  .hero__meta-label { margin-right: -.28em; font-size: 11px; letter-spacing: .28em; }
  .hero__label { font-size: 9px; letter-spacing: .16em; }
}

/*
 * Landscape phones: the artboard is scaled to the short height and centred, so the columns
 * (kept readable by their own scale) would cover the arch. They move out to the screen's
 * sides instead, 56 artboard px from each edge as on desktop.
 */
@media (orientation: landscape) and (max-height: 540px) {
  .hero__col--left { left: calc(56px - (100vw / var(--stage-scale, 1) - 1440px) / 2); }
  .hero__col--right { left: calc(1208px + (100vw / var(--stage-scale, 1) - 1440px) / 2); }
}

/* Story — Figma 122:14 (section 108:13541). Coordinates are artboard pixels (1440 × 1024). */
.story {
  background: var(--color-story);
  /* Covers the hero's last pixels mid-slide: its edge fade antialiases to a light hairline at the seam. */
  box-shadow: -2px 0 0 var(--color-story);
  color: #fff;
}

/* The 1440 × 1024 artboard, scaled to fit the viewport by journey.js. */
.story__stage {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1440px;
  height: 1024px;
  transform: translate(-50%, -50%) scale(var(--stage-scale, 1));
}

/*
 * Murals creep out of the corners once the story has arrived: each stem draws from
 * its root, and every leaf, flower and palmette buds when the tip passes it.
 * Delays live on the elements (--s/--t for stems, --d for buds, in seconds).
 */
.story__murals {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity .5s ease-out;
}

/* While a period is open, the murals step back behind its detail. */
.story[data-active] .story__murals { opacity: .45; }

/* Artboard sizes × the shared stage scale, pinned to the screen corners. */
.story__mural { position: absolute; }
.story__mural svg { display: block; width: 100%; height: auto; overflow: visible; }
.story__mural--tl { top: 0; left: 0; width: calc(320px * var(--stage-scale, 1)); opacity: .45; }
.story__mural--br { right: 0; bottom: 0; width: calc(560px * var(--stage-scale, 1)); opacity: .62; }

.m-stem {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset .4s ease-in;
}

.m-bud {
  opacity: 0;
  transform: scale(0);
  transform-box: fill-box;
  transition: opacity .3s ease-in, transform .3s ease-in;
}

.m-leaf { transform-origin: 0 50%; }     /* grows from its stalk */
.m-palm { transform-origin: 50% 85%; }   /* opens upward from the tip of the scroll */
.m-flower,
.m-dot { transform-origin: 50% 50%; }

.story.has-arrived .m-stem,
.brilliance__mural.is-grown .m-stem {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset calc(var(--t) * 1s) cubic-bezier(.35, .1, .3, 1) calc(var(--s) * 1s);
}

.story.has-arrived .m-bud,
.brilliance__mural.is-grown .m-bud {
  opacity: 1;
  transform: none;
  transition:
    opacity .35s ease-out calc(var(--d) * 1s),
    transform .7s cubic-bezier(.22, 1, .36, 1) calc(var(--d) * 1s);
}

.story__eyebrow {
  position: absolute;
  top: 241px;
  left: 87px;
  display: flex;
  align-items: center;
}

.story__eyebrow-text {
  margin: 0;
  color: #ffeaca;
  font-family: var(--font-label);
  font-size: 20px;
  font-weight: 500;
  font-variation-settings: "opsz" 14;
  line-height: 28px;
  letter-spacing: .4em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Eight-point star (Figma 124:14), 14px at x 274; hairline 120 × 1 at x 298. */
.story__star {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  background: #c8a15a;
  opacity: .9;
  clip-path: polygon(50% 0, 58% 30.6%, 85.4% 14.6%, 69.4% 42%, 100% 50%, 69.4% 58%, 85.4% 85.4%, 58% 69.4%, 50% 100%, 42% 69.4%, 14.6% 85.4%, 30.6% 58%, 0 50%, 30.6% 42%, 14.6% 14.6%, 42% 30.6%);
}

.story__star--eyebrow {
  position: absolute;
  top: 7px;
  left: 187px;
  width: 14px;
  height: 14px;
}

.story__hairline {
  position: absolute;
  top: 14px;
  left: 211px;
  width: 120px;
  height: 1px;
  background: linear-gradient(to right, rgb(200 161 90 / .8), rgb(200 161 90 / 0));
}

.story__star--a { position: absolute; top: 870px; left: 760px; width: 7px; height: 7px; opacity: .5; }
.story__star--b { position: absolute; top: 470px; left: 1320px; width: 6px; height: 6px; opacity: .45; }

.story__title-line { display: block; }

/* Svetze 220px / 120%; the box is trimmed to cap height, as in Figma (top 303). */
.story__title {
  position: absolute;
  top: 303px;
  left: 87px;
  margin: 0;
  color: #fff;
  font-family: var(--font-display);
  font-size: 220px;
  font-weight: 400;
  line-height: 264px;
  white-space: nowrap;
  text-box-trim: trim-both;
  text-box-edge: cap alphabetic;
}

.story__hint {
  position: absolute;
  top: 948px;
  left: 87px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: rgb(255 255 255 / .55);
  font-family: var(--font-label);
  font-size: 12px;
  font-weight: 500;
  font-variation-settings: "opsz" 14;
  line-height: 16px;
  letter-spacing: 1px;
}

/* The colour-burned splatter in the top right. */
.story__splatter {
  position: absolute;
  top: 0;
  right: 0;
  width: calc(492px * var(--stage-scale, 1));
  height: calc(531px * var(--stage-scale, 1));
  object-fit: cover;
  mix-blend-mode: color-burn;
  pointer-events: none;
}

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

.period {
  position: absolute;
  top: var(--y);
  left: var(--x);
  width: 120px;
  height: 120px;
}

.period__thumb {
  display: block;
  width: 120px;
  height: 120px;
  padding: 0;
  border: 0;
  background: var(--color-story);
  filter: drop-shadow(0 12px 25px rgb(0 0 0 / .45)) brightness(1) saturate(1);
  cursor: default;
  transition:
    transform .6s var(--ease-out),
    filter .6s var(--ease-out);
}

.period__thumb img {
  width: 120px;
  height: 120px;
  object-fit: cover;
}

.period__badge {
  position: absolute;
  top: -12px;
  left: -12px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0 0 0 1.5px; /* balances the trailing letter-spacing */
  border: 1px solid #c8a15a;
  border-radius: 20px;
  background: var(--color-story);
  color: #c8a15a;
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 500;
  font-variation-settings: "opsz" 14;
  line-height: 1;
  letter-spacing: 1.5px;
  pointer-events: none;
}

.period__thumb:focus-visible {
  outline: 1px solid var(--color-story-copy);
  outline-offset: 6px;
}

/* The period being read lifts; the others step back. */
.period.is-active .period__thumb {
  transform: translateY(-4px) scale(1.04);
  filter: drop-shadow(0 20px 32px rgb(0 0 0 / .55)) brightness(1) saturate(1);
}

.story[data-active] .period:not(.is-active) .period__thumb {
  filter: drop-shadow(0 12px 25px rgb(0 0 0 / .45)) brightness(.55) saturate(.7);
}

/* Every period's detail shares one spot on the artboard: (666, 840), 184px tall. */
.period__detail {
  position: absolute;
  top: calc(840px - var(--y));
  left: calc(666px - var(--x));
  z-index: 1;
  display: flex;
  gap: 32px;
  width: 311px;
  height: 184px;
  opacity: 0;
  pointer-events: none;
  /* Leaving is quick, so the next period never overlaps it. */
  transition: opacity .16s ease-out;
}

.period__rule {
  position: relative;
  flex: none;
  width: 0;
  height: 184px;
  transform: scaleY(0);
  transform-origin: top;
  transition: transform .2s ease-out;
}

.period__rule img {
  position: absolute;
  top: -1.44338px;
  left: -1.44338px;
  max-width: none;
}

.period__copy {
  width: 279px;
  color: var(--color-story-copy);
}

.period__label,
.period__name,
.period__summary {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .2s ease-out, transform .2s ease-out;
}

.period__label {
  --stagger: .12s;
  margin: 0 0 3px;
  font-family: var(--font-label);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: .72px;
  text-transform: uppercase;
}

.period__name {
  --stagger: .2s;
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 400;
  line-height: 1.2;
}

.period__summary {
  --stagger: .28s;
  margin: 0;
  font-family: var(--font-label);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

/* "Enduring Brilliance" stays on one line, so period III is wider (37:8660). */
.period--3 .period__detail { width: 372px; }
.period--3 .period__copy { width: 340px; }
.period--3 .period__name { white-space: nowrap; }

/* Enter: rule draws first, then label → title → summary. --enter-delay waits for an outgoing period. */
.period.is-active .period__detail {
  opacity: 1;
  transition: opacity .3s ease-out var(--enter-delay, 0s);
}

.period.is-active .period__rule {
  transform: none;
  transition: transform .8s var(--ease-out) var(--enter-delay, 0s);
}

.period.is-active :is(.period__label, .period__name, .period__summary) {
  opacity: 1;
  transform: none;
  transition:
    opacity .6s var(--ease-out) calc(var(--enter-delay, 0s) + var(--stagger)),
    transform .7s var(--ease-out) calc(var(--enter-delay, 0s) + var(--stagger));
}

/* Diving into a period (lib/dive.js; .is-diving on the journey, or on the map for period II):
   the story card hands over to the flying card, and the story stops reacting to the pointer. */
.is-diving .story__stage { will-change: transform; }
.is-diving .periods { pointer-events: none; }
.is-diving .period__detail { visibility: hidden; }
.period.is-flying .period__thumb { visibility: hidden; }

/* Desktop says "Hover"; portrait screens, where the scroll opens the age, say "Scroll". */
.story__hint-scroll { display: none; }

/* The closing slider after period I exists only on portrait screens (see below). */
.next-period { display: none; }

/* Compact layout only (see below). */
.story__eyebrow-lead,
.story__progress { display: none; }

/*
 * Compact story (Figma 671:1096 phone, 692:5032 tablet): no artboard, everything centred. The
 * eyebrow "—— ★ The story ★ ——", the title, then the periods as a slider nobody hovers or swipes:
 * the active card in the middle, the next one peeking in at the right edge. The page scroll makes
 * period I the active card once the story has arrived (script.js → lib/periods.js); its detail
 * enters under it, then three thin segments (the active age in gold) and the hint. The dive then
 * flies from that card (lib/dive.js measures it). The track moves the active card to the middle
 * (--slide), which the closing section after period I uses to move on to period II
 * (lib/next-period.js). Rhythm 8 / 32 / 48 / 32 / 32, as Figma.
 */
@media (max-aspect-ratio: 4/5) {
  .story__stage,
  .next-period__stage {
    --card: max(160px, min(300px, 77vw, 100vh - 544px));
    --gap: 12px;
    --detail: var(--card);
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 40px 0 28px;
    text-align: center;
    transform: none;
    /* The dive zooms the stage about a point in screen px (lib/dive.js). */
    transform-origin: 0 0;
  }

  .story__mural--tl { width: 140px; }
  .story__mural--br { width: 190px; opacity: .45; }
  .story__splatter { width: 210px; height: 227px; opacity: .35; }
  .story__star--a,
  .story__star--b { display: none; }

  :is(.story, .next-period) :is(.story__eyebrow, .story__title, .story__hint) { margin-inline: 20px; }

  .story__eyebrow { position: relative; top: auto; left: auto; gap: 10px; margin-bottom: 8px; }
  .story__eyebrow-lead { display: inline-block; }
  .story__eyebrow-text { margin-right: -.4em; font-size: 12px; line-height: 1.4; }
  .story__star--eyebrow,
  .story__eyebrow .story__star { position: static; width: 8px; height: 8px; }
  .story__hairline { position: static; width: 32px; height: 1px; }

  .story__title {
    position: static;
    margin-bottom: 32px;
    font-size: min(64px, (100vw - 40px) / 5.65);
    line-height: 1;
    letter-spacing: -.02em;
  }

  /* The slider: the active card centred, the next ones waiting to the right. */
  .periods {
    position: relative;
    display: flex;
    flex: none;
    gap: var(--gap);
    align-self: stretch;
    /* Room for the active card's detail under it. */
    margin-bottom: calc(48px + var(--detail-height, 119px) + 32px);
    padding-left: calc((100% - var(--card)) / 2);
    transform: translateX(calc(var(--slide, 0) * -1 * (var(--card) + var(--gap))));
    transition: transform 1.1s cubic-bezier(.65, 0, .35, 1);
  }

  .period {
    position: relative;
    top: auto;
    left: auto;
    flex: none;
    width: var(--card);
    height: var(--card);
  }

  .period__thumb,
  .period__thumb img { width: var(--card); height: var(--card); }

  .period { transition: opacity .7s var(--ease-out); }
  .period.is-past { opacity: 0; }

  /* Waiting cards at 45%; the active one comes forward (filter only, so its box never moves). */
  .period__thumb {
    filter: drop-shadow(0 12px 25px rgb(0 0 0 / .45)) brightness(.45);
    cursor: default;
  }

  .period.is-active .period__thumb,
  [data-active] .period.is-active .period__thumb {
    transform: none;
    filter: drop-shadow(0 18px 30px rgb(0 0 0 / .55)) brightness(1);
  }

  .period__badge { top: -10px; left: -10px; }
  .period:not(.is-active) .period__badge { opacity: .6; }

  /* The detail sits centred under its own card, so it is under the front card whichever is active. */
  .period__detail,
  .period--3 .period__detail {
    top: calc(var(--card) + 48px);
    left: calc((var(--card) - var(--detail)) / 2);
    display: block;
    width: var(--detail);
    height: auto;
    text-align: center;
  }

  .period__rule { display: none; }

  .period__copy,
  .period--3 .period__copy { width: auto; }

  .period__label { margin-bottom: 8px; font-size: 11px; line-height: 1.4; letter-spacing: .3em; }
  .period__name { margin-bottom: 16px; font-size: 30px; line-height: 1.15; letter-spacing: -.01em; }
  .period--3 .period__name { white-space: normal; }
  .period__summary { font-size: 14px; line-height: 23px; }

  /* Three thin segments, the age in front in gold and twice as long. */
  .story__progress { display: flex; gap: 6px; margin-bottom: 32px; }
  .story__progress span { width: 14px; height: 2px; background: rgb(255 255 255 / .25); transition: width .6s var(--ease-out), background-color .6s var(--ease-out); }
  :is(.story__stage, .next-period__stage):has(.period--1.is-active) .story__progress span:nth-child(1),
  :is(.story__stage, .next-period__stage):has(.period--2.is-active) .story__progress span:nth-child(2),
  :is(.story__stage, .next-period__stage):has(.period--3.is-active) .story__progress span:nth-child(3) { width: 28px; background: #c8a15a; }
  :is(.story__stage, .next-period__stage):not(:has(.is-active)) .story__progress span:nth-child(1) { width: 28px; background: #c8a15a; }

  .story__hint { position: static; gap: 10px; font-size: 10px; line-height: 1.4; letter-spacing: .3em; text-transform: uppercase; }
  .story__hint-hover { display: none; }
  .story__hint-scroll { display: inline; }

  /* The closing slider: pinned for a while, the scroll moves it from period I to period II. */
  .next-period {
    position: relative;
    display: none;
    height: 260vh;
    background: var(--color-story);
    color: #fff;
  }

  .next-period__viewport {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: clip;
  }

  .next-period__stage { position: absolute; }
  .next-period .story__progress { display: none; }

  /* The compact layout ends on the closing line (the footer is off the page). */
  .language ~ :not(.language-smoke) { display: none; }
}

/* Upright tablets (Figma 692:5032): cards 480, the detail across the 648 column. */
@media (max-aspect-ratio: 4/5) and (min-width: 600px) {
  .story__stage,
  .next-period__stage {
    --card: max(240px, min(480px, 62.5vw, 100vh - 544px));
    --gap: 16px;
    --detail: min(648px, 100vw - 120px);
    padding-block: 34px;
  }
  :is(.story, .next-period) :is(.story__eyebrow, .story__title, .story__hint) { margin-inline: 60px; }
  .story__eyebrow { gap: 12px; margin-bottom: 10px; }
  .story__eyebrow-text { font-size: 14px; }
  .story__star--eyebrow,
  .story__eyebrow .story__star { width: 10px; height: 10px; }
  .story__hairline { width: 38px; }
  .story__title { font-size: min(96px, (100vw - 120px) / 5.65); }
  .periods { margin-bottom: calc(32px + var(--detail-height, 123px) + 24px); }
  .period__detail,
  .period--3 .period__detail { top: calc(var(--card) + 32px); }
  .period__badge { width: 28px; height: 28px; }
  .period__label { margin-bottom: 10px; font-size: 13px; }
  .period__name { margin-bottom: 19px; font-size: 40px; }
  .period__summary { font-size: 18px; line-height: 30px; }
  .story__progress { gap: 7px; margin-bottom: 24px; }
  .story__progress span { width: 17px; }
  :is(.story__stage, .next-period__stage):has(.period--1.is-active) .story__progress span:nth-child(1),
  :is(.story__stage, .next-period__stage):has(.period--2.is-active) .story__progress span:nth-child(2),
  :is(.story__stage, .next-period__stage):has(.period--3.is-active) .story__progress span:nth-child(3),
  :is(.story__stage, .next-period__stage):not(:has(.is-active)) .story__progress span:nth-child(1) { width: 34px; }
  .story__hint { gap: 12px; font-size: 12px; }
  .story__hint .story__star { width: 10px; height: 10px; }
  .story__mural--tl { width: 168px; }
  .story__mural--br { width: 228px; }
  .story__splatter { width: 252px; height: 272px; }
}

/* Short phones (under 700px tall): a tighter rhythm so the card keeps its size. */
@media (max-aspect-ratio: 4/5) and (max-height: 700px) {
  .story__stage,
  .next-period__stage { --card: max(160px, min(300px, 77vw, 100vh - 470px)); padding-block: 20px; }
  .story__title { margin-bottom: 20px; font-size: min(52px, (100vw - 40px) / 5.65); }
  .periods { margin-bottom: calc(28px + var(--detail-height, 119px) + 20px); }
  .period__detail,
  .period--3 .period__detail { top: calc(var(--card) + 28px); }
  .story__progress { margin-bottom: 20px; }
}
.period__badge { transition: opacity .3s ease-out; }
.period.is-flying .period__badge { opacity: 0; }

/*
 * Period I chapter — Figma 126:13542, a 1440 × 1259 artboard (coordinates below).
 * Pinned over the track; its top 1024px share the story artboard's box, and the
 * remaining 235px scroll into view after the reveal (--read, lib/dive.js).
 * Period II (.chapter--flourishing, below) shares all of it, with its own sizes.
 */
.chapter {
  --height: 1259px;
  --read: 235px;
  position: absolute;
  inset: 0;
  z-index: 1;
  color: #fff;
  pointer-events: none;
  visibility: hidden;
}

.is-diving .chapter { visibility: visible; }
.is-landed .chapter { pointer-events: auto; }

/* The clip that opens from the card to the full screen (clip-path inset set per frame). */
.chapter__reveal {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* Everything that scrolls up by 235 artboard px once the chapter has opened. Its own layer
   isolates blending, so the background lives here for the textures to colour-dodge into. */
.chapter__scroll {
  position: absolute;
  inset: 0 0 auto;
  height: calc(100% + var(--read) * var(--stage-scale, 1));
  background: var(--color-story);
  will-change: transform;
}

/* Texturelabs grunge, 20% colour-dodge, full-bleed (Figma 1886 × 1258 centred on the frame). */
.chapter__grunge {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .2;
  mix-blend-mode: color-dodge;
}

/* Ink paint, 25% colour-dodge, 866 × 578 in the top-right corner (pinned to the screen corner). */
.chapter__ink {
  position: absolute;
  top: calc(1px * var(--stage-scale, 1));
  right: 0;
  width: calc(866px * var(--stage-scale, 1));
  height: calc(578px * var(--stage-scale, 1));
  object-fit: cover;
  opacity: .25;
  mix-blend-mode: color-dodge;
}

/* Same box and scale as the story artboard (centred on the viewport, not the taller scroller), but 1259 tall. */
.chapter__stage {
  position: absolute;
  top: calc(50vh - 512px);
  left: calc(50% - 720px);
  width: 1440px;
  height: var(--height);
  transform: scale(var(--stage-scale, 1));
  transform-origin: 720px 512px;
}

.chapter__heading {
  position: absolute;
  inset: 0;
  /* Its own layer: the reveal repaints only the text, not the textures beneath. */
  will-change: transform;
}

/* Split by lib/heading-reveal.js so each letter and word can rise in on its own. */
.chapter__letter {
  display: inline-block;
  transform-origin: 0 100%;
}

/* A word's letters, kept on one line when the title wraps. */
.chapter__letters { white-space: nowrap; }

.chapter__word { display: inline-block; }

/* Frame 25: 1224 wide at (109, 124), 120px gaps, the hairline takes the rest. */
.chapter__meta {
  position: absolute;
  top: 124px;
  left: 109px;
  display: flex;
  gap: 120px;
  align-items: center;
  width: 1224px;
}

.chapter__kicker {
  margin: 0;
  color: #ffebca;
  font-family: var(--font-label);
  font-size: 28px;
  font-weight: 500;
  font-variation-settings: "opsz" 14;
  line-height: 1.4;
  letter-spacing: .4em;
  text-transform: uppercase;
  white-space: nowrap;
  /* Figma's box ends at the last letter; CSS adds tracking after it. */
  margin-right: -.4em;
}

.chapter__star {
  width: 14px;
  height: 14px;
  opacity: 1;
}

.chapter__hairline {
  flex: 1 0 0;
  height: .5px;
  background: #c8a15a;
}

/* Svetze 240px / 120%, −2% tracking; box trimmed to cap height, as in Figma (92, 215). */
.chapter__title {
  position: absolute;
  top: 215px;
  left: 92px;
  margin: 0;
  font-family: var(--font-display);
  font-size: 240px;
  font-weight: 400;
  line-height: 288px;
  letter-spacing: -4.8px;
  white-space: nowrap;
  text-box-trim: trim-both;
  text-box-edge: cap alphabetic;
}

/* 560 wide, centred, at y 435. Figma sets this in Aref Ruqaa Ink; the site uses DM Sans only. */
.chapter__intro {
  position: absolute;
  top: 435px;
  left: 440px;
  width: 560px;
  margin: 0;
  font-family: var(--font-label);
  font-size: 20px;
  line-height: 1.5;
  letter-spacing: .2px;
  text-align: center;
}

/* Figma "image 14": 1254 × 682 at (93, 577), showing the top of the square painting. */
.chapter__image {
  position: absolute;
  top: 577px;
  left: 93px;
  width: 1254px;
  height: 682px;
  overflow: hidden;
}

.chapter__image img {
  width: 1254px;
  height: 1254px;
}

/*
 * The background's fade (lib/dive.js): once the story has faded the hard clip hands over to a
 * layer in the story colour over the chapter's background (not its heading), which fades out as
 * the title is nearly in. One viewport tall, inside the taller scroller.
 */
.chapter__veil {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: var(--color-story);
  visibility: hidden;
  pointer-events: none;
  will-change: opacity;
}

/* The flying card shares the story artboard's box so it can start exactly on the story card. */
.dive {
  position: absolute;
  top: calc(50% - 512px);
  left: calc(50% - 720px);
  width: 1440px;
  height: 1024px;
  transform: scale(var(--stage-scale, 1));
  transform-origin: 720px 512px;
}

/* Full size (1254px), scaled down: it stays sharp as it grows toward the camera. */
.dive__card {
  position: absolute;
  top: 0;
  left: 0;
  width: 1254px;
  height: 1254px;
  transform-origin: 0 0;
  will-change: transform;
}

.dive__card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* The story card's drop shadow (0 12 25, 45%) at 1254 / 120 scale; fades as the card lands. */
.dive__shadow {
  position: absolute;
  inset: 0;
  box-shadow: 0 125px 261px rgb(0 0 0 / .45);
}

/* Landed: the chapter's own image takes over from the identical flying card. */
.chapter__image,
.is-landed .dive { visibility: hidden; }
/* Docked (the card at rest on it, lib/dive.js), the painting is already drawn under the card. */
.is-docked .chapter__image,
.is-landed .chapter__image { visibility: visible; }

/*
 * Period II chapter — Figma 226:451, a 1440 × 1114 artboard, opened from card II of the map after
 * the Period I closing (lib/period-map.js). Period I's chapter with its own ground (#5e4935 under
 * a soft-light texture), the title on two lines, and the meta row low, between title and painting.
 */
.chapter--flourishing {
  --height: 1114px;
  --read: 90px;
}

.chapter--flourishing .chapter__scroll { background: #5e4935; }

/* Figma "image 30": 1888 × 1259 across the top of the frame, soft light. Full-bleed here. */
.chapter__texture {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  mix-blend-mode: soft-light;
}

.chapter__grain {
  position: absolute;
  inset: 0;
  opacity: .06;
  pointer-events: none;
}

/* Frame 25: 1280 wide at (80, 791), a label at either end. */
.chapter--flourishing .chapter__meta {
  top: 791px;
  left: 80px;
  width: 1280px;
  justify-content: space-between;
}

/* Svetze 240px / 110%, −2%; 1134 wide, so it breaks after "The". Trimmed to cap height at (109, 128). */
.chapter--flourishing .chapter__title {
  top: 128px;
  left: 109px;
  width: 1134px;
  line-height: 264px;
  white-space: normal;
}

/* 424 wide at (725, 227), ranged left (Aref Ruqaa Ink in Figma, DM Sans here). */
.chapter--flourishing .chapter__intro {
  top: 227px;
  left: 725px;
  width: 424px;
  text-align: left;
}

/* Frame 41: 735 wide at (353, 671), showing the top of the square painting. Its 569px box runs
   past the frame's bottom edge (1114) and is cut there, so it ends there. */
.chapter--flourishing .chapter__image {
  top: 671px;
  left: 353px;
  width: 735px;
  height: 443px;
}

.chapter--flourishing .chapter__image img {
  width: 735px;
  height: 735px;
}

/* The flying card lands at 735px. It leaves card II stepped forward, so its shadow is that
   card's lifted one (0 20 32, 55%) at 735 / 124.8. */
.chapter--flourishing .dive__card {
  width: 735px;
  height: 735px;
}

.chapter--flourishing .dive__shadow { box-shadow: 0 118px 188px rgb(0 0 0 / .55); }

/*
 * Compact Flourishing chapter (Figma 619:2722 phone, 708:328 tablet): ranged left from 52px (64px)
 * down: "The / Flourishing" across the column, the intro (Aref Ruqaa Ink, as Figma), the meta line
 * 24px under it, then the painting 16px further down to the screen's foot (the top of the square,
 * where the card from the map lands, lib/dive.js).
 */
@media (max-aspect-ratio: 4/5) {
  .chapter--flourishing { --read: 0px; }
  .chapter--flourishing .chapter__stage { justify-content: flex-start; padding-top: 52px; }
  .chapter--flourishing .chapter__heading { align-items: stretch; text-align: left; }
  .chapter--flourishing .chapter__meta { inset: auto; order: 3; width: 100%; margin: 24px 0 0; }
  .chapter--flourishing .chapter__title {
    inset: auto;
    width: auto;
    font-size: calc((100vw - 40px) / 5.47);
    line-height: 1;
  }
  .chapter--flourishing .chapter__intro {
    inset: auto;
    width: auto;
    max-width: none;
    margin-top: 16px;
    font-family: var(--font-ruqaa);
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: .01em;
    text-align: left;
  }
  .chapter--flourishing .chapter__image {
    inset: auto;
    flex: 1 1 0;
    width: 100%;
    height: auto;
    margin-top: 16px;
    overflow: hidden;
  }
  .chapter--flourishing .chapter__image img { width: 100%; height: 100%; object-fit: cover; }
  .chapter--flourishing .dive__card { width: 300px; height: 300px; }
}

@media (max-aspect-ratio: 4/5) and (min-width: 600px) {
  .chapter--flourishing .chapter__stage { padding-top: 64px; }
  .chapter--flourishing .chapter__title { font-size: calc((100vw - 120px) / 5.47); }
  .chapter--flourishing .chapter__intro { max-width: 449px; font-size: 18px; }
  .chapter--flourishing .chapter__image { width: 100%; margin: 24px 0 0; }
  .chapter--flourishing .dive__card { width: 480px; height: 480px; }
}

/*
 * Compact chapter (Figma 603:2722 phone, 692:5577 tablet). One viewport, no read: the meta line
 * (labels at either end, a short hairline between), "Foundations" across the column, the intro,
 * and the painting under them down to the bottom edge (a square when there is room, its top part
 * otherwise). Rhythm 8 / 16 / 22 (tablet 8 / 16 / 40). lib/dive.js measures the painting's box
 * and lands the flying card on it, and lib/heading-reveal.js runs the same letter-by-letter
 * reveal (its distances are in em, so they keep their proportions here).
 */
@media (max-aspect-ratio: 4/5) {
  :root { --chapter-read: 0px; }
  .journey .chapter { --read: 0px; }

  .chapter__stage {
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    padding: 52px 20px 0;
    transform: none;
  }

  .chapter__heading {
    position: relative;
    inset: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .chapter__meta,
  .chapter--flourishing .chapter__meta {
    position: static;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    margin-bottom: 8px;
  }

  .chapter__kicker { font-size: 12px; }
  .chapter__meta .chapter__star { width: 8px; height: 8px; }
  .chapter__meta .chapter__hairline { flex: 1 1 0; }

  /* "Foundations" with −2% tracking is 5.21em wide: 64px on a 390 phone. */
  .chapter__title {
    position: static;
    font-size: min(200px, (100vw - 40px) / 5.21);
    line-height: 1;
    letter-spacing: -.02em;
  }

  .chapter__intro {
    position: static;
    width: auto;
    max-width: 330px;
    margin-top: 16px;
    font-size: 14px;
    line-height: 23px;
  }

  /* The painting runs to the screen's foot, cropped to fill (lib/dive.js lands the card on it). */
  .chapter__image {
    position: relative;
    top: auto;
    left: auto;
    flex: 1 1 0;
    width: 100%;
    min-height: 140px;
    margin-top: 22px;
    overflow: hidden;
  }

  .chapter__image img { width: 100%; height: 100%; object-fit: cover; }

  .chapter__ink { top: 0; left: auto; right: 0; width: 320px; height: 214px; }

  /* The flying card works in screen px here (lib/dive.js), not in the artboard. */
  .dive {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: none;
  }
}

/* Upright tablets (Figma 692:5577): the 648 column on 60px gutters. */
@media (max-aspect-ratio: 4/5) and (min-width: 600px) {
  .chapter__stage { padding: 64px 60px 0; }
  .chapter__title { font-size: min(200px, (100vw - 120px) / 5.21); }
  .chapter__kicker { font-size: 14px; }
  .chapter__meta .chapter__star { width: 10px; height: 10px; }
  .chapter__intro { max-width: 620px; font-size: 18px; line-height: 30px; letter-spacing: normal; }
  /* The painting runs 15px past the column on either side (Figma 692:5577). */
  .chapter__image { width: calc(100% + 30px); margin: 40px -15px 0; }
  .chapter__ink { width: 384px; height: 257px; }

  /* Period I (the user's tablet reference, 2026-11-23): the meta row a little lower, its stars set
     apart with a short hairline between them, and more air between title, intro and painting. */
  .journey .chapter:not(.chapter--flourishing) .chapter__stage { padding-top: 74px; }
  .journey .chapter:not(.chapter--flourishing) .chapter__meta { margin-bottom: 14px; }
  .journey .chapter:not(.chapter--flourishing) .chapter__meta .chapter__hairline { flex: 0 0 116px; }
  .journey .chapter:not(.chapter--flourishing) .chapter__intro { margin-top: 40px; }
  .journey .chapter:not(.chapter--flourishing) .chapter__image { margin-top: 48px; }
}

/*
 * Period I scenes — Figma 153:14207 and 158:91, 1440 × 1249 artboards in normal page flow after
 * the journey. Same stage scale and centring as the chapter, so the columns sit under its painting.
 */
.scene {
  position: relative;
  height: calc(1249px * var(--stage-scale, 1));
  overflow: hidden;
  color: #0b0a0a;
}

.scene--new-centre { background: #efefef; }

/*
 * Scene 2 rests over scene 1's empty bottom: 126px, from the painting's bottom edge (1123) to the
 * end of the artboard (1249), so it stops right under the painting. lib/scenes.js holds it down by
 * that much at first and lets it slide up over scene 1 as the page scrolls (--overlap 0 → 1); its
 * soft shadow on scene 1 fades as it settles. Without JS it simply rests there.
 */
.scene--river {
  margin-top: calc(-126px * var(--stage-scale, 1));
  background: #fff;
  box-shadow: 0 calc(-18px * var(--stage-scale, 1)) calc(64px * var(--stage-scale, 1)) rgb(11 10 10 / calc(.1 * (1 - var(--overlap, 1))));
}

/*
 * Lift-off from the chapter to scene 1. The cover is pulled up over the journey's last viewport
 * and painted beneath it (z-index −1, so the journey's blend modes stay unisolated): scene 1 sticks
 * to the top behind the pinned chapter, the chapter then scrolls up off it, and the scene holds
 * there for --scene-hold more so its parts finish rising in before it scrolls on as usual.
 * --uncover (0 → 1, set by lib/scenes.js on scene 1 and on the journey, whose shadow reads it)
 * follows the chapter's bottom edge up the screen; without JS it stays 1 (:root).
 */
:root { --uncover: 1; --scene-hold: 35vh; }

/* Stopped where nothing further down reads it, so each change restyles a handful of elements and
   not the journey's ±850 or the scene's whole content. */
#journey > *,
.scene-cover .scene__stage > * { --uncover: 1; }

@media (prefers-reduced-motion: reduce) {
  /* Nothing rises in, so there is nothing to wait for. */
  :root { --scene-hold: 0px; }
}

.scene-cover {
  position: relative;
  z-index: -1;
  height: calc(100vh + var(--scene-hold) + 1249px * var(--stage-scale, 1));
  margin-top: -100vh;
}

.scene-cover > .scene {
  position: sticky;
  top: 0;
}

/* Still in the chapter's shade and slightly sunk while covered; it comes up into the light as the
   chapter lifts away. */
.scene-cover .scene__stage {
  scale: calc(.985 + .015 * var(--uncover));
  translate: 0 calc((1 - var(--uncover)) * 28px);
}

.scene-cover .scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-story);
  opacity: calc((1 - var(--uncover)) * .22);
  pointer-events: none;
}

/* The lifting chapter casts a long, faint shadow onto the scene below its bottom edge (eased
   stops, so it has no visible start); it fades over the last 40% of the lift, so none of it stays
   on the uncovered scene. */
.journey::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: calc(360px * var(--stage-scale, 1));
  background: linear-gradient(rgb(23 6 1 / .3), rgb(23 6 1 / .17) 20%, rgb(23 6 1 / .08) 42%, rgb(23 6 1 / .025) 68%, rgb(23 6 1 / 0));
  opacity: clamp(0, calc((1 - var(--uncover)) * 2.5), 1);
  pointer-events: none;
}

.scene__stage {
  position: absolute;
  top: 0;
  left: calc(50% - 720px);
  width: 1440px;
  height: 1249px;
  transform: scale(var(--stage-scale, 1));
  transform-origin: 720px 0;
}

.scene__stage > * { position: absolute; }
.scene p,
.scene h3 { margin: 0; }

/* "01 · 750": DM Sans Medium 20px / 1.4, 40% tracking, at (89, 120). */
.scene__marker {
  top: 120px;
  left: 89px;
  font-family: var(--font-label);
  font-size: 20px;
  font-weight: 500;
  font-variation-settings: "opsz" 14;
  line-height: 1.4;
  letter-spacing: .4em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Svetze 90px / 120%, −2% tracking. */
.scene__title {
  font-family: var(--font-display);
  font-size: 90px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -1.8px;
}

.scene__story {
  font-family: var(--font-label);
  font-size: 18px;
  font-variation-settings: "opsz" 14;
  /* Body text at 18px: 165%, normal tracking, throughout. */
  line-height: 1.65;
  letter-spacing: normal;
}

.scene__image { overflow: hidden; }

.scene__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 153:14207 — title box trimmed to cap height at (397, 120), 691 wide; story at (397, 335). */
.scene--new-centre .scene__title {
  top: 120px;
  left: 397px;
  width: 691px;
  text-box-trim: trim-both;
  text-box-edge: cap alphabetic;
}

.scene--new-centre .scene__story {
  top: 335px;
  left: 397px;
  width: 648px;
}

/* 690 × 640 frame at (397, 483) cropping the 702 × 652 painting by 6px on each side. */
.scene--new-centre .scene__image {
  top: 483px;
  left: 397px;
  width: 690px;
  height: 640px;
}

.scene--new-centre .scene__image img {
  width: 702px;
  height: 652px;
  margin: -6px 0 0 -6px;
}

/* 158:91 — "Text": column at (397, 120), 636 wide, 28px gap. Figma clips the 648px story at 636
   (it loses "y."), so the column does not clip here. The story's last line sets ≈1px wider in
   the browser than in Figma, so it gets 4px more to keep Figma's four lines. */
.scene__text {
  top: 120px;
  left: 397px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  width: 636px;
}

.scene--river .scene__story { width: 652px; }

/* "762": Svetze 440px / 88%, −4% tracking, at (76, 528); the painting overlaps its last digit. */
.scene__year {
  top: 528px;
  left: 76px;
  font-family: var(--font-display);
  font-size: 440px;
  font-weight: 400;
  line-height: .88;
  letter-spacing: -17.6px;
  white-space: nowrap;
}

.scene__image--river {
  top: 624px;
  left: 656px;
  width: 560px;
  height: 420px;
  box-shadow: 10px 10px 30px rgb(4 10 18 / .11);
}

/* "Number in context": 520 wide at (89, 936), 10px gaps. */
.scene__context {
  top: 936px;
  left: 89px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 520px;
  font-family: var(--font-label);
  font-variation-settings: "opsz" 14;
}

.scene__label {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: .4em;
  text-transform: uppercase;
  white-space: nowrap;
}

.scene__star {
  width: 12px;
  height: 12px;
  opacity: 1;
}

.scene__caption {
  font-size: 16px;
  line-height: 1.5;
}

.scene__note {
  color: rgb(11 10 10 / .55);
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
}

/*
 * Compact scenes 1 and 2 (Figma 603:2735 / 603:2741 phone, 692:5592 / 692:5600 tablet): no
 * artboard, one column on the 20px (60px) gutters. The text block (marker →8→ title →16→ story),
 * then the painting 32px (40px) under it. Scene 2 puts the big "762" over its painting, which
 * sits at the column's right, then the year in context. Scene 2 follows scene 1 without the
 * overlap (lib/scenes.js), and scene 1 still waits under the lifting chapter.
 */
@media (max-aspect-ratio: 4/5) {
  .scene { height: auto; }
  .scene-cover { height: auto; }
  .scene-cover::after { content: ""; display: block; height: calc(100vh + var(--scene-hold)); }
  /* Scene 1 fills the screen while it waits under the lifting chapter, so no band shows under it. */
  .scene-cover > .scene { min-height: 100vh; }
  .scene--river { margin-top: 0; box-shadow: none; }

  .scene__stage {
    position: relative;
    left: auto;
    display: flex;
    flex-direction: column;
    width: auto;
    height: auto;
    padding: 64px 20px 80px;
    transform: none;
  }

  .scene--river .scene__stage { padding-bottom: 60px; }

  .scene__stage > *,
  .scene--new-centre .scene__stage > * { position: relative; inset: auto; }

  .scene__marker { font-size: 12px; }

  /* .scene p / .scene h3 zero every margin, so these need the extra class to win. */
  .scene .scene__title,
  .scene--new-centre .scene__title {
    width: auto;
    margin-top: 8px;
    font-size: 40px;
    line-height: 1.05;
    letter-spacing: -.02em;
  }

  .scene__story,
  .scene--new-centre .scene__story,
  .scene--river .scene__story {
    width: auto;
    margin-top: 16px;
    font-size: 14px;
    line-height: 23px;
  }

  .scene__text { gap: 0; width: auto; }

  .scene--new-centre .scene__image {
    width: 100%;
    height: auto;
    aspect-ratio: 350 / 325;
    margin-top: 32px;
  }

  .scene--new-centre .scene__image img { width: 100%; height: 100%; margin: 0; }

  /* "762" (Mobile year 190 / .88, −4%) with the painting over its last digit, at the right. */
  .scene .scene__year {
    margin: 32px 0 0 -8px;
    font-size: calc((100vw - 40px) * 190 / 350);
    letter-spacing: -.04em;
  }

  .scene__image--river {
    width: 94%;
    height: auto;
    aspect-ratio: 4 / 3;
    margin: -23.7% 0 0 auto;
    box-shadow: 6px 6px 20px rgb(4 10 18 / .11);
  }

  .scene__context { gap: 12px; width: auto; margin-top: 32px; }
  .scene__label { font-size: 12px; }
  .scene__caption { font-family: var(--font-ruqaa); font-size: 14px; line-height: 1.5; letter-spacing: .01em; }
  .scene__note { font-size: 13px; line-height: 1.45; white-space: normal; }
}

@media (max-aspect-ratio: 4/5) and (min-width: 600px) {
  .scene__stage,
  .scene--river .scene__stage { padding: 96px 60px; }
  .scene__marker { font-size: 14px; }
  .scene .scene__title,
  .scene--new-centre .scene__title { font-size: 56px; }
  .scene--new-centre .scene__title { max-width: 460px; }
  .scene__story,
  .scene--new-centre .scene__story,
  .scene--river .scene__story { font-size: 18px; line-height: 30px; }
  .scene--new-centre .scene__image { aspect-ratio: 648 / 601; margin-top: 40px; }
  .scene .scene__year { margin: 40px 0 0 -16px; font-size: calc((100vw - 120px) * 360 / 648); }
  .scene__image--river { width: 540px; max-width: 83%; margin-top: -15.6%; }
  .scene__context { margin-top: 40px; }
  .scene__label { font-size: 14px; }
  .scene__star { width: 14px; height: 14px; }
  .scene__caption { max-width: 540px; font-size: 18px; }
  .scene__note { font-size: 15px; }
}

/*
 * Scroll reveal (not in Figma; lib/scenes.js). Armed only with motion allowed, so without JS or
 * with prefers-reduced-motion every part stays where Figma has it. Each part runs once, when it
 * enters the view, after its own --delay.
 */
.scene.is-armed [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
}

.scene.is-armed [data-reveal].is-in {
  opacity: 1;
  transform: none;
  transition:
    opacity .9s var(--ease-out) var(--delay, 0s),
    transform 1.2s var(--ease-out) var(--delay, 0s),
    clip-path 1.4s cubic-bezier(.7, 0, .2, 1) var(--delay, 0s);
}

/* Titles rise word by word once split (they stay hidden until then, so they never flash). */
.scene.is-armed [data-reveal="words"] { transform: none; }
.scene.is-armed [data-reveal="words"]:not(.is-split) { opacity: 0; }
.scene.is-armed [data-reveal="words"].is-split { opacity: 1; }

.scene__word {
  display: inline-block;
  transform-origin: 0 100%;
}

.scene.is-armed .scene__word {
  opacity: 0;
  transform: translate3d(0, 48px, 0) rotate(4deg);
}

.scene.is-armed .is-in .scene__word {
  opacity: 1;
  transform: none;
  transition:
    opacity .8s var(--ease-out) calc(var(--i) * 80ms + 100ms),
    transform 1.1s var(--ease-out) calc(var(--i) * 80ms + 100ms);
}

/* Paintings open from their bottom edge while the picture settles from a slight zoom. */
.scene.is-armed [data-reveal="unveil"] {
  opacity: 1;
  transform: none;
  clip-path: inset(100% 0 0);
}

.scene.is-armed [data-reveal="unveil"] img {
  scale: calc(var(--rest-scale, 1) * 1.08);
  transition: scale 1.8s var(--ease-out) var(--delay, 0s);
}

.scene.is-armed [data-reveal="unveil"].is-in { clip-path: inset(0); }
.scene.is-armed [data-reveal="unveil"].is-in img { scale: var(--rest-scale, 1); }

/* Scene 1's painting drifts inside its frame while the page scrolls (lib/scenes.js, ±64px); it
   rests 20% larger (71px past the top and bottom edges) so the frame never shows its edges. */
.scene.is-armed [data-parallax="inner"] { --rest-scale: 1.2; }

/*
 * Scenes 1 and 2's paintings are moved on every frame: by their parallax (lib/scenes.js), their
 * settling zoom, and for scene 1 the lift-off's scale and drop (.scene-cover). Painted in with the
 * page, each of those frames re-rasterised the painting at a new size, and an image whose pixels
 * were not ready for that size was drawn without them for a frame: the painting blinked as the
 * chapter lifted off (with decoding="sync" the page stalled on it instead). On their own layers
 * they are rasterised once and only moved and scaled by the compositor.
 */
.scene.is-armed [data-parallax="inner"] img,
.scene.is-armed [data-parallax]:not([data-parallax="inner"]),
.scene.is-armed [data-parallax]:not([data-parallax="inner"]) img {
  will-change: transform, translate, scale;
}

/* The year climbs out of its baseline. */
.scene.is-armed [data-reveal="rise"] {
  transform: translate3d(0, 140px, 0);
  clip-path: inset(100% 0 0);
}

.scene.is-armed [data-reveal="rise"].is-in { clip-path: inset(0); }

/* Once a clip has opened it is dropped, so it never trims a glyph or the painting's shadow. */
.scene.is-armed [data-reveal].is-done { clip-path: none; }

/*
 * Scene 3 — "A city drawn as a circle" (Figma "Scene 3 — B final"). A pinned intro (1440 × 1024,
 * lib/city-intro.js), then the Round City plan, drawn in (lib/city-draw.js) and pinned for four
 * steps (same stage scale and centring as the chapter). lib/city.js draws the plan, ring and marks
 * and sets data-step 0–3.
 */
.city {
  --gold: #c8a15a;
  --gold-light: #ecd09a;
  --cream: 255 235 202;
  background: var(--color-story);
  color: #fff;
}

/*
 * Intro (165:108), pinned for 115vh after it reaches the top. lib/city-intro.js clips the white
 * .city__tittle to a circle that starts over the whole screen (scene 2's white carried on) and
 * shrinks onto the dot of the "i" in "city" (set dotless, so the circle is the dot). A gold hairline
 * follows its edge, and two ripples spread from the dot when it lands.
 * The heading reuses the Foundations chapter classes (title and intro, no meta row), so its type
 * and reveal are the same; only positions and the title size (124px, so the longer line spans the
 * same 92–1348) differ. The block is centred on the 1024 artboard: title 262, intro 401, cue 741.
 */
.city__intro { position: relative; height: 215vh; }

.city__intro-viewport {
  position: sticky;
  top: 0;
  height: 100vh;
  /* Sideways only: the white reaches up under scene 2 (see .city__tittle). */
  overflow-x: clip;
}

.city__intro-stage {
  position: absolute;
  top: calc(50% - 512px);
  left: calc(50% - 720px);
  width: 1440px;
  height: 1024px;
  transform: scale(var(--stage-scale, 1));
  transform-origin: 720px 512px;
}

.city__intro-stage > * { position: absolute; margin: 0; }
.city__intro-stage .chapter__title { top: 262px; font-size: 124px; line-height: 149px; letter-spacing: -2.48px; }
.city__intro-stage .chapter__intro { top: 401px; left: 400px; width: 640px; }

.city__tittle,
.city__halo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  pointer-events: none;
}

/* 3px taller than the frame, under scene 2's white: at a fractional seam the antialiased edge
   would otherwise let the dark background through as a grey line. */
.city__tittle { top: -3px; height: calc(100% + 3px); background: #fff; }
.city__intro.is-live .city__tittle,
.city__intro.is-live .city__halo { display: block; }
.city__halo { overflow: hidden; fill: none; stroke: var(--gold); }
.city__halo-edge { stroke-width: 1; }
.city__halo-ripple { stroke-width: 1; opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .city__intro { height: 100vh; }
}

.city__cue {
  top: 741px;
  left: 0;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  width: 1440px;
  color: rgb(var(--cream) / .7);
  font-family: var(--font-label);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: .3em;
  text-transform: uppercase;
}

.city__cue .story__star { width: 12px; height: 12px; opacity: 1; }
.city__cue-arrow { color: var(--gold); font-size: 16px; letter-spacing: 0; animation: city-cue 2.4s var(--ease-out) infinite; }

@keyframes city-cue {
  0%, 100% { translate: 0 0; opacity: 1; }
  50% { translate: 0 5px; opacity: .6; }
}

/* Pinned explorer: one viewport, 80vh for the plan to be drawn in (lib/city-draw.js), then 75vh
   of scroll per step. It rides up over the intro's empty bottom so the plan's compass star sits
   160 artboard px under the intro's cue (cue bottom 764, star top 163; when the screen is taller
   than the artboard, its extra height is taken out too). The viewport's top half is see-through
   so the overlap (at most ~40% of the view) shows the intro beneath; its bottom half is painted
   so the splatter has a backdrop to colour-burn into (sticky makes the viewport its own group).
   At the end the plan holds on Palace: first a rest, so its zoom and panel can be read, then while
   scene 4 opens over it (.capital-cover). lib/city.js leaves both out of the steps. */
.city__explore {
  position: relative;
  height: calc(480vh + var(--capital-rest) + var(--capital-wipe));
  margin-top: calc(761px * var(--stage-scale, 1) - 100vh);
}

.city__viewport {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: clip;
  background: linear-gradient(transparent 50%, var(--color-story) 50%);
}

.city__stage {
  position: absolute;
  top: calc(50% - 512px);
  left: calc(50% - 720px);
  width: 1440px;
  height: 1024px;
  transform: scale(var(--stage-scale, 1));
  transform-origin: 720px 512px;
}

.city__stage > * { position: absolute; margin: 0; }

/* Artboard px left beside the 1440 artboard on each side when the screen is wider than 1440:1024
   (the stage scales by height). The list and panel move out into it, up to 96px further from the
   ring (gap 64 → 160), then the panel widens by up to 50px for shorter lines. */
.city__stage {
  --spare: max(0px, (100vw / var(--stage-scale, 1) - 1440px) / 2);
  --push: min(var(--spare), 96px);
  --grow: min(max(0px, var(--spare) - 96px), 50px);
}

/* Texturelabs splatter (the story's), turned 180° into the bottom-left corner, colour-burn. */
.city__splatter {
  position: absolute;
  bottom: 0;
  left: 0;
  width: calc(278px * var(--stage-scale, 1));
  height: calc(300px * var(--stage-scale, 1));
  object-fit: cover;
  mix-blend-mode: color-burn;
  rotate: 180deg;
  pointer-events: none;
}

/* Progress ring (r 330 around the plan) and the compass star; full-artboard SVG. */
.city__ring {
  inset: 0;
  width: 1440px;
  height: 1024px;
  overflow: visible;
  pointer-events: none;
}

.city__arc {
  stroke-dasharray: var(--ring-length) var(--ring-length);
  stroke-dashoffset: calc(var(--ring-length) * (1 - var(--progress, .25)));
  transition: stroke-dashoffset .8s var(--ease-out);
}

.city__head,
.city__compass {
  transform-box: view-box;
  transform-origin: 720px 520px;
  transition: transform .8s var(--ease-out);
}

.city__compass { transform-box: fill-box; transform-origin: center; transition-duration: .9s; transition-timing-function: cubic-bezier(.65, 0, .35, 1); }
.city__tick { stroke-opacity: .35; transition: stroke-opacity .4s; }

/* While the plan is drawn in: the ring sweeps in clockwise from 12 o'clock (--sweep), and the
   marks, panel and per-step details wait for the drawing to finish. */
.city__ring.is-sweeping {
  -webkit-mask-image: conic-gradient(from 0deg at 720px 520px, #000 var(--sweep, 0deg), transparent 0);
  mask-image: conic-gradient(from 0deg at 720px 520px, #000 var(--sweep, 0deg), transparent 0);
}

.city__explore.is-drawing .city__mark,
.city__explore.is-drawing .city__panel.is-active { visibility: hidden; opacity: 0; }
.city__explore.is-drawing .city__fx.is-active { opacity: 0; }
.city__drawing { pointer-events: none; }
.city__construct > circle { stroke-width: 1.4; stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0; }
.city__bloom { stroke-width: 1; opacity: 0; }
.city__pen { opacity: 0; }

/* The intro's dot on its way to the plan's centre (lib/city-intro.js); 20px, scaled to size. */
.city__seed {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 5;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 18px rgb(255 255 255 / .35);
  opacity: 0;
  pointer-events: none;
  will-change: transform;
}
.city__tick.is-passed { stroke-opacity: .9; }

/* The plan in a 600px lens centred on the artboard (420, 220). */
.city__lens {
  top: 220px;
  left: 420px;
  width: 600px;
  height: 600px;
  overflow: visible;
}

.city__plan { color: var(--gold); }
.city__plan * { vector-effect: non-scaling-stroke; }

/* The camera zooms 4.5× onto the mosque or the palace, and pans between them (transform set by
   city.js). */
.city__camera { transition: transform 1.4s cubic-bezier(.65, 0, .35, 1); }

.city__plan .plan-part,
.city__plan .plan-ring,
.city__plan .plan-court,
.city__plan .plan-ornament { transition: opacity .6s var(--ease-out), color .6s var(--ease-out), filter .8s var(--ease-out); }
.city__plan .plan-part { opacity: .26; }
.city__plan .plan-ring { opacity: .36; }
.city__plan .plan-court { opacity: .7; }
.city__plan .plan-ornament { opacity: .55; }
.city__plan .plan-part.is-active {
  opacity: 1;
  color: var(--gold-light);
  filter: drop-shadow(0 0 3px rgb(236 208 154 / .45));
}

/* The glow sits inside the camera, so a close-up would blow it up 4.5×: there it is kept to
   about the same 3px on screen, and dimmer. */
.city__explore[data-zoomed] .city__plan .plan-part.is-active { filter: drop-shadow(0 0 .7px rgb(236 208 154 / .25)); }

/* No glow while the plan is drawn in: a filter over the whole part would repaint on every frame
   of its sweep. It fades in once the drawing is done. */
.city__explore.is-drawing .city__plan .plan-part.is-active { filter: none; }

/* The lens edge fades and a fine rim appears only while zoomed in. */
.city__lens-edge,
.city__lens-rim { opacity: 0; transition: opacity .8s var(--ease-out); }
.city__explore[data-zoomed] .city__lens-edge,
.city__explore[data-zoomed] .city__lens-rim { opacity: 1; }

/* Focus marks (the gates' brackets) close in. */
.city__mark { visibility: hidden; }
.city__mark.is-active { visibility: visible; }
.city__brackets { transform-box: fill-box; transform-origin: center; opacity: 0; }
.city__mark.is-active .city__brackets { animation: city-brackets .5s var(--ease-out) .2s both; }

@keyframes city-brackets { from { opacity: 0; scale: 1.25; } to { opacity: 1; scale: 1; } }

/* Per-step details. Loops run only while their step is active. */
.city__fx { opacity: 0; transition: opacity .6s var(--ease-out); }
.city__fx.is-active { opacity: 1; }
.city__fx * { animation-play-state: paused; }
.city__fx.is-active * { animation-play-state: running; }

/* 01 · Walls: light glides along the moat; towers light up clockwise. */
.city__shimmer { stroke-dasharray: 40 960; animation: city-shimmer 4s linear infinite; }
@keyframes city-shimmer { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -1000; } }
.city__explore[data-step="0"] .plan-tower { animation: city-tower .9s var(--ease-out) calc(var(--i) * 20ms + .2s) both; }
@keyframes city-tower { 0% { fill: #3d1c0d; } 35% { fill: var(--gold-light); } 100% { fill: #3d1c0d; } }

/* 02 · Gates: domes pop in turn; travellers drift inward along the avenues. */
.plan-dome { transform-box: fill-box; transform-origin: center; }
.city__explore[data-step="1"] .plan-dome { animation: city-dome .6s var(--ease-out) calc(var(--i) * 120ms + .2s) both; }
@keyframes city-dome { 0% { scale: .8; } 60% { scale: 1.12; } 100% { scale: 1; } }
.city__traveller { animation: city-travel 4s cubic-bezier(.45, 0, .55, 1) calc(var(--k) * -2s) infinite; }
@keyframes city-travel { 0% { translate: 0 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { translate: var(--travel) 0; opacity: 0; } }

/* 03 · Mosque and 04 · Palace: the camera's zoom onto the building is the motion. Their close-up
   detail (lib/round-city-plan.js) is too fine for the whole plan, so it fades in only once the
   camera is most of the way there, and out as it leaves. */
.plan-detail { opacity: 0; transition: opacity .4s var(--ease-out); }
.city__explore[data-zoomed] .plan-detail { opacity: 1; transition: opacity .6s var(--ease-out) .7s; }

/* Parts list and panel sit the same distance from the ring (x 390–1050): 64px on a 1440:1024
   screen (longest name ends at 326, panel starts at 1114), up to 160px on wider ones. Both are
   centred on the plan vertically. */
.city__parts { top: 520px; left: calc(143px - var(--push)); width: 230px; translate: 0 -50%; }
.city__parts ol { display: grid; gap: 18px; margin: 0; padding: 0; list-style: none; }

.city__parts-label,
.city__kicker,
.city__next {
  margin: 0;
  font-family: var(--font-label);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: .3em;
  text-transform: uppercase;
}

.city__parts-label { margin-bottom: 18px; color: rgb(var(--cream) / .5); }

.city__part {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: rgb(var(--cream) / .38);
  cursor: pointer;
  font: inherit;
  transition: color .4s var(--ease-out);
}

.city__part:focus-visible { color: rgb(var(--cream) / .7); }
/* Hover only on a real pointer and outside the compact layout (lib/compact.js FINE_POINTER). */
@media (hover: hover) and (min-aspect-ratio: 801/1000) {
  .city__part:hover { color: rgb(var(--cream) / .7); }
}
.city__part:focus-visible { outline: 1px solid var(--gold); outline-offset: 6px; }
.city__part[aria-current="step"] { color: #fff; }

/* The mark grows 8 → 24px by scaling (not width), so changing step never reflows the list; the
   numbers keep the active row's column. */
.city__part-mark {
  width: 24px;
  height: 1.5px;
  background: var(--gold);
  opacity: .35;
  transform: scaleX(.3333);
  transform-origin: 0 50%;
  transition: transform .5s var(--ease-out), opacity .5s;
}

.city__part[aria-current="step"] .city__part-mark { transform: none; opacity: 1; }

.city__part-num {
  color: var(--gold);
  font-family: var(--font-label);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .3em;
  opacity: .55;
}

.city__part[aria-current="step"] .city__part-num { opacity: 1; }
.city__part-name { font-family: var(--font-display); font-size: 32px; line-height: 1.2; }

/* Explanation panel (250–300 wide from x 1114 + push). One panel per step, stacked. */
.city__panels { top: 520px; left: calc(1114px + var(--push)); width: calc(250px + var(--grow)); }

.city__panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  translate: 0 -50%;
  visibility: hidden;
  opacity: 0;
  transition: opacity .25s, visibility 0s .25s;
}

.city__panel.is-active { visibility: visible; opacity: 1; transition: opacity .25s; }
.city__kicker { color: var(--gold); }

.city__heading {
  margin: 14px 0 0;
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 400;
  line-height: 1.2;
}

.city__rule {
  display: block;
  width: 40px;
  height: 1px;
  margin-top: 18px;
  background: var(--gold);
  transform-origin: 0 0;
}

.city__body {
  margin: 18px 0 0;
  color: rgb(240 223 211 / .9);
  font-family: var(--font-label);
  font-size: 16px;
  font-variation-settings: "opsz" 14;
  line-height: 1.65;
}

.city__next { margin-top: 48px; color: rgb(var(--cream) / .45); }

/* Panel entrance: kicker slides in, heading rises word by word, rule draws, body and next fade up. */
.city__panel .city__kicker,
.city__panel .city__word,
.city__panel .city__body,
.city__panel .city__next { opacity: 0; }
.city__panel .city__rule { scale: 0 1; }
.city__word { display: inline-block; }
.city__panel.is-active .city__kicker { animation: city-slide .6s var(--ease-out) .15s both; }
.city__panel.is-active .city__word { animation: city-rise .8s var(--ease-out) calc(var(--i) * 70ms + .25s) both; }
.city__panel.is-active .city__rule { animation: city-draw .6s var(--ease-out) .55s both; }
.city__panel.is-active .city__body { animation: city-rise-soft .7s var(--ease-out) .65s both; }
.city__panel.is-active .city__next { animation: city-rise-soft .7s var(--ease-out) .9s both; }

@keyframes city-slide { from { opacity: 0; translate: 16px 0; } to { opacity: 1; translate: 0 0; } }
@keyframes city-rise { from { opacity: 0; translate: 0 .5em; } to { opacity: 1; translate: 0 0; } }
@keyframes city-rise-soft { from { opacity: 0; translate: 0 12px; } to { opacity: 1; translate: 0 0; } }
@keyframes city-draw { from { scale: 0 1; } to { scale: 1 1; } }

/*
 * Compact Round City (Figma 607:2721 intro, 607:2728…5579 plan; tablet 692:5615, 692:5623…8465).
 * The intro is one centred column 64px (96px) from the top: title, story, the cue. The plan is one
 * pinned screen on the gutters: the four parts as a row of tabs at the top (number over name, the
 * active one marked under it), the plan under them (ring 340 / lens 309 on a 390 phone; 470 / 415
 * on a tablet; smaller on a short screen), then the panel, its "Next" cue on the foot. The tabs
 * only show the step: the scroll moves it (lib/city.js takes no click in the compact layout).
 */
@media (max-aspect-ratio: 4/5) {
  /* The intro is pinned for a while on its own screen, so it sits in the middle of it (Figma's
     64 / 60 kept as the least room above and below). */
  .city__intro-stage {
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 64px 20px 60px;
    text-align: center;
    transform: none;
  }

  .city__intro-stage > *,
  .city__intro-stage > .chapter__title,
  .city__intro-stage > .chapter__intro { position: relative; inset: auto; }

  .city__intro-stage .chapter__title {
    width: auto;
    white-space: normal;
    font-size: 40px;
    line-height: 1.05;
    letter-spacing: -.02em;
  }

  .city__intro-stage .chapter__intro {
    width: auto;
    max-width: 350px;
    margin-top: 16px;
    font-size: 14px;
    line-height: 23px;
  }

  .city__cue {
    gap: 10px;
    width: auto;
    margin-top: 24px;
    font-size: 12px;
    letter-spacing: .4em;
  }

  .city__explore { margin-top: 0; }
  .city__viewport { background: var(--color-story); }

  .city__stage {
    /* The plan's box: 380 tall on an 844 phone, less on a shorter one; the lens is 309/380 of it. */
    --box: max(220px, min(380px, 100vh - 464px, (100vw - 40px) * 380 / 350));
    --lens: calc(var(--box) * 309 / 380);
    --cy: calc(144px + var(--box) / 2);
    --spare: 0px;
    --push: 0px;
    --grow: 0px;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: none;
  }

  .city__splatter { width: 140px; height: 150px; }

  /* The ring's artboard (1440 × 1024, centre 720, 520) and the lens (600), sized around the centre. */
  .city__ring {
    top: calc(var(--cy) - var(--lens) * 520 / 600);
    left: calc(50% - var(--lens) * 720 / 600);
    width: calc(var(--lens) * 1440 / 600);
    height: calc(var(--lens) * 1024 / 600);
  }

  .city__ring.is-sweeping {
    -webkit-mask-image: conic-gradient(from 0deg at 50% 50.78%, #000 var(--sweep, 0deg), transparent 0);
    mask-image: conic-gradient(from 0deg at 50% 50.78%, #000 var(--sweep, 0deg), transparent 0);
  }

  .city__lens {
    top: calc(var(--cy) - var(--lens) / 2);
    left: calc(50% - var(--lens) / 2);
    width: var(--lens);
    height: var(--lens);
  }

  /* The tabs: four in a row across the column, number over name, the mark under. */
  .city__parts {
    top: 64px;
    right: 20px;
    left: 20px;
    width: auto;
    translate: none;
  }

  .city__parts-label { display: none; }
  .city__parts ol { display: flex; justify-content: space-between; gap: 0; }

  .city__part {
    display: grid;
    justify-items: center;
    gap: 4px;
    cursor: default;
  }

  .city__part-num { order: 1; font-size: 10px; line-height: 1.4; }
  .city__part-name { order: 2; font-size: 20px; line-height: 1.2; }

  .city__part-mark {
    order: 3;
    width: 20px;
    height: 2px;
    margin-top: 0;
    transform: scaleX(.3);
    transform-origin: 50% 50%;
    opacity: 0;
  }

  .city__part[aria-current="step"] .city__part-mark { opacity: 1; }

  /* The panel under the plan, to the foot; "Next" sits on the foot. */
  .city__panels {
    top: calc(144px + var(--box) + 32px);
    right: 20px;
    bottom: calc(28px + 100vh - 100svh);
    left: 20px;
    width: auto;
  }

  .city__panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    translate: none;
  }

  .city__kicker { font-size: 11px; }
  .city__heading { margin-top: 8px; font-size: 24px; line-height: 1.2; }
  .city__rule { margin-top: 16px; }
  .city__body { margin-top: 16px; font-size: 14px; line-height: 23px; }
  .city__next { margin-top: auto; padding-top: 16px; font-size: 11px; }
}

@media (max-aspect-ratio: 4/5) and (min-width: 600px) {
  .city__intro-stage { padding: 96px 60px; }
  .city__intro-stage .chapter__title { font-size: 56px; }
  .city__intro-stage .chapter__intro { max-width: 560px; font-size: 18px; line-height: 30px; }
  .city__cue { gap: 12px; margin-top: 40px; font-size: 14px; }

  /* The tabs well clear of the navbar (104), the plan under them from 200, as large as the view
     leaves room for (its width less the column's margins; its height less the tabs above and the
     panel, 32 + about 230, and 40 below). */
  .city__stage {
    --box: max(300px, min(100vw - 120px, 100vh - 502px));
    --lens: calc(var(--box) * 415 / 510);
    --cy: calc(200px + var(--box) / 2);
  }

  .city__parts { top: 104px; right: 60px; left: 60px; }
  .city__part-num { font-size: 12px; }
  .city__part-name { font-size: 26px; }
  .city__part-mark { width: 24px; }
  .city__panels { top: calc(200px + var(--box) + 32px); right: 60px; bottom: calc(40px + 100vh - 100svh); left: 60px; }
  .city__kicker { font-size: 13px; }
  .city__heading { font-size: 32px; }
  .city__body { font-size: 18px; line-height: 30px; }
  .city__next { font-size: 13px; }
}

/*
 * Scene 4 — "A capital that drew the world in" (Figma 172:376; routes and ruling from 182:49). A
 * 1440 × 1533 artboard on #442f1e under the Texturelabs plaster at 60% overlay (2066 × 1533,
 * centred: full-bleed here), with 80px more plaster below Figma's artboard (--capital-height),
 * so its last lines are read in full, with room to spare, before the next section covers it. It
 * reveals like scenes 1–2 (lib/scenes.js). The side paintings, the place labels and the routes
 * reach the edges of the view: --spare is the artboard px left beside the stage on a wider
 * screen (as in .city__stage), and lib/capital.js leads the routes out to it.
 */
.scene--capital {
  --spare: max(0px, (100vw / var(--stage-scale, 1) - 1440px) / 2);
  --gold: #c8a15a;
  --cream: 255 229 189;
  height: calc(var(--capital-height) * var(--stage-scale, 1));
  background: #442f1e;
  color: #fff;
  isolation: isolate;
}

.scene--capital::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("assets/capital/ink-plaster.avif") center / cover;
  opacity: .6;
  mix-blend-mode: overlay;
  pointer-events: none;
}

/* Only fetched once the scene is within reach (lib/offscreen.js, decodeAhead). */
.scene--capital:not(.is-near)::before { background-image: none; }

.scene--capital .scene__stage { height: 1533px; }

/*
 * Cover as a card (not in Figma). The wrapper starts --capital-wipe before the Round City
 * explorer unpins (the plan holds still on Palace by then, lib/city.js) and is that much taller
 * than the scene, so the scene sticks to the top for exactly that scroll, over the still plan,
 * then scrolls on. lib/capital.js lays it on the plan like a card: from below the view, a little
 * to the right and turned anticlockwise (about its top middle), it rises, turns level and lands
 * (--sheet-x, --sheet-y, --sheet-turn), its shadow on the plan fading as it settles, and its
 * painting settles from a slight zoom. Without JS, or with prefers-reduced-motion, the scene
 * simply slides up over the plan and rests there for that scroll.
 */
.capital-cover {
  --capital-height: 1613px;
  position: relative;
  z-index: 1;
  height: calc(var(--capital-wipe) + var(--capital-height) * var(--stage-scale, 1));
  margin-top: calc(-100vh - var(--capital-wipe));
  /* Sideways only: the card lands from the right and turned, and must not widen the page. */
  overflow-x: clip;
}

.capital-cover > .scene {
  position: sticky;
  top: 0;
}

.capital-cover.is-wiping > .scene {
  translate: var(--sheet-x, 0) var(--sheet-y, 0);
  rotate: var(--sheet-turn, 0deg);
  transform-origin: 50% 0;
  box-shadow: 0 -24px 90px rgb(8 2 0 / calc(.6 * (1 - var(--wipe, 1))));
}

.capital-cover.is-wiping .scene__stage { scale: calc(1.04 - .04 * var(--wipe)); }

/* Frames: the market 778 × 674 at (357, 271); the side paintings 374 × 468 at (−74, 477) and
   (1192, 272), each running out past the edge of the view. */
.capital__image--hub { top: 271px; left: 357px; width: 778px; height: 674px; }

.capital__image--left {
  top: 477px;
  left: calc(-74px - var(--spare));
  width: calc(374px + var(--spare));
  height: 468px;
}

.capital__image--right {
  top: 272px;
  left: 1192px;
  width: calc(374px + var(--spare));
  height: 468px;
}

.capital__title {
  top: 120px;
  left: 301px;
  width: 838px;
  text-align: right;
}

/* Routes (182:75, not in the original frame): gold hairlines in from the edges, each ending on a
   gate (ring and cream dot) at a painting's edge, with waystations along the way and dashed
   branches running off to other places. */
.capital__routes {
  top: 0;
  left: 0;
  width: 1440px;
  height: 1533px;
  overflow: visible;
  pointer-events: none;
}

.capital__routes path {
  fill: none;
  stroke: var(--gold);
  stroke-width: .9;
  stroke-linecap: round;
}

.capital__line { stroke-opacity: .5; }
.capital__branch { stroke-opacity: .32; stroke-dasharray: 2 5; }
.capital__stop { fill: var(--gold); fill-opacity: .7; }
.capital__gate { transform-box: fill-box; transform-origin: center; }
.capital__gate-ring { fill: none; stroke: var(--gold); stroke-opacity: .9; stroke-width: .75; }
.capital__gate-dot { fill: rgb(var(--cream) / .9); }

/* "Route label": place in DM Sans Medium 10px, 22% tracking; what it sent in 12px; 24px in from
   the edge of the view. */
.capital__places {
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: none;
}

.capital__place {
  position: absolute;
  left: calc(24px - var(--spare));
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-label);
  font-variation-settings: "opsz" 14;
  line-height: 1.3;
  white-space: nowrap;
}

.capital__place--right {
  left: auto;
  right: calc(24px - var(--spare));
  align-items: flex-end;
  text-align: right;
}

.capital__place-name {
  color: rgb(var(--cream) / .78);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.capital__place--right .capital__place-name { margin-right: -.22em; }

.capital__place-gift {
  color: rgb(var(--cream) / .5);
  font-size: 12px;
}

/* Body: 581 wide at (430, 1009), 44px apart. The first-line indent matches Figma's
   leading space without adding whitespace to the copy. The badges (I, II) stay omitted;
   leading is 185% so the ruling below sits clear of the text. */
.capital__text {
  top: 1009px;
  left: 430px;
  display: flex;
  flex-direction: column;
  gap: 44px;
  width: 581px;
}

.capital__para {
  position: relative;
  isolation: isolate;
  color: #8a8686;
  text-indent: 110px;
  line-height: 1.65;
}

/* Mistara ruling (182:71, not in the original frame): the blind lines a scribe's ruling board left
   on the page, one 8px under each baseline (29px into each 29.7px line: DM Sans 18 has its baseline
   20.85px into a 165% line; clear of the descenders),
   running 26px past the column, with a pinhole where the cord met each margin. The margins run
   14px past the text. */
.capital__para::before {
  content: "";
  position: absolute;
  inset: 0 -26px;
  z-index: -1;
  background:
    radial-gradient(circle at 1px 29px, rgb(var(--cream) / .3) 1px, transparent 1.5px) 0 0 / 2px 1.65em repeat-y,
    radial-gradient(circle at 1px 29px, rgb(var(--cream) / .3) 1px, transparent 1.5px) 100% 0 / 2px 1.65em repeat-y,
    linear-gradient(transparent 28.5px, rgb(200 161 90 / .16) 28.5px 29.5px, transparent 29.5px) 0 0 / 100% 1.65em repeat-y;
  pointer-events: none;
}

.capital__margins {
  position: absolute;
  inset: -14px -26px;
  border-inline: 1px solid rgb(200 161 90 / .16);
  pointer-events: none;
}

/* Motion (lib/scenes.js arms it): each route draws in from the edge of the view to its gate, its
   waystations and branch appear as the line passes them, then the gate opens. The ruling sweeps
   across under each paragraph as it fades up, and the margins drop down beside it. */
.scene.is-armed .capital__route[data-reveal] { opacity: 1; transform: none; }
.scene.is-armed .capital__line { stroke-dasharray: 1; stroke-dashoffset: 1; }

.scene.is-armed .is-in .capital__line {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 2.4s cubic-bezier(.45, .05, .25, 1) var(--delay, 0s);
}

.scene.is-armed .capital__branch,
.scene.is-armed .capital__stop { opacity: 0; }

.scene.is-armed .is-in :is(.capital__branch, .capital__stop) {
  opacity: 1;
  transition: opacity .8s var(--ease-out) calc(var(--delay, 0s) + var(--at) * 2.4s);
}

.scene.is-armed .capital__gate { opacity: 0; scale: .3; }

.scene.is-armed .is-in .capital__gate {
  opacity: 1;
  scale: 1;
  transition:
    opacity .5s var(--ease-out) calc(var(--delay, 0s) + 2.2s),
    scale .9s cubic-bezier(.16, 1, .3, 1) calc(var(--delay, 0s) + 2.2s);
}

.scene.is-armed .capital__para::before { clip-path: inset(0 100% 0 0); }

.scene.is-armed .capital__para.is-in::before {
  clip-path: inset(0);
  transition: clip-path 1.6s cubic-bezier(.7, 0, .2, 1) var(--delay, 0s);
}

.scene.is-armed .capital__margins[data-reveal] { transform: none; clip-path: inset(0 0 100%); }
.scene.is-armed .capital__margins[data-reveal].is-in { clip-path: inset(0); }

/*
 * Compact scene 4 (Figma 608:2721 phone, 692:9297 tablet). One column: the title centred, the
 * market painting across the column, the two side paintings under it at the screen's edges (the
 * left one lower), then the two paragraphs on their ruling (one blind line under each 23px line).
 * The routes and place labels are left out (ornament the small screen has no room for). The
 * scene still lands over the plan as a card (lib/capital.js); the cover holds it for
 * --capital-wipe, then it scrolls on.
 */
@media (max-aspect-ratio: 4/5) {
  .capital-cover { height: auto; }
  .capital-cover::after { content: ""; display: block; height: var(--capital-wipe); }
  .scene--capital { height: auto; }

  .scene--capital .scene__stage {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "title title" "hub hub" "left right" "text text";
    height: auto;
    padding: 60px 20px 88px;
  }

  .capital__routes,
  .capital__places { display: none; }

  .capital__title,
  .scene--capital .capital__title {
    position: relative;
    inset: auto;
    grid-area: title;
    width: auto;
    margin: 0;
    text-align: center;
  }

  .capital__image--hub,
  .capital__image--left,
  .capital__image--right { inset: auto; height: auto; }

  .capital__image--hub { grid-area: hub; width: 100%; aspect-ratio: 350 / 303; margin-top: 32px; }

  .capital__image--left,
  .capital__image--right { width: calc((100vw - 40px) * .449); aspect-ratio: 157 / 196; }
  .capital__image--left { grid-area: left; justify-self: start; margin: 47px 0 0 -20px; }
  .capital__image--right { grid-area: right; align-self: start; justify-self: end; margin: 27px -20px 0 0; }

  .capital__text {
    position: relative;
    inset: auto;
    grid-area: text;
    gap: 23px;
    width: auto;
    margin-top: 32px;
    padding-inline: 14px;
  }

  .capital__para {
    text-indent: 2.1em;
    font-size: 14px;
    line-height: 23px;
  }

  /* One blind line 22px into each 23px line, 14px past the column, with the pinholes. */
  .capital__para::before {
    inset: 0 -14px;
    background:
      radial-gradient(circle at 1px 22px, rgb(var(--cream) / .3) 1px, transparent 1.5px) 0 0 / 2px 23px repeat-y,
      radial-gradient(circle at 1px 22px, rgb(var(--cream) / .3) 1px, transparent 1.5px) 100% 0 / 2px 23px repeat-y,
      linear-gradient(transparent 21.5px, rgb(200 161 90 / .16) 21.5px 22.5px, transparent 22.5px) 0 0 / 100% 23px repeat-y;
  }

  .capital__margins { inset: -10px 0; }
}

@media (max-aspect-ratio: 4/5) and (min-width: 600px) {
  .scene--capital .scene__stage { padding: 115px 60px 106px; }
  .capital__title,
  .scene--capital .capital__title { justify-self: center; max-width: 520px; }
  .capital__image--hub { aspect-ratio: 648 / 561; margin-top: 38px; }
  .capital__image--left,
  .capital__image--right { width: calc((100vw - 120px) * .449); }
  .capital__image--left { margin: 87px 0 0 -37px; }
  .capital__image--right { margin: 50px -37px 0 0; }
  .capital__text { gap: 30px; margin-top: 38px; padding-inline: 20px; }
  .capital__para { font-size: 18px; line-height: 30px; }
  .capital__para::before {
    inset: 0 -20px;
    background:
      radial-gradient(circle at 1px 28px, rgb(var(--cream) / .3) 1px, transparent 1.5px) 0 0 / 2px 30px repeat-y,
      radial-gradient(circle at 1px 28px, rgb(var(--cream) / .3) 1px, transparent 1.5px) 100% 0 / 2px 30px repeat-y,
      linear-gradient(transparent 27.5px, rgb(200 161 90 / .16) 27.5px 28.5px, transparent 28.5px) 0 0 / 100% 30px repeat-y;
  }
  .capital__margins { inset: -14px 0; }
}

/* Scene 4's own entrances, each starting as the opening reaches it (lib/capital.js). No second
   sweep: the scene's arrival is the only one. Paintings fade in where they are, developing out
   of a dark sepia wash and settling from a zoom. Title words rise out of a blur, the paragraphs
   lift out of a softer one, and place names draw their letters in. */
.scene--capital.is-armed .capital__image[data-reveal] { opacity: 0; clip-path: none; }

.scene--capital.is-armed .capital__image[data-reveal].is-in {
  opacity: 1;
  transition: opacity 1.4s var(--ease-out) var(--delay, 0s);
}

/* Paintings rest 12% large (6% past each edge) so they can drift inside their frames (below). */
.scene--capital.is-armed .capital__image[data-reveal] img {
  scale: 1.32;
  filter: sepia(.7) brightness(.45) contrast(1.15);
  transition:
    scale 2.6s var(--ease-out) var(--delay, 0s),
    filter 2.2s cubic-bezier(.4, 0, .2, 1) calc(var(--delay, 0s) + .2s);
}

.scene--capital.is-armed .capital__image[data-reveal].is-in img { scale: 1.12; filter: none; }

.scene--capital.is-armed .scene__word { filter: blur(14px); }

.scene--capital.is-armed .is-in .scene__word {
  filter: none;
  transition:
    opacity 1s var(--ease-out) calc(var(--i) * 90ms + 100ms),
    transform 1.4s var(--ease-out) calc(var(--i) * 90ms + 100ms),
    filter 1.2s var(--ease-out) calc(var(--i) * 90ms + 100ms);
}

.scene--capital.is-armed .capital__para[data-reveal] { filter: blur(6px); }

.scene--capital.is-armed .capital__para[data-reveal].is-in {
  filter: none;
  transition:
    opacity 1.2s var(--ease-out) var(--delay, 0s),
    transform 1.5s var(--ease-out) var(--delay, 0s),
    filter 1.4s var(--ease-out) var(--delay, 0s);
}

.scene--capital.is-armed .capital__place-name { letter-spacing: .6em; }

.scene--capital.is-armed .capital__place.is-in .capital__place-name {
  letter-spacing: .22em;
  transition: letter-spacing 1.8s var(--ease-out) var(--delay, 0s);
}

/* Depth (lib/capital.js). Each painting moves at its own pace (--drift-*, artboard px): the left
   one rises fastest, as if nearest, the right one sinks the other way, and the market rises more
   slowly; all three are at their Figma places just as the scene has opened. The routes move
   with the market, as every gate sits on its edge, and the title slowest, behind it all. Inside
   its frame each painting lags the other way (--inner-*), like a view through a window. While
   the scene opens (--wipe 0 → 1) the side paintings also slide in from their edges. Without JS
   or with reduced motion every variable is unset: Figma. */
.capital__image--hub,
.capital__routes { translate: 0 var(--drift-hub, 0px); }
.capital__image--left { translate: calc((1 - var(--wipe, 1)) * -120px) var(--drift-left, 0px); }
.capital__image--right { translate: calc((1 - var(--wipe, 1)) * 120px) var(--drift-right, 0px); }
.capital__title { translate: 0 var(--drift-title, 0px); }
.capital__image--hub img { translate: 0 var(--inner-hub, 0px); }
.capital__image--left img { translate: 0 var(--inner-left, 0px); }
.capital__image--right img { translate: 0 var(--inner-right, 0px); }

/* Knowledge — Figma 206:66 (rest) / 206:109 (after 60vh and cursor light).
   Same 1440px stage as the preceding scenes; the rows use real grid layout.
   It covers scene 4 as it comes up (not in Figma): scene 4 is held back while this section
   slides over it (lib/cover.js: --arrived on this section, --covered on scene 4), its top edge
   casting a faint shadow that fades as it lands, and scene 4 dims a little beneath it. The title
   keeps Figma's 120px below that edge. The Period I closing covers this section the same way. */
/* 120px more ground below Figma's 1491 artboard, so the last row is read in full before the
   Period I closing covers it. */
.scene--knowledge {
  z-index: 2;
  height: calc(1611px * var(--stage-scale, 1));
  background: #1f160e;
  color: #fff;
  isolation: isolate;
}

.scene--knowledge,
.scene--closing,
.court-timeline {
  box-shadow: 0 calc(-6px * var(--stage-scale, 1)) calc(36px * var(--stage-scale, 1)) rgb(4 2 0 / calc(.18 * (1 - var(--arrived, 1))));
}

.scene--capital::after,
.scene--knowledge::after,
.period-map::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #000;
  opacity: calc(var(--covered, 0) * .25);
  pointer-events: none;
}

/* Above the Flourishing chapter, which the Period II timeline covers (lib/court-timeline.js). */
.period-map::after { z-index: 5; }

/* --covered is only for the dimming above; stopped at the children, so a change to it restyles
   the covered section itself and not everything inside it (the map has ±800 elements). */
:is(.scene--capital, .scene--knowledge, .period-map) > * { --covered: 0; }

.knowledge__stage { height: 1491px; }

.knowledge__title {
  top: 120px;
  left: 405px;
  width: 630px;
  text-align: center;
}

.knowledge__intro {
  top: 352px;
  left: 429px;
  width: 581px;
  color: rgb(240 223 211 / .9);
  line-height: 1.65;
  text-align: center;
}

.knowledge__painting {
  top: 404px;
  left: 392px;
  width: 654px;
  height: 654px;
}

.knowledge__backing { position: absolute; top: 84px; left: 1px; }

.knowledge__window {
  width: 654px;
  height: 654px;
  overflow: hidden;
  mask: url("assets/knowledge/arch-mask.svg") 1px 84px / 653px 485px no-repeat;
}

/* The painting drifts inside its arch (--inner-scholars, lib/knowledge.js), so with motion it
   rests 8% large: 26px spare above and below. */
.knowledge__scholars {
  width: 100%;
  height: 100%;
  object-fit: cover;
  translate: 0 var(--inner-scholars, 0px);
}

.scene--knowledge.is-armed .knowledge__scholars { scale: 1.08; }

.knowledge__points {
  top: 882px;
  left: 320px;
  width: 800px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: #38291c;
  font-variation-settings: "opsz" 14;
}

.knowledge__point {
  position: relative;
  display: grid;
  grid-template-columns: 40px 153px minmax(0, 1fr);
  column-gap: 24px;
  align-items: start;
  padding: 32px;
  min-height: 194px;
}

.knowledge__point + .knowledge__point { padding-top: 32.5px; }
.knowledge__point + .knowledge__point::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: .5px;
  background: #5a432f;
  transform-origin: 0 50%;
}
.knowledge__point:last-child { min-height: 220.5px; }

.knowledge__number {
  font-size: 13px;
  font-weight: 500;
  line-height: 28.6px;
  letter-spacing: .78px;
}

.knowledge__point-title {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.5;
}

.scene .knowledge__point-copy {
  margin: 0 0 0 24px;
  /* 48px title–copy gap, 24px number–title gap. */
  color: rgb(240 223 211 / .9);
  /* 14px (Figma 16px), keeping its 1.625 leading. */
  font-size: 14px;
  line-height: 1.625;
}

.knowledge__orbits,
.knowledge__lit-orbits {
  inset: 0;
  pointer-events: none;
}

.knowledge__arc { position: absolute; width: 1507px; height: 1508px; }
.knowledge__arc img { position: absolute; }
.knowledge__arc--left { left: -788px; top: 881.5px; translate: 0 var(--arc-mid-y, 0px); }
.knowledge__arc--right { left: 569px; top: 894.5px; translate: 0 var(--arc-mid-y, 0px); }
.knowledge__arc--near { left: -136px; top: 670.5px; translate: 0 var(--arc-near-y, 0px); }
.knowledge__arc--far { left: -33px; top: -665.5px; translate: 0 var(--arc-far-y, 0px); }
/* Keep SVGs at their intrinsic export dimensions, including stroke/blur overflow. */
.knowledge__orbits :is(.knowledge__arc--left, .knowledge__arc--right) img { left: -.3px; top: -.3px; }
.knowledge__orbits .knowledge__arc--far img { left: -.8px; top: -.8px; }
.knowledge__lit-orbits .knowledge__arc img { top: .5px; }

/* Stars brighten as the cursor's light nears them (--near 0–1 per star, lib/knowledge.js). */
.knowledge__star {
  position: absolute;
  filter: brightness(calc(1 + var(--near, 0) * .6)) drop-shadow(0 0 calc(var(--near, 0) * 7px) rgb(236 204 150 / calc(var(--near, 0) * .9)));
}
.knowledge__star--1 { left: 318px; top: 722px; }
.knowledge__star--2 { left: 1160px; top: 902px; }
.knowledge__star--3 { left: 76px; top: 883px; }

/*
 * The lit lines and the glow share one reach (--lantern-reach) and one falloff: a bell curve in
 * 12 steps, so the light thins out smoothly instead of in rings. Smaller and softer than the
 * exported glow (206:157, linear 16% over 231px), which read as a hard disc on the dark ground.
 * 120px (was 170). The glow is drawn here in CSS, over the WebGL ground (lib/section-ground.js).
 */
.knowledge__stage { --lantern-reach: 120px; }
.knowledge__lit-orbits {
  opacity: var(--lantern-opacity, 0);
  mask-image: radial-gradient(circle var(--lantern-reach) at var(--lantern-x, 1010px) var(--lantern-y, 790px), rgb(0 0 0 / 1.000) 0.0%, rgb(0 0 0 / 0.971) 8.3%, rgb(0 0 0 / 0.888) 16.7%, rgb(0 0 0 / 0.766) 25.0%, rgb(0 0 0 / 0.621) 33.3%, rgb(0 0 0 / 0.474) 41.7%, rgb(0 0 0 / 0.340) 50.0%, rgb(0 0 0 / 0.228) 58.3%, rgb(0 0 0 / 0.142) 66.7%, rgb(0 0 0 / 0.080) 75.0%, rgb(0 0 0 / 0.040) 83.3%, rgb(0 0 0 / 0.015) 91.7%, rgb(0 0 0 / 0.000) 100.0%);
}

/* Travel west's ground (lib/section-ground.js), first in a pinned view (the court timeline) or,
   here, one viewport fixed to the view, so it stays put while the section moves over it as Travel
   west's pinned ground does; the section clips it to itself. */
.section-ground {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.section-ground--fixed { position: fixed; }
.scene--knowledge.has-ground { clip-path: inset(0); }

.knowledge__lantern {
  position: absolute;
  left: calc(var(--lantern-x, 1010px) - var(--lantern-reach));
  top: calc(var(--lantern-y, 790px) - var(--lantern-reach));
  width: calc(var(--lantern-reach) * 2);
  height: calc(var(--lantern-reach) * 2);
  background: radial-gradient(closest-side, rgb(255 148 64 / 0.1500) 0.0%, rgb(255 148 64 / 0.1456) 8.3%, rgb(255 148 64 / 0.1332) 16.7%, rgb(255 148 64 / 0.1148) 25.0%, rgb(255 148 64 / 0.0932) 33.3%, rgb(255 148 64 / 0.0712) 41.7%, rgb(255 148 64 / 0.0510) 50.0%, rgb(255 148 64 / 0.0342) 58.3%, rgb(255 148 64 / 0.0213) 66.7%, rgb(255 148 64 / 0.0121) 75.0%, rgb(255 148 64 / 0.0060) 83.3%, rgb(255 148 64 / 0.0022) 91.7%, rgb(255 148 64 / 0.0000) 100.0%);
  mix-blend-mode: screen;
  opacity: var(--lantern-opacity, 0);
  pointer-events: none;
}

/*
 * Compact knowledge (Figma 608:2823 / 612:2728 / 612:2776 phone, 692:9382… tablet). The section is
 * pinned (three steps of scroll) on one screen: the title and intro centred 60px (129px) from the
 * top, the scholars in their arch (221 wide; 400 on a tablet), and the three points as one card
 * glued to the screen's bottom edge. The scroll opens one point at a time (lib/knowledge.js):
 * the open one shows its copy and a "−", the others are dimmed to 55% with a "+".
 */
@media (max-aspect-ratio: 4/5) {
  /* clip, not hidden: a hidden overflow would stop the stage from sticking. */
  .scene--knowledge { height: calc(100vh + 180vh); overflow: clip; }

  .knowledge__stage {
    --k: .338;
    position: sticky;
    top: 0;
    left: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: auto;
    height: 100vh;
    /* 60px from the top as Figma; the card lies over the painting if a short phone needs it. */
    padding: 60px 20px 0;
    overflow: hidden;
  }

  .knowledge__stage > :is(.knowledge__title, .knowledge__intro, .knowledge__painting, .knowledge__points) { position: relative; inset: auto; }

  /* The arcs and stars at the screen's scale (633 of 1507 on a 390 phone), centred. */
  .knowledge__orbits,
  .knowledge__lit-orbits,
  .knowledge__lantern { display: none; }
  .knowledge__stage > .knowledge__orbits {
    position: absolute;
    display: block;
    inset: 0 auto auto 50%;
    width: 1440px;
    height: 1491px;
    margin-left: -720px;
    transform: scale(.42);
    transform-origin: 50% 0;
  }

  .knowledge__title { width: auto; }
  .knowledge__intro { width: auto; max-width: 350px; margin-top: 16px; font-size: 14px; line-height: 23px; }

  /* The arch: Figma's 653 × 485 window at (1, 84) of the 654 painting, scaled to fit. */
  .knowledge__painting {
    flex: none;
    width: calc(653px * var(--k));
    height: calc(485px * var(--k));
    margin-top: 16px;
  }

  .knowledge__window,
  .knowledge__backing {
    position: absolute;
    transform: scale(var(--k));
    transform-origin: 0 0;
  }

  .knowledge__window { top: calc(-84px * var(--k)); left: calc(-1px * var(--k)); }
  .knowledge__backing { top: 0; left: 0; }

  /* On the screen's foot whatever its height: it grows up over the painting rather than down off
     the screen while two points are half open. */
  .knowledge__stage > .knowledge__points {
    position: absolute;
    right: 20px;
    bottom: 0;
    left: 20px;
    z-index: 1;
    width: auto;
  }

  /*
   * Each point opens by --open (0 shut, 1 open), set from the scroll on every frame
   * (lib/knowledge.js): one closes as the next opens, the card growing up from the screen's foot.
   * Nothing is timed, so it follows the scroll exactly, both ways, with no lag behind it.
   */
  .knowledge__point,
  .knowledge__point:last-child {
    --open: 0;
    --pad-top: 18px;
    --pad-top-open: 22px;
    --pad-bottom: 18px;
    --pad-bottom-open: 24px;
    --copy-gap: 16px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "num title sign" "copy copy copy";
    column-gap: 14px;
    min-height: 0;
    padding:
      calc(var(--pad-top) + (var(--pad-top-open) - var(--pad-top)) * var(--open)) 20px
      calc(var(--pad-bottom) + (var(--pad-bottom-open) - var(--pad-bottom)) * var(--open));
  }

  .knowledge__point + .knowledge__point { padding-top: calc(var(--pad-top) + (var(--pad-top-open) - var(--pad-top)) * var(--open)); }

  .knowledge__number { grid-area: num; align-self: center; font-size: 11px; line-height: 1.4; letter-spacing: .3em; }
  .knowledge__point-title { grid-area: title; font-size: 18px; }

  .knowledge__point::after {
    content: "+";
    grid-area: sign;
    align-self: center;
    font-size: 18px;
    line-height: 1;
  }

  .knowledge__point.is-open::after { content: "−"; }

  /* Dimmed by colour (the rows' own entrance animates their opacity): 55% shut, full open. */
  .knowledge__number,
  .knowledge__point-title,
  .knowledge__point::after { color: rgb(255 255 255 / calc(.55 + .45 * var(--open))); }

  /* Its own height (--copy-height, lib/knowledge.js) × --open; the text fades with it, so the
     opening never shows as an empty box. */
  .scene .knowledge__point-copy {
    grid-area: copy;
    height: calc(var(--copy-height, 0px) * var(--open));
    overflow: hidden;
    margin: calc(var(--copy-gap) * var(--open)) 0 0;
    color: rgb(240 223 211 / calc(.9 * var(--open)));
    font-size: 14px;
    line-height: 23px;
    translate: 0 calc((1 - var(--open)) * 12px);
  }
}

@media (max-aspect-ratio: 4/5) and (min-width: 600px) {
  /* 129px from the top as Figma; the card lies over the painting if a short screen needs it. */
  .knowledge__stage { --k: .6126; padding: 129px 60px 0; }
  /* --k and --orbit-k from lib/knowledge.js (fitTablet). */
  .knowledge__stage > .knowledge__orbits { transform: scale(var(--orbit-k, .83)); }
  .knowledge__title { font-size: 56px; }
  .knowledge__intro { max-width: 648px; margin-top: 19px; font-size: 18px; line-height: 30px; }
  .knowledge__painting { margin-top: 24px; }
  .knowledge__stage > .knowledge__points { right: 60px; left: 60px; }
  .knowledge__point,
  .knowledge__point:last-child {
    --pad-top: 22px;
    --pad-top-open: 26px;
    --pad-bottom: 22px;
    --pad-bottom-open: 29px;
    --copy-gap: 19px;
    column-gap: 17px;
    padding-inline: 24px;
  }
  .knowledge__number { font-size: 13px; }
  .knowledge__point-title,
  .knowledge__point::after { font-size: 22px; }
  .scene .knowledge__point-copy { font-size: 18px; line-height: 30px; }
}

/* The arrival should be legible at normal scrolling speed. Keep the final
   Figma layout unchanged; animate the title, arch reveal, and row contents. */
@media (prefers-reduced-motion: no-preference) {
  .scene--knowledge.is-armed .scene__word {
    opacity: 0;
    transform: translate3d(0, 72px, 0) rotate(5deg);
    filter: blur(9px);
  }

  .scene--knowledge.is-armed .is-in .scene__word {
    opacity: 1;
    transform: none;
    filter: blur(0);
    transition:
      opacity 1s var(--ease-out) calc(var(--i) * 110ms),
      transform 1.5s var(--ease-out) calc(var(--i) * 110ms),
      filter 1.3s var(--ease-out) calc(var(--i) * 110ms);
  }

  .scene--knowledge.is-armed .knowledge__painting[data-reveal] {
    opacity: 0;
    transform: translate3d(0, 60px, 0);
    clip-path: inset(0 0 100% 0);
  }

  .scene--knowledge.is-armed .knowledge__painting[data-reveal].is-in {
    opacity: 1;
    transform: none;
    clip-path: inset(0);
    transition:
      opacity .7s ease-out,
      transform 1.8s var(--ease-out),
      clip-path 1.8s cubic-bezier(.22, .68, .2, 1);
  }

  .scene--knowledge.is-armed .knowledge__orbits {
    opacity: 0;
    clip-path: circle(8% at 50% 48%);
    transition: opacity 1s ease-out .2s, clip-path 2.4s var(--ease-out) .2s;
  }

  .scene--knowledge.is-armed.is-entered .knowledge__orbits {
    opacity: 1;
    clip-path: circle(110% at 50% 48%);
  }

  /* Stars catch the light once the orbits have opened: they turn in and grow, one by one. */
  .scene--knowledge.is-armed .knowledge__star {
    opacity: 0;
    scale: .2;
    rotate: -120deg;
  }

  .scene--knowledge.is-armed.is-entered .knowledge__star {
    opacity: 1;
    scale: 1;
    rotate: 0deg;
    transition:
      opacity .6s ease-out var(--star-delay),
      scale 1.1s cubic-bezier(.16, 1, .3, 1) var(--star-delay),
      rotate 1.4s var(--ease-out) var(--star-delay);
  }

  .knowledge__star--1 { --star-delay: 1.2s; }
  .knowledge__star--2 { --star-delay: 1.45s; }
  .knowledge__star--3 { --star-delay: 1.7s; }

  /* The list's panel opens downward before its rows rise in; each divider draws from the left. */
  .scene--knowledge.is-armed .knowledge__points { clip-path: inset(0 0 100% 0); }

  .scene--knowledge.is-armed .knowledge__points.is-in {
    clip-path: inset(0);
    transition: clip-path 1.3s cubic-bezier(.7, 0, .2, 1);
  }

  .scene--knowledge.is-armed .knowledge__point + .knowledge__point::before { scale: 0 1; }

  .scene--knowledge.is-armed .knowledge__point.is-in::before {
    scale: 1 1;
    transition: scale 1.2s var(--ease-out) .1s;
  }

  .scene--knowledge.is-armed .knowledge__point > * {
    opacity: 0;
    transform: translate3d(0, 40px, 0);
    transition: opacity .85s var(--ease-out), transform 1.2s var(--ease-out);
  }

  .scene--knowledge.is-armed .knowledge__point > :nth-child(2) { transition-delay: .12s; }
  .scene--knowledge.is-armed .knowledge__point > :nth-child(3) { transition-delay: .24s; }
  .scene--knowledge.is-armed .knowledge__point.is-in > * { opacity: 1; transform: none; }
}

/*
 * Period I closing — Figma 215:340, 1440 × 1491 on #1c170c. A sheet of paper with a wax seal,
 * held up in a gloved hand (1042 × 1563 at (199, 0), running past the bottom), carries the last
 * word on Period I: kicker and title at (405, 327), the dusk painting inside an arch 701 × 521 at
 * (369, 533), "833" over it at (389, 734) in overlay at 35%, and the body at (404, 1094).
 * Everything on the sheet is placed in the sheet's own coordinates so it moves with it.
 * Motion (not in Figma, lib/closing.js): it covers the knowledge section (lib/cover.js); while it
 * arrives the sheet is handed up into place, turning level (--sheet-y, --sheet-turn), and leans a
 * little toward the cursor (--tilt-*); the painting settles from a slight push-in (--push) and
 * drifts in its arch once landed (--inner). "833" stays still: an accent on the painting.
 */
.scene--closing {
  z-index: 3;
  height: calc(1491px * var(--stage-scale, 1));
  background: #1c170c;
  color: #060503;
  isolation: isolate;
}

.closing__stage { height: 1491px; }

.closing__sheet {
  top: 0;
  left: 199px;
  width: 1042px;
  height: 1563px;
  translate: 0 var(--sheet-y, 0px);
  rotate: var(--sheet-turn, 0deg);
  transform: perspective(1800px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  /* Turned about the hand that holds it. */
  transform-origin: 50% 92%;
}

.closing__sheet > *,
.closing__content > * { position: absolute; margin: 0; }
.closing__paper { top: 0; left: 0; width: 1042px; height: 1563px; }

/* Heading, painting, "833" and paragraph together: 327–1242.5 × 170–871.5 on the sheet. As the
   closing is cropped to a square of its paper (lib/period-map.js), they shrink about their own
   centre (--fit), so the card still holds all of them with a margin. */
.closing__content {
  top: 0;
  left: 0;
  width: 1042px;
  height: 1563px;
  transform-origin: 520.75px 784.75px;
  scale: var(--fit, 1);
}

.closing__head {
  top: 327px;
  left: 206px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 630px;
  text-align: center;
}

.closing__kicker {
  margin: 0;
  color: #8d6b2e;
  font-family: var(--font-label);
  font-size: 12px;
  font-weight: 500;
  font-variation-settings: "opsz" 14;
  letter-spacing: .3em;
  text-transform: uppercase;
}

/* Svetze 68 / 1.1, −2% tracking; the width breaks it after "gone." as in Figma. */
.closing__title {
  color: #060503;
  font-size: 68px;
  line-height: 1.1;
  letter-spacing: -1.36px;
}

.closing__window {
  top: 533px;
  left: 170px;
  width: 701.47px;
  height: 521px;
  overflow: hidden;
  mask: url("assets/closing/arch-mask.svg") 0 0 / 100% 100% no-repeat;
}

/* The painting as placed in Figma (955 × 679, 254 px left of and 79 px above the arch), with its
   warm glow at 50%. */
.closing__view {
  position: absolute;
  top: -79px;
  left: -254px;
  width: 955px;
  height: 679px;
  translate: 0 var(--inner, 0px);
  scale: var(--push, 1);
  transform-origin: 62% 60%;
}

.closing__view img { width: 100%; height: 100%; object-fit: cover; }

.closing__view::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 434px 309px at 607.7px 524.7px, rgb(242 195 122 / .55), rgb(242 195 122 / 0));
  opacity: .5;
  pointer-events: none;
}

/* The oil lamp on the scholar's desk: a warm glow that breathes like a flame, centred on the
   flame of the brass lamp in dusk-833 (≈430, 451 in the 955 × 679 view). */
.closing__lamp {
  position: absolute;
  top: 391px;
  left: 370px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(255 196 120 / .6), rgb(255 150 60 / .2) 42%, rgb(255 150 60 / 0) 70%);
  mix-blend-mode: screen;
  opacity: .75;
  animation: closing-flame 3.6s linear infinite;
  pointer-events: none;
}

@keyframes closing-flame {
  0%, 100% { opacity: .75; scale: 1; }
  14% { opacity: .62; scale: .97; }
  27% { opacity: .86; scale: 1.03; }
  41% { opacity: .7; scale: .99; }
  58% { opacity: .9; scale: 1.05; }
  73% { opacity: .64; scale: .98; }
  86% { opacity: .82; scale: 1.02; }
}

.closing__year {
  top: 734px;
  left: 190px;
  opacity: .35;
  mix-blend-mode: overlay;
  pointer-events: none;
}

.closing__year-text {
  display: block;
  color: #f0dfd3;
  font-family: var(--font-display);
  font-size: 367.143px;
  line-height: .88;
  letter-spacing: -14.6857px;
  white-space: nowrap;
  text-box-trim: trim-both;
  text-box-edge: cap alphabetic;
}

.scene .closing__body {
  top: 1094px;
  left: 205px;
  width: 631px;
  color: rgb(0 0 0 / .9);
  line-height: 1.65;
  text-align: center;
}

/* A sheen that crosses the wax seal once, as the sheet lands (.is-sealed). */
.closing__glint {
  top: 85px;
  left: 414px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: linear-gradient(115deg, rgb(255 240 205 / 0) 38%, rgb(255 240 205 / .85) 50%, rgb(255 240 205 / 0) 62%) 130% 0 / 300% 100% no-repeat;
  mask: radial-gradient(circle, #000 44%, transparent 48%);
  mix-blend-mode: screen;
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .scene--closing.is-sealed .closing__glint { animation: closing-glint 1.6s ease-in-out .15s both; }

  /* The painting develops out of a dark sepia wash as its arch opens. */
  .scene--closing.is-armed .closing__window img {
    filter: sepia(.7) brightness(.45) contrast(1.15);
    transition:
      scale 1.8s var(--ease-out) var(--delay, 0s),
      filter 2.2s cubic-bezier(.4, 0, .2, 1) calc(var(--delay, 0s) + .2s);
  }

  .scene--closing.is-armed .closing__window.is-in img { filter: none; }
}

@keyframes closing-glint {
  from { opacity: 0; background-position: 130% 0; }
  20% { opacity: 1; }
  to { opacity: 0; background-position: -30% 0; }
}

/*
 * Compact closing of Period I (Figma 608:2865 phone, 692:9526 tablet). The sheet runs past both
 * screen edges (426 of 390; 788 of 768) and grows with its content: its seal and its hand are the
 * top and bottom of sheet.avif (border-image), the plain paper between them stretches. Inside, one
 * centred column (300; 540 on a tablet): kicker and title, the dusk painting in its arch with
 * "833" over it, then the paragraph. lib/closing.js still hands the sheet up into place.
 */
@media (max-aspect-ratio: 4/5) {
  .scene--closing { height: auto; }

  /* Only the 40px above the seal: the section ends with the hand (the scenes' own padding,
     sides and foot, does not apply here). */
  .closing__stage,
  .scene .closing__stage {
    position: relative;
    left: auto;
    width: auto;
    height: auto;
    padding: 40px 0 0;
    transform: none;
  }

  .closing__sheet {
    --k: .4277;
    position: relative;
    inset: auto;
    width: calc(100% + 36px);
    height: auto;
    margin-left: -18px;
    padding: 139px 0 138px;
    border-style: solid;
    border-width: 131px 0 169px;
    border-color: transparent;
    border-image: url("assets/closing/sheet.avif") 315 97 406 97 fill / 131px 0 169px 0 stretch;
    /* The paper's own colour under the slices, from where the paper starts in the top one (row
       168 of 315) to where it ends in the bottom one (row 1281), so no hairline shows between them. */
    --paper-top: 70px;
    --paper-bottom: 106px;
    background: linear-gradient(rgb(243 234 225), rgb(243 234 225)) 0 var(--paper-top) / 100% calc(100% - var(--paper-top) - var(--paper-bottom)) no-repeat border-box;
    /* The paper's own border sits on the padding, not inside the content. */
    padding-block: 8px 0;
  }

  .closing__paper { display: none; }
  .closing__glint { top: calc(-131px + 20px); left: calc(50% - 45px); width: 90px; height: 90px; }

  .closing__content {
    position: relative;
    display: grid;
    grid-template-areas: "head" "art" "body";
    justify-items: center;
    gap: 20px;
    width: min(300px, 100vw - 90px);
    height: auto;
    /* The paragraph ends 138px above the sheet's foot, inside the hand's slice. */
    margin: 0 auto -31px;
    transform-origin: 50% 50%;
  }

  .closing__sheet > *,
  .closing__content > * { position: relative; inset: auto; }
  .closing__glint { position: absolute; }

  .closing__head { grid-area: head; gap: 8px; width: auto; }
  .closing__kicker { font-size: 11px; line-height: 1.4; }
  /* Breaks after "gone.", as Figma. */
  /* .scene .scene__title (scenes 1–2) would set it at 40px; this is the sheet's own 30. */
  .scene .closing__title { max-width: 10em; margin: 0 auto; font-size: min(30px, (100vw - 90px) / 8.6); line-height: 1.15; letter-spacing: -.01em; }

  /* The arch 701.47 × 521 at --k, the painting placed in it as on desktop. */
  .closing__window {
    grid-area: art;
    width: calc(701.47px * var(--k));
    height: calc(521px * var(--k));
  }

  .closing__view {
    top: calc(-79px * var(--k));
    left: calc(-254px * var(--k));
    width: calc(955px * var(--k));
    height: calc(679px * var(--k));
  }

  .closing__view::after { background: radial-gradient(ellipse 45.4% 45.5% at 63.6% 77.3%, rgb(242 195 122 / .55), rgb(242 195 122 / 0)); }

  .closing__lamp {
    top: calc(391px * var(--k));
    left: calc(370px * var(--k));
    width: calc(120px * var(--k));
    height: calc(120px * var(--k));
  }

  .closing__year {
    grid-area: art;
    align-self: start;
    justify-self: start;
    margin: calc(201px * var(--k)) 0 0 calc(20px * var(--k));
  }

  .closing__year-text { font-size: calc(367.143px * var(--k)); letter-spacing: -.04em; }

  .scene .closing__body {
    position: relative;
    inset: auto;
    grid-area: body;
    width: auto;
    font-size: 14px;
    line-height: 23px;
  }
}

@media (max-aspect-ratio: 4/5) and (min-width: 600px) {
  .closing__sheet {
    --k: .7413;
    width: calc(100% + 20px);
    margin-left: -10px;
    border-width: 242px 0 312px;
    border-image-width: 242px 0 312px 0;
    --paper-top: 129px;
    --paper-bottom: 196px;
    padding-top: 6px;
  }
  .closing__glint { top: calc(-242px + 40px); left: calc(50% - 80px); width: 160px; height: 160px; }
  .closing__content { gap: 24px; width: min(540px, 100vw - 120px); margin-bottom: -73px; }
  .closing__head { gap: 10px; }
  .closing__kicker { font-size: 13px; }
  .scene .closing__title { font-size: 40px; }
  .scene .closing__body { font-size: 18px; line-height: 30px; }
}

/*
 * Back to the three ages (not in Figma; lib/period-map.js). The pin is the closing plus
 * --return-length of scroll: once its bottom reaches the bottom of the view the closing sticks
 * there, and over that scroll it shrinks into card I of .period-map, a copy of the story made
 * from the story's own markup, stuck to the view behind it. The map's camera pulls back
 * (its scale about card I) as the closing's ground dissolves; as it comes down, it turns over
 * into card I's own painting (.period-map__turn), and card I is marked done while card II steps
 * forward with its detail, as what comes next.
 */
.closing-pin {
  --return-length: 200vh;
  position: relative;
  z-index: 3;
  /* Then, still pinned: rest .3 and dive 2 viewports into card II, and read Period II's last 90
     artboard px (REST, DIVE and READ in lib/period-map.js). */
  --onward-length: calc(230vh + 90px * var(--stage-scale, 1));
  height: calc(1491px * var(--stage-scale, 1) + var(--return-length) + var(--onward-length));
}

.closing-pin > .scene--closing {
  position: sticky;
  top: calc(100vh - 1491px * var(--stage-scale, 1));
}

.period-map {
  position: sticky;
  top: 0;
  height: 100vh;
  margin-bottom: -100vh;
  overflow: hidden;
  background: var(--color-story);
  opacity: 0;
  pointer-events: none;
}

.period-map__camera {
  position: absolute;
  inset: 0;
  /* Its zoom about the card is written inline (lib/period-map.js, lib/sky.js). */
  transform-origin: 50% 50%;
  scale: 1;
}

.period-map .story {
  position: absolute;
  inset: 0;
}

/*
 * Card I's painting turning up from the back of the shrinking closing, on the same path
 * (transform from lib/period-map.js); card I itself shows once it has landed.
 */
.period-map__turn {
  position: absolute;
  top: 0;
  left: 0;
  visibility: hidden;
  background: var(--color-story);
  filter: drop-shadow(0 calc(12px * var(--stage-scale, 1)) calc(25px * var(--stage-scale, 1)) rgb(0 0 0 / .45));
}

.period-map__turn img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/*
 * Compact return to the three ages: no shrink into card I (lib/period-map.js). The closing sticks
 * with its bottom on the view's, fades to the map (the story's slider with the Flourishing in
 * front; Foundations, already read, left out), and the dive into card II opens Period II's chapter
 * as Period I's opens from the story.
 */
@media (max-aspect-ratio: 4/5) {
  .closing-pin { --return-length: 100vh; height: auto; }
  .closing-pin::after { content: ""; display: block; height: calc(var(--return-length) + var(--onward-length)); }
  .closing-pin > .scene--closing { top: calc(100vh - var(--closing-height, 100vh)); }
}


.story--map .period--1:not(.is-turned) .period__thumb { visibility: hidden; }

/* Card I, read: a gold badge with a check, and a gold rule drawn under the card. */
.story--map .period__badge {
  transition: opacity .3s var(--ease-out), background-color .5s var(--ease-out), color .5s var(--ease-out);
}

.story--map .period--1:not(.is-turned) .period__badge { opacity: 0; }

.story--map .period__badge svg {
  position: absolute;
  width: 12px;
  height: 12px;
  opacity: 0;
  scale: .4;
  transition: opacity .4s var(--ease-out) .15s, scale .7s cubic-bezier(.16, 1, .3, 1) .15s;
}

.story--map .period.is-done .period__badge { background: #c8a15a; color: transparent; }
.story--map .period.is-done .period__badge svg { opacity: 1; scale: 1; }

.story--map .period--1::after {
  content: "";
  position: absolute;
  top: 134px;
  left: 0;
  width: 120px;
  height: 1px;
  background: #c8a15a;
  scale: 0 1;
  transform-origin: 0 50%;
  transition: scale .9s var(--ease-out) .3s;
}

.story--map .period--1.is-done::after { scale: 1 1; }

/*
 * Period II, part I — Figma 253:174: the court moves, the learning stays. A 4320 × 1024 artboard
 * on #1c170c, three screens wide, laid out at the page's shared scale. The section is the track's travel tall
 * (2880 artboard px) plus a view; the track is pinned and lib/court-timeline.js turns the scroll
 * into --shift (0 → 1), which moves it sideways so that the first screen starts centred and the
 * last ends centred. The year nearest the centre of the screen is lit (.is-active), and the line
 * is gold up to it (--progress). Each year has its scene in a plain frame (assets/court).
 *
 * Motion (not in Figma; lib/court-timeline.js sets the classes, .is-armed only with motion
 * allowed, so without it everything simply shows):
 * - entrance (.is-entered, as the section comes up): the kicker, each heading line and the intro
 *   rise in one after another, and the line draws from its start to its arrow;
 * - each year, once, as it comes within REVEAL of the centre (.is-seen): its picture opens from
 *   the bottom while the image settles from a slight zoom, then the Hijri line (its Arabic a
 *   beat later), the year rising, the stem drawn down to the line, the node, and the story;
 * - the lit year eases in and the others back; its ring gives way to the star, turning in, a
 *   gold ring spreads from it once, and the gold draws on along the line to it, its tip glowing;
 * - it arrives over the Flourishing chapter, which it holds back and dims (lib/cover.js);
 * - the Arabic year is written on from the right; the caliph's name closes up from wide spacing;
 * - the Samarra bracket draws across as the centre passes 836 → 892 (--bracket), its count
 *   climbing to 56; inside each fixed frame the image runs a little behind the track (--drift);
 * - then, past the travel (--iris more of the section, lib/iris.js), the track runs on to bring
 *   the arrow at the end of the line to the centre while the gold runs on past 945 to it and it
 *   lights up (--focus, --charge), and an iris opens from the arrow on to part II: its gold edge
 *   is drawn here, outside the circle, while part I dims and steps back (--recede).
 */
.court-timeline {
  /* Its own ground, warmer and a little lighter than the story's; used wherever it shows through. */
  --ground: #1c170c;
  --travel: 2880px;
  /* The iris into part II (lib/iris.js): pinned on, after the track's travel. */
  --iris: 1200px;
  --rise: cubic-bezier(.16, 1, .3, 1);
  --open: cubic-bezier(.65, 0, .35, 1);
  position: relative;
  z-index: 3;
  height: calc(100vh + (var(--travel) + var(--iris)) * var(--stage-scale, 1));
  background: var(--ground);
  color: #fff;
}

.court-timeline__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.court-timeline__track {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4320px;
  height: 1024px;
  transform-origin: 0 0;
  transform:
    translate(calc(-720px * var(--stage-scale, 1)), calc(-512px * var(--stage-scale, 1)))
    translateX(calc((var(--shift, 0) * var(--travel) + var(--focus, 0px)) * -1 * var(--stage-scale, 1)))
    scale(var(--stage-scale, 1));
  /* Part I steps back as the iris opens (lib/iris.js), about the screen's centre. */
  scale: calc(1 - var(--recede, 0) * .05);
  /* The gold past 945 waits for the gold up to 945 (--full), then catches up with the scroll. */
  --full: 0;
  transition: --full .6s var(--ease-out);
}

/* Part I dims under the opening iris; its gold edge stays bright above that. */
.court-timeline__pin::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background: #000;
  opacity: calc(var(--recede, 0) * .6);
  pointer-events: none;
}

/* The iris's gold edge, just outside the circle that part II shows through (lib/iris.js). */
.court-timeline__iris {
  position: absolute;
  z-index: 2;
  top: var(--iris-y, 50%);
  left: var(--iris-x, 50%);
  width: calc(var(--iris-r, 0px) * 2);
  height: calc(var(--iris-r, 0px) * 2);
  border: 1px solid rgb(200 161 90 / .75);
  border-radius: 50%;
  /* Glows both ways: inwards it shows through part II's fading edge, so the two meet softly. */
  box-shadow:
    0 0 calc(32px * var(--stage-scale, 1)) rgb(200 161 90 / .4),
    inset 0 0 calc(24px * var(--stage-scale, 1)) rgb(200 161 90 / .3);
  opacity: var(--iris-edge, 0);
  translate: -50% -50%;
  pointer-events: none;
}

.court-timeline__track > *,
.court-timeline__year > * { position: absolute; margin: 0; }

/* Header, at the start of the track. */
.court-timeline__head { top: 370px; left: 80px; width: 560px; }

.court-timeline__kicker {
  margin: 0;
  color: #c8a15a;
  font-family: var(--font-label);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .4em;
  text-transform: uppercase;
}

.court-timeline__heading {
  margin: 20px 0 0 -4px;
  font-family: var(--font-display);
  font-size: 84px;
  font-weight: 400;
  line-height: .96;
  letter-spacing: -1.68px;
  /* Svetze runs wider than the Figma stand-in: each line stays whole, clear of the line's start. */
  white-space: nowrap;
}

.court-timeline__heading > span { display: block; }

.court-timeline__intro {
  width: 470px;
  margin: 26px 0 0;
  color: rgb(240 223 211 / .85);
  font-family: var(--font-ruqaa);
  font-size: 19px;
  line-height: 1.5;
  letter-spacing: .01em;
}

/* The line: the city's learning, unbroken; gold up to the year in view (--progress). */
/* Starts 60px right of the screen's centre, clear of the heading's longest line. */
.court-timeline__line {
  top: 630px;
  left: 780px;
  width: 3450px;
  height: 1px;
  background: rgb(240 223 211 / .22);
}

.court-timeline__line::before,
.court-timeline__line::after {
  content: "";
  position: absolute;
  top: 50%;
}

.court-timeline__line::before {
  left: -3px;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: rgb(240 223 211 / .6);
}

.court-timeline__line::after {
  right: 2px;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-top: 1.4px solid rgb(240 223 211 / .5);
  border-right: 1.4px solid rgb(240 223 211 / .5);
  rotate: 45deg;
  /* Turns gold and glows as the gold reaches it, before the iris opens from it (lib/iris.js). */
  border-color: color-mix(in srgb, #c8a15a calc(var(--charge, 0) * var(--full) * 100%), rgb(240 223 211 / .5));
  filter: drop-shadow(0 0 calc(var(--charge, 0) * var(--full) * 5px) rgb(200 161 90 / .9));
}

/* Past 945 the gold runs on to the arrow as 945 gathers (--charge, lib/iris.js): from just past
   945's node (3874) to the arrow (line end − 6). Only once the gold up to 945 is drawn
   (.is-full, lib/court-timeline.js); a gather already under way is then caught up over .6s. */
.court-timeline__track.is-full { --full: 1; }

.court-timeline__tail {
  position: absolute;
  top: -.25px;
  left: 3094px;
  width: calc(350px * var(--charge, 0) * var(--full));
  height: 1.5px;
  background: #c8a15a;
}

/* Its tip glows as it runs, and stays lit on the arrow until the iris takes over. */
.court-timeline__tail::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -3px;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: #f3d9a4;
  box-shadow: 0 0 10px 3px rgb(200 161 90 / .7), 0 0 26px 8px rgb(200 161 90 / .25);
  opacity: clamp(0, calc(var(--charge, 0) * var(--full) * 4 - var(--recede, 0) * 6), 1);
}

/* Where the iris opens: the middle of the arrow. Measured by lib/iris.js. */
.court-timeline__end {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 0;
  height: 0;
}

.court-timeline__progress {
  position: absolute;
  top: -.25px;
  left: 0;
  width: var(--progress, 266px);
  height: 1.5px;
  background: #c8a15a;
  transition: width 1.1s var(--open);
}

/* The gold's tip glows while it draws on to the newly lit year (.is-drawing). */
.court-timeline__progress::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -3px;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: #f3d9a4;
  box-shadow: 0 0 10px 3px rgb(200 161 90 / .7), 0 0 26px 8px rgb(200 161 90 / .25);
  opacity: 0;
  scale: .4;
  transition: opacity .5s var(--ease-out), scale .5s var(--ease-out);
}

.court-timeline__track.is-drawing .court-timeline__progress::after {
  opacity: 1;
  scale: 1;
  transition-duration: .2s;
}

/* The court in Samarra, 836–892: a bracket across the top, between the two years. */
.court-timeline__bracket {
  top: 112px;
  left: 1760px;
  width: 1400px;
  height: 13px;
  text-align: center;
}

/* The bracket's rule and ends, drawn as the centre passes 836 → 892 (--bracket 0 → 1). Over the
   WebGL ground (.has-ground) the label cannot cut the rule with a flat fill, which would show as a
   patch on the moving ground: the rule leaves a gap the label's width (--label-w,
   lib/court-timeline.js) where the label rides instead. */
.court-timeline.has-ground .court-timeline__bracket::before {
  --gap-at: max(150px, calc(var(--bracket, 1) * 700px));
  --gap: calc(var(--label-w, 0px) / 2);
  -webkit-mask-image: linear-gradient(to right, #000 calc(var(--gap-at) - var(--gap)), transparent 0, transparent calc(var(--gap-at) + var(--gap)), #000 0);
  mask-image: linear-gradient(to right, #000 calc(var(--gap-at) - var(--gap)), transparent 0, transparent calc(var(--gap-at) + var(--gap)), #000 0);
}
.court-timeline.has-ground .court-timeline__bracket > span { background: none; }

/* Drawn in WebGL over the ground (lib/court-pictures.js), once its image is on the GPU: the DOM
   picture stays, transparent, for reading and clicking; its clip and opacity still run, and are
   read from it. */
.court-timeline__picture.is-gl { border-color: transparent; }
.court-timeline__picture.is-gl .court-timeline__image { background: none; }
.court-timeline__picture.is-gl img { opacity: 0; }
.court-timeline__bracket::before,
.court-timeline__bracket::after {
  content: "";
  position: absolute;
  top: 0;
  height: 13px;
}

.court-timeline__bracket::before {
  left: 0;
  width: calc(var(--bracket, 1) * 100%);
  opacity: var(--bracket-label, 1);
  border-top: 1px solid rgb(200 161 90 / .6);
  border-left: 1px solid rgb(200 161 90 / .6);
}

.court-timeline__bracket::after {
  right: 0;
  border-right: 1px solid rgb(200 161 90 / .6);
  opacity: var(--bracket-end, 1);
}

/* The label rides at the middle of the drawn part, so it ends centred on the whole bracket. */
.court-timeline__bracket > span {
  position: absolute;
  z-index: 1;
  top: -8px;
  left: max(150px, calc(var(--bracket, 1) * 50%));
  translate: -50% 0;
  padding: 0 16px;
  white-space: nowrap;
  background: var(--ground);
  color: rgb(200 161 90 / .9);
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .3em;
  text-transform: uppercase;
  opacity: var(--bracket-label, 1);
}

.court-timeline__count {
  display: inline-block;
  min-width: 1.6em;
  font-variant-numeric: tabular-nums;
}

/* Each year: a 360px column centred on its place on the line (--x). */
.court-timeline__years { margin: 0; padding: 0; list-style: none; }

/* As the iris opens, the years and the bracket go well before the circle reaches the corners, so
   nothing of them is left cut by its edge; the line, its gold and the arrow stay (lib/iris.js). */
.court-timeline__years,
.court-timeline__bracket { opacity: clamp(0, calc(1 - var(--recede, 0) * 2.5), 1); }

.court-timeline__year {
  position: absolute;
  top: 0;
  left: calc(var(--x) - 180px);
  width: 360px;
  height: 1024px;
  text-align: center;
}

/* Clicking another year brings it to the centre (lib/court-timeline.js). */
.court-timeline__year:not(.is-active) { cursor: pointer; }

/* The frame stays put; the image inside it runs a little behind the track (--drift), with room
   either side to do so. The scenes are 16:9, a shade narrower than the 452 × 252.5 they fill. */
.court-timeline__picture {
  top: 159.5px;
  left: 10px;
  width: 340px;
  height: 252.5px;
  overflow: hidden;
  border: 1px solid rgb(200 161 90 / .35);
  opacity: .55;
  transition: opacity .6s var(--ease-out);
}

.court-timeline__image {
  position: absolute;
  inset: 0 -56px;
  background: #2a2213;
  translate: var(--drift, 0) 0;
}

.court-timeline__image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 32px below the picture (Figma has 25). */
.court-timeline__ah {
  top: 444px;
  left: 0;
  width: 100%;
  color: rgb(240 223 211 / .45);
  font-family: var(--font-label);
  font-size: 13px;
  font-weight: 500;
  line-height: 34px;
  letter-spacing: .3em;
  transition: color .6s var(--ease-out);
}

.court-timeline__ah span {
  display: inline-block;
  margin-left: 14px;
  color: rgb(200 161 90 / .5);
  font-family: var(--font-ruqaa);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0;
  transition: color .6s var(--ease-out);
}

.court-timeline__date {
  top: 497px;
  left: 0;
  width: 100%;
  color: rgb(240 223 211 / .45);
  font-family: var(--font-display);
  font-size: 80px;
  line-height: 1;
  letter-spacing: -.8px;
  transition: color .6s var(--ease-out);
}

.court-timeline__stem {
  top: 576px;
  left: 179.5px;
  width: 1px;
  height: 46px;
  background: rgb(240 223 211 / .35);
  transform-origin: 50% 0;
  transition: background-color .6s var(--ease-out);
}

/* A ring on the line; the year in view gets the site's eight-pointed star instead, on a glow. */
.court-timeline__node {
  top: 615px;
  left: 165px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgb(200 161 90 / 0);
  transition: background-color .6s var(--ease-out);
}

.court-timeline__ring {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 10px;
  height: 10px;
  border: 1.2px solid rgb(240 223 211 / .5);
  border-radius: 50%;
  background: var(--ground);
  transition: opacity .3s var(--ease-out), scale .4s var(--ease-out);
}

/* One gold ring spreads from the node as its year is lit. */
.court-timeline__node::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgb(200 161 90 / .8);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.court-timeline.is-armed .court-timeline__year.is-seen.is-active .court-timeline__node::after {
  animation: court-ripple 1.4s cubic-bezier(.2, .7, .2, 1) .15s;
}

@keyframes court-ripple {
  from { opacity: .9; scale: .6; }
  to { opacity: 0; scale: 3.2; }
}

.court-timeline__node svg {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 20px;
  height: 20px;
  fill: #c8a15a;
  opacity: 0;
  scale: .3;
  rotate: -90deg;
  transition: opacity .35s var(--ease-out), scale .7s var(--rise), rotate .9s var(--rise);
}

.court-timeline__story {
  top: 680px;
  left: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 330px;
}

.court-timeline__story > * { transition: color .6s var(--ease-out); }

.court-timeline__title {
  margin: 0;
  color: rgb(240 223 211 / .5);
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 400;
  line-height: 1.1;
}

.court-timeline__text {
  width: 330px;
  margin: 0;
  color: rgb(240 223 211 / .42);
  font-family: var(--font-label);
  font-size: 16px;
  line-height: 1.6;
}

.court-timeline__caliph {
  margin: 0;
  color: rgb(200 161 90 / .45);
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .3em;
  text-transform: uppercase;
}

.court-timeline__trades {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  width: 330px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.court-timeline__trades li {
  padding: 4px 10px;
  border: 1px solid rgb(200 161 90 / .35);
  border-radius: 20px;
  color: rgb(240 223 211 / .5);
  font-family: var(--font-label);
  font-size: 11px;
  line-height: 1.4;
  transition: border-color .6s var(--ease-out), color .6s var(--ease-out);
}

/* The year in view. */
.court-timeline__year.is-active .court-timeline__picture { opacity: 1; }
.court-timeline__year.is-active .court-timeline__ah { color: rgb(240 223 211 / .75); }
.court-timeline__year.is-active .court-timeline__ah span { color: rgb(200 161 90 / .9); }
.court-timeline__year.is-active .court-timeline__date,
.court-timeline__year.is-active .court-timeline__title { color: #fff; }
.court-timeline__year.is-active .court-timeline__text { color: rgb(240 223 211 / .85); }
.court-timeline__year.is-active .court-timeline__caliph { color: rgb(200 161 90 / .85); }
.court-timeline__year.is-active .court-timeline__trades li { border-color: rgb(200 161 90 / .6); color: rgb(240 223 211 / .8); }
.court-timeline__year.is-active .court-timeline__stem { background-color: rgb(200 161 90 / .9); }
.court-timeline__year.is-active .court-timeline__node { background-color: rgb(200 161 90 / .15); }
.court-timeline__year.is-active .court-timeline__ring { opacity: 0; scale: .4; }
.court-timeline__year.is-active .court-timeline__node svg { opacity: 1; scale: 1; rotate: 0deg; }

/* --- Entrances. Armed by lib/court-timeline.js only with motion allowed. --- */

/* The header: kicker, each heading line, then the intro. */
.court-timeline.is-armed :is(.court-timeline__kicker, .court-timeline__heading > span, .court-timeline__intro) {
  opacity: 0;
  translate: 0 44px;
}

.court-timeline.is-entered :is(.court-timeline__kicker, .court-timeline__heading > span, .court-timeline__intro) {
  opacity: 1;
  translate: 0 0;
  transition: opacity .9s var(--ease-out) var(--d, 0s), translate 1.2s var(--rise) var(--d, 0s);
}

.court-timeline__heading > span:first-child { --d: .12s; }
.court-timeline__heading > span:last-child { --d: .24s; }
.court-timeline__intro { --d: .42s; }

/* The line draws from its start to its arrow (the start dot and the arrow kept clear of the clip). */
/* Room above and below for the gold tips' glow. */
.court-timeline.is-armed .court-timeline__line { clip-path: inset(-40px 100% -40px -40px); }

.court-timeline.is-entered .court-timeline__line {
  clip-path: inset(-40px);
  transition: clip-path 2.4s var(--open) .3s;
}

/* Each year, once: the arch opens, then the Hijri line, the year, the stem, the node, the story. */
.court-timeline.is-armed .court-timeline__picture { clip-path: inset(100% 0 0 0); }
.court-timeline.is-armed .court-timeline__image { scale: 1.08; transform-origin: 50% 100%; }

.court-timeline.is-armed .court-timeline__ah { opacity: 0; translate: 0 12px; }
.court-timeline.is-armed .court-timeline__ah span { opacity: 0; clip-path: inset(-6px 0 -6px 100%); }
.court-timeline.is-armed .court-timeline__date { opacity: 0; translate: 0 34px; }
.court-timeline.is-armed .court-timeline__stem { scale: 1 0; }
.court-timeline.is-armed .court-timeline__node { scale: 0; }
.court-timeline.is-armed .court-timeline__story > * { opacity: 0; translate: 0 20px; }

.court-timeline .court-timeline__year.is-seen .court-timeline__picture {
  clip-path: inset(-2px);
  transition: clip-path 1.2s var(--open), opacity .6s var(--ease-out);
}

.court-timeline .court-timeline__year.is-seen .court-timeline__image {
  scale: 1;
  transition: scale 1.6s var(--ease-out);
}

.court-timeline .court-timeline__year.is-seen .court-timeline__ah {
  opacity: 1;
  translate: 0 0;
  transition: opacity .7s var(--ease-out) .35s, translate .9s var(--rise) .35s, color .6s var(--ease-out);
}

/* The Arabic follows the Latin a beat later, written on from the right, as Arabic is. */
.court-timeline .court-timeline__year.is-seen .court-timeline__ah span {
  opacity: 1;
  clip-path: inset(-6px -6px -6px -6px);
  transition: opacity .3s var(--ease-out) .7s, clip-path 1.1s var(--open) .7s, color .6s var(--ease-out);
}

.court-timeline .court-timeline__year.is-seen .court-timeline__date {
  opacity: 1;
  translate: 0 0;
  transition: opacity .8s var(--ease-out) .45s, translate 1.2s var(--rise) .45s, color .6s var(--ease-out);
}

.court-timeline .court-timeline__year.is-seen .court-timeline__stem {
  scale: 1 1;
  transition: scale .5s var(--open) .75s, background-color .6s var(--ease-out);
}

.court-timeline .court-timeline__year.is-seen .court-timeline__node {
  scale: 1;
  transition: scale .6s cubic-bezier(.34, 1.56, .64, 1) 1.05s, background-color .6s var(--ease-out);
}

.court-timeline .court-timeline__year.is-seen .court-timeline__story > * {
  opacity: 1;
  translate: 0 0;
  transition: opacity .8s var(--ease-out) var(--d), translate 1s var(--rise) var(--d), color .6s var(--ease-out);
}

/* The caliph's name closes up from wide spacing as it comes in. */
.court-timeline.is-armed .court-timeline__caliph { letter-spacing: .7em; }

.court-timeline .court-timeline__year.is-seen .court-timeline__caliph {
  letter-spacing: .3em;
  transition: opacity .8s var(--ease-out) var(--d), translate 1s var(--rise) var(--d), letter-spacing 1.6s var(--rise) var(--d), color .6s var(--ease-out);
}

.court-timeline__story > :nth-child(1) { --d: .95s; }
.court-timeline__story > :nth-child(2) { --d: 1.08s; }
.court-timeline__story > :nth-child(3) { --d: 1.2s; }

/*
 * Compact court timeline (Figma 620:2721 … 648:601 phone, 708:340 … 708:724 tablet). The header
 * stays at the top of the pinned screen; under it the track holds one year per screen (--i,
 * lib/court-timeline.js), the screen's width apart, and the scroll moves it a year at a time
 * (--year-shift). Each year is one centred column: the picture (350 × 197; 560 × 315), the Hijri
 * and Common Era years, the stem, its node on the line, then the story. The Samarra bracket spans
 * 836 to 892 above the pictures. The iris into part II opens from the arrow, as on desktop.
 */
@media (max-aspect-ratio: 4/5) {
  .court-timeline {
    --gutter: 20px;
    /* Set from the layout itself by lib/court-timeline.js; Figma's 390 × 844 values otherwise. */
    --pic-top: 294px;
    --pic-h: 197px;
    --line-y: 605px;
    height: calc(100vh + 280vh + var(--iris) * var(--stage-scale, 1));
  }

  .court-timeline__track {
    top: 0;
    left: 0;
    width: 500vw;
    height: 100%;
    transform: translateX(calc(var(--year-shift, 0) * -100vw - var(--charge, 0) * (50vw - var(--gutter) - 6px)));
  }

  /* The header stays put while the track moves under it. */
  .court-timeline__head {
    top: 64px;
    left: var(--gutter);
    width: calc(100vw - 2 * var(--gutter));
    transform: translateX(calc(var(--year-shift, 0) * 100vw + var(--charge, 0) * (50vw - var(--gutter) - 6px)));
  }

  .court-timeline__kicker { font-size: 11px; line-height: 1.4; letter-spacing: .3em; }
  .court-timeline__heading { margin: 8px 0 0; font-size: 40px; line-height: 1.05; letter-spacing: -.02em; white-space: normal; }
  .court-timeline__intro { width: auto; margin-top: 16px; font-size: 14px; }

  .court-timeline__line {
    top: var(--line-y);
    left: var(--gutter);
    width: calc(500vw - 2 * var(--gutter));
  }

  .court-timeline__tail {
    left: calc(450vw - var(--gutter));
    width: calc((50vw - var(--gutter) - 6px) * var(--charge, 0) * var(--full));
  }

  /* Midway between the header and the picture (--bracket-up, lib/court-timeline.js). */
  .court-timeline__bracket {
    top: calc(var(--pic-top) - var(--bracket-up, 30px));
    left: 150vw;
    width: 200vw;
  }

  /* The label rides the tip of the bracket as it draws, so it is always mid-screen. */
  .court-timeline.has-ground .court-timeline__bracket::before { --gap-at: calc(var(--bracket, 1) * 200vw); }
  .court-timeline__bracket > span { left: calc(var(--bracket, 1) * 100%); font-size: 10px; }

  .court-timeline__year {
    left: calc(var(--i, 0) * 100vw);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100vw;
    height: 100%;
    padding: var(--pic-top) var(--gutter) 0;
  }

  .court-timeline__year > * { position: relative; inset: auto; }

  .court-timeline__picture { flex: none; width: min(100%, var(--pic-h) * 350 / 197); height: var(--pic-h); }
  .court-timeline__image { inset: 0 -20px; }

  .court-timeline__ah { width: auto; margin-top: 16px; font-size: 10px; line-height: 25px; }
  .court-timeline__ah span { margin-left: 12px; font-size: 16px; }
  .court-timeline__date { width: auto; margin-top: -3px; font-size: 56px; letter-spacing: -.01em; }
  .court-timeline__stem { flex: none; height: 12px; margin-top: 2px; }

  .court-timeline__node { flex: none; width: 14px; height: 14px; }
  .court-timeline__ring { top: 2px; left: 2px; }
  .court-timeline__node svg { top: 0; left: 0; width: 14px; height: 14px; }

  .court-timeline__story { gap: 16px; width: 100%; margin-top: 15px; }
  .court-timeline__title { font-size: 24px; line-height: 1.1; }
  .court-timeline__text { width: auto; font-size: 14px; line-height: 23px; }
  .court-timeline__caliph { font-size: 10px; line-height: 1.4; }
  .court-timeline__trades { width: auto; }
  .court-timeline__trades li { font-size: 12px; }
  /* Short screens (lib/court-timeline.js): tighter under the header, the year a little smaller. */
  .court-timeline.is-short .court-timeline__ah { margin-top: 10px; }
  .court-timeline.is-short .court-timeline__date { font-size: 44px; }
  .court-timeline.is-short .court-timeline__stem { height: 8px; }
  .court-timeline.is-short .court-timeline__story { gap: 10px; margin-top: 10px; }
  .court-timeline.is-short .court-timeline__title { font-size: 22px; }
  .court-timeline.is-short .court-timeline__trades li { padding: 3px 9px; }
}

@media (max-aspect-ratio: 4/5) and (min-width: 600px) {
  .court-timeline {
    --gutter: 60px;
    --pic-top: 314px;
    --pic-h: 315px;
    --line-y: 761px;
  }
  /* Well clear of the navbar (lib/court-timeline.js lays out the rest under it). */
  .court-timeline__head { top: 96px; text-align: center; }
  .court-timeline__kicker { font-size: 13px; }
  .court-timeline__heading { font-size: 56px; }
  .court-timeline__intro { max-width: 560px; margin-inline: auto; font-size: 18px; }
  .court-timeline__bracket > span { font-size: 12px; }
  .court-timeline__picture { width: min(648px, 100%, var(--pic-h) * 560 / 315); }
  .court-timeline__ah { font-size: 12px; line-height: 28px; }
  .court-timeline__ah span { margin-left: 14px; font-size: 18px; }
  .court-timeline__date { margin-top: -6px; font-size: 72px; }
  .court-timeline__stem { height: 10px; margin-top: 6px; }
  .court-timeline__node { width: 17px; height: 17px; }
  .court-timeline__ring { top: 3px; left: 3px; width: 11px; height: 11px; }
  .court-timeline__node svg { width: 17px; height: 17px; }
  .court-timeline__story { width: 560px; max-width: 100%; margin-top: 13px; }
  .court-timeline__title { font-size: 32px; }
  .court-timeline__text { font-size: 18px; line-height: 30px; }
  .court-timeline__caliph { font-size: 12px; }
  .court-timeline__trades li { font-size: 13px; }
}

/*
 * Period II, part II — Figma 265:166: the people behind it. A 1440 × 1009 artboard on #2b2110,
 * at the page's shared scale and set on the bottom of the view, so the arch's feet and the hand
 * always reach it. The section is TRAVEL (lib/people.js) tall plus a view, and pinned; the scroll
 * turns the astrolabe disc (--turn, about its centre at 720, 1121.5), bringing the five scholars
 * one after another up under the card in the hand, which shows the one at the top (.is-active).
 * The rim is drawn whole (assets/people/rim.svg) so it can turn; Figma's is cut at the frame.
 * Portraits: assets/people/portraits, whole, as in Figma.
 *
 * Motion (not in Figma; lib/people.js sets the classes, .is-armed only with motion allowed):
 * - entrance, driven by the iris opening over it (--in-*): the hand lifts the card the last
 *   little way, then the body, the title's lines and the kicker rise in, the disc comes up turning into
 *   place with the stations one by one; then, the circle open, the arch is drawn up from its feet
 *   to the apex and the finial drops on to it;
 * - each station grows and brightens as it nears the top (--near, --size), and passes under the
 *   card there;
 * - the card changes with the turn itself, not on a timer: its portrait wheel turns the next face
 *   in, and the last entry fades and slides out to the left as the next comes in from the right;
 * - it is opened from part I by an iris (lib/iris.js): the section starts a view and the iris's
 *   length higher, over part I's end, and is pinned through it, masked to a soft-edged circle that grows
 *   from the arrow at the end of part I's line (--iris-x, --iris-y, --iris-r) while what it
 *   shows settles from a slight zoom (--iris-zoom). Once the circle covers the view the mask is
 *   dropped (.is-open). The entrance plays as it opens.
 */
.people {
  --ground: #2b2110;
  --iris: 1200px;
  --rise: cubic-bezier(.16, 1, .3, 1);
  --open: cubic-bezier(.65, 0, .35, 1);
  position: relative;
  /* Over part I's last view and its iris, which open on to it. */
  z-index: 4;
  /* --cover-extra (compact): Built to last covers part III over a whole view (lib/iris.js). */
  height: calc(100vh + (var(--travel, 3200px) + var(--iris)) * var(--stage-scale, 1) + var(--cover-extra, 0px));
  margin-top: calc(-100vh - var(--iris) * var(--stage-scale, 1));
  color: #fff;
  pointer-events: none;
}

.people__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  isolation: isolate;
  /* The iris: a circle whose edge fades over --feather (a mask rather than a clip-path, which
     cuts a hard, stepped edge), widening as the circle grows. A mask does not stop clicks, so the
     pin only takes them once open; until then they go to part I beneath. */
  --feather: clamp(2px, calc(var(--iris-r, 0px) * .06), calc(48px * var(--stage-scale, 1)));
  -webkit-mask-image: radial-gradient(circle at var(--iris-x, 50%) var(--iris-y, 50%), #000 calc(var(--iris-r, 0px) - var(--feather)), transparent var(--iris-r, 0px));
  mask-image: radial-gradient(circle at var(--iris-x, 50%) var(--iris-y, 50%), #000 calc(var(--iris-r, 0px) - var(--feather)), transparent var(--iris-r, 0px));
  pointer-events: none;
}

.people.is-open .people__pin {
  -webkit-mask-image: none;
  mask-image: none;
  pointer-events: auto;
}

/* The ground is on the view, not the pin, so the ink and the hand blend with it inside the view's
   own group. */
.people__view {
  position: absolute;
  inset: 0;
  background: var(--ground);
  transform-origin: var(--iris-x, 50%) var(--iris-y, 50%);
  scale: var(--iris-zoom, 1);
}

.people__ink {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .9;
  mix-blend-mode: overlay;
  pointer-events: none;
}

.people__stage {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 1440px;
  height: 1009px;
  transform-origin: 0 0;
  transform:
    translate(calc(-720px * var(--stage-scale, 1)), calc(-1009px * var(--stage-scale, 1)))
    scale(var(--stage-scale, 1));
}

.people__stage > * { position: absolute; margin: 0; }

/* Star-and-cross tiles inside the arch, fading in row by row towards the floor. */
.people__pattern {
  top: 480px;
  left: 0;
  width: 1440px;
  height: 480px;
  opacity: calc(.09 * var(--part2, 1));
  pointer-events: none;
}

.people__pattern::before,
.people__pattern::after {
  content: "";
  position: absolute;
  height: 240px;
  background: url("assets/people/pattern.svg") 0 0 / 120px 120px;
}

.people__pattern::before {
  top: 0;
  left: 240px;
  width: 960px;
  mask-image: linear-gradient(rgb(0 0 0 / .06) 50%, rgb(0 0 0 / .44) 50%);
}

.people__pattern::after {
  top: 240px;
  left: 120px;
  width: 1200px;
  mask-image: linear-gradient(rgb(0 0 0 / .81) 50%, #000 50%);
}

/* The rim, its ticks and the rete's stars, centred on (720, 1121.5). --settle is the entrance's
   extra turn, back to 0. */
@property --full {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

@property --settle {
  syntax: "<angle>";
  inherits: true;
  initial-value: 0deg;
}

.people__disc {
  top: 1121.5px;
  left: 720px;
  width: 0;
  height: 0;
  rotate: calc(var(--turn, 0deg) + var(--settle));
}

.people__rim {
  position: absolute;
  top: -520px;
  left: -520px;
  max-width: none;
}

.people__star {
  position: absolute;
  top: -457.5px;
  left: -6px;
  transform-origin: 6px 457.5px;
  rotate: var(--a);
}

.people__arch { top: 0; left: 0; }
.people__finial { top: 5px; left: 704px; }

/* The body ends 20px above the card's frame (514), as in Figma; its three lines are 79.2 here
   (Figma rounds them to 78), so the block starts at 181 rather than Figma's 182. */
.people__head {
  top: 181px;
  left: 405px;
  width: 630px;
  text-align: center;
}

/* DM Sans Medium 14, 40% tracking, with a star 14px either side. */
.people__kicker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 0;
  color: #c8a15a;
  font-family: var(--font-label);
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;
  letter-spacing: .4em;
  text-transform: uppercase;
}

/* The tracking trails the last letter; pulled back so the stars sit evenly. */
.people__kicker span { margin-right: -.4em; white-space: pre; }

/* Svetze 80 / 1.2, −2% tracking, 16 below the kicker. */
.people__title {
  margin: 16px 0 0;
  font-family: var(--font-display);
  font-size: 80px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -1.6px;
}

.people__title > span { display: block; }

/* DM Sans 16 / 1.65, 502 wide, 8 below the title. */
.people__body {
  width: 502px;
  margin: 8px auto 0;
  color: #675f56;
  font-family: var(--font-label);
  font-size: 16px;
  font-variation-settings: "opsz" 14;
  line-height: 1.65;
}

/*
 * A station sits on the disc 491.5 from its centre, at its own angle (--a) plus the disc's turn;
 * the seat itself stays upright. Figma's at 30° is 134 across with its portrait at 80%, at 60°
 * 114 and 55%: lib/people.js sets --near (1 at 30° or closer, 0 at 60°, −1 at 90°) and --size.
 */
.people__stations { margin: 0; padding: 0; list-style: none; }

.people__station {
  position: absolute;
  top: 1121.5px;
  left: 720px;
  width: 0;
  height: 0;
  rotate: calc(var(--a) + var(--turn, 0deg) + var(--settle));
}

.people__seat {
  position: absolute;
  top: -558.5px;
  left: -67px;
  width: 134px;
  height: 134px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  rotate: calc((var(--a) + var(--turn, 0deg) + var(--settle)) * -1);
  scale: var(--size, 1);
}

.people__seat > img { position: absolute; }
.people__seat-dots { inset: 0; }
.people__seat-ring { top: 7px; left: 7px; }

/* The portrait, round, with a fine gold edge; dimmer the further it is from the top. */
.people__seat-portrait {
  top: 15px;
  left: 15px;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  outline: 1px solid rgb(200 161 90 / .35);
  outline-offset: -1px;
  opacity: calc(.55 + .45 * var(--near, 1));
  transition: filter .4s var(--ease-out);
}

.people__seat:focus-visible .people__seat-portrait { filter: brightness(1.6); }
@media (hover: hover) and (min-aspect-ratio: 801/1000) {
  .people__seat:hover .people__seat-portrait { filter: brightness(1.6); }
}

.people__seat:focus-visible { outline: 1px solid #c8a15a; outline-offset: 6px; }

/* Its number, 19px out from the station's edge along the disc's radius, upright. */
.people__numeral {
  position: absolute;
  top: calc(-491.5px - 67px * var(--size, 1) - 19px);
  left: 0;
  color: rgb(200 161 90 / .85);
  font-family: var(--font-ruqaa);
  font-size: 22px;
  line-height: 34px;
  translate: -50% -50%;
  rotate: calc((var(--a) + var(--turn, 0deg) + var(--settle)) * -1);
  pointer-events: none;
}

/*
 * The card in the hand, 346 × 519 at (547, 514), lightened over everything behind it (its own
 * ground is black). A stage's transform would keep the blend from reaching the ground, so the
 * picture is placed on the pin by the same sums, and what is on the card is in a second stage.
 */
.people__hand {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 346px;
  height: 519px;
  object-fit: cover;
  transform-origin: 0 0;
  transform:
    translate(calc(-720px * var(--stage-scale, 1)), calc(-1009px * var(--stage-scale, 1)))
    scale(var(--stage-scale, 1))
    translate(547px, 514px);
  mix-blend-mode: lighten;
  pointer-events: none;
}

.people__stage--front { pointer-events: none; }

.people__card {
  top: 514px;
  left: 547px;
  width: 346px;
  height: 519px;
}

.people__card > * { position: absolute; }
/* Whoever is at the top, 96 round with a gold edge. Behind it the five portraits sit on a small
   wheel that turns with the disc (lib/people.js, translate): the next comes in from the right
   along its arc as the last goes out to the left. */
.people__card-portrait {
  top: 68px;
  left: 125px;
  width: 96px;
  height: 96px;
  overflow: hidden;
  border-radius: 50%;
  background: #2a2213;
}

/* Each round itself, so no straight edge shows while two pass through the window. */
.people__card-portrait img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

/* Without the script, only the first: the card starts on Hunayn. */
.people__card-portrait img:not(:first-child),
.people__entry:not(:first-child) { visibility: hidden; }

.people__card-portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.2px solid rgb(200 161 90 / .8);
  border-radius: 50%;
}
.people__card-ring { top: 61px; left: 118px; }

/* Each entry is a 240-wide column at (53, 186): name and line, then the star rule and the fields,
   32 apart. */
.people__entries { top: 186px; left: 53px; width: 240px; }

.people__entry {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #000;
  text-align: center;
  /* lib/people.js: --o, how much of it shows, and --x, how far it has slid, both from the turn. */
  opacity: var(--o, 0);
}

.people__entry:first-child { --o: 1; }

/* What is on it slides with the turn, the lower lines a little further, so they follow the name. */
.people__entry > * { translate: calc(var(--x, 0px) * var(--k, 1)) 0; }
.people__entry .people__line { --k: 1.2; }
.people__entry .people__divider { --k: 1.4; }
.people__entry .people__fields { --k: 1.6; }

.people__name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -.01em;
  white-space: nowrap;
}

.people__line {
  width: 196px;
  margin: 8px 0 0;
  color: #71644f;
  font-family: var(--font-label);
  font-size: 14px;
  font-variation-settings: "opsz" 14;
  line-height: 1.5;
}

.people__divider { display: block; margin-top: 32px; }

.people__fields {
  width: 196px;
  margin: 32px 0 0;
  color: rgb(0 0 0 / .6);
  font-family: var(--font-label);
  font-size: 10px;
  font-weight: 500;
  font-variation-settings: "opsz" 14;
  line-height: 1.7;
  letter-spacing: .3em;
  text-transform: uppercase;
}

/* --- Motion. Armed by lib/people.js only with motion allowed. --- */

/*
 * Entrance, as the iris opens over part II (lib/people.js, enter): each piece by how far the
 * circle has grown (--in-*, 0 → 1), so it comes together as it is uncovered and follows the
 * scroll both ways: the card first, nearly in place, its portrait just below the circle's centre
 * (the arrow), then the body, the title's lines, the kicker and the disc. Once the circle is open, the arch is drawn up from its feet to the apex and the
 * finial drops on to it (--in-arch, --in-finial), before the disc turns. Unset (no script, or
 * reduced motion) everything is simply there.
 */
.people__arch { clip-path: inset(calc((1 - var(--in-arch, 1)) * 100%) 0 0 0); }

.people__finial {
  opacity: calc(var(--in-finial, 1) * var(--part2, 1));
  translate: 0 calc((1 - var(--in-finial, 1)) * -16px);
}

.people__kicker { --in: var(--in-kicker, 1); }
.people__title > span:first-child { --in: var(--in-t1, 1); }
.people__title > span:last-child { --in: var(--in-t2, 1); }
.people__body { --in: var(--in-body, 1); }

:is(.people__kicker, .people__title > span, .people__body) {
  opacity: var(--in);
  translate: 0 calc((1 - var(--in)) * 44px);
}

/* The kicker's stars turn in with it. */
.people__kicker img {
  rotate: calc((1 - var(--in)) * -90deg);
  scale: calc(.3 + .7 * var(--in));
}

/* The disc comes up, turning into place (--settle, set with it); the stations follow one by one. */
:is(.people__disc, .people__stations) {
  /* The orbit and the stations' rings go first and slowly, as part III begins (lib/sky.js). */
  opacity: calc(var(--in-disc, 1) * var(--orbit, 1));
  translate: 0 calc((1 - var(--in-disc, 1)) * 140px + var(--sink, 0px));
}

/* As each of the five becomes a star (lib/sky.js), its station lets go of the portrait (--held),
   and the card of its face. */
.people__card-portrait img { opacity: var(--face, 1); }

.people__seat > img,
.people__numeral { opacity: var(--in-seat, 1); }

.people__seat > .people__seat-portrait { opacity: calc((.55 + .45 * var(--near, 1)) * var(--in-seat, 1) * var(--held, 1)); }

/* The hand brings the card up from below. */
.people__card {
  opacity: var(--part2, 1);
  translate: 0 calc((1 - var(--in-card, 1)) * 60px + var(--drop, 0px));
}

.people__hand {
  opacity: var(--part2, 1);
  translate: 0 calc(((1 - var(--in-card, 1)) * 60px + var(--drop, 0px)) * var(--stage-scale, 1));
}

/* Part II gives way to part III (lib/sky.js): its header, arch and pattern fade as night falls. */
:is(.people__head, .people__arch) { opacity: var(--part2, 1); }


/*
 * Period II, part III — Figma 290:1975: a century of brilliance. Not a section of its own but the
 * rest of part II's pin (lib/sky.js, TAIL more of the section's scroll), so the five can rise from
 * the disc itself:
 * - rise: the disc sinks where it stopped, the hand lowers the card and part II fades
 *   (--part2, --sink, --drop); night falls behind it (.sky-night, --night), Baghdad in 945 coming
 *   up below, and the five, already stars where their portraits were, lift off one by one from
 *   the top of the disc down (al-Razi from the card), each on a curve trailing light, to their
 *   places on a pointed arch over the city (.sky__star, set by lib/sky.js);
 * - words: the arch is drawn through them from ١ to ٥ (--drawn), their numerals light, and the
 *   kicker, title and body rise in inside it;
 * - close: the whole view is cut to a square and shrinks into card II on the three ages
 *   (.period-map--end), turning over into card II's own painting as Period I's closing does into
 *   card I; card II is marked done and card III steps forward. That is the end of the page.
 * The night sky is a 1440 × 1024 artboard set on the bottom of the view, like part II's.
 */
.sky-night {
  position: absolute;
  inset: 0;
  background: #05060c;
  opacity: var(--night, 0);
  pointer-events: none;
}

:is(.sky-night__stage, .sky__stage) {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 1440px;
  height: 1024px;
  transform-origin: 0 0;
  transform:
    translate(calc(-720px * var(--stage-scale, 1)), calc(-1024px * var(--stage-scale, 1)))
    scale(var(--stage-scale, 1));
}

:is(.sky-night__stage, .sky__stage) > * { position: absolute; margin: 0; }

/* The painting fills the artboard as in Figma (cover: 1820 wide, its sides past the artboard). */
.sky-night__painting {
  top: 0;
  left: -190px;
  width: 1820px;
  height: 1024px;
  max-width: none;
  object-fit: cover;
  opacity: var(--painting, 1);
}

/* A deeper sky above it, and the faint stars. */
.sky-night__deep {
  top: 0;
  left: -400px;
  width: 2240px;
  height: 640px;
  background: linear-gradient(rgb(5 6 12 / .75), rgb(5 6 12 / .2) 70%, rgb(5 6 12 / 0));
}

.sky-night__stars { top: 0; left: 0; opacity: var(--starlight, 1); }


.sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* The figure: the pointed arch drawn through the stars, from ١ to ٥ (--drawn). */
.sky__figure { top: 0; left: 0; overflow: visible; }

.sky__figure path {
  stroke-dasharray: 1 1;
  stroke-dashoffset: calc(1 - var(--drawn, 1));
}

/* A trail of light behind a star as it rises (lib/sky.js sets where). */
.sky__thread {
  top: 0;
  left: -.75px;
  width: 1.5px;
  height: var(--length, 0px);
  background: linear-gradient(rgb(200 161 90 / 0), rgb(200 161 90 / .65));
  transform-origin: 50% 0;
  opacity: var(--glow, 0);
}

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

/* A star: rays and a dotted ring about the portrait (Figma: rays 108, ring 74, portrait 56), at
   --x, --y, --scale from lib/sky.js; the crown comes on as it rises. */
.sky__star {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  opacity: var(--shown, 0);
  translate: var(--x, 0px) var(--y, 0px);
}

.sky__star > *,
.sky__crown > * { position: absolute; }

.sky__crown {
  position: absolute;
  inset: 0;
  opacity: var(--crown, 1);
  scale: var(--scale, 1);
}

.sky__rays {
  top: -54px;
  left: -54px;
  width: 108px;
  height: 108px;
  opacity: .28;
}

.sky__ring {
  top: -37px;
  left: -37px;
  width: 74px;
  height: 74px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 74 74'><circle cx='37' cy='37' r='36.5' fill='none' stroke='%23C8A15A' stroke-opacity='.5' stroke-dasharray='1 3'/></svg>") center / 100% no-repeat;
}

.sky__portrait {
  top: -28px;
  left: -28px;
  width: 56px;
  height: 56px;
  border: 1px solid rgb(200 161 90 / .9);
  border-radius: 50%;
  opacity: var(--lit, 1);
  scale: var(--scale, 1);
}

/* Its numeral, as on the disc: Aref Ruqaa Ink 18, gold 85%, its centre 71.5 above the star's. */
.sky__numeral {
  top: -71.5px;
  left: 0;
  color: rgb(200 161 90 / .85);
  font-family: var(--font-ruqaa);
  font-size: 18px;
  line-height: 27px;
  translate: -50% -50%;
  opacity: var(--numerals, 1);
}

/* The words, inside the arch: kicker DM Sans Medium 13, 40%; title Svetze 56 / 1.05, −2%;
   body DM Sans 15 / 1.65, #D9C9B0 85%, 390 wide. */
.sky__head {
  top: 288px;
  left: 470px;
  width: 500px;
  text-align: center;
}

.sky__kicker {
  margin: 0;
  color: #c8a15a;
  font-family: var(--font-label);
  font-size: 13px;
  font-weight: 500;
  line-height: 20px;
  letter-spacing: .4em;
  text-transform: uppercase;
}

.sky__title {
  margin: 14px 0 0;
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -1.12px;
}

.sky__title > span { display: block; }

.sky__body {
  width: 390px;
  margin: 18px auto 0;
  color: rgb(217 201 176 / .85);
  font-family: var(--font-label);
  font-size: 15px;
  font-variation-settings: "opsz" 14;
  line-height: 1.65;
}

.sky__kicker { --in: var(--in-k3, 1); }
.sky__title > span:first-child { --in: var(--in-t3a, 1); }
.sky__title > span:last-child { --in: var(--in-t3b, 1); }
.sky__body { --in: var(--in-b3, 1); }

:is(.sky__kicker, .sky__title > span, .sky__body) {
  opacity: var(--in);
  translate: 0 calc((1 - var(--in)) * 32px);
}


/* Period II's end on the three ages: stuck behind part II's view in its pin, card I already done
   and turned, card II turning up from the night sky and then done, card III stepping forward. */
.period-map--end {
  position: absolute;
  inset: 0;
  height: auto;
  margin: 0;
}

/* Unseen (opacity 0) until the close starts (lib/sky.js), so its ±650 elements are skipped by
   the style and layout part II's and III's scroll work causes until then. Only the map: Period
   III's chapter is measured at start-up (lib/heading-reveal.js). */
.period-map--end:not(.is-awake) > .period-map__camera { content-visibility: hidden; }

.story--end .period--2:not(.is-turned) .period__thumb { visibility: hidden; }
.story--end .period--2:not(.is-turned) .period__badge { opacity: 0; }

.story--end .period--2::after {
  content: "";
  position: absolute;
  top: 134px;
  left: 0;
  width: 120px;
  height: 1px;
  background: #c8a15a;
  scale: 0 1;
  transform-origin: 0 50%;
  transition: scale .9s var(--ease-out) .3s;
}

.story--end .period--2.is-done::after { scale: 1 1; }

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

  /* Scene 3's entrances start hidden and only end visible through an animation. */
  .city__panel .city__kicker,
  .city__panel .city__word,
  .city__panel .city__body,
  .city__panel .city__next,
  .city__brackets { opacity: 1; }
  .city__panel .city__rule { scale: 1 1; }
}

@media print {
  .hero { padding: 0; }
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/*
 * Period III — two desktop frames, kept at their Figma proportions, with their own width scale so
 * the cropped title and the right painting meet the edges of the screen.
 */
.period-three { --period-three-scale: 1; }
.period-three__stage {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1440px;
  transform: translateX(-50%) scale(var(--period-three-scale));
  transform-origin: 50% 0;
  isolation: isolate;
}
.period-three__stage > * { position: absolute; margin: 0; }

/*
 * The chapter (Figma 314:3692): on the end map, opened from card III (lib/dive.js, lib/brilliance.js).
 * The veil is over the stage, not under it as in Period I and II: the title's difference blend
 * needs the ground in its own group, so what must show while the veil opens is on .brilliance__front.
 */
.chapter--brilliance .chapter__scroll {
  height: calc(1259px * var(--period-three-scale));
  min-height: 100%;
  background: #130f08;
}
.brilliance__stage { height: 1259px; background: #130f08; }
.brilliance__front { height: 1259px; }
.brilliance__paper {
  top: 1px; left: -223px; width: 1886px; height: 1258px;
  opacity: .25; mix-blend-mode: lighten; pointer-events: none;
}
.brilliance__intro {
  top: 1049px; left: 109px; width: 393px;
  font-size: 20px; font-weight: 400; line-height: 1.5; letter-spacing: .2px;
  font-variation-settings: "opsz" 14; color: rgb(255 255 255 / .7);
}
.chapter--brilliance .chapter__image { top: 487px; left: 668px; width: 772px; height: 772px; }
.chapter--brilliance .chapter__image img { display: block; width: 772px; height: 772px; object-fit: cover; }
.brilliance__display {
  top: 300px; left: -291px; width: 1450px;
  font-family: var(--font-display); font-size: 356.557px; font-weight: 400;
  line-height: 1; letter-spacing: -7.1311px; text-align: center;
  text-box: trim-both cap alphabetic; white-space: pre; mix-blend-mode: difference;
}
.brilliance__display span { display: inline-block; will-change: transform; }
.chapter--brilliance .chapter__heading { inset: auto auto auto 668px; top: 121px; width: 304px; display: flex; flex-direction: column; gap: 28px; }
.chapter--brilliance .chapter__title {
  position: static; font-family: inherit; font-size: 40px; line-height: 1.1; letter-spacing: -1.9px;
  font-variation-settings: "opsz" 14;
}
.brilliance__meta { display: flex; align-items: center; justify-content: space-between; width: 304px; }
.chapter--brilliance .chapter__kicker { margin: 0; font-size: 16px; font-weight: 300; letter-spacing: normal; }
.chapter--brilliance .chapter__star { width: 14px; height: 14px; }
.brilliance__mural { top: 0; left: 0; width: 434px; height: 298px; pointer-events: none; }
.brilliance__mural :is(img, svg) { position: absolute; top: -27.991px; left: -28.025px; }
/* Inlined by lib/brilliance.js; each bud grows from where it meets its stem (set in user units). */
.brilliance__mural .m-bud { transform-box: view-box; }

/*
 * Compact Period III chapter (Figma 638:2721 phone, 716:749 tablet): one screen, laid out in screen
 * px (no frame scale). The small heading at the top right, the painting (300; 440) on the right
 * 152px (184px) above the foot, the great "Enduring / Brilliance" over it and run off the left
 * edge, the intro under it on the left. lib/dive.js lands card III on the painting.
 */
@media (max-aspect-ratio: 4/5) {
  .chapter--brilliance .period-three__stage {
    left: 0;
    width: 100%;
    height: 100%;
    transform: none;
  }

  .chapter--brilliance .chapter__scroll { height: 100%; }

  .brilliance__paper { top: 0; left: 50%; width: auto; height: 100%; translate: -50% 0; }

  /* --chapter-k (lib/brilliance.js): the painting and the great title shrink together on a view
     too short for them, so the title stays clear of the small heading. */
  .chapter--brilliance .chapter__image {
    top: auto;
    right: 0;
    bottom: 152px;
    left: auto;
    width: calc(300px * var(--chapter-k, 1));
    height: calc(300px * var(--chapter-k, 1));
  }

  .chapter--brilliance .chapter__image img { width: 100%; height: 100%; }

  .brilliance__display {
    top: auto;
    bottom: calc(152px + (300px + 186px - 199px) * var(--chapter-k, 1));
    left: calc(-121px * var(--chapter-k, 1));
    width: calc(496px * var(--chapter-k, 1));
    font-size: calc(108px * var(--chapter-k, 1));
    letter-spacing: -.02em;
  }

  .chapter--brilliance .chapter__heading { top: 64px; right: 20px; left: auto; width: 217px; gap: 8px; }
  .chapter--brilliance .chapter__title { font-size: 18px; line-height: 1.5; letter-spacing: normal; }
  .brilliance__meta { width: 100%; }
  .brilliance__meta .chapter__star { display: none; }
  .chapter--brilliance .chapter__kicker { font-size: 12px; font-weight: 500; letter-spacing: .4em; }

  .brilliance__intro {
    top: auto;
    bottom: calc(128px - 92px);
    left: 20px;
    width: min(300px, 100vw - 40px);
    font-size: 14px;
    line-height: 23px;
  }

  .brilliance__mural { scale: .41; transform-origin: 0 0; }
}

@media (max-aspect-ratio: 4/5) and (min-width: 600px) {
  /* The painting on its own scale (--chapter-image-k), the title's from the view's width (--chapter-k,
     lib/brilliance.js): "Brilliance" sits on a line 430 above the foot, its B at the left edge. */
  .chapter--brilliance .chapter__image { right: 60px; bottom: 184px; width: calc(440px * var(--chapter-image-k, 1)); height: calc(440px * var(--chapter-image-k, 1)); }
  .brilliance__display {
    bottom: calc(184px + 246px * var(--chapter-k, 1));
    left: calc(-26px * var(--chapter-k, 1));
    width: calc(736px * var(--chapter-k, 1));
    font-size: calc(174px * var(--chapter-k, 1));
  }
  .chapter--brilliance .chapter__heading { right: 60px; width: 255px; gap: 10px; }
  .chapter--brilliance .chapter__title { font-size: 22px; }
  .chapter--brilliance .chapter__kicker { font-size: 14px; }
  .brilliance__intro { bottom: calc(144px - 90px); left: 60px; width: 520px; font-size: 18px; line-height: 30px; }
  .brilliance__mural { scale: .66; }
}

/*
 * Compact part II and the sky (Figma 621:2721 / 633:2721 phone, 708:820 / 708:1120 tablet). Both
 * artboards are drawn at --pk (lib/people.js: 0.62 on a 390 × 844 phone, 0.93 on a 768 × 1024
 * tablet), set on the bottom of the view and centred, so the disc, its stations, the card in the
 * hand and the stars that rise from them keep their places relative to each other. The card is
 * drawn a little larger (×1.18; ×1.1). What is read is laid out in screen px instead: each heading
 * is scaled back by 1 / --pk and placed by its Figma position (--st, --sl: the artboard's top left
 * on screen). The arch is widened so its legs run off the screen and the heading sits inside it.
 */
@media (max-aspect-ratio: 4/5) {
  .people {
    --pk: .62;
    --card-k: 1.18;
    --st: calc(100vh - 1009px * var(--pk));
    --sky-top: calc(100vh - 1024px * var(--pk));
    --sl: calc(50vw - 720px * var(--pk));
  }

  .people__stage {
    transform: translate(calc(-720px * var(--pk)), calc(-1009px * var(--pk))) scale(var(--pk));
  }

  .people__hand {
    transform:
      translate(calc(-720px * var(--pk)), calc(-1009px * var(--pk)))
      scale(var(--pk))
      translate(547px, 514px)
      translate(173px, 519px) scale(var(--card-k)) translate(-173px, -519px);
  }

  .people__card { transform-origin: 173px 519px; scale: var(--card-k); }

  :is(.sky-night__stage, .sky__stage) {
    transform: translate(calc(-720px * var(--pk)), calc(-1024px * var(--pk))) scale(var(--pk));
  }

  /* Read in screen px: scaled back, and placed where Figma has them. */
  .people__head,
  .people__arch,
  .people__finial,
  .sky__head { scale: calc(1 / var(--pk)); transform-origin: 0 0; }

  /* Figma's 248 from the top, but never so low that the intro runs into the card: its foot at least
     28 above the card's top (420 on the artboard, at rest; --head-h, lib/people.js). */
  .people__head {
    top: min(calc((248px - var(--st)) / var(--pk)), calc(420px - (28px + var(--head-h, 240px)) / var(--pk)));
    left: calc((20px - var(--sl)) / var(--pk));
    width: calc(100vw - 40px);
  }

  .people__kicker { gap: 10px; font-size: 12px; line-height: 1.4; letter-spacing: .3em; }
  .people__kicker img { width: 10px; height: 10px; }
  .people__title { margin-top: 8px; font-size: 40px; line-height: 1.05; letter-spacing: -.02em; }
  .people__body { width: auto; max-width: 290px; margin-top: 16px; font-size: 14px; line-height: 23px; }

  .people__arch {
    top: calc((15px - var(--st)) / var(--pk));
    left: calc((-32vw - var(--sl)) / var(--pk));
    width: 164vw;
    height: calc(164vw * 1.358);
  }

  .people__finial {
    top: calc((24px - var(--st)) / var(--pk));
    left: calc((50vw - 13px - var(--sl)) / var(--pk));
    width: 26px;
    height: 42px;
  }

  /* The night runs past the sides of the view: the close's crop (lib/sky.js) is a square about the
     whole arch, wider than a phone, and the sky above the painting has to fill it. */
  .sky-night { inset: 0 -50vw; }

  /* lib/sky.js sets --sky-head-top: inside the arch it draws for the screen. */
  .sky__head {
    top: calc((var(--sky-head-top, 215px) - var(--sky-top)) / var(--pk));
    left: calc((50vw - 95px - var(--sl)) / var(--pk));
    width: 190px;
  }

  .sky__kicker { font-size: 11px; line-height: 1.4; letter-spacing: .3em; }
  .sky__title { margin-top: 8px; font-size: 40px; line-height: 1.05; letter-spacing: -.02em; }
  .sky__body { width: auto; margin-top: 16px; font-size: 12px; line-height: 1.5; }

}

@media (max-aspect-ratio: 4/5) and (min-width: 600px) {
  .people { --pk: .93; --card-k: 1.1; }
  /* Down by the card: its foot 56 above the card's top (462 on the artboard, at rest; --head-h,
     lib/people.js), but never nearer the top of the view than 96. */
  .people__head {
    top: max(calc((96px - var(--st)) / var(--pk)), calc(462px - (56px + var(--head-h, 280px)) / var(--pk)));
    left: calc((60px - var(--sl)) / var(--pk));
    width: calc(100vw - 120px);
  }
  .people__kicker { font-size: 13px; }
  .people__title { font-size: 56px; }
  /* Inside the arch's legs. */
  .people__body { max-width: 440px; margin-inline: auto; font-size: 18px; line-height: 30px; }
  .people__arch { top: calc((-12px - var(--st)) / var(--pk)); }
  .people__finial { top: calc((35px - var(--st)) / var(--pk)); left: calc((50vw - 15px - var(--sl)) / var(--pk)); width: 31px; height: 50px; }
  .sky__head { left: calc((50vw - 190px - var(--sl)) / var(--pk)); width: 380px; }
  .sky__kicker { font-size: 13px; }
  .sky__title { font-size: 48px; }
  .sky__body { font-size: 16px; }
}

/*
 * Part I (Figma 335:4367, 1440 × 964): slides up over the chapter, still pinned (lib/cover.js),
 * and is at least a view tall, so its top always gets there. The turn is in lib/built-to-last.js.
 * It then sticks by its foot for --through artboard px, while the hall opens through the hollow
 * of its disc (lib/hall.js); --through stays 0 with reduced motion.
 */
.built-to-last {
  --frame: max(calc(964px * var(--period-three-scale)), 100vh);
  position: relative;
  z-index: 5;
  height: calc(var(--frame) + var(--through, 0px) * var(--stage-scale, 1));
  margin-top: calc(-1024px * var(--stage-scale, 1) - var(--cover-extra, 0px));
  background: #efefef;
  color: #0b0a0a;
  box-shadow: 0 calc(-6px * var(--stage-scale, 1)) calc(36px * var(--stage-scale, 1)) rgb(4 2 0 / calc(.4 * (1 - var(--arrived, 1))));
}
/* On a view taller than the frame, the ground and the paper run on to the section's foot. */
.built-to-last__pin {
  position: sticky;
  top: calc(100vh - var(--frame));
  height: var(--frame);
  overflow: hidden;
}
.built-to-last__camera { position: absolute; inset: 0; will-change: transform; }
.built-to-last__stage { height: max(964px, calc(100vh / var(--period-three-scale))); background: #efefef; }
.built-to-last__orbit { left: 136px; }
.built-to-last__orbit--top { top: -394px; }
.built-to-last__orbit--bottom { top: 475px; }
/* Figma's own renders, feathered and on the paper's colour, so under the orbits. */
.built-to-last__embossed { z-index: -1; }
.built-to-last__embossed--bottom { left: 0; top: 652px; width: 1440px; height: 312px; }
.built-to-last__embossed--top { left: 0; top: 6px; width: 1430.5px; height: 318px; }
/* The whole of the letters, in Figma's own emboss, only ever seen fading in about the cursor. */
.built-to-last__embossed--full {
  top: 0;
  left: 0;
  width: 1440px;
  height: 964px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s var(--ease-out);
  /* Eased, so it thins into the paper with no edge to see. */
  mask-image: radial-gradient(circle 380px at var(--x, 0) var(--y, 0), #000, rgb(0 0 0 / .84) 20%, rgb(0 0 0 / .58) 40%, rgb(0 0 0 / .3) 60%, rgb(0 0 0 / .1) 80%, transparent);
}
.built-to-last__embossed--full.is-shown { opacity: .7; }
.built-to-last__paper { left: -62.744px; top: -104px; width: 1565.487px; height: max(1168px, calc(100vh / var(--period-three-scale) + 104px)); object-fit: cover; opacity: .2; mix-blend-mode: color-burn; pointer-events: none; }
.built-to-last__line { left: 0; top: 623.75px; }
/* The hollow's own edge frames the picture. The mask reaches past it (Figma 226.7 × 233.8, centred
   the same), because the hollow isn't round and the picture must still fill it as it turns. */
.built-to-last__window {
  top: 285.604px; left: 420.939px; width: 596.696px; height: 397.798px;
  mask: url("assets/built-to-last/gateway-mask.svg") 178px 153px / 240px 240px no-repeat;
}
/* The hall's first painting, at the size and place it has when the camera sets off (lib/hall.js):
   the same picture under the same light, so nothing changes when the hall takes over from it. */
.built-to-last__picture { position: absolute; top: 151.8px; left: 117px; width: 362px; height: 242.4px; overflow: hidden; isolation: isolate; will-change: rotate; }
.built-to-last__picture img { display: block; width: 100%; height: 100%; object-fit: cover; }
.built-to-last__seal {
  top: 302px; left: 463.5px; width: 514px; height: 514px;
  filter: drop-shadow(0 6px 12px rgb(40 22 12 / .22)) drop-shadow(0 28px 70px rgb(6 3 1 / .15));
}
/* Turned about the disc's own centre, which is not quite the box's; the shadow stays where it falls. */
.built-to-last__seal-crop { position: absolute; top: 0; left: 2.139px; width: 509.723px; height: 514.713px; overflow: hidden; transform-origin: 254.83px 257.4px; will-change: rotate; }
.built-to-last__seal-crop img { position: absolute; top: -4.88%; left: -4.32%; width: 110.48%; height: 109.34%; max-width: none; }
.built-to-last__heading { top: 149px; left: 375px; width: 691px; text-align: center; display: flex; flex-direction: column; gap: 32px; }
.built-to-last__heading p { margin: 0; font-size: 14px; font-weight: 500; line-height: normal; letter-spacing: 5.6px; text-transform: uppercase; }
.built-to-last__heading h3 { margin: 0; font-family: var(--font-display); font-size: 90px; font-weight: 400; line-height: 1.2; letter-spacing: -1.8px; text-box: trim-both cap alphabetic; }
/* The whole text circle is centred on (720, 559); this box is the part with words on it. */
.built-to-last__curved-copy { left: 482.479px; top: 519.475px; transform-origin: 237.521px 39.525px; will-change: rotate; }
.built-to-last__date { width: 120px; display: flex; flex-direction: column; gap: 2px; text-align: center; text-transform: uppercase; }
.built-to-last__date p { margin: 0; font-size: 13px; font-weight: 700; line-height: normal; letter-spacing: 1.82px; }
.built-to-last__date span { font-size: 10px; font-weight: 500; line-height: normal; letter-spacing: 1.4px; color: rgb(11 10 10 / .7); }
.built-to-last__date--buyid { top: 897px; left: 659px; }
.built-to-last__date--abbasid { top: 641px; left: 134px; }
.built-to-last__date--seljuk { top: 641px; left: 1187px; }

/*
 * Compact Built to last (Figma 638:2875 phone, 716:903 tablet): the frame is drawn about its disc
 * (lib/brilliance.js: the disc 340 across on a phone, 520 on a tablet), centred, its top 214px
 * (209px) down. The heading and the three dates are read in screen px (scaled back by the frame's
 * scale): the heading centred at the top, the dates in a row under the disc, 982 · 1067 · 1234.
 */
@media (max-aspect-ratio: 4/5) {
  .built-to-last {
    --bt-y: 14px;
    --bt-sl: calc(50vw - 720px * var(--period-three-scale));
  }

  .built-to-last__stage {
    height: max(964px, calc((100vh - var(--bt-y)) / var(--period-three-scale)));
    transform: translateX(-50%) translateY(var(--bt-y)) scale(var(--period-three-scale));
  }

  /* The frame is set --bt-y down, and the paper's texture reaches above it: its ground goes up too,
     or the texture would burn into nothing there and the top edge show a flat grey band. */
  .built-to-last__stage::before {
    content: "";
    position: absolute;
    z-index: -2;
    bottom: 100%;
    left: 0;
    width: 1440px;
    height: 120px;
    background: #efefef;
  }

  .built-to-last__heading,
  .built-to-last__date { scale: calc(1 / var(--period-three-scale)); transform-origin: 0 0; }

  .built-to-last__heading {
    top: calc((64px - var(--bt-y)) / var(--period-three-scale));
    left: calc((20px - var(--bt-sl)) / var(--period-three-scale));
    width: calc(100vw - 40px);
    gap: 8px;
  }

  .built-to-last__heading p { font-size: 11px; line-height: 1.4; letter-spacing: .3em; }
  .built-to-last__heading h3 { font-size: 40px; line-height: 1.05; letter-spacing: -.02em; text-box: none; }

  .built-to-last__date { top: calc((604px - var(--bt-y)) / var(--period-three-scale)); width: 120px; }
  .built-to-last__date p { font-size: 11px; font-weight: 500; letter-spacing: .3em; }
  .built-to-last__date--buyid { left: calc((0px - var(--bt-sl)) / var(--period-three-scale)); }
  .built-to-last__date--seljuk { left: calc((50vw - 60px - var(--bt-sl)) / var(--period-three-scale)); }
  .built-to-last__date--abbasid { left: calc((100vw - 120px - var(--bt-sl)) / var(--period-three-scale)); }
  .built-to-last__line { top: calc((590px - var(--bt-y)) / var(--period-three-scale)); }
}

@media (max-aspect-ratio: 4/5) and (min-width: 600px) {
  /* The heading 100 down, clear of the navbar; the frame (its disc) 16 lower than Figma's to match. */
  .built-to-last { --bt-y: -80px; }
  .built-to-last__heading { top: calc((100px - var(--bt-y)) / var(--period-three-scale)); left: calc((60px - var(--bt-sl)) / var(--period-three-scale)); width: calc(100vw - 120px); gap: 10px; }
  .built-to-last__heading p { font-size: 13px; }
  .built-to-last__heading h3 { font-size: 56px; }
  /* The dates and their line by the disc's foot (816 on the frame), 61 and 41 under it as Figma has
     them on a 768 tablet, so a wider one, whose disc is larger, never runs the disc into them. */
  .built-to-last__date { top: calc(816px + 61px / var(--period-three-scale)); width: 144px; }
  .built-to-last__date p { font-size: 13px; }
  .built-to-last__date span { font-size: 12px; }
  .built-to-last__date--buyid { left: calc((48px - var(--bt-sl)) / var(--period-three-scale)); }
  .built-to-last__date--seljuk { left: calc((50vw - 72px - var(--bt-sl)) / var(--period-three-scale)); }
  .built-to-last__date--abbasid { left: calc((100vw - 192px - var(--bt-sl)) / var(--period-three-scale)); }
  .built-to-last__line { top: calc(816px + 41px / var(--period-three-scale)); }
}
.built-to-last__star { width: 20px; font-size: 14px; font-weight: 500; line-height: normal; color: #491508; text-align: center; }
.built-to-last__star--left { left: 184px; top: 615px; }
.built-to-last__star--right { left: 1237px; top: 615px; }
.built-to-last__star--bottom { left: 709px; top: 937px; }
.built-to-last__point--right { left: 1108px; top: 621px; }
.built-to-last__point--left { left: 327px; top: 621px; }

/*
 * The hall (Figma 359:220): one long room of three bays, each 1582 stage px wide with its wall set
 * from Figma's 1440 × 964 scene. They overlap by 110 px, in the dark of the doorway, and each wall
 * fades in over the last, so the floor and carpet run on with no seam. The stage fits the view (--hall-scale, lib/hall.js) and everything
 * on it is in scene px; the bays are offset by their crop in Figma (−71, −91), so on a wider view
 * more of the room shows. Over the wall: the painting, then the gilded frame with its opening
 * transparent, then the plaque, in the bay's own coordinates.
 */
.hall {
  --ground: #0a0403;
  position: relative;
  z-index: 6;
  height: calc(100vh + var(--hall-travel, 0px) * var(--stage-scale, 1));
  background: var(--ground);
  color: #fff8ee;
}
/* Over the disc's section until it has opened, seen only through the hollow. */
.hall.is-armed {
  margin-top: calc(-100vh - var(--through, 0px) * var(--stage-scale, 1));
  background: none;
  pointer-events: none;
}
.hall.is-armed.is-open { pointer-events: auto; }
.hall__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--ground);
  isolation: isolate;
}
/* Opened through the disc's hollow (the circle is written by lib/hall.js). A clip rather than a
   mask: a mask over the whole hall is repainted on every frame of the zoom. Clipped to nothing,
   not hidden: hidden, it would all have to be painted again in the frame it comes back. */
.hall.is-armed:not(.is-open) .hall__pin { clip-path: circle(0 at 50% 50%); pointer-events: none; }
.hall__stage {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1440px;
  height: 964px;
  transform: translate(-50%, -50%) scale(var(--hall-scale, 1));
  will-change: transform;
}
.hall__track { position: absolute; top: -91px; left: -71.04px; display: flex; will-change: transform; }
.hall__bay { position: relative; flex: 0 0 1582.08px; height: 1054.72px; }
.hall__bay + .hall__bay { margin-left: -110px; }
.hall__wall { display: block; width: 100%; height: 100%; }
.hall__bay + .hall__bay .hall__wall {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 110px);
  mask-image: linear-gradient(90deg, transparent, #000 110px);
}
.hall__art { position: absolute; top: 140px; left: 443.04px; width: 696px; height: 466px; overflow: hidden; isolation: isolate; }
.hall__art img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* The room's light on the picture: warmed, and falling off to the corners. */
.hall__light {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 72% 72% at 50% 50%, rgb(58 28 8 / 0), rgb(58 28 8 / .06) 55%, rgb(58 28 8 / .5)), rgb(239 207 155 / .34);
  box-shadow: inset 0 3px 16px rgb(20 8 0 / .5);
  mix-blend-mode: multiply;
}
.hall__frame {
  position: absolute;
  top: 106.13px;
  left: 409.29px;
  width: 763.5px;
  height: 534.3px;
  max-width: none;
  box-shadow: 0 14px 30px rgb(5 2 0 / .62);
}
/* Figma's plaque: the label cut into the brass. The letters are multiplied into the plate, so its
   grain shows through them; the copy underneath is the lower lip of the cut, catching the light. */
.hall__plaque {
  position: absolute;
  top: 624px;
  left: 681.54px;
  display: grid;
  place-items: center;
  width: 219px;
  height: 38px;
  margin: 0;
  background: url("assets/hall/plaque.webp") center / 100% 100% no-repeat;
  box-shadow: 0 4px 10px rgb(5 2 0 / .6);
  font-family: var(--font-label);
  font-size: 10px;
  font-weight: 500;
  font-variation-settings: "opsz" 14;
  letter-spacing: .15em;
  line-height: 1;
  white-space: nowrap;
  isolation: isolate;
}
/* Once, as a bay is reached: a band of light across the gilding, then the brass. Masked to their
   own shapes, so it never touches the painting. */
.hall__sheen {
  position: absolute;
  top: 106.13px;
  left: 409.29px;
  width: 763.5px;
  height: 534.3px;
  overflow: hidden;
  -webkit-mask: url("assets/hall/frame.webp") center / 100% 100% no-repeat;
  mask: url("assets/hall/frame.webp") center / 100% 100% no-repeat;
  pointer-events: none;
}
.hall__sheen i {
  position: absolute;
  top: -20%;
  left: 0;
  width: 46%;
  height: 140%;
  background: linear-gradient(90deg, rgb(255 236 186 / 0), rgb(255 236 186 / .07) 22%, rgb(255 236 186 / .2) 50%, rgb(255 236 186 / .07) 78%, rgb(255 236 186 / 0));
  transform: translate3d(-130%, 0, 0) rotate(14deg);
  opacity: 0;
  will-change: transform;
}
.hall__bay.is-here .hall__sheen i { animation: hall-sheen 3.4s cubic-bezier(.45, .05, .55, .95) .2s both; }
@keyframes hall-sheen {
  from { transform: translate3d(-110%, 0, 0) rotate(14deg); opacity: 0; }
  30% { opacity: 1; }
  70% { opacity: 1; }
  to { transform: translate3d(230%, 0, 0) rotate(14deg); opacity: 0; }
}
.hall__plaque::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(100deg, rgb(255 240 200 / 0) 15%, rgb(255 240 200 / .2) 50%, rgb(255 240 200 / 0) 85%) -219px 0 / 219px 100% no-repeat;
  -webkit-mask: url("assets/hall/plaque.webp") center / 100% 100% no-repeat;
  mask: url("assets/hall/plaque.webp") center / 100% 100% no-repeat;
}
.hall__bay.is-here .hall__plaque::before { animation: hall-plaque-sheen 2.2s cubic-bezier(.45, .05, .55, .95) 1.5s both; }
@keyframes hall-plaque-sheen {
  from { background-position: -219px 0; }
  to { background-position: 219px 0; }
}
.hall__plaque span {
  position: relative;
  color: rgb(51 27 8 / .92);
  text-shadow: 0 -.5px .5px rgb(13 5 0 / .75);
  mix-blend-mode: multiply;
}
.hall__plaque span::after {
  content: attr(data-label);
  position: absolute;
  inset: .55px 0 auto;
  z-index: -1;
  color: rgb(255 230 158 / .8);
  text-shadow: none;
}
/* The dark of the walk: on the view, not the wall, so it has no edge to pass across the room. On
   its own layer: changing it must not repaint the wall beneath. */
.hall__passage {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3200px;
  height: 2000px;
  background: radial-gradient(ellipse 34% 40% at 50% 46%, rgb(10 4 3 / .1), rgb(10 4 3 / .92));
  opacity: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  will-change: opacity;
}
.hall__glow {
  position: absolute;
  top: 40px;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgb(255 176 84 / .13), rgb(255 176 84 / 0));
  pointer-events: none;
  will-change: opacity;
}
.hall__glow--left { left: 149px; }
.hall__glow--right { left: 1092px; animation-delay: -2.3s; }
/* A candle, breathing: very little, very slowly. */
@keyframes hall-flicker {
  from { opacity: .72; }
  38% { opacity: 1; }
  62% { opacity: .84; }
  to { opacity: .96; }
}
.hall.is-armed .hall__glow { animation: hall-flicker 5.4s ease-in-out infinite alternate; }
.hall__glow.is-offscreen { animation-play-state: paused; }
.hall__shade {
  position: absolute;
  top: 561px;
  left: 131px;
  width: 1320px;
  height: 640px;
  background: radial-gradient(ellipse closest-side, rgb(10 4 3 / .86), rgb(10 4 3 / .74) 55%, rgb(10 4 3 / 0));
  pointer-events: none;
}
.hall__entries { position: absolute; top: 618px; left: 340px; width: 760px; will-change: transform; }
.hall__entry { position: absolute; top: 0; left: 0; width: 100%; text-align: center; }
.hall__entry + .hall__entry { opacity: 0; }
.hall__entry h4 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 400;
  line-height: 56px;
}
.hall__entry h4 span { display: inline-block; }
.hall__entry p {
  width: 680px;
  margin: 0 auto;
  color: rgb(255 248 238 / .8);
  font-size: 18px;
  line-height: 1.65;
}
.hall__dots {
  position: absolute;
  top: 900px;
  left: 50%;
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  transform: translateX(-50%);
}
.hall__dots li {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffebca;
  opacity: .3;
}
/* A column near the camera, in shadow and out of focus, with the soft dark it throws around it
   (all in the image): passes the view faster than the wall (lib/hall.js). */
/* Figma 376:217. The room goes down and the letter is thrown in (lib/letter-throw.js): the sheet is
   on the canvas while it flies, and the letter itself takes over as it comes to rest. Opacity only,
   so neither has to be painted again when it comes. Its box and its turn at rest are Figma's. */
.hall__dim {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3200px;
  height: 2000px;
  background: rgb(10 4 3 / .68);
  opacity: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  will-change: opacity;
}
.hall__letter,
.hall__letter-shadow {
  position: absolute;
  top: 252.42px;
  left: 386.01px;
  width: 680px;
  height: 440px;
  opacity: 0;
  transform: rotate(-1.6deg);
  will-change: transform, opacity;
}
.hall__letter-shadow { background: rgb(5 3 0 / .62); filter: blur(30px); pointer-events: none; }
.hall__sheet {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  visibility: hidden;
  pointer-events: none;
}
.hall__letter img { display: block; width: 100%; height: 100%; }
.hall__letter-copy {
  position: absolute;
  top: 139px;
  left: 80px;
  width: 520px;
  color: #241208;
  text-align: center;
  mix-blend-mode: multiply;
}
.hall__letter h4 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 400;
  line-height: 45px;
}

/*
 * Compact hall (Figma 640:2721 … 640:2787 phone, 716:940 … 716:1009 tablet). The room is drawn about
 * its painting (lib/hall.js: --hall-scale makes the painting 300 across on a phone, 480 on a
 * tablet), centred in the view. The copy and the dots are read in screen px: scaled back by
 * 1 / --hall-scale and placed where Figma has them, the copy 64px (40px) under the plaque. The
 * letter comes to rest under the plaque (lib/letter-throw.js).
 */
@media (max-aspect-ratio: 4/5) {
  .hall {
    --hall-top: calc(50vh - 482px * var(--hall-scale, 1));
    --hall-left: calc(50vw - 720px * var(--hall-scale, 1));
  }

  .hall__entries {
    top: calc((517px - var(--hall-top)) / var(--hall-scale, 1));
    left: calc((20px - var(--hall-left)) / var(--hall-scale, 1));
    width: calc(100vw - 40px);
    scale: calc(1 / var(--hall-scale, 1));
    transform-origin: 0 0;
  }

  .hall__entry h4 { margin-bottom: 16px; font-size: 30px; line-height: 1.1; }
  .hall__entry p { width: auto; max-width: 310px; font-size: 14px; line-height: 23px; }

  .hall__dots {
    top: calc((796px - var(--hall-top)) / var(--hall-scale, 1));
    scale: calc(1 / var(--hall-scale, 1));
    transform-origin: 0 0;
  }
}

/* Tablet (Figma 716:940): the room is lowered by --hall-drop (lib/hall.js) and fades into the dark
   above and below it ("Calm"), so no edge of the picture shows and it reads as a room one stands in.
   The copy and the dots are placed as on the 768 × 1024 frame, scaled about the middle of the view. */
@media (max-aspect-ratio: 4/5) and (min-width: 600px) {
  .hall__track { top: calc(-91px + var(--hall-drop, 0px)); }
  .hall__track::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgb(10 4 3) 0%, rgb(10 4 3 / .85) 3%, rgb(10 4 3 / .1) 15%, rgb(10 4 3 / .15) 63.9%, rgb(10 4 3 / .9) 69.9%, rgb(10 4 3) 100%);
    pointer-events: none;
  }
  .hall__shade { display: none; }
  .hall__entries { top: calc((50vh + 17.708vw - var(--hall-top)) / var(--hall-scale, 1)); left: calc((60px - var(--hall-left)) / var(--hall-scale, 1)); width: calc(100vw - 120px); }
  .hall__entry h4 { font-size: 48px; line-height: 1.15; letter-spacing: -.01em; }
  .hall__entry p { max-width: 540px; font-size: 21.6px; line-height: 34.8px; }
  .hall__dots { top: calc((50vh + 61.458vw - var(--hall-top)) / var(--hall-scale, 1)); gap: 10px; }
}
.hall__letter p { margin: 0; color: rgb(36 18 8 / .82); font-size: 16px; line-height: 1.65; }
.hall__column {
  position: absolute;
  top: -170px;
  left: 0;
  width: 562px;
  height: 1300px;
  background: url("assets/hall/column.webp") center / 100% 100% no-repeat;
  transform: translate3d(-900px, 0, 0);
  will-change: transform;
  pointer-events: none;
}

/* Period III, part II: A catalogue of everything (Figma 397:6265; lib/catalogue.js). Under the hall, pinned
   through the burn that opens it. The room is on the view, sized and placed from the script so its
   lamp can sit where the fire began, and the stage is scaled to fit it. */
.hall.is-burnt .hall__pin { clip-path: circle(0 at 50% 50%); pointer-events: none; }
.hall__burn {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  visibility: hidden;
  pointer-events: none;
}
.catalogue {
  --ground: #170601;
  position: relative;
  z-index: 5;
  height: calc(100vh + var(--catalogue-travel, 0px) * var(--stage-scale, 1));
  background: var(--ground);
  color: #fff;
}
.catalogue.is-armed { margin-top: calc(-100vh - var(--burn, 0px) * var(--stage-scale, 1)); }
.catalogue__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--ground);
  isolation: isolate;
}
.catalogue__room {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.catalogue__scene { display: block; width: 100%; height: 100%; }
.catalogue__foot {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 28%;
  background: linear-gradient(transparent, var(--ground));
}
/* The lamp, still burning. */
.catalogue__lamp {
  position: absolute;
  top: 51.76%;
  left: 50.17%;
  width: 44%;
  aspect-ratio: 1.2;
  background: radial-gradient(closest-side, rgb(255 168 84 / .3), rgb(255 150 70 / .1) 45%, transparent);
  transform: translate(-50%, -50%);
  mix-blend-mode: screen;
  pointer-events: none;
  opacity: .9;
  will-change: opacity;
}
/* Still until the canvas has gone, so it shows the same glow the canvas drew, then alive. */
.catalogue.is-lit .catalogue__lamp { animation: catalogue-flame 3.6s ease-in-out infinite alternate; }
.catalogue__lamp.is-offscreen { animation-play-state: paused; }
@keyframes catalogue-flame {
  0% { opacity: .9; }
  32% { opacity: 1; }
  58% { opacity: .84; }
  100% { opacity: .94; }
}
.catalogue__dim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgb(23 6 1 / .72), rgb(23 6 1 / .6) 22%, transparent 42%),
    rgb(23 6 1 / .46);
  pointer-events: none;
  will-change: opacity;
}
.catalogue.is-armed .catalogue__dim { opacity: 0; }
.catalogue__stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 1440px;
  height: 1261px;
  transform-origin: 0 0;
  will-change: transform;
  pointer-events: none;
}
.catalogue__title {
  position: absolute;
  top: 120px;
  left: 367px;
  width: 707px;
  margin: 0;
  font-family: var(--font-display);
  font-size: 90px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -1.8px;
  text-align: center;
}
.catalogue__title span { display: inline-block; }
.catalogue__wheel {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.catalogue__card {
  position: absolute;
  top: 392px;
  left: 574px;
  width: 292px;
  height: 430px;
  pointer-events: auto;
  will-change: transform, opacity;
}
.catalogue.is-armed:not(.is-set) .catalogue__card { pointer-events: none; }
.catalogue__face {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: #241208;
  font: inherit;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
}
.catalogue.is-dragging .catalogue__face { cursor: grabbing; }
.catalogue__face:focus { outline: none; }
/* Under the pointer the card comes up a little and its painting leans in. */
.catalogue__lift {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .7s cubic-bezier(.2, .7, .2, 1);
}
@media (hover: hover) and (min-aspect-ratio: 801/1000) {
  .catalogue__face:hover .catalogue__lift { transform: translate3d(0, -7px, 0); }
  .catalogue__face:hover .catalogue__art { transform: scale(1.035); }
}
.catalogue.is-dragging .catalogue__lift { transform: none; }
.catalogue__art { transition: transform 1.2s cubic-bezier(.2, .7, .2, 1); will-change: transform; }
/* A chapter just reached takes one soft band of light across its leaf, like the hall's frames.
   Added to the leaf by the script. */
.catalogue__sheen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}
.catalogue__sheen i {
  position: absolute;
  top: -30%;
  left: -70%;
  width: 60%;
  height: 160%;
  background: linear-gradient(100deg, transparent, rgb(255 244 222 / .24) 50%, transparent);
  opacity: 0;
}
.catalogue__card.is-active .catalogue__sheen i { animation: catalogue-sheen 2.2s cubic-bezier(.4, .05, .4, 1) .15s both; }
.catalogue:not(.is-set) .catalogue__card.is-active .catalogue__sheen i { animation: none; }
@keyframes catalogue-sheen {
  0% { opacity: 0; transform: translate3d(0, 0, 0); }
  18% { opacity: 1; }
  82% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(330%, 0, 0); }
}
.catalogue__face:focus-visible .catalogue__copy strong { text-decoration: underline; text-underline-offset: 4px; }
/* Each chapter is a loose manuscript leaf (Figma 663:1140): aged paper (a Figma AI texture, toned
   as in Figma and baked into leaf-paper.jpg) as tall as its text needs, the painting inside thin
   jadwal rules, the maqala's number as a red Ruqaa rubric (exported from Figma, the site's Ruqaa
   subset has no Arabic letters). The card box stays 292 × 430, so the wheel turns as before. */
.catalogue__leaf {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 244px;
  padding: 16px 22px 22px;
  border-radius: 1.5px;
  background: #d9c29a url("assets/catalogue/leaf-paper.jpg") center / 100% 100% no-repeat;
  /* Soft, wide and low: the leaf rests in lamplight rather than casting a hard edge. */
  box-shadow:
    inset 0 0 14px rgb(107 69 31 / .22),
    0 18px 40px -10px rgb(8 3 0 / .38),
    0 6px 16px -6px rgb(8 3 0 / .22);
}
.catalogue__rubric {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 23px;
}
.catalogue__rubric::before,
.catalogue__rubric::after {
  content: "";
  width: 26px;
  height: .6px;
  background: rgb(133 38 20 / .6);
}
.catalogue__rubric img { display: block; height: auto; }
/* Jadwal: an ink hairline, a gold band inside it, the painting set in by 7px. */
.catalogue__frame {
  position: relative;
  flex: none;
  width: 200px;
  height: 190px;
}
.catalogue__frame::before,
.catalogue__frame::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.catalogue__frame::before { inset: .5px; border: .75px solid rgb(36 18 8 / .45); }
.catalogue__frame::after { inset: 3.5px; border: 1.5px solid #a8803d; }
.catalogue__window {
  position: absolute;
  inset: 7px;
  overflow: hidden;
  outline: .5px solid rgb(36 18 8 / .6);
}
.catalogue__art { display: block; width: 100%; height: 100%; object-fit: cover; }
.catalogue__copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 196px;
  padding-top: 4px;
  text-align: center;
}
.catalogue__copy strong { color: rgb(41 20 8); font-family: var(--font-display); font-size: 19px; font-weight: 400; line-height: 1.18; }
.catalogue__copy small { color: rgb(46 26 13 / .78); font-size: 12px; line-height: 18px; }
.catalogue__intro {
  position: absolute;
  top: 900px;
  left: 420px;
  width: 600px;
  text-align: center;
}
.catalogue__intro > * { will-change: transform, opacity; }
.catalogue__label { margin: 0 0 18px; color: rgb(255 229 189 / .8); font-size: 16px; font-weight: 300; line-height: 1.4; }
.catalogue__body { margin: 0; color: rgb(255 247 237 / .8); font-size: 18px; line-height: 1.65; }
.catalogue__star { display: block; margin: 36px auto 0; }
.catalogue__heading { display: none; }

/*
 * Compact catalogue (Figma 641:2721 phone, 716:1027 tablet): the wheel of leaves at their own size
 * (lib/catalogue.js), the title at the top and the intro under the wheel read in screen px, scaled
 * back from the stage (--catalogue-f) and placed where Figma has them.
 */
@media (max-aspect-ratio: 4/5) {
  .catalogue__title,
  .catalogue__intro { scale: calc(1 / var(--catalogue-f, 1)); transform-origin: 0 0; }

  .catalogue__title {
    top: calc((64px - var(--catalogue-top, 0px)) / var(--catalogue-f, 1));
    left: calc((20px - var(--catalogue-left, 0px)) / var(--catalogue-f, 1));
    width: calc(100vw - 40px);
    font-size: 40px;
    line-height: 1.05;
    letter-spacing: -.02em;
  }

  /* Under the leaf, where lib/catalogue.js has made room (--catalogue-intro-top). The chapters'
     dots lead it, just under the leaf, as the slider's pagination: the one on top longer and lit. */
  .catalogue__intro {
    top: calc((var(--catalogue-intro-top, 586px) - var(--catalogue-top, 0px)) / var(--catalogue-f, 1));
    left: calc((20px - var(--catalogue-left, 0px)) / var(--catalogue-f, 1));
    display: flex;
    flex-direction: column;
    width: calc(100vw - 40px);
  }

  /* Tappable: each dot is drawn 3px tall in a 23px band (padding, outside its background). */
  .catalogue .catalogue__dots { order: -1; gap: 6px; margin: -10px 0 14px; pointer-events: auto; }
  .catalogue.is-armed:not(.is-set) .catalogue__dots { pointer-events: none; }
  .catalogue .catalogue__dots li {
    box-sizing: content-box;
    padding: 10px 0;
    cursor: pointer;
    width: calc(6px + 16px * var(--near, 0));
    height: 3px;
    border-radius: 2px;
    background: color-mix(in srgb, #ffebca, #c8a15a calc(var(--near, 0) * 100%)) content-box;
  }
  .catalogue__star { display: none; }

  .catalogue__label { margin-bottom: 12px; font-size: 12px; }
  .catalogue__body { font-size: 14px; line-height: 23px; }
}

@media (max-aspect-ratio: 4/5) and (min-width: 600px) {
  /* Centred in the view, the title 104 down (clear of the navbar; lib/catalogue.js knows it too). */
  /* Figma 716:1027: the title --catalogue-title-y down (lib/catalogue.js); under the leaf the kicker,
     the heading again and the body. As on a phone the scroll goes on to the next section, so the
     chapters' dots lead the intro, as the slider's pagination, in place of the star. */
  .catalogue__title { top: calc((var(--catalogue-title-y, 86px) - var(--catalogue-top, 0px)) / var(--catalogue-f, 1)); left: calc((50vw - 280px - var(--catalogue-left, 0px)) / var(--catalogue-f, 1)); width: 560px; font-size: 56px; }
  .catalogue__title br { display: none; }
  .catalogue__title br + span { margin-left: .26em; }
  .catalogue__intro { left: calc((50vw - 280px - var(--catalogue-left, 0px)) / var(--catalogue-f, 1)); width: 560px; align-items: center; }
  .catalogue .catalogue__dots { gap: 8px; margin-bottom: 18px; }
  .catalogue .catalogue__dots li { width: calc(8px + 20px * var(--near, 0)); }
  .catalogue__label { margin-bottom: 10px; color: #ffebca; font-size: 13px; font-weight: 500; letter-spacing: .3em; }
  .catalogue__heading { display: block; margin: 0 0 19px; color: #fff; font-family: var(--font-display); font-size: 32px; font-weight: 400; line-height: 1.1; letter-spacing: -.01em; }
  .catalogue__body { font-size: 18px; line-height: 30px; }
}
/* As in the hall: each as lit as the wheel is near its chapter (lib/catalogue.js). */
.catalogue__dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}
.catalogue__dots li { width: 6px; height: 6px; border-radius: 50%; background: #ffebca; opacity: .3; }
.catalogue__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ===========================================================================================
   Period III, part III · Travel west (Figma 575:2716 statement, 580:2752 track of six stops).
   It slides over the catalogue while that is still pinned (the negative margin), then pins over a
   still ground (WebGL where it can): the statement lights word by word and goes up, the row of six
   stops comes up from below and in from the right at once, then moves sideways, 1:1. At Book II
   the ground turns from night to paper: lib/travel.js sets .is-paper as Book II's edge passes, and
   --light runs 0 → 1 over 2.4 s on a gentle sine curve, so the ground dawns rather than flips.
   The ground follows --light all the way; the ink (text, the map's ink, which is its SVG as a mask
   over --fg, the BOOK words) follows --ink, which holds until the ground is half way and then
   turns over a short window (INK in lib/travel-gl.js matches it). Mixed together, ground and ink
   met at the same grey and the map, the words and the text vanished for a second; this way the
   ink is light while the ground is darker than mid and dark once it is lighter. Artboard px,
   scaled by --stage-scale like the other sections.
   =========================================================================================== */
@property --light {
  syntax: '<number>';
  inherits: true;
  initial-value: 0;
}
.travel {
  --light: 0;
  transition: --light 2.4s cubic-bezier(.37, 0, .63, 1);
  --ink: clamp(0, (var(--light) - .44) / .12, 1);
  --ground: color-mix(in oklab, #efefef calc(var(--light) * 100%), #170601);
  --fg: color-mix(in oklab, #2a1207 calc(var(--ink) * 100%), #f0dfd3);
  --bright: color-mix(in oklab, #170601 calc(var(--ink) * 100%), #fff);
  --gold: color-mix(in oklab, #a8680a calc(var(--ink) * 100%), #dd981b);
  position: relative;
  z-index: 6;
  height: calc(100vh + var(--travel-length, 10000px) * var(--stage-scale, 1));
  margin-top: -100vh;
  background: var(--ground);
  color: var(--fg);
  /* Its foot's shadow; gone once it hands off to the finale (lib/handoff.js). */
  box-shadow:
    0 calc(-8px * var(--stage-scale, 1)) calc(48px * var(--stage-scale, 1)) rgb(4 2 0 / calc(.5 * (1 - var(--arrived, 1)))),
    0 calc(14px * var(--stage-scale, 1)) calc(56px * var(--stage-scale, 1)) rgb(4 2 0 / calc(.5 - .3 * var(--light)));
}
.travel.is-paper { --light: 1; }
@media (prefers-reduced-motion: reduce) { .travel { transition: none; } }
.travel :where(p, h2, h3, figure) { margin: 0; font-weight: 400; }
.travel__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  isolation: isolate;
  background: var(--ground);
}
.travel__ground { position: absolute; inset: 0; pointer-events: none; }
.travel__texture {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  mix-blend-mode: soft-light;
  opacity: .55;
}
/* One warm pool of light; it goes out as the paper comes up. */
.travel__glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 55% at 50% 48%, rgb(90 42 18 / .42), rgb(90 42 18 / 0) 100%);
  opacity: calc(1 - var(--light));
}
/* In WebGL (lib/travel-gl.js): the ground, the pictures and the big BOOK words in one canvas under
   the section's text. Once it draws them, their DOM stays in place, transparent, for reading. */
.travel__gl { position: absolute; inset: 0; width: 100%; height: 100%; }
.travel.is-gl .travel__texture,
.travel.is-gl .travel__glow { display: none; }
.travel.is-gl .travel__print,
.travel.is-gl .travel__ghost { opacity: 0 !important; }
.travel__stage {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1440px;
  height: 1024px;
  /* --push: the camera moving in as the section hands off to the finale (lib/handoff.js). */
  transform: translate(-50%, -50%) scale(calc(var(--stage-scale, 1) * var(--push, 1)));
}
/* The six stops, 1440 each; they come in from the right once the statement has gone up. */
.travel__track { position: absolute; top: 0; left: 0; width: 8640px; height: 1024px; will-change: transform; }

/* The statement (575:2716): Svetze 77 over 1084, three words in gold. */
.travel__intro { position: absolute; top: 161px; left: 178px; width: 1084px; text-align: center; will-change: transform; }
.travel__kicker {
  color: rgb(255 229 189 / .8);
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.travel__statement {
  margin-top: 40px !important;
  color: #fff;
  font-family: var(--font-display);
  font-size: 77px;
  line-height: 1.2;
  letter-spacing: -.02em;
  text-wrap: balance;
}
.travel__statement em { color: #dd981b; font-style: normal; }

/* A stop: everything placed where Figma has it in its 1440 × 1024 panel. */
.travel__stop { position: absolute; top: 0; width: 1440px; height: 1024px; }
.travel__stop > * { position: absolute; }
.travel__ghost {
  color: color-mix(in srgb, var(--bright) 6.5%, transparent);
  font-family: var(--font-display);
  font-size: 300px;
  line-height: 375px;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}
.travel__text { width: 307px; }
.travel__star { display: block; color: var(--gold); font-size: 18px; line-height: 23px; }
.travel__body { margin-top: 12px !important; color: color-mix(in srgb, var(--fg) 76%, transparent); font-size: 18px; font-weight: 500; line-height: 23px; }
.travel__caption,
.travel__count { font-size: 12px; font-weight: 500; line-height: 16px; white-space: nowrap; }
.travel__caption { color: color-mix(in srgb, var(--bright) 70%, transparent); text-transform: uppercase; }
.travel__count { color: var(--bright); translate: -100% 0; }

/* The map (642 × 508): cream ink straight on the ground, a hairline frame, live labels. */
.travel__plate { width: 642px; height: 508px; }
.travel__map { position: absolute; inset: 0; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 22%, transparent); }
.travel__ink {
  position: absolute;
  inset: 0;
  background: var(--fg);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
.travel__tick,
.travel__label,
.travel__town { position: absolute; translate: -50% -50%; line-height: 1.2; white-space: nowrap; }
.travel__tick { color: color-mix(in srgb, var(--fg) 45%, transparent); font-size: 9px; letter-spacing: .04em; }
.travel__label--range { color: color-mix(in srgb, var(--fg) 58%, transparent); font-size: 9px; letter-spacing: .3em; text-transform: uppercase; }
.travel__label--river,
.travel__label--sea { font-family: var(--font-display); font-style: italic; }
.travel__label--river { color: color-mix(in srgb, var(--fg) 75%, transparent); font-size: 14px; letter-spacing: .02em; }
.travel__label--sea { color: color-mix(in srgb, var(--fg) 58%, transparent); font-size: 15px; letter-spacing: .08em; }
.travel__town { color: color-mix(in srgb, var(--fg) 62%, transparent); font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; }
.travel__town.is-on { color: var(--gold); }
.travel__pins { position: absolute; inset: 0; width: 642px; height: 508px; overflow: visible; }
.travel__ring { fill: none; stroke: var(--gold); stroke-width: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
.travel__dot { fill: var(--gold); transform-box: fill-box; transform-origin: center; }
.travel__spot { fill: color-mix(in srgb, var(--fg) 62%, transparent); }
.travel__scale { position: absolute; top: 478px; display: flex; height: 4px; box-shadow: inset 0 0 0 .75px color-mix(in srgb, var(--fg) 70%, transparent); }
.travel__scale i { flex: 1; }
.travel__scale i:nth-child(odd) { background: color-mix(in srgb, var(--fg) 70%, transparent); }
.travel__km { position: absolute; top: 461px; right: 24px; color: color-mix(in srgb, var(--fg) 60%, transparent); font-size: 9px; line-height: 12px; letter-spacing: .04em; }

/* The pictures: cream mounts, no shadow, the picture drawn a little larger so it can drift in its
   frame. */
/* Cream on the night ground; on paper, white with a hairline, so the card still stands off the
   page (no shadow). It follows the ground (--light); lib/travel-gl.js draws it the same way. */
.travel__print {
  box-sizing: border-box;
  padding: 12px 12px 0;
  background: color-mix(in oklab, #fff calc(var(--light) * 100%), #f4ede1);
  box-shadow: inset 0 0 0 1px rgb(42 18 7 / calc(.16 * var(--light)));
}
.travel__art { display: block; overflow: hidden; }
.travel__art img { display: block; width: 100%; height: auto; scale: 1.12; }
.travel__print figcaption { padding: 12px 2px 16px; color: rgb(11 10 10 / .7); font-size: 12px; line-height: 16px; text-transform: uppercase; }

/* With JS and motion, a stop's parts start out and come in as it arrives (lib/travel.js). */
.travel.is-armed .travel__stop > :not(.travel__plate),
.travel.is-armed .travel__map { opacity: 0; }

/* Handing off to the finale (lib/handoff.js): the section's own paper goes, so the finale beneath
   shows as Travel's ground fades, and nothing of it catches the pointer once it has gone. */
.travel.is-handing,
.travel.is-handing .travel__pin { background: transparent; box-shadow: none; }
.travel.is-handed { pointer-events: none; }
.travel.is-gl .handoff .travel__print { opacity: 1 !important; }

/*
 * Compact Travel west (Figma 643:2721 the sentence, 643:2728–2974 the stops). The stage is drawn
 * from the view's top left at the shared scale (a stop is then a view wide), still pushed in about
 * the view's middle as it hands off (--push). lib/travel.js sets every part's place and scale in
 * screen px (inline); the sizes below are screen px, as Figma has them on a phone.
 */
@media (max-aspect-ratio: 4/5) {
  .travel__stage {
    top: 0;
    left: 0;
    transform-origin: 0 0;
    transform:
      translate(50vw, 50vh)
      scale(calc(var(--stage-scale, 1) * var(--push, 1)))
      translate(calc(-50vw / var(--stage-scale, 1)), calc(-50vh / var(--stage-scale, 1)));
  }

  .travel__intro,
  .travel__stop > * { transform-origin: 0 0; }

  .travel__kicker { font-size: 11px; line-height: 15px; letter-spacing: .3em; }
  .travel__statement { margin-top: 8px !important; font-size: min(38px, (100vw - 40px) / 9.2); line-height: 1.2; }

  .travel__text { width: 350px; }
  .travel__star { display: flex; gap: 14px; align-items: center; font-size: 12px; line-height: 17px; }
  .travel__star::after {
    content: "Book I";
    font-family: var(--font-label);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .3em;
    text-transform: uppercase;
  }
  .travel__stop:nth-child(n + 4) .travel__star::after { content: "Book II"; }
  .travel__body { margin-top: 12px !important; font-size: 18px; line-height: 1.5; }

  .travel__count { translate: none; font-size: 12px; line-height: 17px; letter-spacing: .2em; }
  .travel__caption { font-size: 10px; line-height: 14px; letter-spacing: .3em; }

  .travel__ghost { font-size: 120px; line-height: 145px; text-align: left; }

  .travel__print { padding: 6px 6px 0; }
  .travel__art { height: 150px; }
  .travel__art img { height: 100%; object-fit: cover; }
  .travel__print figcaption { padding: 8px 2px 10px; font-size: 10px; line-height: 14px; letter-spacing: .3em; }
}

/* Tablet Travel west (Figma 716:1163–1424): the same parts at the tablet's sizes. */
@media (max-aspect-ratio: 4/5) and (min-width: 600px) {
  .travel__kicker { font-size: 13px; line-height: 18px; }
  .travel__statement { margin-top: 16px !important; font-size: 56px; line-height: 1.05; }
  .travel__text { width: 648px; }
  .travel__body { max-width: 560px; font-size: 22px; line-height: 1.5; }
  .travel__star,
  .travel__star::after { font-size: 14px; line-height: 20px; letter-spacing: .4em; }
  .travel__count { font-size: 12px; line-height: 20px; letter-spacing: .3em; }
  .travel__caption { font-size: 12px; line-height: 17px; letter-spacing: .3em; }
  .travel__ghost { font-size: 144px; line-height: 174px; }
  .travel__print { padding: 7px 7px 0; }
  .travel__art { height: 180px; }
  .travel__stop:has(.travel__print + .travel__print) .travel__art { height: 150px; }
  .travel__print figcaption { padding: 10px 2px 12px; font-size: 12px; line-height: 17px; letter-spacing: .3em; }
}
/* Brescia's picture as a card that turns over: its mount on the front, the finale's window on the
   back. Sizes and turns come from lib/handoff.js; each face is drawn at its own size and scaled. */
.handoff { position: absolute; inset: 0; pointer-events: none; visibility: hidden; }
.handoff.is-on { visibility: visible; }
.handoff__card { position: absolute; top: 0; left: 0; transform-style: preserve-3d; will-change: transform; }
.handoff__face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.handoff__face--back { transform: rotateX(180deg); }
.handoff__content { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.handoff__content .finale__window { top: 0; left: 0; }
.handoff__shade { position: absolute; inset: 0; background: #1c0b03; opacity: 0; }
.handoff__shadow {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 8px;
  background: rgb(42 18 7);
  opacity: 0;
  will-change: transform, opacity;
}

/* The catalogue dims beneath as this slides over it (lib/travel.js). */
.catalogue__under {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: #0a0300;
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
}


/*
 * Period III, finale (Figma 527:2390, 1440 × 1249): 1258. A Period III frame (width scale, as Built
 * to last), on the same paper: #efefef, the Texturelabs paper colour-burned at 20%, and the grain.
 * The mihrab relief is a light-and-shade map (neutral grey) overlaid on that paper, so it takes the
 * page's own tone and fibre; the frame and its painting are Figma renders with real transparency.
 * The parts rise in with lib/scenes.js; with reduced motion they stay as in Figma.
 */
.scene.finale {
  z-index: 5;
  /* Beneath Travel's last view and its handoff (Travel is z 6; --handoff is HANDOFF in
     lib/travel.js, set by lib/finale.js). The hold is one view, sticky for the whole section, and
     lib/finale.js moves the stage in it (--lift): still while Brescia's picture flies into the
     frame (lib/handoff.js), then 1:1 with the scroll through the artboard until its foot meets the
     view's, where the hold lets go and the closing line follows as plain scroll. So: the handoff
     and the artboard (or one view, if taller). clip, not hidden, so the hold can stick. */
  --handoff-hold: calc(var(--handoff, 1700px) * var(--stage-scale, 1));
  /* Plus, with the closing line's smoke on, a stretch at the foot where the stage stays put while
     the smoke gathers over it (--smoke-hold in vh, set by lib/language.js). */
  height: calc(max(1249px * var(--period-three-scale), 100vh) + var(--handoff-hold) + var(--smoke-hold, 0vh));
  margin-top: calc(-100vh - var(--handoff-hold));
  overflow: clip;
  background: #efefef;
}
.finale__hold { position: sticky; top: 0; height: 100vh; overflow: hidden; }
.finale__stage { translate: 0 var(--lift, 0px); }
.finale__stage { height: 1249px; background: #efefef; }
.finale__paper { left: -116.5px; top: 0; width: 1673px; height: 1249px; object-fit: cover; opacity: .2; mix-blend-mode: color-burn; pointer-events: none; }
.finale__relief { left: 234px; top: -16px; width: 972.8px; height: 972.8px; mix-blend-mode: overlay; pointer-events: none; }
/* The relief comes up as Travel's ground fades off the paper (--relief-in, lib/handoff.js). */
.finale__relief:not(.finale__relief--near) { opacity: var(--relief-in, 1); }
/* The same relief once more, seen only about the pointer, so the emboss deepens where the reader
   looks, as with Built to last's letters (lib/finale.js sets --x/--y in stage px). */
.finale__relief--near {
  opacity: 0;
  transition: opacity 1.2s var(--ease-out);
  mask-image: radial-gradient(circle 300px at var(--x, 0) var(--y, 0), #000, rgb(0 0 0 / .8) 22%, rgb(0 0 0 / .5) 45%, rgb(0 0 0 / .2) 70%, transparent);
}
.finale__relief--near.is-shown { opacity: .85; }
.finale__grain {
  inset: 0;
  opacity: .06;
  pointer-events: none;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1.6 -.5'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* Frame 88 (220 × 28 at 609.5, 208): a red dot and a hairline either side of the year. */
.finale__marker {
  left: 609.5px; top: 208px; width: 220px; height: 28px;
  display: flex; align-items: center; gap: 18px;
  font-size: 20px; font-weight: 500; line-height: 28px; letter-spacing: 8px;
  font-variation-settings: "opsz" 14; color: #0b0a0a; white-space: nowrap;
}
.finale__rule { position: relative; flex: none; width: 58.5px; height: 5px; }
.finale__rule::before,
.finale__rule::after { content: ""; position: absolute; }
.finale__rule::before { left: 0; top: 0; width: 5px; height: 5px; border-radius: 50%; background: #491508; }
.finale__rule::after { left: 2.5px; top: 2px; width: 56px; height: 1px; background: rgb(0 0 0 / .35); }
.finale__rule--end::before { left: auto; right: 0; }
.finale__rule--end::after { left: 0; }

/* The vintage frame (530:2529, 515 × 540 at 463, 268.2), rendered with 120px round it for its shadow. */
.finale__frame { left: 343px; top: 148.2px; width: 755px; height: 780px; }
/* The painting sits behind the frame, 6px larger all round than the opening (178–577 × 175–603 in
   the render, measured from it), and the opening is cut out of the frame: its gilt lip overlaps the
   painting, so the edge is the frame's own. */
.finale__window { position: absolute; left: 172px; top: 169px; width: 411px; height: 440px; overflow: hidden; }
/* The picture drifts inside the frame as the page scrolls (--drift, lib/finale.js), drawn 1.25×
   so its ±48px never shows an edge. The lamp's glow is on it, so it drifts too. */
.finale__picture { position: absolute; inset: 0; transform: translate3d(0, var(--drift, 0px), 0) scale(1.25); will-change: transform; }
.finale__picture img { width: 100%; height: 100%; }
@media (prefers-reduced-motion: reduce) { .finale__picture { transform: scale(1.06); } }
.finale__moulding { position: absolute; inset: 0; width: 755px; height: 780px; pointer-events: none; }
/* The painting lands first, as Brescia's card turned over (lib/handoff.js); the frame then fades in
   round it from a touch larger, never so large that its lip leaves the painting's edge. */
.finale__moulding { opacity: var(--frame-in, 1); scale: calc(1 + .025 * (1 - var(--frame-in, 1))); }
.finale.is-waiting .finale__window { visibility: hidden; }
/* One slow glint along the gilt once the frame is in (.is-lit, lib/handoff.js), masked to the
   moulding itself (frame-mask.png: the render's solid alpha, not its shadow). */
.finale__sheen {
  position: absolute;
  inset: 0;
  -webkit-mask: url("assets/finale/frame-mask.png") 0 0 / 100% 100% no-repeat;
  mask: url("assets/finale/frame-mask.png") 0 0 / 100% 100% no-repeat;
  /* A wide, soft band of warm light, faint at its peak: the gilt catches it, nothing flares. */
  background: linear-gradient(115deg, transparent 28%, rgb(255 236 200 / .05) 38%, rgb(255 238 205 / .13) 46%, rgb(255 242 214 / .18) 50%, rgb(255 238 205 / .13) 54%, rgb(255 236 200 / .05) 62%, transparent 72%) 0 0 / 300% 100% no-repeat;
  background-position: 100% 0;
  mix-blend-mode: screen;
  opacity: 0;
  pointer-events: none;
}
.finale.is-lit .finale__sheen { animation: finale-glint 4.2s cubic-bezier(.45, .05, .35, 1) .4s both; }
@keyframes finale-glint {
  0% { background-position: 100% 0; opacity: 0; }
  30% { opacity: .8; }
  70% { opacity: .8; }
  100% { background-position: 0 0; opacity: 0; }
}

/* The oil lamp on the desk: the same breathing glow as Period I's closing lamp, centred on the
   flame in painting.avif (72.5%, 62% of the picture). */
.finale__lamp {
  position: absolute;
  top: 237px;
  left: 262px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(255 196 120 / .6), rgb(255 150 60 / .2) 42%, rgb(255 150 60 / 0) 70%);
  mix-blend-mode: screen;
  opacity: .75;
  animation: closing-flame 3.6s linear infinite;
  pointer-events: none;
}

/* Frame 87 (621 wide at 410, 905): Svetze 60 / 1.2, −2%, then the story 16 below it. */
.finale__title {
  left: 410px; top: 905px; width: 621px;
  font-family: var(--font-display); font-size: 60px; font-weight: 400; line-height: 1.2; letter-spacing: -1.2px;
  text-align: center; color: #0b0a0a;
}
.finale__story {
  left: 454px; top: 1065px; width: 533px;
  font-size: 16px; font-weight: 400; line-height: 1.5;
  font-variation-settings: "opsz" 14; text-align: center; color: rgb(11 10 10 / .8);
}

/* Compact finale (Figma 644:2721): lib/finale.js places the parts; their sizes in screen px. */
@media (max-aspect-ratio: 4/5) {
  /* The stage is shorter than the view here: its ground reaches past it, so the paper's texture
     (colour-burned within the stage) covers the view evenly. */
  .finale__stage { box-shadow: 0 0 0 calc(100vh / var(--period-three-scale, 1)) #efefef; }
  .finale__marker,
  .finale__title,
  .finale__story { transform-origin: 0 0; }
  .finale__marker { height: 17px; gap: 17px; font-size: 12px; line-height: 17px; letter-spacing: .4em; justify-content: center; }
  .finale__title { font-size: 30px; line-height: 1.15; letter-spacing: -1px; }
  .finale__story { font-size: 14px; line-height: 23px; }
}
@media (max-aspect-ratio: 4/5) and (min-width: 600px) {
  .finale__marker { height: 20px; gap: 22px; font-size: 14px; line-height: 20px; }
  .finale__title { font-size: 56px; line-height: 1.05; letter-spacing: -.02em; }
  .finale__story { font-size: 18px; line-height: 30px; }
}

/* Back up through the handoff: the year, the title and the story fade out as soon as it has gone
   back past the point where they rose in (.is-handed, lib/handoff.js), before the frame goes and the
   picture turns back over, so the way back is the way in reversed. */
.finale :is(.finale__marker, .finale__title, .finale__story) { transition: opacity .6s var(--ease-out); }
.travel.is-handing:not(.is-handed) ~ .finale :is(.finale__marker, .finale__title, .finale__story) { opacity: 0; }

/* The year's hairlines draw outward from it, then their dots land at the ends. */
.scene.is-armed .finale__rule::after { scale: 0 1; transform-origin: 100% 50%; transition: scale .9s var(--ease-out) .25s; }
.scene.is-armed .finale__rule--end::after { transform-origin: 0 50%; }
.scene.is-armed .finale__rule::before { opacity: 0; scale: .2; transition: opacity .5s var(--ease-out) .95s, scale .5s var(--ease-out) .95s; }
.scene.is-armed .finale__marker.is-in .finale__rule::after { scale: 1 1; }
.scene.is-armed .finale__marker.is-in .finale__rule::before { opacity: 1; scale: 1; }
/* A breath between the two sentences of the title: "Its light did not." waits for the first. */
.scene.is-armed .finale__title.is-in .scene__word:nth-of-type(n + 5) { transition-delay: calc(var(--i) * 80ms + 550ms); }

/*
 * The closing line (Figma 672:1195, 1440 × 1024, "v3a Stucco, tile & brick"; image 672:7, Figma
 * AI, upscaled 2×). One view, after the finale as plain scroll. The image carries the leaf of
 * indigo parchment; the stage is the whole image in Figma units (1536 × 1024 at Figma's 1.08 crop
 * scale), the words set on the leaf in the same units, scaled (--k) about the leaf's centre, held
 * at the view's centre, to cover the view without cutting the leaf (lib/language.js).
 * It comes through white smoke, a small fluid simulation (lib/language.js, lib/language-smoke.js,
 * .language-smoke below): the finale stays put at its foot while smoke is blown in from both sides
 * and covers the view; under it the page goes on to this section (.is-covered shows the hold;
 * until then it is only the finale's paper carried on), and it thins away slowly until the section
 * is all in view. The same back up. The scroll stays paused while the smoke is on. Meanwhile the stage
 * waits a little closer (--push, .is-smoked) and settles as the smoke clears (.is-clearing). The
 * words rise in once the section shows through (.is-shown), then the rule, the glossary and the
 * colophon (lib/scenes.js).
 * Figma sets the small type in Cormorant Garamond and the Arabic in Reem Kufi; the site keeps its
 * own: Svetze, DM Sans, and Aref Ruqaa Ink's stack (its subset lacks these letters, so the system's
 * Arabic face draws them).
 */
.scene.language {
  /* Over the footer, which waits beneath it (lib/footer.js). */
  z-index: 6;
  position: relative;
  isolation: isolate;
  height: 100vh;
  overflow: clip;
  /* 2 px over the finale's foot: where two sections meet on a fraction of a pixel, the page's dark
     ground shows through as a hairline. */
  margin-top: -2px;
  background: #efefef;
  color: #fff;
}
/* The finale's paper carried on, so the two meet without a seam: the same Texturelabs scan at the
   finale's own size and place (1673 × 1249 at −116.5, at Period III's width scale), colour-burned
   at 20%, but mirrored top to bottom, so at the join both show the same row of the scan. */
.language__paper {
  position: absolute;
  left: calc(-116.5px * var(--period-three-scale));
  top: 0;
  width: calc(1673px * var(--period-three-scale));
  height: calc(1249px * var(--period-three-scale));
  max-width: none;
  object-fit: cover;
  scale: 1 -1;
  opacity: .2;
  mix-blend-mode: color-burn;
  pointer-events: none;
}
.language__grain {
  position: absolute;
  inset: 0;
  opacity: .06;
  pointer-events: none;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1.6 -.5'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  /* The finale's grain is drawn inside its scaled stage; match its size. */
  background-size: calc(240px * var(--period-three-scale));
}
.language__hold { position: absolute; inset: 0; overflow: hidden; background: #2b2019; }
/* Until the smoke covers the view, the section is only the finale's paper carried on. */
.language.is-smoked:not(.is-covered) .language__hold { visibility: hidden; }
/* The image in Figma units; the leaf's centre (832, 530) is held at the view's centre. */
.language__stage {
  --push: 1;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1659px;
  height: 1106px;
  transform-origin: 832px 530px;
  translate: -832px -530px;
  scale: calc(var(--k, 1) * var(--push));
  will-change: scale;
}
.language.is-smoked .language__stage { --push: 1.14; }
/* As the smoke clears, a slow dolly back: long and soft, still settling while the words come. */
.language.is-smoked.is-clearing .language__stage { --push: 1; transition: scale 7.5s cubic-bezier(.16, 1, .3, 1); }
/* And a rack focus: under the smoke the picture is soft, and it sharpens as the smoke thins
   (the image only; the words have their own entrance). */
.language.is-smoked :is(.language__ground, .language__ground-gl) { filter: blur(9px) brightness(1.05); will-change: filter; }
.language.is-smoked.is-clearing :is(.language__ground, .language__ground-gl) { filter: none; transition: filter 3.6s cubic-bezier(.33, 1, .68, 1) .3s; }
.language.is-smoked.is-shown :is(.language__ground, .language__ground-gl) { will-change: auto; }
/* The picture drawn in WebGL with Travel west's touch (lib/language-ground.js), under the stage;
   once it draws, the DOM image is only the fallback. */
.language__ground-gl { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.language.has-ground .language__ground { visibility: hidden; }
/* Once its entrance is over the leaf's words and ornament are drawn there too, pushed with the
   parchment; the DOM leaf stays, transparent, for reading and selecting. */
.language.is-gl-text .language__leaf { opacity: 0; }
/* The smoke: over the page while it shows, under the navbar (z 20); drawn only then. */
.language-smoke {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  visibility: hidden;
}
.language__ground { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; }
/* The leaf as Figma has it (568 × 880 at 548, 90): a gold rule and an ivory hairline inside its
   edge, a small star on each corner of the rule, and the words in one centred column. */
.language__leaf {
  position: absolute;
  left: 548px;
  top: 90px;
  width: 568px;
  height: 880px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
}
.language__leaf::before,
.language__leaf::after { content: ""; position: absolute; pointer-events: none; }
.language__leaf::before { inset: 22px; border: 1.5px solid rgb(217 182 113 / .9); }
.language__leaf::after { inset: 30px; border: .75px solid rgb(244 236 222 / .3); }
.language__stars {
  position: absolute;
  inset: 15px;
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28'><path fill='%23d9b671' d='M23.89 4.11 18.92 11.96 28 14 18.92 16.04 23.89 23.89 16.04 18.92 14 28 11.96 18.92 4.11 23.89 9.08 16.04 0 14 9.08 11.96 4.11 4.11 11.96 9.08 14 0 16.04 9.08Z'/></svg>") left top / 14px no-repeat,
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28'><path fill='%23d9b671' d='M23.89 4.11 18.92 11.96 28 14 18.92 16.04 23.89 23.89 16.04 18.92 14 28 11.96 18.92 4.11 23.89 9.08 16.04 0 14 9.08 11.96 4.11 4.11 11.96 9.08 14 0 16.04 9.08Z'/></svg>") right top / 14px no-repeat,
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28'><path fill='%23d9b671' d='M23.89 4.11 18.92 11.96 28 14 18.92 16.04 23.89 23.89 16.04 18.92 14 28 11.96 18.92 4.11 23.89 9.08 16.04 0 14 9.08 11.96 4.11 4.11 11.96 9.08 14 0 16.04 9.08Z'/></svg>") left bottom / 14px no-repeat,
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28'><path fill='%23d9b671' d='M23.89 4.11 18.92 11.96 28 14 18.92 16.04 23.89 23.89 16.04 18.92 14 28 11.96 18.92 4.11 23.89 9.08 16.04 0 14 9.08 11.96 4.11 4.11 11.96 9.08 14 0 16.04 9.08Z'/></svg>") right bottom / 14px no-repeat;
}
.language__leaf :where(p, dl, dd) { margin: 0; }
.language__leaf .language__kicker {
  margin-bottom: 24px;
  color: #e4c78e;
  font-family: var(--font-label);
  font-size: 12px;
  font-weight: 500;
  font-variation-settings: "opsz" 14;
  letter-spacing: 3px;
  text-transform: uppercase;
}
.language__line {
  width: 420px;
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 400;
  line-height: 1.28;
  letter-spacing: -.72px;
}
.language__part { display: inline; }
.language__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* The words come first; the second half waits for the first, as the finale's title does. */
/*
 * The entrance (not in Figma), once the smoke has thinned enough to read through (.is-shown, and
 * lib/scenes.js sets .is-in): everything emerges out of the smoke, from soft to sharp, on one long,
 * gentle curve. First the gold frame and its stars; then the line word by word, its second half
 * after a breath; the rule draws out from the middle and its star turns in; the glossary row by
 * row, each hairline drawn left to right as its word rises and the Arabic comes in from the right;
 * the colophon last. Delays (--delay, index.html) count from .is-in.
 */
.language { --ease-cine: cubic-bezier(.22, 1, .36, 1); }
.scene.is-armed.language [data-reveal]:not([data-reveal="words"]) {
  opacity: 0;
  filter: blur(6px);
  transform: translate3d(0, 14px, 0);
}
.scene.is-armed.language [data-reveal]:not([data-reveal="words"]).is-in {
  opacity: 1;
  filter: none;
  transform: none;
  transition:
    opacity 1.6s var(--ease-cine) var(--delay, 0s),
    filter 1.6s var(--ease-cine) var(--delay, 0s),
    transform 1.9s var(--ease-cine) var(--delay, 0s),
    letter-spacing 2.4s var(--ease-cine) var(--delay, 0s);
}
/* The frame. */
.scene.is-armed.language .language__leaf::before,
.scene.is-armed.language .language__leaf::after,
.scene.is-armed.language .language__stars { opacity: 0; }
.scene.is-armed.language .language__leaf::before { scale: 1.025; }
.scene.is-armed.language.is-shown .language__leaf::before,
.scene.is-armed.language.is-shown .language__leaf::after {
  opacity: 1;
  scale: 1;
  transition: opacity 2.2s var(--ease-cine) .1s, scale 2.8s var(--ease-cine) .1s;
}
.scene.is-armed.language.is-shown .language__stars { opacity: 1; transition: opacity 1.8s var(--ease-cine) .9s; }
/* The kicker closes up as it comes. */
.scene.is-armed.language .language__kicker { letter-spacing: 9px; }
.scene.is-armed.language .language__kicker.is-in { letter-spacing: 3px; }
/* The line: each word out of the blur, unhurried. */
.scene.is-armed.language .scene__word {
  opacity: 0;
  filter: blur(10px);
  transform: translate3d(0, 22px, 0);
}
.scene.is-armed.language .language__part.is-in .scene__word {
  --wd: calc(var(--i) * 110ms + 500ms);
  opacity: 1;
  filter: none;
  transform: none;
  transition:
    opacity 1.4s var(--ease-cine) var(--wd),
    filter 1.6s var(--ease-cine) var(--wd),
    transform 1.8s var(--ease-cine) var(--wd);
}
.scene.is-armed.language .language__part--end.is-in .scene__word { --wd: calc(var(--i) * 120ms + 1700ms); }
/* The rule: its lines draw out from the star, which turns in. */
.scene.is-armed.language .language__rule { filter: none; transform: none; }
.scene.is-armed.language .language__rule::before { transform: scaleX(0); transform-origin: 100% 50%; }
.scene.is-armed.language .language__rule::after { transform: scaleX(0); transform-origin: 0 50%; }
.scene.is-armed.language .language__rule.is-in::before,
.scene.is-armed.language .language__rule.is-in::after { transform: none; transition: transform 1.5s var(--ease-cine) calc(var(--delay) + 150ms); }
.scene.is-armed.language .language__rule .language__star { opacity: 0; scale: .3; rotate: -120deg; }
.scene.is-armed.language .language__rule.is-in .language__star {
  opacity: 1;
  scale: 1;
  rotate: 0deg;
  transition: opacity .8s var(--ease-cine) var(--delay), scale 1.3s cubic-bezier(.34, 1.56, .64, 1) var(--delay), rotate 1.6s var(--ease-cine) var(--delay);
}
/* The glossary. */
.scene.is-armed.language .language__words::before,
.scene.is-armed.language .language__entry::after { transform: scaleX(0); }
.scene.is-armed.language.is-shown .language__words::before { transform: none; transition: transform 1.6s var(--ease-cine) 3.7s; }
.scene.is-armed.language .language__entry.is-in::after { transform: none; transition: transform 1.6s var(--ease-cine) calc(var(--delay) + 250ms); }
.scene.is-armed.language .language__entry .language__origin { opacity: 0; }
.scene.is-armed.language .language__entry.is-in .language__origin { opacity: 1; transition: opacity 1.4s var(--ease-cine) calc(var(--delay) + 250ms); }
.scene.is-armed.language .language__entry .language__arabic { opacity: 0; filter: blur(6px); translate: 18px 0; }
.scene.is-armed.language .language__entry.is-in .language__arabic {
  opacity: 1;
  filter: none;
  translate: 0 0;
  transition: opacity 1.4s var(--ease-cine) calc(var(--delay) + 350ms), filter 1.4s var(--ease-cine) calc(var(--delay) + 350ms), translate 1.8s var(--ease-cine) calc(var(--delay) + 350ms);
}
/* rule · star · rule */
.language__rule { display: flex; align-items: center; gap: 14px; margin: 26px 0 22px; }
.language__rule::before,
.language__rule::after { content: ""; width: 72px; height: 1px; background: rgb(217 182 113 / .7); }
.language__star { display: block; width: 17px; height: 17px; fill: #d9b671; }
.language__leaf .language__intro {
  margin-bottom: 18px;
  color: rgb(244 236 222 / .78);
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.2;
}
.language__words { position: relative; width: 420px; text-align: left; }
.language__words::before,
.language__entry::after { content: ""; position: absolute; left: 0; right: 0; height: 1px; background: rgb(217 182 113 / .35); transform-origin: 0 50%; }
.language__words::before { top: 0; }
.language__entry::after { bottom: 0; }
.language__entry {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 24px;
  align-items: center;
  position: relative;
  padding: 14px 0;
}
.language__entry dt {
  grid-column: 1;
  color: #f4ecde;
  font-family: var(--font-display);
  font-size: 27px;
  line-height: 1.1;
}
.language__leaf .language__origin {
  grid-column: 1;
  max-width: 286px;
  margin-top: 5px;
  color: #e4cb97;
  font-family: var(--font-label);
  font-size: 14px;
  line-height: 1.45;
}
.language__arabic {
  grid-column: 2;
  grid-row: 1 / 3;
  color: #d9b671;
  font-family: var(--font-ruqaa);
  font-size: 32px;
  line-height: 1;
}
.language__leaf .language__colophon {
  width: 420px;
  margin-top: 26px;
  color: rgb(244 236 222 / .62);
  font-family: var(--font-label);
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: .2px;
}
/*
 * Compact closing line (Figma 644:2953): the leaf 350 × 662 on a phone, taller than the one in the
 * picture, so it is drawn here over it: the picture's own parchment, stretched to the taller leaf
 * (its 568 × 880 of the stage made 568 × 1074), centred where the picture's leaf is. Sizes in Figma's
 * phone px × --f, the stage's units per px there (568 / 350); lib/language.js scales the stage (--k).
 */
@media (max-aspect-ratio: 4/5) {
  /* --leaf-h: the leaf's height on the phone, in its px; --stretch: how much the picture's parchment
     is drawn taller to fill it (its 880 in the stage made --leaf-h × --f). */
  .language { --f: 1.62286; --leaf-h: 662px; --stretch: 1.22083; }
  /* The ground: the picture's carved stucco (its left third, the palm at its top) covering the view
     behind the leaf, as Figma has it; the picture itself, with its own leaf, is not drawn. */
  /* Drawn tall enough (at least 212vw) that the picture's own leaf, from a third across, is off the view. */
  .language__hold { background: #2b2019 url("assets/language/stucco-tile-brick.avif") 0 50% / auto max(100%, 212vw) no-repeat; }
  .language__ground { display: none; }
  /* Below the middle by --leaf-shift (lib/language.js), clear of the navbar. */
  .language__stage { top: calc(50% + var(--leaf-shift, 0px)); }
  .language__leaf {
    top: calc(530px - var(--leaf-h) * var(--f) / 2);
    height: calc(var(--leaf-h) * var(--f));
    justify-content: flex-start;
    padding-top: calc(52px * var(--f));
    background: url("assets/language/stucco-tile-brick.avif") -548px calc(-90px * var(--stretch)) / 1659px calc(1106px * var(--stretch)) no-repeat;
  }
  .language__leaf::before { inset: calc(14px * var(--f)); }
  .language__leaf::after { inset: calc(20px * var(--f)); }
  .language__stars { inset: calc(9px * var(--f)); background-size: calc(11px * var(--f)); }
  .language__leaf .language__kicker { margin-bottom: calc(12px * var(--f)); font-size: calc(11px * var(--f)); letter-spacing: .3em; }
  .scene.is-armed.language .language__kicker,
  .scene.is-armed.language .language__kicker.is-in { letter-spacing: .3em; }
  .language__line { width: calc(282px * var(--f)); font-size: calc(24px * var(--f)); line-height: 1.1; letter-spacing: -.01em; }
  .language__rule { gap: calc(9px * var(--f)); margin: calc(20px * var(--f)) 0 calc(18px * var(--f)); }
  .language__rule::before,
  .language__rule::after { width: calc(50px * var(--f)); }
  .language__star { width: calc(12px * var(--f)); height: calc(12px * var(--f)); }
  .language__leaf .language__intro { width: calc(230px * var(--f)); margin-bottom: calc(16px * var(--f)); font-size: calc(20px * var(--f)); }
  .language__words { width: calc(282px * var(--f)); }
  .language__entry { column-gap: calc(12px * var(--f)); padding: calc(13px * var(--f)) 0; }
  .language__entry dt { font-size: calc(20px * var(--f)); line-height: 1.2; }
  .language__leaf .language__origin { max-width: calc(234px * var(--f)); margin-top: calc(2px * var(--f)); font-size: calc(12px * var(--f)); line-height: 1.5; }
  .language__arabic { font-size: calc(24px * var(--f)); }
  .language__leaf .language__colophon { width: calc(282px * var(--f)); margin-top: calc(18px * var(--f)); font-size: calc(12px * var(--f)); line-height: 1.5; }

  /* The entrance in about two seconds, not six: the line comes as a whole (its two halves a
     moment apart, not word by word), then the rest close behind it, each a little quicker. */
  .scene.is-armed.language .language__part.is-in .scene__word { --wd: 100ms; transition-duration: 1s; }
  .scene.is-armed.language .language__part--end.is-in .scene__word { --wd: 300ms; }
  .scene.is-armed.language [data-reveal]:not([data-reveal="words"]).is-in { transition-duration: 1s; }
  .scene.is-armed.language.is-shown .language__leaf::before,
  .scene.is-armed.language.is-shown .language__leaf::after { transition-duration: 1.2s; }
  .scene.is-armed.language.is-shown .language__stars { transition-delay: .3s; }
  .scene.is-armed.language.is-shown .language__words::before { transition-delay: .7s; }
  /* Over the inline --delay of each part (index.html, the desktop's long entrance). */
  .language .language__kicker { --delay: 0ms !important; }
  .language .language__rule { --delay: 500ms !important; }
  .language .language__intro { --delay: 600ms !important; }
  .language .language__entry:nth-child(1) { --delay: 700ms !important; }
  .language .language__entry:nth-child(2) { --delay: 800ms !important; }
  .language .language__entry:nth-child(3) { --delay: 900ms !important; }
  .language .language__colophon { --delay: 1000ms !important; }
}

/* Tablet closing line (Figma 716:1707): the leaf 540 × 837, the picture's own shape (so its parchment
   is not stretched), and the words at the tablet's sizes, in its px × --f (568 / 540). */
@media (max-aspect-ratio: 4/5) and (min-width: 600px) {
  .language { --f: 1.05185; --leaf-h: 837px; --stretch: 1; }
  .language__leaf { padding-top: calc(92px * var(--f)); }
  .language__leaf::before { inset: calc(17px * var(--f)); }
  .language__leaf::after { inset: calc(24px * var(--f)); }
  .language__stars { inset: calc(11px * var(--f)); background-size: calc(14px * var(--f)); }
  .language__leaf .language__kicker { margin-bottom: calc(14px * var(--f)); font-size: calc(13px * var(--f)); }
  .language__line { width: calc(428px * var(--f)); font-size: calc(32px * var(--f)); }
  .language__rule { gap: calc(12px * var(--f)); margin: calc(24px * var(--f)) 0 calc(21px * var(--f)); }
  .language__rule::before,
  .language__rule::after { width: calc(62px * var(--f)); }
  .language__star { width: calc(16px * var(--f)); height: calc(16px * var(--f)); }
  .language__leaf .language__intro { width: calc(280px * var(--f)); margin-bottom: calc(18px * var(--f)); font-size: calc(26px * var(--f)); }
  .language__words { width: calc(428px * var(--f)); }
  .language__entry { column-gap: calc(16px * var(--f)); padding: calc(17px * var(--f)) 0; }
  .language__entry dt { font-size: calc(26px * var(--f)); }
  .language__leaf .language__origin { max-width: calc(370px * var(--f)); font-size: calc(14px * var(--f)); }
  .language__arabic { font-size: calc(29px * var(--f)); }
  .language__leaf .language__colophon { width: calc(460px * var(--f)); margin-top: calc(20px * var(--f)); font-size: calc(14px * var(--f)); }
}

/* Once in, the star catches the light now and then. */
.scene.is-armed .language__rule.is-in .language__star { animation: language-star 7s ease-in-out 7s infinite; }
@keyframes language-star {
  0%, 74%, 100% { scale: 1; rotate: 0deg; opacity: 1; }
  83% { scale: 1.18; rotate: 18deg; opacity: 1; }
  91% { scale: .95; rotate: 24deg; opacity: .85; }
}
@media (prefers-reduced-motion: reduce) {
  .scene.is-armed .language__rule.is-in .language__star { animation: none; }
}

/*
 * The footer (Figma 563:2725, 1440 × 900, at Period III's width scale). Warm white paper with the
 * Built to last grain; the painting (Figma AI, white sky) is multiplied into it, so its sky takes the
 * paper's tone.
 *
 * It waits beneath the closing line, as the finale waits beneath Travel west: z under .language, a
 * −100vh margin so it starts behind the line's view, and a sticky hold that keeps it still for that
 * one view while the line lifts off it. The hold is at least a view tall, the artboard on its
 * bottom (a short artboard gets more paper above it, its sky); a taller artboard then scrolls on
 * to its foot. It comes out of the line's shade (--come, 0 → 1, lib/footer.js), and the painting
 * rises the last of the way as it does (--rise). clip, not hidden, so the hold can stick.
 */
.site-footer {
  --footer-hold: max(100vh, calc(900px * var(--period-three-scale)));
  z-index: 5;
  height: calc(100vh + var(--footer-hold));
  margin-top: -100vh;
  overflow: clip;
  background: #fbf8f3;
  color: #491508;
}
.site-footer__hold { position: sticky; top: 0; height: var(--footer-hold); overflow: hidden; }
.site-footer__stage { top: auto; bottom: 0; height: 900px; overflow: hidden; transform-origin: 50% 100%; background: #fbf8f3; }
.site-footer__shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #0a0300;
  opacity: calc(.55 * (1 - var(--come, 1)));
  pointer-events: none;
}
.site-footer__paper { left: -120px; top: -180px; width: 1680px; height: 1254px; object-fit: cover; opacity: .07; mix-blend-mode: multiply; pointer-events: none; }
.site-footer__painting {
  left: -80px;
  top: 0;
  width: 1600px;
  height: 900px;
  mix-blend-mode: multiply;
  translate: 0 var(--rise, 0px);
  pointer-events: none;
}
.site-footer__painting img { width: 100%; height: 100%; object-fit: cover; }
.site-footer__fade {
  left: 0;
  top: 770px;
  width: 1440px;
  height: 130px;
  background: linear-gradient(rgb(251 248 243 / 0), rgb(251 248 243 / .3) 45%, rgb(251 248 243 / .8) 75%, rgb(251 248 243 / .97));
  pointer-events: none;
}
.site-footer__star { flex: none; width: 9px; height: 9px; fill: currentColor; }
.site-footer__kicker {
  left: 0;
  top: 84px;
  width: 1440px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: rgb(73 21 8 / .75);
  font-family: var(--font-label);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 2.4px;
  text-transform: uppercase;
}
.site-footer__kicker .site-footer__star { color: rgb(73 21 8 / .7); }
.site-footer__rule { flex: none; width: 40px; height: 1px; background: rgb(73 21 8 / .4); }
.site-footer__title {
  left: 0;
  top: 114px;
  width: 1440px;
  font-family: var(--font-display);
  font-size: 112px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -2.24px;
  text-align: center;
}
.site-footer__title .scene__word { transform-origin: 50% 100%; }
.site-footer__line {
  left: 0;
  top: 242px;
  width: 1440px;
  color: #6e5249;
  font-family: var(--font-label);
  font-size: 16px;
  line-height: 24px;
  text-align: center;
}
/* The three ages, ✦ between them (36px each side), as in the menu: a click takes you there. */
.site-footer__ages { left: 0; top: 318px; width: 1440px; }
.site-footer__ages ol { display: flex; justify-content: center; gap: 82px; margin: 0; padding: 0; list-style: none; }
.site-footer__ages li { position: relative; }
.site-footer__ages li + li::before {
  content: "";
  position: absolute;
  left: -46px;
  top: 20px;
  width: 10px;
  height: 10px;
  background: rgb(73 21 8 / .45);
  clip-path: polygon(50% 0, 60.6% 39.4%, 100% 50%, 60.6% 60.6%, 50% 100%, 39.4% 60.6%, 0 50%, 39.4% 39.4%);
}
.site-footer__ages a { display: flex; flex-direction: column; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.site-footer__years {
  color: rgb(73 21 8 / .65);
  font-family: var(--font-label);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 2.4px;
  text-transform: uppercase;
}
.site-footer__age {
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.1;
  background: linear-gradient(currentColor, currentColor) 50% 100% / 0 1px no-repeat;
  transition: background-size .5s var(--ease-out);
}
.site-footer__ages a:is(:hover, :focus-visible) .site-footer__age { background-size: 100% 1px; }
/* The way back: an ink pill, its arrow in a cream disc. */
.site-footer__back {
  left: 50%;
  top: 420px;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 48px;
  padding: 0 8px 0 24px;
  border-radius: 999px;
  background: #491508;
  color: #f6ead9;
  font-family: var(--font-label);
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color .3s var(--ease-out);
}
.site-footer__arrow {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f6ead9;
  color: #491508;
  font-size: 15px;
  transition: translate .4s var(--ease-out);
}
.site-footer__back:is(:hover, :focus-visible) { background: #5e1d0b; }
.site-footer__back:is(:hover, :focus-visible) .site-footer__arrow { translate: 0 -3px; }
.site-footer :is(a, .site-footer__back):focus-visible { outline: 2px solid #491508; outline-offset: 4px; }
.site-footer__bar {
  left: 112px;
  top: 868px;
  width: 1216px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-label);
  font-size: 12px;
  line-height: 1;
}
.site-footer__bar p { margin: 0; color: rgb(73 21 8 / .75); }
.site-footer__notes { display: flex; align-items: center; gap: 22px; }
.site-footer__notes .site-footer__star { width: 6px; height: 6px; color: rgb(73 21 8 / .4); }
.site-footer__sources { display: inline-flex; align-items: center; gap: 4px; color: #491508; font-weight: 500; }
/* DM Sans has ↑ but not →: the arrow turned. */
.site-footer__arrow-right { display: inline-block; rotate: 90deg; }
