/*
 * Umberly, «Bar by bar» — a page played from footage, and a page that travels
 * (tickets/SC-48.md; the footage, the words and the colours are those of ../prototype-film, SC-29).
 *
 * This sheet is written in two halves.
 *
 * First, the page as it is without the script, or where motion is not wanted: every shot
 * is a screen of its own — its still, its words at the foot of it — and between the acts
 * lie the blocks of the page: the maker's line on the gold, the strip of four stills.
 *
 * Then (html.live, set before the first paint when the film will play) the page becomes
 * four acts with real scroll between them:
 *   .act        as tall as its scene is pinned for, plus one screen (--pin, set by the script)
 *   .stage      the scene of the act: a sticky screen. The page brings it in from below,
 *               holds it and carries it away upwards
 *     .frame      the picture: the first frame of the act (.poster) until the film is
 *                 there, then the footage (.screen, a canvas of its own in every act).
 *                 In act 2 it is a tall column beside the word «Cacao,», in act 4 a window
 *                 in the umber (clip-path, set by the script): both open to the whole screen
 *     .leaders    the line from a word to its thing
 *   .cue        the words of an act lie on the page, not on the scene: they come from
 *               below and leave upwards with the scroll while the picture stands pinned
 *   .block      what lies between two acts and scrolls as any page does: the line on
 *               the brown and on the gold, the strip of stills on the umber. A block that
 *               follows a flood lies over the end of the act before it, so its words
 *               rise on the colour while that still stands pinned
 *   .bar        the name and the steps of the story, fixed over all of it
 * After the film, in the flow of the page: .foot — the foil and the paper band, opened.
 *
 * The words take their ink from what lies under them (data-tone): cream on the dark of
 * the workshop and the walnut ("night"), umber on the white marble and on gold ("day").
 *
 * Brand colours (tickets/SC-29.md): umber #1a0f0a, brown #7b3f00, gold #d4af37.
 */

:root {
  --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);

  --umber: #1a0f0a;
  --brown: #7b3f00;
  --gold: #d4af37;
  --cream: #f4e9d8;

  /* The maker's own pair. Cormorant Garamond — the serif of its paper band — for every
     large word; Jost for everything small. The studio's faces (Unbounded, Onest) are in
     the studio's lime corner and nowhere else. */
  --face-display: "Cormorant Garamond", "Cormorant", Garamond, Georgia, serif;
  --face-text: "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
  --face-studio-display: "Unbounded", "Arial Black", Arial, sans-serif;
  --face-studio-text: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html {
  background: #1a0f0a;
  color: #f4e9d8;
  -webkit-text-size-adjust: 100%;
}

body {
  position: relative;
  margin: 0;

  /* Cream: the ink of every word until something says otherwise. */
  --ui: #f4e9d8;
  --ui-said: rgb(244 233 216 / 0.62);
  --plate: rgb(26 15 10 / 0.62);
  --mark: #d4af37;
  --halo: rgb(26 15 10 / 0.5);
  color: #f4e9d8;
  font-family: var(--face-text);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
}

::selection {
  background-color: #d4af37;
  color: #1a0f0a;
}

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

ol,
ul {
  list-style: none;
}

/*
 * ——— The page without the film: seven stills, their words, and the blocks between ———
 */

.stage,
.acts,
.hint {
  display: none;
}

.bar {
  position: absolute;
  top: var(--gutter);
  left: var(--gutter);
  right: var(--gutter);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #f4e9d8;
  line-height: 1;
}

