/* ---------- The front-door hero (docs/site-relaunch/round-two/specs/hero-arrival.md, unit A). Markup: lib/site/parts/arrival-hero.ts.
   Linked only by pages that print the part (their `css` lists ARRIVE_CSS); styles `.ah` classes only.

   Settled state (no script, reduced motion, return visits): the picture fills the section under the header, edge to edge, and
   the page's words sit in the picture's calm pocket. No overlay, scrim, gradient, card, border or shadow behind the words, no
   text shadow; the section paints nothing (the picture covers it).

   Section height (spec amended 2026-11-11): the viewport under the header (69px: the bar's 68px and its 1px rule), never under
   420px, then clamped by the picture's safe box (the record's `safe`, the box around the pocket and every character) so that
   box is never cropped: at least 100vw x k x safe.h, at most 100vw x k / safe.w, where k is the picture's height over its width
   (9/16 wide, 3/2 tall). On a very wide screen the hero may be a little taller than the screen; cropping a character is not
   accepted. Tall mode (ARRIVE_TALL_MEDIA) uses the tall picture's numbers.

   The picture is one box at its own shape (`.ah__frame`, 16:9 or 2:3) sized to cover the section and placed so its safe box is
   centered, clamped so the picture still covers the section. The pocket is a child of that box placed by the record's
   percentages (--ah-wx..--ah-wh wide, --ah-tx..--ah-th tall, on the section), so the words stay glued to the pocket at every size; the words box sits inside it, inset 6% of the pocket, its type scaled with the
   pocket (container units) between the spec's floors and ceilings. Ported from the hero spike (.pic.w169, --pw, add-move.py).

   Play state (only while the gate in the section has set `data-play`, and only with motion allowed): `wait` (the gate ran,
   js/arrive.js has not), `clip` (wide mode with a clip: the still hidden, the poster then the video over the settle color),
   `zoom` (the still eases from 1.3 to 1 about the crew's center over 4.5s), `rise` (the words rise in over 0.9s). Removing
   `data-play` is the settled state, with no transition, so an input settles at once. Only opacity, transform and visibility of
   the picture layers change, and only opacity and transform of the words (never display), so they stay in reach. ---------- */
