/*
 * Gristholm Brewing — a one-page project in live 3D (tickets/SC-10.md).
 *
 * The stage is a taproom. Layers of the pinned stage, back to front:
 *   .field     z0  the wall behind the bar in one light: .room is a picture the script paints —
 *                  copper kettles and lamps, out of focus (the gradient under it is what is left
 *                  without the script)
 *   .word …    z1  what is written on that wall: the name in two lines, the toast
 *   #gl        z2  the top of the bar, the bottles and the glasses: a transparent canvas, so
 *                  the wall shows over the bar
 *   .bar …     z3  the interface, which stands still: the captions of act 1, the callouts
 *                  of act 2, the line and the button of act 4
 * After the stage, in the flow of the page: .foot.
 *
 * Four lights on the whole page: dusk, gold, copper, night.
 */

:root {
  --gh-dark: #101418;
  --gh-amber: #f2a900;
  --gh-white: #ffffff;
  --gh-gold: #f2c94c;
  --gh-copper: #c7702a;
  --gh-stout: #1b1210;
  --gh-foam: #f4ead3;

  --ease-camera: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-text: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: clamp(16px, 2.6vw, 40px);

  /* The brewery's pair: the gothic of its label for names, its plain sister for what is small. */
  --face-display: "Grenze Gotisch", Georgia, serif;
  --face-text: "Grenze", Georgia, "Times New Roman", serif;
  /* The studio's own face, for its corner only. */
  --face-studio: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html {
  background: var(--gh-dark);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--gh-white);
  font-family: var(--face-text);
  font-size: 18px;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
}

p,
h1,
h2,
h3,
ol,
ul {
  margin: 0;
  padding: 0;
}

/* ——— The pinned scene ——— */

/* Six screens of scroll for the four acts, and the screen the stage itself takes. */
.scene {
  position: relative;
  height: 700vh;
}

.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
}

/* ——— z0: the field ——— */

.field {
  position: absolute;
  inset: 0;
  background-color: var(--f);
  background-image: radial-gradient(120% 88% at 50% 44%, var(--f-hi) 0%, var(--f) 48%, var(--f-lo) 100%);
}

.field[data-tone="dark"] {
  --f: #101418;
  --f-hi: #1b242d;
  --f-lo: #080b0e;
  --w: var(--gh-amber);
}

.field[data-tone="gold"] {
  --f: #f2c94c;
  --f-hi: #f8d868;
  --f-lo: #e2b22c;
  --w: var(--gh-white);
}

.field[data-tone="copper"] {
  --f: #c7702a;
  --f-hi: #d6833c;
  --f-lo: #ab5a1b;
  --w: #f6dcae;
}

.field[data-tone="stout"] {
  --f: #1b1210;
  --f-hi: #2c1d18;
  --f-lo: #0e0807;
  --w: var(--gh-copper);
}

.room {
  position: absolute;
  inset: -2.5%;
  background: center / cover no-repeat;
  transform: translate3d(calc(var(--wx, 0px) * 0.6), 0, 0);
}

.field[data-tone="dark"] .room {
  background-image: var(--room-dark, none);
}

.field[data-tone="gold"] .room {
  background-image: var(--room-gold, none);
}

.field[data-tone="copper"] .room {
  background-image: var(--room-copper, none);
}

.field[data-tone="stout"] .room {
  background-image: var(--room-stout, none);
}

/* The light of a beer floods over the one before: a soft-edged circle that grows from its glass. */
.flood {
  visibility: hidden;
  -webkit-mask-image: radial-gradient(
    circle at var(--fx, 50%) var(--fy, 50%),
    #000 var(--r0, 0px),
    transparent var(--r1, 0px)
  );
  mask-image: radial-gradient(
    circle at var(--fx, 50%) var(--fy, 50%),
    #000 var(--r0, 0px),
    transparent var(--r1, 0px)
  );
}

.flood.is-open {
  visibility: visible;
}

.flood.is-full {
  -webkit-mask-image: none;
  mask-image: none;
}

/* A field wholly under a full one is not painted. */
.field.is-under {
  visibility: hidden;
}

/* ——— z1: the name, written across the wall in the gothic of the label ——— */

.word {
  position: absolute;
  left: 0;
  right: 0;
  /* High on the wall: the necks of the bottles cross it, their shoulders stand under it. */
  top: 20%;
  /* It slides against the scroll, and away from the pointer. */
  transform: translate3d(calc(var(--wx, 0px) + var(--slide, 0px)), -50%, 0);
  color: var(--w);
  font-family: var(--face-display);
  font-size: var(--word-size, 19vw);
  font-weight: 900;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}