.brand {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  isolation: isolate;
  color: var(--ui);
  font-family: var(--face-display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color 300ms linear;
}

/* The name passes over a lit window and a dark wall alike: it carries its own soft plate. */
.brand::before {
  content: "";
  position: absolute;
  inset: -22px -34px;
  z-index: -1;
  background-image: radial-gradient(closest-side, var(--plate), rgb(0 0 0 / 0));
  pointer-events: none;
  transition: opacity 200ms linear;
}

/* Over a flood, or on the colour of the page, the name and the steps lie on one colour: they need no plate. */
.bar.is-bare .brand::before,
.bar.is-bare .acts::before {
  opacity: 0;
}

.brand-mark {
  flex: none;
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* A shot: its still fills a screen, its words stand at the foot of it. */
.shot {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 10px;
  min-height: 100vh;
  min-height: 100svh;
  padding: 96px var(--gutter) clamp(28px, 6vh, 64px);
  overflow: hidden;
  isolation: isolate;
}

.still {
  position: absolute;
  inset: 0;
  z-index: -2;
  display: block;
}

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

/* Under the words a still is darker, so the cream reads on any of the seven. */
.shot::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(to top, rgb(26 15 10 / 0.9), rgb(26 15 10 / 0.56) 28%, rgb(26 15 10 / 0) 58%);
  pointer-events: none;
}

.cue {
  position: relative;
  color: var(--ui);
}

.line {
  display: block;
  overflow: hidden;
  padding: 0.08em 0.08em 0.2em;
  margin: -0.08em -0.08em -0.2em;
}

.line > span {
  display: block;
}

/* The line of the first screen. */
.title {
  font-family: var(--face-display);
  font-size: clamp(42px, 5.4vw, 88px);
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 0.98;
}

.title .line:last-child > span {
  font-style: italic;
  font-weight: 500;
}

/* The line of the page: «Cacao, sugar, time.» */
.cue-phrase {
  font-family: var(--face-display);
  font-size: clamp(48px, 7vw, 108px);
  font-style: italic;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 0.9;
}

/* Without the film the line is read once, whole, on the gold before the bar is turned out. */
#cue-cacao,
.block-film {
  display: none;
}

/* A still with no words is left as it was shot. */
.shot[data-words="none"]::after {
  content: none;
}

/* A word tied to a thing of the picture. */
.caption-word {
  width: -webkit-fit-content;
  width: fit-content;
  font-family: var(--face-display);
  font-size: clamp(32px, 3.5vw, 56px);
  font-weight: 600;
  line-height: 1.04;
  white-space: nowrap;
}

.final-title {
  font-family: var(--face-display);
  font-size: clamp(44px, 5.6vw, 92px);
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 0.98;
  white-space: nowrap;
}

/* The number that stands on the band: in the gold of the foil. */
.final-title .line:last-child > span {
  color: #d4af37;
  font-style: italic;
  font-weight: 500;
}

/* The button: a capsule of the foil's gold, an arrow drawn after its words. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  height: 58px;
  margin-top: clamp(20px, 3.4vh, 34px);
  padding: 0 26px 0 30px;
  border-radius: 999px;
  background-color: #d4af37;
  color: #1a0f0a;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 180ms linear;
}

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

.pill:focus-visible {
  outline: 2px solid #f4e9d8;
  outline-offset: 3px;
}

.pill svg {
  width: 28px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 220ms var(--ease-text);
}

.pill:hover svg,
.pill:focus-visible svg {
  transform: translate3d(5px, 0, 0);
}

/*
 * The blocks of the page, between the acts. Each lies on one of the maker's three colours.
 */

.block {
  position: relative;
  overflow: hidden;
  background-color: var(--field);
  color: #1a0f0a;
}

[data-field="gold"] {
  --field: #d4af37;
}

[data-field="brown"] {
  --field: #7b3f00;
}

[data-field="umber"] {
  --field: #1a0f0a;
}

.block[data-field="brown"],
.block[data-field="umber"] {
  color: #f4e9d8;
}

/* The line of the page: «Cacao, sugar, time.» */
.block-phrase {
  padding: clamp(48px, 11vh, 110px) var(--gutter);
}

.phrase {
  font-family: var(--face-display);
  font-size: clamp(48px, 7vw, 108px);
  font-style: italic;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 0.9;
}

/* The strip: four stills of the footage, the name of its step under each. */
.block-strip {
  padding: clamp(40px, 8vh, 84px) var(--gutter) clamp(36px, 6.5vh, 68px);
}

.strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(10px, 1.6vw, 24px);
}

.strip img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 3px;
  background-color: #2c1810;
}

.strip figcaption {
  margin-top: 12px;
  font-family: var(--face-display);
  font-size: clamp(24px, 2.4vw, 38px);
  font-style: italic;
  font-weight: 500;
  line-height: 1.1;
}

/*
 * ——— The film: four acts, and the page between them ———
 */

