/* Flatbed · how it works
   Base rules give the section with no JavaScript and with reduced motion: five blocks, each scene in its finished state.
   Rules under .how--live (set by js/how.js once its timeline is built) stack the five scenes into one pinned stage that scroll plays.
   Everything is scoped under .how and uses the page's custom properties (--well, --ink, --bone, --on-bone, --grey, --m, --ui)
   and three of its classes (.line and .line__in for the heading's mask, .ico for icons, .mono for the typed face). */

.how {
  --how-stage: #101010;
  --how-fill: #1b1b1b;
  --how-chip: #2a2a2a;
  --how-box: rgba(16, 16, 16, 0.88);
  --how-r: clamp(14px, 1.8vw, 26px);
  --how-lv: 100vh;
  --how-sv: 100vh;
  position: relative;
  background: var(--well);
}
@supports (height: 100lvh) { .how { --how-lv: 100lvh; --how-sv: 100svh; } }
.how h3, .how ol, .how ul, .how li { margin: 0; padding: 0; }
.how ol, .how ul { list-style: none; }

/* ---------- the heading: one row when it fits ---------- */
.how__head { padding: clamp(104px, 18vh, 200px) var(--m) clamp(40px, 7vh, 76px); }
.how__head .line { display: inline-block; vertical-align: top; }

/* ---------- five blocks ---------- */
.how .how__steps { display: grid; gap: clamp(72px, 12vh, 132px); padding: 0 var(--m) clamp(88px, 14vh, 160px); }
.how__step { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: center; gap: clamp(32px, 5vw, 84px); }
.how__ico { width: 28px; height: 28px; margin-bottom: 18px; color: var(--ink); }
.how__text h3 { font-weight: 600; font-size: clamp(1.625rem, 2.5vw, 2.25rem); letter-spacing: -0.025em; line-height: 1.05; }
.how__text p { margin-top: 0.7em; max-width: 26em; font-size: clamp(1.0625rem, 1.3vw, 1.1875rem); line-height: 1.45; color: var(--grey); }

/* ---------- the lit screen. Everything inside is sized from it (cqw, cqh), with a floor of 13px on type ---------- */
.how__scene { position: relative; aspect-ratio: 16 / 9; border-radius: var(--how-r); background: var(--how-stage); overflow: hidden; container-type: size; isolation: isolate; color: var(--ink); }
.how__scene .ico { width: 1.2em; height: 1.2em; }
.how__caret { display: inline-block; width: max(2px, 0.07em); height: 0.95em; margin-left: 0.1em; vertical-align: -0.12em; border-radius: 1px; background: var(--bone); }

/* 1 · connect: the URL and the key, pasted into one field */
.how__c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3.4cqw; }
.how__field { display: flex; gap: 1.2cqw; padding: 1.2cqw; border-radius: 2.7cqw; background: var(--how-fill); }
.how__chip { display: flex; align-items: center; gap: 1.1cqw; height: 6.2cqw; padding: 0 2.5cqw 0 2cqw; border-radius: 1.5cqw; background: var(--how-chip); font-size: max(13px, 2.15cqw); white-space: nowrap; }
.how__chip .ico { width: 1.1em; height: 1.1em; color: var(--grey); }
.how .how__chip .mono { font-size: max(13px, 0.92em); letter-spacing: 0.05em; }
.how__agents { display: flex; gap: 3.6cqw; font-size: max(13px, 1.7cqw); color: var(--grey); white-space: nowrap; }
.how .how__ok { display: flex; align-items: center; gap: 1.1cqw; font-size: max(13px, 1.6cqw); white-space: nowrap; }
.how__ok-name { color: var(--grey); }

/* 2 · describe: one sentence, typed */
.how__say { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 2.4cqw; padding: 0 11cqw 1.5cqw; }
.how .how__who { font-size: max(13px, 1.25cqw); color: var(--grey); }
.how__line { position: relative; font-size: max(20px, 4.6cqw); font-weight: 400; line-height: 1.14; letter-spacing: -0.025em; text-wrap: balance; }

/* 3 · built as code: one frame of the film, its three layers held apart.
   The pose of the open stack is set here and read by js/how.js: --tx and --ty where it sits, --ps its scale, --rx its lean back
   and --rz its turn in degrees, --gap the distance between layers in cqh, --vs the overlay line's scale. */