/* Act 3: the toast as wide as the wall, over the glasses. It slides against the scroll. */
.shout {
  position: absolute;
  left: 50%;
  top: 25%;
  transform: translate3d(calc(-50% + var(--shift, 0px) + var(--wx, 0px)), -50%, 0);
  color: var(--gh-amber);
  font-family: var(--face-display);
  font-size: var(--shout-size, 24vw);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}

/* ——— z2: the bottles ——— */

#gl {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 900ms var(--ease-camera);
}

#gl.is-ready {
  opacity: 1;
}

/* ——— Tones of the interface: dark on a colour, white on the dark fields ——— */

[data-ui] {
  --ui: var(--gh-dark);
  --ui-dim: rgb(16 20 24 / 0.9);
  --ui-line: rgb(16 20 24 / 0.5);
  --ui-mark: var(--gh-dark);
  --ui-mark-ink: var(--gh-white);
  color: var(--ui);
  transition: color 420ms var(--ease-camera);
}

[data-ui][data-tone="dark"],
[data-ui][data-tone="stout"] {
  --ui: var(--gh-white);
  --ui-dim: rgb(255 255 255 / 0.74);
  --ui-line: rgb(255 255 255 / 0.4);
  --ui-mark: var(--gh-amber);
  --ui-mark-ink: var(--gh-dark);
}

/* ——— z3: the interface ——— */

.bar {
  position: absolute;
  top: var(--gutter);
  left: var(--gutter);
  right: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--face-display);
  font-size: 24px;
  font-weight: 700;
}

/* The brewery's letter, as on the band round the neck. */
.brand-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: var(--ui-mark);
  color: var(--ui-mark-ink);
  font-family: var(--face-display);
  font-size: 22px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  transition:
    background-color 420ms var(--ease-camera),
    color 420ms var(--ease-camera);
}

.bar-note {
  color: var(--ui-dim);
  transition: color 420ms var(--ease-camera);
}

/* The captions share one cell; one is shown at a time. */
.captions {
  position: absolute;
  left: var(--gutter);
  bottom: calc(var(--gutter) + 4px);
  display: grid;
  width: min(24vw, 340px);
}

.caption {
  grid-area: 1 / 1;
  align-self: end;
}

/* The line of the brewery: said in the text face. */
.voice {
  font-size: clamp(26px, 2.5vw, 40px);
  font-weight: 500;
  line-height: 1.06;
}

.title {
  font-family: var(--face-display);
  font-size: clamp(32px, 3.3vw, 56px);
  font-weight: 700;
  line-height: 0.98;
}

.notes {
  margin-top: 14px;
  font-size: clamp(17px, 1.35vw, 21px);
  font-weight: 500;
  line-height: 1.25;
}

/* A line comes up from under a mask and leaves the way it came. */
.line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.14em;
  margin-bottom: -0.14em;
}

.line > span {
  display: block;
  transform: translate3d(0, 118%, 0);
  transition: transform 320ms var(--ease-camera);
}

.caption.is-on .line > span,
.callout.is-on .line > span,
.final.is-on .line > span {
  transform: none;
  transition: transform 700ms var(--ease-text) calc(var(--i, 0) * 70ms + 160ms);
}

/* The pointer of the three beers: three taps, each the colour of what it pours. */
.index {
  position: absolute;
  right: calc(var(--gutter) - 14px);
  top: 76%;
  transform: translateY(-50%);
  transition:
    opacity 420ms var(--ease-camera),
    visibility 0s linear 0s;
}

.stage:not([data-act="0"]) .index {
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 420ms var(--ease-camera),
    visibility 0s linear 420ms;
}

.taps {
  display: flex;
  flex-direction: column;
  list-style: none;
}

.taps button {
  position: relative;
  display: block;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: inherit;
  cursor: pointer;
}

.taps button::before,
.taps button::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.taps button::before {
  width: 12px;
  height: 12px;
  background-color: var(--tap);
  box-shadow: 0 0 0 1.5px var(--ui);
  transition: box-shadow 420ms var(--ease-camera);
}

.taps button::after {
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--ui);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.6);
  transition:
    opacity 300ms linear,
    transform 500ms var(--ease-text),
    border-color 420ms var(--ease-camera);
}

.taps li:nth-child(1) button {
  --tap: var(--gh-gold);
}