/* The ink of the words over the footage. */
.live [data-tone="night"] {
  --ui: #f4e9d8;
  --ui-said: rgb(244 233 216 / 0.62);
  --plate: rgb(26 15 10 / 0.62);
  --mark: #d4af37;
  --halo: rgb(26 15 10 / 0.5);
}

.live [data-tone="day"] {
  --ui: #1a0f0a;
  --ui-said: rgb(26 15 10 / 0.58);
  --plate: rgb(246 240 230 / 0.66);
  --mark: #7b3f00;
  --halo: rgb(246 240 230 / 0.62);
}

.live .bar {
  position: fixed;
  transition: opacity 320ms var(--ease-camera);
}

/* Nothing of a scene makes the page wider than the screen: a soft plate under riding words may reach past its edge. */
.live .film {
  overflow-x: clip;
}

.live .bar.is-away {
  opacity: 0;
  pointer-events: none;
}

/* An act is as tall as its scene is pinned for, and the screen the scene itself takes. */
.live .act {
  position: relative;
  z-index: 0;
  height: calc((1 + var(--pin, 1)) * 100vh);
  height: calc((1 + var(--pin, 1)) * 100svh);
}

/* An act that follows a flood lies over the last of the act before it: its first word rises on the colour while that still stands pinned. */
.live .act.is-over {
  margin-top: calc(var(--over, 0.2) * -100vh);
  margin-top: calc(var(--over, 0.2) * -100svh);
}

/* The window of the last act rides in under the foot of the strip: the strip ends on the window's own margin. */
.live .act[data-act="foil"] {
  margin-top: -14vh;
  margin-top: -14svh;
}

.live .stage {
  position: sticky;
  top: 0;
  z-index: 0;
  display: block;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background-color: var(--field, #1a0f0a);
}

.live .frame {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background-color: #1a0f0a;
}

.live .poster {
  position: absolute;
  inset: 0;
  display: block;
}

/* Until the script has laid it exactly where the film will lie, the first frame covers its scene. */
.live .poster img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

/* A canvas is shown from its first drawing on: before that the first frame of the act stands there. */
.live .screen {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  visibility: hidden;
}

.live .screen.is-painted {
  visibility: visible;
}

/* A shot is no longer a box: its words lie on the page of its act. */
.live .shot {
  position: static;
  display: block;
  min-height: 0;
  padding: 0;
  overflow: visible;
  isolation: auto;
}

.live .shot::after {
  content: none;
}

.live .still {
  display: none;
}

.live .leaders {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

/*
 * A line from a word to its thing: a hair of the word's own ink, and at its end one small
 * square. Under the hair lies a wider, fainter line of the other tone, so it reads where
 * it crosses from walnut onto marble.
 */
.leader path {
  fill: none;
  stroke: var(--ui);
  stroke-width: 1.5;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 160ms var(--ease-camera);
}

.leader .under {
  stroke: var(--halo);
  stroke-width: 4.5;
  stroke-linecap: round;
}

.leader .mark {
  fill: var(--mark);
  stroke: var(--ui);
  stroke-width: 1.5;
  opacity: 0;
  transition: opacity 140ms linear;
}

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

.leader.is-on .mark {
  opacity: 1;
  transition: opacity 180ms linear 240ms;
}

/*
 * The words of an act. They are set on the page — on the act, which is taller than the
 * screen — so the scroll itself brings them up from below and carries them off at the
 * top, over a picture that stands pinned.
 */
.live .cue {
  position: absolute;
  z-index: 3;
  isolation: isolate;
  pointer-events: none;
  transition:
    color 300ms linear,
    visibility 0s linear 0s;
}

.live .cue:not(.is-on) {
  visibility: hidden;
  transition:
    color 300ms linear,
    visibility 0s linear 340ms;
}

/* A line comes up from under a mask and leaves the way it came. */
.live .line > span {
  transform: translate3d(0, 124%, 0);
  transition: transform 280ms var(--ease-camera);
}

.live .cue.is-on .line > span {
  transform: none;
  transition: transform 640ms var(--ease-text) calc(var(--i, 0) * 80ms + 80ms);
}

/* Under a block of words the picture is one soft plate of the block's own tone: no glow round every letter. */
.live .cue::before {
  content: "";
  position: absolute;
  inset: -58% -34%;
  z-index: -1;
  background-image: radial-gradient(closest-side, var(--plate), rgb(0 0 0 / 0));
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms linear;
}

.live .cue.is-on::before {
  opacity: 1;
  transition: opacity 520ms linear 80ms;
}

/* The line of the first screen stands in its corner and goes up with the page from the first turn of the wheel. */
.live .cue-opening {
  /* Set by the script: the words fade just before they would ride up under the header. */
  opacity: var(--fade, 1);
  left: var(--gutter);
  bottom: calc(var(--pin, 1) * 100vh + var(--gutter) + 4px);
  bottom: calc(var(--pin, 1) * 100svh + var(--gutter) + 4px);
}

/*
 * «Cacao,» — the first word of the line, on the gold beside the column of act 2. It rises
 * on the flood of act 1 and rides up with the column; the two other words join it on the
 * blocks further down, each standing where it will stand in the whole line.
 */
.live #cue-cacao {
  display: block;
  left: 7.5vw;
  top: 10vh;
  top: 10svh;
  opacity: var(--fade, 1);
  font-size: clamp(64px, 14.4vw, 232px);
  line-height: 0.9;
  white-space: nowrap;
}

/* On the gold there is nothing to lift the word off. */
.live #cue-cacao::before {
  content: none;
}