.ah {
  --ah-hdr: 69px;
  /* The picture's height over its width (k) and width over height (r), and its safe box (plain numbers, percent). */
  --ah-k: .5625;
  --ah-r: 1.777778;
  --ah-sx: var(--ah-wsx);
  --ah-sy: var(--ah-wsy);
  --ah-sw: var(--ah-wsw);
  --ah-sh: var(--ah-wsh);
  --ah-fg: var(--ink);
  --ah-fg-2: var(--ink-2);
  --ah-settle: var(--paper-2);
  --ah-px: var(--ah-wx);
  --ah-py: var(--ah-wy);
  --ah-pw: var(--ah-ww);
  --ah-ph: var(--ah-wh);
  /* The record's type multiplier for this mode (spec unit E): h1 and sentence sizes and ceilings, never the floors. */
  --ah-type: var(--ah-wt, 1);
  position: relative;
  display: block;
  height: clamp(100vw * var(--ah-k) * var(--ah-sh) / 100, max(420px, 100svh - var(--ah-hdr)), 100vw * var(--ah-k) * 100 / var(--ah-sw));
  overflow: hidden;
  container-type: size;
}
.ah[data-tone="dark"] { --ah-fg: var(--on-dark); --ah-fg-2: var(--on-dark-2); --ah-settle: var(--navy); }
.ah__frame {
  --ah-cx: 68%;
  --ah-cy: 52%;
  --ah-fw: max(100cqw, 100cqh * var(--ah-r));
  position: absolute;
  left: clamp(100cqw - var(--ah-fw), 50cqw - var(--ah-fw) * (var(--ah-sx) + var(--ah-sw) / 2) / 100, 0px);
  top: clamp(100cqh - var(--ah-fw) * var(--ah-k), 50cqh - var(--ah-fw) * var(--ah-k) * (var(--ah-sy) + var(--ah-sh) / 2) / 100, 0px);
  width: var(--ah-fw);
  aspect-ratio: 16 / 9;
}
.ah__frame > picture { position: absolute; inset: 0; display: block; }
.ah :is(.ah__img, .ah__poster, .ah__clip) { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.ah :is(.ah__poster, .ah__clip) { opacity: 0; visibility: hidden; pointer-events: none; }
.ah__pocket { position: absolute; left: var(--ah-px); top: var(--ah-py); width: var(--ah-pw); height: var(--ah-ph); container-type: size; }
.ah__words { position: absolute; inset: 6%; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; text-align: left; color: var(--ah-fg); }
.ah__words > * { max-width: 100%; }
.ah__words > h1 { margin: 0 0 .32em; color: inherit; font-size: clamp(1.5rem, min(7.6cqw, 8.4cqh) * var(--ah-type), 3.2rem * var(--ah-type)); font-weight: 700; line-height: 1.04; letter-spacing: -.012em; text-wrap: balance; }
/* The status row as the open hero prints it (its kicker, label or hero-status row, sections.css): a bare label (the
   audience pages) takes the tone's color like the kicker does, never the site's grey .label. */
.ah__words > .kicker, .ah__words > .label, .ah__words > .hero-status { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 clamp(10px, 3.4cqh, 18px); color: inherit; font-family: var(--ui); font-size: .78rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.ah__words .kicker .label { color: inherit; font-size: inherit; font-weight: inherit; letter-spacing: inherit; }
/* Round four U15 (W14): Live and Done for you print as a plain line (relaunch.css 17a); only a Coming chip keeps a pill. */
.ah__words .chip--status { text-transform: none; letter-spacing: .01em; background: var(--paper); color: var(--ink); border-color: var(--paper); }
.ah .chip--status[data-status="Coming"] { --dot: var(--amber-ink); }
.ah .ah__sentence { margin: 0 0 clamp(14px, 4.6cqh, 26px); color: var(--ah-fg-2); font-size: clamp(.95rem, min(4.2cqw, 4.6cqh) * var(--ah-type), 1.15rem * var(--ah-type)); line-height: 1.45; }
.ah__words > .doors { gap: 10px 18px; margin: 0; }
.ah__words .doors .tcta { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
/* Centered words (`align: 'center'`, /for, unit D): the words block, its status row and its buttons centered in the pocket,
   both modes. Every other page keeps the left default. */
.ah[data-align="center"] .ah__words { align-items: center; text-align: center; }
.ah[data-align="center"] .ah__words > .kicker, .ah[data-align="center"] .ah__words > .label, .ah[data-align="center"] .ah__words > .hero-status, .ah[data-align="center"] .ah__words > .doors { justify-content: center; }

/* Tablet-landscape widths: the wide picture's painted card is small here, so the words step down one size and the two
   actions share a row. Without it the long openings (Video, Writing, Marketing Teams) ran past the card (panel three, 2026-11-12). */
@media (min-width: 861px) and (max-width: 1100px) and (min-aspect-ratio: 6/5) {
  .ah__words > h1 { font-size: clamp(1.3rem, min(7.6cqw, 8.4cqh) * var(--ah-type), 3.2rem * var(--ah-type)); }
  .ah .ah__sentence { margin-bottom: clamp(10px, 3.4cqh, 18px); font-size: clamp(.88rem, min(4.2cqw, 4.6cqh) * var(--ah-type), 1.15rem * var(--ah-type)); line-height: 1.4; }
  .ah__words > .kicker, .ah__words > .label, .ah__words > .hero-status { margin-bottom: clamp(6px, 2.4cqh, 14px); }
  .ah__words > .doors { gap: 8px 14px; font-size: .86rem; }
  .ah__words > .doors .btn { padding: .5em 1em; font-size: inherit; }
  .ah__words > .doors .tcta { font-size: inherit; }
}

/* Tall mode: the 2:3 picture, its own pocket and tone, the crew grouped below the pocket. */
@media (max-width: 860px), (max-aspect-ratio: 6/5) {
  .ah { --ah-k: 1.5; --ah-r: .666667; --ah-sx: var(--ah-tsx); --ah-sy: var(--ah-tsy); --ah-sw: var(--ah-tsw); --ah-sh: var(--ah-tsh); --ah-px: var(--ah-tx); --ah-py: var(--ah-ty); --ah-pw: var(--ah-tw); --ah-ph: var(--ah-th); --ah-type: var(--ah-tt, 1); }
  .ah[data-tone-tall="light"] { --ah-fg: var(--ink); --ah-fg-2: var(--ink-2); --ah-settle: var(--paper-2); }
  .ah[data-tone-tall="dark"] { --ah-fg: var(--on-dark); --ah-fg-2: var(--on-dark-2); --ah-settle: var(--navy); }
  .ah__frame { --ah-cx: 50%; --ah-cy: 72%; aspect-ratio: 2 / 3; }
}

/* Small phones: the painted card shrinks with the screen, so the words step down with it. At 360 wide the opening ran up to
   63px past the card before this (first-screen check, 2026-11-12). The second block is for short screens (667 tall). */
@media (max-width: 480px) {
  .ah__words { inset: 4.5%; }
  .ah__words > h1 { margin-bottom: .26em; font-size: clamp(1.18rem, min(7.6cqw, 8.4cqh) * var(--ah-type), 3.2rem * var(--ah-type)); }
  .ah .ah__sentence { margin-bottom: clamp(8px, 3.4cqh, 18px); font-size: clamp(.8rem, min(4.2cqw, 4.6cqh) * var(--ah-type), 1.15rem * var(--ah-type)); line-height: 1.36; }
  .ah__words > .kicker, .ah__words > .label, .ah__words > .hero-status { margin-bottom: clamp(5px, 2.2cqh, 12px); }
  .ah__words > .doors { gap: 6px 14px; font-size: .84rem; }
  .ah__words > .doors .btn { padding: .48em 1em; font-size: inherit; }
  .ah__words > .doors .tcta { font-size: inherit; }
}
@media (max-width: 480px) and (max-height: 700px) {
  .ah__words { inset: 3.5%; }
  .ah__words > h1 { font-size: clamp(1.08rem, min(7.6cqw, 8.4cqh) * var(--ah-type), 3.2rem * var(--ah-type)); }
  .ah .ah__sentence { margin-bottom: 7px; line-height: 1.32; }
  .ah__words > .doors { gap: 4px 12px; }
  .ah__words > .doors .btn { padding: .34em .9em; min-height: 0; }
}

/* The play state, motion allowed only (the gate never sets it under reduced motion; this keeps it inert if it did). */
@media (prefers-reduced-motion: no-preference) {
  .ah[data-play] { background: var(--ah-settle); }
  .ah[data-play] .ah__words { opacity: 0; transform: translateY(1.1rem); }
  .ah[data-play="rise"] .ah__words { opacity: 1; transform: none; transition: opacity .9s ease, transform .9s cubic-bezier(.2, .7, .2, 1); }
  .ah[data-play]:not([data-play="rise"]) .ah__img { transform: scale(1.3); transform-origin: var(--ah-cx) var(--ah-cy); }
  .ah[data-play="zoom"] .ah__img { animation: ah-zoom 4.5s cubic-bezier(.22, .7, .12, 1) both; }
  /* Wide mode with a clip: the still waits hidden; the poster fades in once loaded, then the video plays over it. */
  .ah[data-clip][data-play="wait"] .ah__img, .ah[data-play="clip"] .ah__img { opacity: 0; transform: none; }
  .ah[data-play] .ah__poster { transition: opacity .4s ease, visibility 0s linear .4s; }
  .ah[data-play="clip"][data-poster] .ah__poster { opacity: 1; visibility: visible; transition: opacity .4s ease; }
  .ah[data-play="clip"][data-rolling] .ah__clip { opacity: 1; visibility: visible; }
  /* The poster is the clip's first frame. Once the clip is rolling it goes (unseen, under the clip), and it never
     transitions during the rise: left in place it faded out over the still and flashed the opening frame at the end. */
  .ah[data-play="clip"][data-rolling] .ah__poster { opacity: 0; visibility: hidden; transition: opacity .3s ease .3s, visibility 0s linear .6s; }
  .ah[data-play="rise"] .ah__poster { transition: none; }
  /* The hand-off: the ended clip holds its last frame and dissolves into the still beneath it. */
  .ah[data-play="rise"][data-rolling] .ah__clip { opacity: 0; visibility: hidden; transition: opacity .45s ease, visibility 0s linear .45s; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 860px), (prefers-reduced-motion: no-preference) and (max-aspect-ratio: 6/5) {
  /* Tall mode never plays the clip: the code zoom on the still. */
  .ah[data-clip][data-play="wait"] .ah__img { opacity: 1; transform: scale(1.3); }
}
@keyframes ah-zoom { from { transform: scale(1.3); } to { transform: none; } }