.taps li:nth-child(2) button {
  --tap: var(--gh-copper);
}

.taps li:nth-child(3) button {
  --tap: var(--gh-stout);
}

.taps button:hover::after,
.taps button:focus-visible::after {
  opacity: 0.6;
  transform: translate(-50%, -50%);
}

.taps button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -4px;
}

.stage[data-state="1"] .taps li:nth-child(1) button::after,
.stage[data-state="2"] .taps li:nth-child(2) button::after,
.stage[data-state="3"] .taps li:nth-child(3) button::after {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.hint {
  position: absolute;
  right: var(--gutter);
  bottom: calc(var(--gutter) + 4px);
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ui-dim);
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
  transition:
    opacity 420ms var(--ease-camera),
    color 420ms var(--ease-camera);
}

.hint i {
  display: block;
  width: 1px;
  height: 34px;
  background-color: currentColor;
}

.stage.is-moving .hint {
  opacity: 0;
}

/* ——— Act 2: one bottle in detail ——— */

.detail,
.final {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.leaders {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.leader path {
  fill: none;
  stroke: var(--ui);
  stroke-width: 1.25;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 300ms var(--ease-camera);
}

.leader .dot {
  fill: var(--ui);
  opacity: 0;
  transition: opacity 200ms linear;
}

.leader .ring {
  fill: none;
  stroke: var(--ui);
  stroke-width: 1.25;
  opacity: 0;
  transition: opacity 200ms linear;
}

.leader.is-on path {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 700ms var(--ease-text) 140ms;
}

.leader.is-on .dot {
  opacity: 1;
  transition: opacity 240ms linear 520ms;
}

.leader.is-on .ring {
  opacity: 0.6;
  transition: opacity 240ms linear 620ms;
}

.callout {
  position: absolute;
  left: clamp(60px, 13.5vw, 210px);
  width: min(24vw, 360px);
}

.callout[data-n="0"] {
  top: 21%;
}

.callout[data-n="1"] {
  left: auto;
  right: clamp(60px, 13.5vw, 210px);
  top: 40%;
  text-align: right;
}

.callout[data-n="1"] .callout-word {
  margin-left: auto;
}

.callout[data-n="2"] {
  top: 55%;
}

.callout-word {
  width: -webkit-fit-content;
  width: fit-content;
  font-family: var(--face-display);
  font-size: clamp(34px, 4vw, 66px);
  font-weight: 700;
  line-height: 0.96;
}

.callout-text {
  margin-top: 12px;
  color: var(--ui-dim);
  font-size: clamp(17px, 1.4vw, 21px);
  font-weight: 500;
  line-height: 1.25;
}

/* ——— Act 4: the three together ——— */

.final-body {
  position: absolute;
  left: var(--gutter);
  top: 42%;
  width: min(36vw, 540px);
  transform: translate3d(0, -50%, 0);
}

.final-title {
  font-size: clamp(2.6rem, 4.9vw, 5.6rem);
  font-weight: 700;
  line-height: 0.94;
}

/* The button: a dark capsule with its arrow in a round of the brewery's amber. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  height: 56px;
  margin-top: clamp(24px, 4vh, 44px);
  padding: 6px 6px 6px 24px;
  border-radius: 999px;
  background-color: var(--gh-dark);
  color: var(--gh-white);
  font-size: 19px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition:
    opacity 240ms linear,
    transform 320ms var(--ease-camera),
    background-color 180ms linear;
}

.final.is-on .pill {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition:
    opacity 420ms linear 440ms,
    transform 700ms var(--ease-text) 440ms,
    background-color 180ms linear;
}

.pill:hover {
  background-color: #000000;
}

.pill:focus-visible {
  outline: 2px solid var(--gh-dark);
  outline-offset: 3px;
}

.pill-round {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--gh-amber);
  color: var(--gh-dark);
  transition: transform 180ms var(--ease-camera);
}

.pill-round svg,
.studio svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 180ms var(--ease-camera);
}

.pill:hover .pill-round,
.pill:focus-visible .pill-round {
  transform: scale(1.06);
}

.pill:hover .pill-round svg,
.pill:focus-visible .pill-round svg {
  transform: rotate(45deg);
}

/* ——— The footer: the bar from above — a beer mat, and the three taps by their plates ——— */

.foot {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.25fr);
  align-items: center;
  gap: clamp(28px, 5vw, 88px);
  min-height: 62vh;
  padding: clamp(48px, 9vh, 96px) clamp(24px, 6vw, 96px) clamp(96px, 14vh, 132px);
  overflow: hidden;
  /*
   * The oak of the bar, a photograph, to the scale of the mat on it: the mat is 11 cm across
   * and a tile of the photograph is four boards of 12 cm. Over it, the light of one lamp
   * falling off to the corners. The script paints both once into .foot-wood, a canvas under
   * the words: a background picture stretched to this size is painted by Safari piece by
   * piece as the footer comes near, and that cost the last act its smoothness. Without the
   * script the same two are a plain background (.no-js, below).
   */
  --mat: clamp(220px, 27vw, 400px);
  background-color: #7b4d24;
  color: var(--gh-white);
}

.no-js .foot {
  background-image:
    radial-gradient(110% 120% at 26% 30%, rgb(24 12 4 / 0) 0%, rgb(24 12 4 / 0.12) 45%, rgb(24 12 4 / 0.62) 100%),
    url("textures/oak.webp");
  background-size:
    auto,
    calc(var(--mat) * 4.4) calc(var(--mat) * 4.4);
  background-position:
    center,
    38% 31%;
}

.foot-wood {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* The mat and the rail are pictures of their own, painted once when the page opens. */
.mat,
.rail {
  z-index: 1;
  will-change: transform;
}

/* The mat: cardboard, printed in one ink, left a little askew. */
.mat {
  position: relative;
  justify-self: center;
  width: var(--mat);
  aspect-ratio: 1;
}

.mat-card {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow:
    0 2px 0 rgb(255 255 255 / 0.18) inset,
    0 14px 26px rgb(0 0 0 / 0.5),
    0 2px 3px rgb(0 0 0 / 0.6);
  transform: rotate(-9deg);
}

.mat-board {
  fill: #ecdcb6;
}

.mat-line {
  fill: none;
  stroke: #5a3a1c;
  stroke-width: 1.6;
}

.mat-hair {
  fill: none;
  stroke: #5a3a1c;
  stroke-width: 0.6;
}

.mat-rim {
  fill: #3a2412;
  font-family: var(--face-text);
  font-size: 12.4px;
  font-weight: 600;
}

.mat-name {
  fill: #2a180c;
  font-family: var(--face-display);
  font-size: 33px;
  font-weight: 900;
}

.mat-kind {
  fill: #3a2412;
  font-family: var(--face-text);
  font-size: 13px;
  font-weight: 600;
}

/* The ring a wet glass left on the wood beside the mat. */
.mat-stain {
  position: absolute;
  left: 58%;
  top: 56%;
  width: 62%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(
    closest-side,
    rgb(0 0 0 / 0) 88%,
    rgb(0 0 0 / 0.26) 91%,
    rgb(255 255 255 / 0.1) 95%,
    rgb(0 0 0 / 0) 98%
  );
}

/* The rail of the taps: brass, and three plates hung on it. */
.rail {
  position: relative;
  padding-top: 13px;
}

.rail::before {
  content: "";
  position: absolute;
  left: -4%;
  right: -4%;
  top: 0;
  height: 13px;
  border-radius: 7px;
  background: linear-gradient(180deg, #f6dc9a 0%, #c98f2e 38%, #8a5a14 78%, #5e3c0c 100%);
  box-shadow: 0 6px 10px rgb(0 0 0 / 0.45);
}

.plates {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 1.6vw, 26px);
  list-style: none;
}

.plate {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 26px;
  padding: clamp(18px, 2vw, 28px) clamp(14px, 1.5vw, 22px) clamp(18px, 2vw, 26px);
  border-radius: 10px;
  background-color: var(--plate);
  box-shadow:
    0 0 0 2px var(--plate) inset,
    0 0 0 3.5px var(--plate-line) inset,
    0 12px 20px rgb(0 0 0 / 0.42);
  color: var(--plate-ink);
}

/* The two straps a plate hangs by. */
.plate::before,
.plate::after {
  content: "";
  position: absolute;
  top: -28px;
  width: 6px;
  height: 30px;
  border-radius: 2px;
  background: linear-gradient(90deg, #7a4f12, #e2b560 45%, #7a4f12);
}

.plate::before {
  left: 22%;
}

.plate::after {
  right: 22%;
}

.plate:nth-child(1) {
  transform: rotate(-1.2deg);
}

.plate:nth-child(2) {
  transform: rotate(0.8deg);
}

.plate:nth-child(3) {
  transform: rotate(-0.5deg);
}

.plate[data-beer="lager"] {
  --plate: #f2c94c;
  --plate-line: #6a4310;
  --plate-ink: #101418;
}

.plate[data-beer="amber"] {
  --plate: #c7702a;
  --plate-line: #f6dcae;
  --plate-ink: #101418;
}

.plate[data-beer="stout"] {
  --plate: #1b1210;
  --plate-line: #d9a45b;
  --plate-ink: #efe3c8;
}

.plate em {
  font-family: var(--face-display);
  font-size: clamp(2rem, 3.8vw, 3.75rem);
  font-style: normal;
  font-weight: 900;
  line-height: 0.9;
}

.plate b {
  margin-top: clamp(10px, 2vh, 22px);
  font-family: var(--face-display);
  font-size: clamp(1.375rem, 1.9vw, 1.875rem);
  font-weight: 700;
  line-height: 1;
}

.plate span {
  font-size: 17px;
  font-weight: 500;
  line-height: 1.2;
}

/* The studio signs in its own colours, not the brewery's: volt and ink, in the corner. */
.studio {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px var(--gutter) 18px 26px;
  border-top-left-radius: 28px;
  background-color: #d6fa50;
  color: #0a0a0a;
  font-family: var(--face-studio);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
  transition: background-color 180ms linear;
}

.studio:hover,
.studio:focus-visible {
  background-color: #b8dc2c;
}

.studio:focus-visible {
  outline: 2px solid var(--gh-white);
  outline-offset: 3px;
}

.studio svg {
  width: 16px;
  height: 16px;
}

.studio:hover svg,
.studio:focus-visible svg {
  transform: rotate(45deg);
}

/* ——— A tall screen: the name in two halves, over the bottle and under it ——— */

@media (max-aspect-ratio: 4 / 5) {
  .scene {
    height: 660vh;
    height: 660svh;
  }

  /* The name in two halves, one under the other at the top of the wall: only the necks of
     the bottles stand before the second. */
  .word {
    top: 7.5%;
    left: 5%;
    right: 5%;
    transform: translate3d(var(--wx, 0px), 0, 0);
    line-height: 0.74;
  }

  .word span {
    display: block;
  }

  .word span:first-child {
    text-align: left;
  }

  .word span:last-child {
    text-align: right;
  }

  /* The toast in one line across the wall, over the glasses. */
  .shout {
    top: 22%;
  }

  .brand {
    font-size: 22px;
  }

  .bar-note {
    display: none;
  }

  .captions {
    width: min(72vw, 300px);
    bottom: calc(var(--gutter) + 6px + env(safe-area-inset-bottom, 0px));
  }

  .voice {
    font-size: 25px;
  }

  .title {
    font-size: 31px;
  }

  .notes {
    margin-top: 8px;
    font-size: 17px;
  }

  .index {
    top: calc(var(--gutter) - 8px);
    right: calc(var(--gutter) - 12px);
    transform: none;
  }

  .taps {
    flex-direction: row;
  }

  .hint {
    bottom: calc(var(--gutter) + 6px + env(safe-area-inset-bottom, 0px));
  }

  .hint span {
    display: none;
  }

  /* The callouts share the foot of the screen; the newest one is shown. */
  .callout[data-n="0"],
  .callout[data-n="1"],
  .callout[data-n="2"] {
    left: var(--gutter);
    right: var(--gutter);
    top: auto;
    bottom: calc(var(--gutter) + 6px + env(safe-area-inset-bottom, 0px));
    width: auto;
    text-align: left;
  }

  .callout-word,
  .callout[data-n="1"] .callout-word {
    margin-left: 0;
    font-size: 38px;
  }

  .callout-text {
    margin-top: 6px;
    font-size: 17px;
  }

  .final-body {
    top: auto;
    bottom: calc(var(--gutter) + 10px + env(safe-area-inset-bottom, 0px));
    width: auto;
    transform: none;
  }

  .final-title {
    font-size: clamp(2.3rem, 11.4vw, 3.3rem);
  }

  .pill {
    height: 52px;
    margin-top: 20px;
  }

  .pill-round {
    width: 40px;
    height: 40px;
  }

  .foot {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
    min-height: 0;
    padding: 44px var(--gutter) 104px;
  }

  .foot {
    --mat: min(62vw, 250px);
  }

  .rail {
    padding-top: 11px;
  }

  .rail::before {
    left: -2%;
    right: -2%;
    height: 11px;
  }

  /* On a narrow bar the plates hang one under another, each a line: strength, name, style. */
  .plates {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .plate {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 16px;
    row-gap: 2px;
    margin-top: 24px;
    padding: 14px 16px;
  }

  .plate em {
    grid-row: 1 / 3;
    min-width: 3.1em;
    font-size: 2.125rem;
  }

  .plate b {
    margin-top: 0;
    font-size: 1.375rem;
  }

  .plate::before,
  .plate::after {
    top: -26px;
    height: 28px;
  }
}

/*
 * ——— Reduced motion (or ?still): the acts become plain sections ———
 *
 * No pinned stage and no long scroll: the script draws one frame of each act
 * and sets it in a section of its own (.still) — the field, the picture of
 * the bottles, the words — one under another.
 */

.rm .scene {
  height: auto;
}

.rm .stage {
  position: relative;
}

.rm .stage[hidden] {
  display: none;
}

.still {
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
}

.still .field {
  visibility: visible;
  -webkit-mask-image: none;
  mask-image: none;
}

.still-shot {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.rm .hint,
.rm .index {
  display: none;
}

.rm #gl,
.rm [data-ui],
.rm .line > span,
.rm .leader path,
.rm .leader circle,
.rm .pill {
  transition: none !important;
}

.rm .line > span {
  transform: none;
}

.rm .caption:not(.is-on) {
  display: none;
}

.rm .leader path {
  stroke-dashoffset: 0;
}

.rm .leader .dot {
  opacity: 1;
}

.rm .leader .ring {
  opacity: 0.6;
}

.rm .pill {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

@media (max-aspect-ratio: 4 / 5) {
  /* On a phone the three callouts stand in a column at the foot, without their lines. */
  .rm .detail {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 12px;
    padding: 0 var(--gutter) calc(var(--gutter) + 6px);
  }

  .rm .callout,
  .rm .callout[data-n="1"] {
    position: static;
  }

  .rm .callout-word {
    font-size: 28px;
  }

  .rm .callout[data-n="2"] .line {
    display: inline;
  }

  .rm .callout[data-n="2"] .line > span {
    display: inline;
  }

  .rm .callout-text {
    margin-top: 4px;
  }

  .rm .leaders {
    display: none;
  }
}

/* Before the script has run, or without it. */
@media (prefers-reduced-motion: reduce) {
  .scene {
    height: auto;
  }

  .stage {
    position: relative;
  }

  #gl,
  [data-ui],
  .line > span {
    transition: none;
  }
}

/* ——— Without the script: one tall dark field, every word of the page in a column ——— */

.no-js .scene {
  height: auto;
}

.no-js .stage {
  position: relative;
  height: auto;
  min-height: 100vh;
  padding: 62vh var(--gutter) 56px;
}

.no-js .word {
  top: 6vh;
  bottom: auto;
  transform: none;
}

.no-js .captions,
.no-js .detail,
.no-js .final {
  position: relative;
  inset: auto;
  display: block;
  width: auto;
  margin: 0 0 44px;
}

.no-js .caption {
  margin-bottom: 28px;
}

.no-js .final-body {
  position: static;
  width: auto;
  transform: none;
}

.no-js .callout[data-n] {
  position: static;
  width: auto;
  margin-bottom: 24px;
  text-align: left;
}

.no-js .callout[data-n] .callout-word {
  margin-left: 0;
}

.no-js .line > span {
  transform: none;
}

.no-js .pill {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  background-color: var(--gh-amber);
  color: var(--gh-dark);
}

.no-js .pill-round {
  background-color: var(--gh-dark);
  color: var(--gh-white);
}

.no-js .index,
.no-js .hint,
.no-js .leaders,
.no-js #gl {
  display: none;
}

/* ——— No WebGL: the field, the name and the words stay ——— */

.no-gl #gl {
  display: none;
}

/* ——— Checks ——— */

.hud {
  position: fixed;
  left: 8px;
  top: 64px;
  z-index: 20;
  margin: 0;
  padding: 8px 10px;
  border-radius: 4px;
  background: rgb(0 0 0 / 0.82);
  color: #b6ff7a;
  font: 11px/1.45 ui-monospace, Menlo, monospace;
  white-space: pre;
  pointer-events: none;
}

.labels {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  gap: 8px;
  padding: 8px;
  overflow: auto;
  background: #222;
}

.labels canvas {
  display: block;
  width: 100%;
  height: auto;
}