/* It takes its time: the word rises slowly, as the lines of the blocks do. */
.live #cue-cacao.is-on .line > span {
  transition: transform 1100ms cubic-bezier(0.22, 0.72, 0.2, 1) 80ms;
}

/*
 * A word tied to a thing of the picture: it rides up its side of the page (`--at`, set by
 * the script: it crosses its line of the screen as its second of the film comes), and
 * while it passes a line ties it to its thing.
 */
.live .note {
  top: calc(var(--at, 0.6) * 100vh);
  top: calc(var(--at, 0.6) * 100svh);
  opacity: var(--fade, 1);
  transform: translate3d(0, -50%, 0);
}

/* Each on the side its thing is not. */
.live #cue-beans {
  left: 7.5vw;
}

/* The first of them rides on the gold beside the column, and then over white marble: nothing to lift it off. */
.live #cue-beans::before {
  content: none;
}

.live #cue-marble {
  left: 62%;
}

.live #cue-mould {
  left: 5%;
}

.live #cue-foil {
  left: 6%;
}

/* Under the bar, a step in from its foil end. */
.live #cue-gold {
  left: 21%;
}

.live #cue-band {
  left: 74%;
}

/* The last line rides in from below once the band lies on the bar — on the side the hand does not come from — and goes up with the scene. */
.live .cue-final {
  left: 6%;
  top: calc((var(--pin, 1) + 0.17) * 100vh);
  top: calc((var(--pin, 1) + 0.17) * 100svh);
}

.live .pill {
  opacity: 0;
  transform: translate3d(0, 16px, 0);
  transition:
    opacity 220ms linear,
    transform 300ms var(--ease-camera),
    background-color 180ms linear;
}

.live .cue-final.is-on .pill {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition:
    opacity 400ms linear 340ms,
    transform 640ms var(--ease-text) 340ms,
    background-color 180ms linear;
}

/*
 * The blocks between the acts.
 */

.live .block {
  z-index: 1;
}

.live .block-film {
  display: block;
}

/*
 * A block after a flood lies over the last of the act before it (--over screens, set by
 * the script from the act's hold). Up there it is clear — the flood itself is the colour —
 * and its words rise over the pinned flood; below the act it paints the same colour on,
 * and flood and block ride away as one page.
 */
.live .block.is-over {
  margin-top: calc(var(--over, 0.2) * -100vh);
  margin-top: calc(var(--over, 0.2) * -100svh);
  background-color: rgb(0 0 0 / 0);
  background-image: linear-gradient(to bottom, rgb(0 0 0 / 0) calc(var(--over, 0.2) * 100vh - 2px), var(--field) calc(var(--over, 0.2) * 100vh - 2px));
  background-image: linear-gradient(to bottom, rgb(0 0 0 / 0) calc(var(--over, 0.2) * 100svh - 2px), var(--field) calc(var(--over, 0.2) * 100svh - 2px));
}