.how__space { --tx: 9cqw; --ty: 0.56cqw; --ps: 0.47; --rx: 54; --rz: -17; --gap: 27.6; --vs: 1; position: absolute; inset: 0; perspective: 190cqw; perspective-origin: 50% 40%; }
.how__stack, .how__turn { position: absolute; inset: 0; transform-style: preserve-3d; }
.how__stack { translate: var(--tx) var(--ty); transform: rotateX(calc(var(--rx) * 1deg)) scale(var(--ps)); } /* GSAP's order, so the still and the live pose are one pose */
.how__turn { transform: rotateZ(calc(var(--rz) * 1deg)); }
.how__ply { position: absolute; left: 0; top: 0; width: 100%; height: 100%; border-radius: 2.6cqw; overflow: hidden; }
.how__ply--edit { transform: translateZ(calc(var(--gap) * -1cqh)); background: #1b1b1b; }
.how__ply--shot { background: #1e1e1e; }
.how__ply--over { transform: translateZ(calc(var(--gap) * 1cqh)); background: rgba(237, 237, 237, 0.07); }
.how__ply--edit svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.how__ply img, .how__shot img, .how__pic img, .how__pic canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.how__ply--shot img { filter: grayscale(1) brightness(1.2); mix-blend-mode: lighten; } /* not rendered yet: grey clay on its sheet, as the film has it */
.how__clips rect { fill: #343434; }
.how__clips .how__clip { fill: #8a8a8a; }
.how__wave { fill: none; stroke: #6a6a6a; stroke-width: 6; stroke-linecap: round; }
/* "Oh. It's you.", the film's overlay line: Avio Sans Medium Italic written out as a path (3.7456em wide at a line height of 1.16), so no extra font is loaded */
.how__voice { --vf: 5.6cqw; position: absolute; left: 70.6%; top: 40.5%; width: calc(var(--vf) * 3.7456); height: auto; aspect-ratio: 7671 / 4751; fill: #f5f0e0; overflow: visible; }
.how__ply .how__voice { transform: scale(var(--vs)); transform-origin: 0 50%; } /* on a small stage the line is set larger while its sheet lies back */
.how .how__files { position: absolute; left: 7cqw; top: 0; font-size: max(13px, 1.2cqw); line-height: 1.5; white-space: nowrap; }
.how__files li { position: absolute; left: 0; display: grid; grid-template-columns: auto auto; column-gap: 1.1em; align-items: center; }
.how__files li:nth-child(1) { top: 13cqw; }
.how__files li:nth-child(2) { top: 24.5cqw; }
.how__files li:nth-child(3) { top: 36cqw; }
.how__files .ico { grid-row: 1 / 3; width: 1.6em; height: 1.6em; color: var(--grey); }
.how__files b { font-weight: 400; color: var(--ink); }
.how__files span { grid-column: 2; color: var(--grey); }

/* 4 · rendered: the same frame, flat and in colour */
.how__shot { position: absolute; left: 0; top: 0; width: 100%; height: 100%; background: #000; }
.how__scan { position: absolute; inset: 0; overflow: hidden; pointer-events: none; opacity: 0; }
.how__scan i { position: absolute; inset: 0; }
.how__scan i::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 3px; background: #fffbe8; }
.how .how__tag { position: absolute; z-index: 3; left: 2.2cqw; top: 2.2cqw; display: flex; align-items: center; gap: 0.65em; height: max(30px, 3.1cqw); padding: 0 1.15em 0 0.95em; border-radius: 999px; background: var(--how-box); font-size: max(13px, 1.15cqw); white-space: nowrap; }
.how__tag .ico { width: 1.3em; height: 1.3em; }
.how__cut { display: grid; }
.how__cut > span { grid-area: 1 / 1; }
.how__cut > span:first-child { opacity: 0; }

/* 5 · mark it, send: the frame, two marks, their comments, Send, the status */
.how__view { position: absolute; inset: 0; overflow: hidden; }
.how__frame { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.how__pic { position: absolute; inset: 0; background: #000; }
.how__region { position: absolute; left: 46.4%; top: 2.8%; width: 13.2%; height: 15.8%; }
.how__corner { --t: max(2px, 0.19cqw); position: absolute; width: max(9px, 1.25cqw); aspect-ratio: 1; border: 0 solid var(--bone); }
.how__corner--tl { left: 0; top: 0; border-top-width: var(--t); border-left-width: var(--t); }
.how__corner--tr { right: 0; top: 0; border-top-width: var(--t); border-right-width: var(--t); }
.how__corner--bl { left: 0; bottom: 0; border-bottom-width: var(--t); border-left-width: var(--t); }
.how__corner--br { right: 0; bottom: 0; border-bottom-width: var(--t); border-right-width: var(--t); }
.how__num { --d: max(22px, 2.3cqw); position: absolute; display: grid; place-items: center; width: var(--d); height: var(--d); border-radius: 50%; background: var(--bone); color: var(--on-bone); font-size: max(13px, 1.25cqw); line-height: 1; }
.how__num b, .how__num .ico { grid-area: 1 / 1; }
.how__num b { font-weight: 600; opacity: 0; } /* answered: the number gives way to a check */
.how__num .ico { width: 58%; height: 58%; stroke-width: 2.4; }
.how__num--1 { right: calc(100% + 0.7cqw); top: 0; }
.how__num--2 { left: 52.2%; top: 89.2%; margin: calc(var(--d) / -2) 0 0 calc(var(--d) / -2); }
.how__note { position: absolute; display: flex; align-items: center; height: max(30px, 3.1cqw); padding: 0 1em; border-radius: 0.6em; background: var(--how-box); font-size: max(13px, 1.35cqw); line-height: 1; white-space: nowrap; }
.how__note > span { display: block; }
.how__note .how__caret { display: none; }
.how__note--1 { left: calc(59.6% + 1.1cqw); top: 2.8%; }
.how__note--2 { left: calc(52.2% + max(11px, 1.15cqw) + 0.9cqw); top: 89.2%; margin-top: calc(max(30px, 3.1cqw) / -2); }
.how__bar { position: absolute; z-index: 3; right: 2.2cqw; bottom: 2.2cqw; display: grid; justify-items: end; align-items: center; }
.how__bar > * { grid-area: 1 / 1; }
.how__send { display: flex; align-items: center; gap: 0.6em; height: max(36px, 3.9cqw); padding: 0 0.55em 0 1.15em; border-radius: 999px; background: var(--bone); color: var(--on-bone); font-weight: 600; font-size: max(14px, 1.4cqw); white-space: nowrap; opacity: 0; } /* sent: the status has its place */
.how__send .ico { width: 1.15em; height: 1.15em; }
.how .how__count { display: grid; place-items: center; width: 1.85em; height: 1.85em; margin-left: 0.15em; border-radius: 50%; background: var(--on-bone); color: var(--bone); font-size: max(13px, 0.82em); letter-spacing: 0; }
.how__count b { grid-area: 1 / 1; font-weight: 400; }
.how__count b:first-child { opacity: 0; }
.how .how__status { display: flex; align-items: center; height: max(32px, 3.5cqw); padding: 0 1.25em; border-radius: 999px; background: var(--how-box); font-size: max(13px, 1.3cqw); white-space: nowrap; opacity: 0; }
.how .how__status:last-child { opacity: 1; }
.how__ptr { display: none; position: absolute; z-index: 4; left: 0; top: 0; width: max(20px, 2.1cqw); height: max(20px, 2.1cqw); margin: -0.36cqw 0 0 -0.36cqw; fill: var(--ink); stroke: var(--well); stroke-width: 1.5; stroke-linejoin: round; pointer-events: none; }

/* ============================================================
   Live: one pinned stage. Nothing here applies until js/how.js has built its timeline.
   ============================================================ */
/* The stage's box. It is as large as the screen's height allows, with room for the words under it and the rail beside it.
   It starts at the page margin; on a screen much wider than the stage it moves in, so the stage and its rail sit near the middle. */
.how--live {
  --sw: min(calc(100vw - 2 * var(--m) - 5.5rem), calc((var(--how-sv) - 15.5rem) * 16 / 9));
  --sh: calc(var(--sw) * 9 / 16);
  --sx: max(var(--m), calc((100vw - var(--sw) - 5.5rem) / 2 - 2rem));
  --sy: max(4.5rem, calc((var(--how-sv) - var(--sh) - 9rem) / 2));
}
.how--live .how__head { padding-left: var(--sx); }
.how--live .how__run { height: calc(var(--how-lv) + var(--how-run, 396) * 1vh); } /* js/how.js sets --how-run to its timeline's length */
.how--live .how__pin { position: sticky; top: 0; height: var(--how-lv); overflow: hidden; }
.how--live .how__steps { display: block; padding: 0; position: absolute; inset: 0; } /* the list is the stage's box: its scenes and words are placed against it */
.how--live .how__steps::before { content: ""; position: absolute; left: var(--sx); top: var(--sy); width: var(--sw); height: var(--sh); border-radius: var(--how-r); background: var(--how-stage); }
.how--live .how__step { display: block; }
.how--live .how__scene { position: absolute; left: var(--sx); top: var(--sy); width: var(--sw); height: var(--sh); aspect-ratio: auto; background: none; }
.how--live .how__text { position: absolute; left: var(--sx); top: calc(var(--sy) + var(--sh) + 1.75rem); width: var(--sw); pointer-events: none; -webkit-user-select: none; user-select: none; }
.how--live .how__text.is-on { pointer-events: auto; -webkit-user-select: auto; user-select: auto; }
.how--live .how__text p { max-width: none; margin-top: 0.55em; }
.how--live .how__ico { display: none; }
.how--live .how__caret { display: block; position: absolute; left: 0; top: 0; margin: 0; }
.how--live .how__ptr { display: block; }
.how--live .how__stack, .how--live .how__turn, .how--live .how__ply { transform: none; } /* js/how.js sets the pose */

/* the rail: five icons, the current one in bone. js/how.js builds it, so it exists only here */
.how__rail { position: absolute; left: min(calc(100vw - var(--m) - 33px), calc(var(--sx) + var(--sw) + 6.5rem)); top: calc(var(--sy) + var(--sh) / 2); display: grid; gap: 6px; transform: translateY(-50%); }
.how__dot { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; color: #6b6b6b; cursor: pointer; transition: color 320ms ease, transform 160ms var(--ui); }
.how__dot .ico { width: 22px; height: 22px; }
.how__dot.is-done { color: var(--grey); }
.how__dot.is-on { color: var(--bone); }
.how__dot:active { transform: scale(0.92); }
@media (hover: hover) and (pointer: fine) {
  .how__dot:hover { color: var(--ink); }
  .how__dot.is-on:hover { color: var(--bone); }
}

/* ============================================================
   Tall screens: the stage on top, the rail and the words under it
   ============================================================ */
@media (max-aspect-ratio: 5/4) {
  .how__step { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .how--live {
    --sw: calc(100vw - 2 * var(--m));
    --sh: min(calc(var(--sw) * 9 / 16), calc(var(--how-sv) - 20rem));
    --sx: var(--m);
    --sy: max(4.75rem, calc((var(--how-sv) - var(--sh) - 15rem) / 2));
  }
  .how__rail { left: calc(var(--m) - 11px); top: calc(var(--sy) + var(--sh) + 0.5rem); grid-auto-flow: column; gap: 0; transform: none; }
  .how--live .how__text { top: calc(var(--sy) + var(--sh) + 4rem); }
}

/* ============================================================
   Phone: a square stage, and every scene re-set for it
   ============================================================ */
@media (max-width: 720px) {
  .how { --how-r: 18px; }
  .how__head { padding: 96px var(--m) 36px; }
  .how .how__steps { gap: 64px; padding-bottom: 96px; }
  .how__ico { width: 24px; height: 24px; margin-bottom: 12px; }
  .how__scene { aspect-ratio: 1 / 1; }
  .how--live {
    --sh: min(var(--sw), calc(var(--how-sv) - 20.5rem));
    --sy: max(4.5rem, calc((var(--how-sv) - var(--sh) - 14rem) / 2));
  }
  .how--live .how__text { top: calc(var(--sy) + var(--sh) + 3.75rem); }
  .how--live .how__text h3 { font-size: 1.625rem; }

  /* 1 */
  .how__c { gap: 6.4cqw; }
  .how__field { gap: 2cqw; padding: 2cqw; border-radius: 5.4cqw; }
  .how__chip { gap: 1.8cqw; height: 12.4cqw; padding: 0 3.4cqw 0 2.8cqw; border-radius: 3.6cqw; font-size: clamp(13px, 4.2cqw, 21px); }
  .how__agents { gap: 5.4cqw; font-size: clamp(13px, 3.9cqw, 19px); }
  .how .how__ok { gap: 2cqw; font-size: clamp(13px, 3.8cqw, 19px); }

  /* 2 */
  .how__say { gap: 4.6cqw; padding: 0 8cqw 2cqw; }
  .how .how__who { font-size: clamp(13px, 3.6cqw, 17px); }
  .how__line { font-size: clamp(20px, 7.3cqw, 42px); line-height: 1.16; letter-spacing: -0.02em; }

  /* 3 and 4: the frame is wider than the stage, so the layers are whole frames when they are apart and fill the stage when they close.
     The three lie one under another, each with its name above it. */
  .how__scene--code, .how__scene--render { --fw: max(100cqw, calc(100cqh * 16 / 9)); --fx: 0.575; }
  .how__ply, .how__shot { width: var(--fw); left: calc(50cqw - var(--fw) * var(--fx)); }
  .how__space { --tx: calc((var(--fx) - 0.5) * var(--fw) * var(--ps)); --ty: 3.6cqh; --ps: 0.44; --rx: 60; --rz: 0; --gap: 37; --vs: 1.9; perspective: 600cqw; perspective-origin: 50% 50%; }
  .how__ply { border-radius: 5cqw; }
  .how__voice { --vf: calc(var(--fw) * 0.05); left: 64.5%; top: 57%; }
  .how__ply .how__voice { transform-origin: 100% 50%; }
  .how .how__files { left: 0; font-size: 13px; line-height: 1.4; }
  .how__files li { left: calc(50cqw - var(--fw) * 0.224); display: flex; column-gap: 0.75em; }
  .how__files .ico { width: 1.3em; height: 1.3em; }
  .how__files li:nth-child(1) { top: calc(10.6cqh - 23px); }
  .how__files li:nth-child(2) { top: calc(42cqh - 23px); }
  .how__files li:nth-child(3) { top: calc(73.4cqh - 23px); }
  /* a short phone: the stage is wider than it is tall, so the names move beside their layers */
  @container (min-aspect-ratio: 6/5) {
    .how__space { --tx: calc((var(--fx) - 0.5) * var(--fw) * var(--ps) + 47cqw - var(--fw) * var(--ps) * 0.5); --ty: 0px; --gap: 36; }
    .how__files li { left: 4cqw; display: block; }
    .how__files .ico { display: none; }
    .how__files b, .how__files span { display: block; }
    .how__files li:nth-child(1) { top: calc(19cqh - 18px); }
    .how__files li:nth-child(2) { top: calc(50cqh - 18px); }
    .how__files li:nth-child(3) { top: calc(81cqh - 18px); }
  }

  /* 4: the tag keeps clear of the hood */
  .how .how__tag { left: auto; right: 3.6cqw; top: 3.6cqw; height: 30px; font-size: 13px; }

  /* 5: the picture gives its bottom edge to Send and the status */
  .how__scene--mark { --bar: 54px; }
  .how__view { bottom: var(--bar); }
  .how__frame { --fw: max(100cqw, calc((100cqh - var(--bar)) * 16 / 9)); width: var(--fw); height: calc(var(--fw) * 9 / 16); left: calc(50cqw - var(--fw) * 0.47); }
  .how__num { --d: 22px; font-size: 13px; }
  .how__corner { width: 9px; }
  .how__num--1 { right: calc(100% + 5px); }
  .how__note { height: 28px; padding: 0 9px; border-radius: 8px; font-size: 13px; }
  .how__note--1 { left: 46.4%; top: calc(18.6% + 7px); }
  .how__note--2 { left: calc(52.2% + 11px + 6px); margin-top: -14px; }
  .how__bar { left: 0; right: 0; bottom: 0; height: var(--bar); padding: 0 12px; background: var(--how-stage); }
  .how__send { height: 36px; font-size: 14px; }
  .how .how__status { height: 30px; padding: 0 2px; background: none; font-size: 13px; }
  .how__ptr { width: 20px; height: 20px; margin: -3px 0 0 -3px; }
}