/*
 * The line of the page is said in three places, a word more in each: «Cacao,» beside the
 * column, «Cacao, sugar,» on the brown, the whole line on the gold. The lines are set
 * from the same left edge in the same size, so a word keeps its place from one to the next.
 */
.live .block-phrase {
  padding: 3vh 0 5vh 7.5vw;
  padding: 3svh 0 5svh 7.5vw;
}

.live .phrase {
  font-size: clamp(64px, 14.4vw, 232px);
  line-height: 0.9;
  white-space: nowrap;
}

.live .phrase .line {
  /* Set by the script: a line fades just before it would ride up under the header. */
  opacity: var(--fade, 1);
  /* Each line a step further in than the one before, and they draw apart a little as the block rides through the screen. */
  transform: translate3d(calc(var(--i, 0) * 7vw + (var(--p, 0.5) - 0.5) * var(--i, 0) * 9vw), 0, 0);
}

/* What has been said already stands back; the new word is in full ink. */
.live .phrase .is-said {
  color: var(--said);
}

.block[data-field="brown"] {
  --said: rgb(244 233 216 / 0.6);
}

.block[data-field="gold"] {
  --said: rgb(26 15 10 / 0.56);
}

/* It takes its time: each line rises slowly, the next well after the one before. */
.live .block.is-on .phrase .line > span {
  transform: none;
  transition: transform 1100ms cubic-bezier(0.22, 0.72, 0.2, 1) calc(var(--i, 0) * 240ms + 80ms);
}

/*
 * The strip: wider than the screen, and it runs to the left as the page goes down — the
 * day so far goes by, one step after another. Every second still hangs a step lower.
 */
.live .block-strip {
  padding: 7vh 0 19vh;
  padding: 7svh 0 19svh;
}

.live .strip {
  display: flex;
  gap: clamp(14px, 2.2vw, 34px);
  width: -webkit-max-content;
  width: max-content;
  transform: translate3d(calc(36vw - var(--p, 0.5) * 72vw), 0, 0);
}

.live .strip li {
  width: clamp(220px, 25vw, 420px);
}

.live .strip li:nth-child(even) {
  margin-top: 7vh;
  margin-top: 7svh;
}

/*
 * The steps of the story: five squares, as of a bar, and the name of the one on screen.
 * A square fills as its step goes by and stays full after it.
 */
.live .acts {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  isolation: isolate;
  color: var(--ui);
  transition: color 300ms linear;
}

/* Like the name: the steps pass over marble, walnut and a lit lamp, and carry their own soft plate. */
.live .acts::before {
  content: "";
  position: absolute;
  inset: -26px -44px;
  z-index: -1;
  background-image: radial-gradient(closest-side, var(--plate), rgb(0 0 0 / 0));
  pointer-events: none;
}

.acts-now {
  font-family: var(--face-display);
  font-size: 24px;
  font-style: italic;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.acts ol {
  display: flex;
  align-items: center;
  list-style: none;
}

.acts button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

.acts button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 0;
  border-radius: 3px;
}

.acts i {
  position: relative;
  display: block;
  width: 14px;
  height: 14px;
  overflow: hidden;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  transition: transform 220ms var(--ease-text);
}

.acts i::after {
  content: "";
  position: absolute;
  inset: 0;
  background-color: currentColor;
  transform: scaleX(var(--p, 0));
  transform-origin: 0 50%;
}

.acts button:hover i,
.acts .is-now i {
  transform: scale(1.22);
}

.live .hint {
  position: absolute;
  right: var(--gutter);
  bottom: calc(var(--gutter) + 4px);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #f4e9d8;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
  transition: opacity 360ms var(--ease-camera);
}

.hint i {
  display: block;
  width: 1.5px;
  height: 34px;
  background-color: #d4af37;
}

.hint.is-off {
  opacity: 0;
}

/*
 * ——— The footer: the foil and the band, opened ———
 *
 * Seen from over it: the sheet of gold foil, smoothed flat again on the walnut, and on
 * it the paper band, unfolded, its creases still in it; one square of the chocolate and
 * a few crumbs (textures/wrap.webp, photographed). The band is the maker's printed
 * paper: its face in the middle, as it lay on the bar, and the two flaps that were
 * folded under. The ink is laid on the paper by multiplying, so every crease shows
 * through the letters. The foil runs off both sides of the screen: the footer is a
 * field of gold. The studio's lime corner is the one thing that is the same on every page.
 */

.foot {
  position: relative;
  z-index: 1;
  overflow: hidden;
  background-color: #1a0f0a;
  color: #2c1810;
}

.wrap {
  position: relative;
  left: 50%;
  width: max(100%, min(1680px, 118vw));
  aspect-ratio: 2752 / 1536;
  container-type: inline-size;
  isolation: isolate;
  transform: translate3d(-50%, 0, 0);
}

/* Under the photograph, where its band lies: plain paper, so the print can be read even if the photograph does not come. */
.wrap::after {
  content: "";
  position: absolute;
  left: 36.2%;
  width: 26.9%;
  top: 8.7%;
  height: 82.6%;
  z-index: -1;
  background-color: #efe6d6;
}

/* The photograph: its walnut goes out into the umber of the page at the top. */
.wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("textures/wrap.webp");
  background-size: 100% 100%;
  -webkit-mask-image: linear-gradient(to bottom, rgb(0 0 0 / 0), #000 3.6%);
  mask-image: linear-gradient(to bottom, rgb(0 0 0 / 0), #000 3.6%);
}

/* The band: where the paper lies in the photograph. Its rows are its panels, between the creases. */
.band {
  position: absolute;
  left: 36.2%;
  width: 26.9%;
  top: 8.7%;
  height: 82.6%;
  display: grid;
  grid-template-rows: 22.4% 6.6% 42% 6.6% 22.4%;
  justify-items: center;
  text-align: center;
  /* White, multiplied, leaves the photographed paper as it is; only the ink darkens it. */
  background-color: #ffffff;
  mix-blend-mode: multiply;
}

/* The sizes of the print go with the sheet (cqw: a hundredth of the photograph's width). */
.band-made {
  grid-row: 1;
  align-self: center;
  /* As wide as the paper, with a margin in the paper's own measure: a share of a width that
     is itself shrunk to the words makes Safari break the line. */
  justify-self: stretch;
  padding: 0 2cqw;
  color: #7b3f00;
  font-family: var(--face-display);
  font-size: clamp(20px, 1.62cqw, 28px);
  font-style: italic;
  font-weight: 600;
  line-height: 1.1;
}

.band-face {
  grid-row: 3;
  align-self: center;
  display: grid;
  justify-items: center;
  gap: 0.9cqw;
}

.band-name {
  color: #2c1810;
  font-family: var(--face-display);
  font-size: 4.9cqw;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 0.9;
}

/* Under the name, a rule in the brown of the print. */
.band-name::after {
  content: "";
  display: block;
  width: 3.2cqw;
  height: 1.5px;
  margin: 1.3cqw auto 0;
  background-color: #7b3f00;
}

.band-kind {
  color: #2c1810;
  font-size: clamp(15px, 1.12cqw, 19px);
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.band-back {
  grid-row: 5;
  align-self: center;
  justify-self: stretch;
  display: grid;
  gap: 0.8cqw;
  padding: 0 2cqw;
  color: #2c1810;
  font-size: clamp(14px, 0.98cqw, 17px);
  line-height: 1.3;
}

.band-back dt {
  display: inline;
  font-weight: 600;
}

.band-back dt::after {
  content: ": ";
}

.band-back dd {
  display: inline;
}

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

.studio-by {
  font-family: var(--face-studio-text);
  text-transform: uppercase;
}

.studio-name {
  font-family: var(--face-studio-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

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

.studio:focus-visible {
  outline: 2px solid #f4e9d8;
  outline-offset: 3px;
}

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

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

/*
 * ——— A tall screen: the tall frames ———
 * (The script switches to the tall series at the same ratio.)
 */

@media (max-aspect-ratio: 5 / 6) {
  .brand {
    font-size: 27px;
  }

  .title {
    font-size: clamp(2.5rem, 11.6vw, 3.4rem);
  }

  .caption-word {
    font-size: clamp(2rem, 9.4vw, 2.6rem);
  }

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

  /* Without the film a tall screen shows each still whole — the bar is as wide as the cut — and the words under it. */
  html:not(.live) .shot {
    justify-content: flex-start;
    gap: 6px;
    min-height: 0;
    padding: 0 0 34px;
  }

  html:not(.live) .shot::after {
    content: none;
  }

  html:not(.live) .still {
    position: relative;
    inset: auto;
    z-index: 0;
    width: 100%;
    margin-bottom: 14px;
    aspect-ratio: 5 / 6;
  }

  html:not(.live) .cue {
    padding: 0 var(--gutter);
  }

  html:not(.live) .cue-phrase {
    font-size: 19vw;
  }

  .pill {
    height: 54px;
    margin-top: 16px;
  }

  .live .cue-opening {
    bottom: calc(var(--pin, 1) * 100vh + var(--gutter) + 6px + env(safe-area-inset-bottom, 0px));
    bottom: calc(var(--pin, 1) * 100svh + var(--gutter) + 6px + env(safe-area-inset-bottom, 0px));
  }

  /* The word stands on the gold over the window; the two other blocks set theirs from the same edge. */
  .live #cue-cacao {
    left: var(--gutter);
    top: 9vh;
    top: 9svh;
    font-size: 25.5vw;
  }

  .live .block-phrase {
    padding-left: var(--gutter);
  }

  .live .phrase {
    font-size: 25.5vw;
  }

  .live .phrase .line {
    transform: translate3d(calc(var(--i, 0) * 5vw + (var(--p, 0.5) - 0.5) * var(--i, 0) * 8vw), 0, 0);
  }

  /* The notes ride up the left of the screen: through the umber under the picture and over it, each on its own plate. */
  /* The first of them rides over the dark shelves of the frame: there it needs its plate. */
  .live #cue-beans::before {
    content: "";
  }

  .live #cue-beans,
  .live #cue-marble,
  .live #cue-mould,
  .live #cue-foil,
  .live #cue-gold,
  .live #cue-band {
    left: var(--gutter);
    right: auto;
  }

  /* The last line: under the bar, in the umber the picture goes out into. */
  .live .cue-final {
    left: var(--gutter);
    top: calc((var(--pin, 1) + 0.74) * 100vh);
    top: calc((var(--pin, 1) + 0.74) * 100svh);
  }

  .live .cue::before {
    inset: -46% -16% -34%;
  }

  /* Two stills to a row without the film; with it the strip runs as on a wide screen, its stills larger. */
  .strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 12px;
  }

  .strip figcaption {
    margin-top: 8px;
    font-size: 24px;
  }

  .live .block-strip {
    padding: 7vh 0 16vh;
    padding: 7svh 0 16svh;
  }

  .live .strip {
    gap: 14px;
    transform: translate3d(calc(60vw - var(--p, 0.5) * 250vw), 0, 0);
  }

  .live .strip li {
    width: 62vw;
  }

  .live .strip li:nth-child(even) {
    margin-top: 5vh;
    margin-top: 5svh;
  }

  .acts-now {
    font-size: 22px;
  }

  .acts button {
    width: 22px;
  }

  .live .hint span {
    display: none;
  }

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

  /* The photograph is cut to the band and the foil round it. */
  .wrap {
    width: 100%;
    aspect-ratio: 916 / 1536;
  }

  .wrap::before {
    background-image: url("textures/wrap-tall.webp");
  }

  .wrap::after,
  .band {
    left: 9.6%;
    width: 80.8%;
  }

  .band-made {
    padding: 0 6cqw;
    font-size: clamp(20px, 5.6cqw, 26px);
  }

  .band-face {
    gap: 2.4cqw;
  }

  .band-name {
    font-size: 14.4cqw;
  }

  .band-name::after {
    width: 9cqw;
    margin-top: 3.6cqw;
  }

  .band-kind {
    font-size: clamp(15px, 4.2cqw, 18px);
  }

  .band-back {
    gap: 1.6cqw;
    padding: 0 6cqw;
    font-size: clamp(14px, 3.8cqw, 16px);
  }

  .foot {
    padding-bottom: 58px;
  }
}

/* ——— 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;
}
