/* ============================================================================
   Floom — the focus stage
   ----------------------------------------------------------------------------
   A full-bleed picture that arrives as a framed card, opens to the width of
   the window WHILE it rises, and then scrolls on like any other block.

   There is no pin and no hold. An earlier build pinned the stage for a window
   of scroll and opened the card during the pin; the reference does neither.
   Its container is an ordinary block (a sticky with nowhere to go — its
   spacer is exactly its own height), and the whole move is a function of one
   thing: where the container's top edge is in the window. Measured off it at
   1440x900 and 1920x1080 in 50px steps, the same curve at both:

     q      0 with the top edge at the window's bottom, 1 at the window's top
            q = (vh - top) / vh
     f      1 -> 0, the one eased progress everything rides
            f = 1 - cubic-bezier(0.45, 0, 0.75, 0.7)(q)
            (rmse 0.003 against 75 samples; no standard easing, however the
            anchors are shifted, comes within 0.005)
     clip   inset(0% calc(f * 25%) round calc(f * 4.17px)) — no vertical inset
     marks  travel f * 200/804 of the panel sideways and twice that upward:
            the four start as a square half the panel's size, anchored at its
            top edge, and reach its corners the instant the top edge lands
     media  115% of the container, translated from -15% of itself to 0 across
            the container's whole passage (bottom edge in to top edge out), so
            the picture lags the page by 17.25% of the container's height

   The stage carries the render's own 2000x1300 frame at the full width of the
   window, so nothing is cropped to fit. The media box is taller than that
   frame by the reference's 15% and the frame sits centred in it, which puts
   the render exactly in the window at the moment the stage covers it
   (passage 0.5). The margins above and below the frame only pass through
   while they are off screen or under the plate's own black foot.

   ── the scene ──────────────────────────────────────────────────────────────
   The supplied render, rebuilt from its three pieces. Its geometry is not
   guessed: the background plate and the finished render were differenced, each
   cutout fitted back onto that difference by brute force, and the winning
   placement recomposited and compared against the render pixel for pixel
   (mean |Δ| 5.9 of 765; 2.5% of pixels over 40, all of them silhouette edge).

   Against the render's own 2000x1300 frame:

     person   left 20.417%   top 33.432%   width 49.210%   ( h 66.77% )
     screen   left 50.274%   top 45.191%   width 37.362%   ( h 51.69% )

   Only the width is written below — each cutout is cropped to its own opaque
   bounds, so its intrinsic ratio supplies the height exactly.
   ========================================================================== */

.ff{
  position: relative;               /* the hero holds a transform above it */
  background: var(--ap-cream);
  padding-top: round(clamp(56px, 7.5vw, 104px), 8px);
  --ff-ink: var(--ap-ink);
  --ff-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ── the words on the page ────────────────────────────────────────────────
   Centred, as the reference's are. */
.ff-intro{
  text-align: center;
  width: var(--fl-wrap);
  margin-inline: auto;
  margin-bottom: var(--fl-gap-head);
}
.ff-label{
  margin: 0 0 var(--fl-gap-eyebrow);
  /* The system's uppercase label (Urbanist, +5%, 500). It was a monospace at
     10px; the design system has no monospace. */
  font-family: var(--font);
  font-size: 12.41px; font-weight: 500; line-height: 1.3;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ap-orange);
}
.ff-head{
  margin: 0 auto;
  font-family: var(--font-display);
  /* The house heading, which was taken off THIS rule — 53.28 at 1440, w500,
     normal tracking, leading 1, uppercase. It is read from the tokens now so
     the other seven headings cannot drift away from it again. */
  font-size: var(--fl-head-size);
  font-weight: var(--fl-head-weight);
  letter-spacing: var(--fl-head-track);
  line-height: var(--fl-head-lead);
  text-transform: uppercase;
  color: var(--black);
  max-width: var(--fl-span-6);   /* columns 4–9 */
}

/* ── the track ────────────────────────────────────────────────────────────
   The full-bleed wrapper and nothing else. It was two windows of scroll
   length while the stage pinned; the reference has no pin, so it is exactly
   the stage. */
.ff-track{
  position: relative;
  margin-inline: round(calc(50% - 50vw), 4px);
}

/* ── the stage ────────────────────────────────────────────────────────────
   An ordinary block carrying the render's own frame at the window's width.

   --ff-open is the reference's f: at 1 the picture is a rounded card inset a
   quarter from each side, at 0 it is the whole width with square corners.
   There is no vertical inset — that was the earlier build's, and it cropped
   the frame at the two edges that carry the scene. */
.ff-stage{
  position: relative;
  width: 100vw;
  aspect-ratio: 2000 / 1300;
  overflow: clip;
  background: var(--ff-ink);
  clip-path: inset(
    0% calc(var(--ff-open, 1) * 25%)
    round calc(var(--ff-open, 1) * 4.17px));
}

/* ── the media box ────────────────────────────────────────────────────────
   The reference's parallax, as it has it: 115% of the stage, top-anchored,
   translated from -15% of its own height to 0 across the stage's passage.
   `translate` reads its % against the element itself, which is the law
   exactly. Black behind it: the only parts of the box the frame does not
   cover are a margin above it that is never on screen and a margin below it
   that only shows under the plate's own black foot, and black is the
   palette's. Before the script runs, --ff-p is 0.5 and the frame is in the
   window exactly. */
.ff-media{
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 115%;
  background: #000000;
  translate: 0 calc((var(--ff-p, 0.5) - 1) * 15%);
  will-change: translate;
}

/* The scrim: the whole picture at 30% black, so the words sit on a settled
   ground wherever in the frame they fall rather than on whatever happens to be
   behind them. Last child of .ff-media, so it paints over every layer; the
   panel's own z-index: 2 keeps the words and the corner marks above it. The
   palette is closed and black is a member of it — opacity is the one variation
   it allows, and a wash laid over a ground you don't control is the case it
   names. */
.ff-media::after{
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .30);
  pointer-events: none;
}

/* ── the frame ────────────────────────────────────────────────────────────
   The render's 2000x1300, centred in the media box: 7.5% above, 7.5% below,
   100/115 of the box tall, the box's full width. Every layer inside is a
   percentage of it, so the three pieces sit exactly where they were
   composed, at every width. */
.ff-scene{
  position: absolute;
  left: 0; top: 7.5%;
  width: 100%;
  height: calc(100% / 1.15);
}
.ff-l{ position: absolute; display: block; }

/* The plate: the gradient with the wordmark cut into it and the black foot
   along its bottom tenth. Exactly the frame — it does not drift against it,
   so no edge of it is ever exposed.

   The bleed is the same plate again, mirrored, with its bottom edge on the
   frame's top edge. In a window TALLER than the frame (an iPad Pro held
   upright, a 4:3 monitor) the media box's lag puts the frame's top edge a
   little below the stage's while the stage's top edge is still on screen —
   up to 20px on a 1024x1366 — and that strip has to be gradient, not the
   box's black. A mirror continues the gradient's top row upward without a
   seam and without a colour the palette does not have. Everywhere else it is
   above the stage's edge and clipped. */
.ff-l-bg{ inset: 0; width: 100%; height: 100%; }
.ff-l-bleed{
  left: 0; bottom: 100%;
  width: 100%; height: 100%;
  transform: scaleY(-1);
}

/* Measured off the render. Width only — the crop supplies the height. */
.ff-l-person{ left: 20.417%; top: 33.432%; width: 49.210%; height: auto; --ff-depth: 54px; }
.ff-l-screen{ left: 50.274%; top: 45.191%; width: 37.362%; height: auto; --ff-depth: 30px; }

/* ── depth ────────────────────────────────────────────────────────────────
   The media box carries the reference's motion; on top of it the screen and
   the person each drift by their own amount against the plate, nearest most.
   --ff-p runs 0 -> 1 over the passage and is 0.5 — every layer at rest, the
   render exactly as composed — at the moment the stage covers the window,
   which is the frame the reader actually sees whole. The plate has no depth
   of its own (--ff-depth unset, 0). */
.ff-l{ translate: 0 calc((0.5 - var(--ff-p, 0.5)) * 2 * var(--ff-depth, 0px)); }

/* ── the panel ────────────────────────────────────────────────────────────
   Dead centre of the frame, marked at the corners rather than boxed — the
   scrim is the whole picture, so the words no longer have to live in the
   clear band above her head to be readable, and the middle is where a block
   on a full-bleed picture belongs.

   The block is content-sized with a square floor, so a long paragraph is never
   squeezed into a fixed square and a short one still reads as a deliberate
   shape. `align-content` and `justify-items` with symmetric padding centre the
   copy and the button inside it, in both axes, at every size the paragraph
   reflows to. */
.ff-panel{
  /* A square, as the reference's is — 670 of 1440, 0.465 of the width, capped
     so it can never be taller than the window. The marks travel as a share of
     it, so one number carries both. */
  --ff-side: min(670px, 46.5vw, 72svh);

  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: var(--ff-side);
  min-height: var(--ff-side);
  display: grid; align-content: center; justify-items: center;
  gap: round(clamp(16px, 1.9vw, 24px), 4px);
  padding: round(clamp(24px, 2.3vw, 32px), 4px) round(clamp(24px, 2.4vw, 32px), 4px);
  text-align: center;
}
.ff-copy{
  margin: 0;
  width: min(440px, 100%);
  font-family: var(--font);
  font-size: clamp(14px, 1.1vw, 15.79px);
  font-weight: 450;
  line-height: 1.3;
  color: #FFFFFF;
}
/* The button is the site's own — .ap-btn .ap-btn-solid, with its label swap
   and the thread its ::before and ::after draw. Nothing about its look is
   this file's business; it only needs to not stretch across the panel's
   centred grid. */
.ff-cta{ justify-self: center; }

/* ── the four corner marks ────────────────────────────────────────────────
   Cells, not arcs. The reference draws a quarter-round flourish there; ours is
   the square this design language ends every thread with, so the panel is
   marked in the site's own vocabulary.

   The MOVE is the reference's. Its four marks hold a square anchored at the
   panel's top edge and centred horizontally, half the panel's size at rest,
   and grow to all of it as the container rises — read off its own transforms:
   the top pair never move vertically, the bottom pair move exactly twice the
   horizontal travel, and the travel is 200 of an 804 panel (166.67 of 670 at
   1440), riding the same eased f as the clip. Opacity is 1 the whole way —
   they do not fade in, they arrive from the middle.

   The offsets are percentages so they stay true whatever shape the panel takes
   — `left` reads its % against the panel's width and `bottom` against its
   height, which is exactly what is wanted here, and is the same resolution
   rule that has to be kept away from a custom property used in two axes. */
.ff-corner{
  position: absolute;
  width: clamp(9px, 0.85vw, 12px); height: clamp(9px, 0.85vw, 12px);
  background: #FFFFFF;
  /* The picture under them is mostly dark, but a quarter of it is the product
     screen, and a white mark on that reads 2.1:1 through a 30% scrim — present
     and invisible. The halo is what carries it over the bright part; on the
     dark part there is nothing for it to show against. */
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, .62));
  --ff-sx: calc(var(--ff-open, 1) * 24.876%);
  --ff-sy: calc(var(--ff-open, 1) * 49.751%);
}
.ff-corner.tl{ top: 0;             left:  var(--ff-sx); }
.ff-corner.tr{ top: 0;             right: var(--ff-sx); }
.ff-corner.br{ bottom: var(--ff-sy); right: var(--ff-sx); }
.ff-corner.bl{ bottom: var(--ff-sy); left:  var(--ff-sx); }

/* ── narrow ───────────────────────────────────────────────────────────────
   The render's frame is 1.54:1. On a phone that is a 253-tall strip across a
   844-tall window, so down here the stage is a window of its own and the
   scene is sized PAST it and cropped — the picture fills the bottom, the
   words take the top. How far past is a function of how narrow it is: 1.85x
   at 390 and 1.50x at 834, the two ends measured, carried through.

   Held off a landscape phone by the aspect query, where the desktop frame is
   the right one and this would put her head through the copy. */
@media (max-width: 860px){
  .ff-stage{
    height: 100svh;
    aspect-ratio: auto;
    clip-path: inset(
      0% calc(var(--ff-open, 1) * 7%)
      round calc(var(--ff-open, 1) * 4.17px));
  }
  /* The stage is a window tall, not the frame's shape, so the frame is
     bottom-anchored instead of centred: its bottom edge sits where the stage's
     bottom edge falls in the media box at the moment the stage covers the
     window (passage 0.5), 5.54% up from the box's bottom. Its top runs past
     the box's top and is clipped — the picture fills the bottom, the words
     take the top. */
  .ff-scene{
    inset: auto 0 5.5435% 0;
    height: auto;
    aspect-ratio: 2000 / 1300;
  }
  .ff-panel{
    --ff-side: min(440px, 88vw);
    min-height: 0;
    padding: round(clamp(24px, 7vw, 40px), 4px) round(clamp(16px, 5vw, 32px), 4px);
  }
}

@media (max-width: 860px) and (max-aspect-ratio: 0.95){
  /* Upright, the frame is sized PAST the window and no longer covers the top
     of the stage, so the plate moves off the frame and onto the media box as
     a bottom-anchored cover — the one gradient behind the whole stage, its
     foot on the box's floor — and the frame keeps only the two cutouts. */
  .ff-media{ background: #000000 url(/assets/focus-bg.webp) 50% 100% / cover no-repeat; }
  .ff-l-bg, .ff-l-bleed{ display: none; }
  .ff-scene{
    --ff-w: var(--ff-sw);
    /* 32 below the floor: the furthest the nearest layer rises, so the lift
       never opens a strip of the black foot under her and leaves her
       hovering. */
    inset: auto auto calc(5.5435% - 32px) 50%;
    width: var(--ff-w);
    /* -56% rather than the pair's own -54% centre gives the crop back to her
       side, where a silhouette loses nothing, instead of taking all of it off
       the screen's right column. */
    translate: -56% 0;
  }
  /* Shorter travel on a shorter layer: the 54px that reads as depth across a
     625px person is a lurch across a 313px one. */
  .ff-l-person{ --ff-depth: 30px; }
  .ff-l-screen{ --ff-depth: 18px; }
}
/* The scene's width upright, named on the band so the words can be placed by
   it: 1.19 of the window plus 256, never past 1.9 windows. */
@media (max-width: 860px) and (max-aspect-ratio: 0.95){
  .ff{ --ff-sw: min(calc(119vw + 256px), 190vw); }
}

/* ── a phone, upright ───────────────────────────────────────────────────────
   A window-tall card left a third of empty ground over the words, and the
   picture is sized by the width, not the height: on a short phone her head
   rose into the button. So the card is shorter, and the words are centred in
   the room ABOVE her head rather than in the card. Her head is where the
   frame puts it, solved: the scene's foot sits 32px under the card's foot
   when the card covers the window, the scene is 0.65 of its width tall, and
   her head is a third of the way down it, so the head lands at
   H + 32 - 0.4327 x the scene's width. Half of that is the words' centre.
   The depth is gentler here too: on a hand-held screen the picture's own
   drift is most of what reads as shake. */
@media (max-width: 719.98px) and (max-aspect-ratio: 0.95){
  .ff{ --ff-h: clamp(520px, 84svh, 760px); }
  .ff-stage{ height: var(--ff-h); }
  .ff-panel{ top: calc((var(--ff-h) + 32px - var(--ff-sw) * 0.4327) / 2); }
  .ff-l-person{ --ff-depth: 16px; }
  .ff-l-screen{ --ff-depth: 10px; }
}

/* ── on the scroll timeline ─────────────────────────────────────────────────
   Where the browser has view timelines the whole move runs on the stage's
   own passage, not in a script: the card opening (the reference's eased curve
   as the animation's timing, from the stage's top edge at the window's foot
   to the top), the picture lagging the page across the whole passage, the
   two cutouts drifting by their depth, and the marks travelling out to the
   corners. Sampled at the scroll position each frame paints, so a phone that
   scrolls on its own thread no longer draws the picture a frame behind its
   card, which is what shook. floom-focus.js stands down here. */
@keyframes ff-open-desk{ from{ clip-path: inset(0% 25% round 4.17px); } to{ clip-path: inset(0% 0% round 0px); } }
@keyframes ff-open-narrow{ from{ clip-path: inset(0% 7% round 4.17px); } to{ clip-path: inset(0% 0% round 0px); } }
@keyframes ff-lag{ from{ translate: 0 -15%; } to{ translate: 0 0; } }
@keyframes ff-depth{ from{ translate: 0 var(--ff-depth, 0px); } to{ translate: 0 calc(var(--ff-depth, 0px) * -1); } }
@keyframes ff-mark-tl{ from{ left: 24.876%; } to{ left: 0%; } }
@keyframes ff-mark-tr{ from{ right: 24.876%; } to{ right: 0%; } }
@keyframes ff-mark-br{ from{ right: 24.876%; bottom: 49.751%; } to{ right: 0%; bottom: 0%; } }
@keyframes ff-mark-bl{ from{ left: 24.876%; bottom: 49.751%; } to{ left: 0%; bottom: 0%; } }
@supports (animation-timeline: view()){
  @media (prefers-reduced-motion: no-preference){
    .ff-stage{
      view-timeline: --ff-pass block;
      animation: ff-open-desk linear both;
      animation-timing-function: cubic-bezier(0.45, 0, 0.75, 0.7);
      animation-timeline: --ff-pass;
      animation-range: cover 0% cover 100vh;
    }
    .ff-corner{
      animation-duration: auto;
      animation-fill-mode: both;
      animation-timing-function: cubic-bezier(0.45, 0, 0.75, 0.7);
      animation-timeline: --ff-pass;
      animation-range: cover 0% cover 100vh;
    }
    .ff-corner.tl{ animation-name: ff-mark-tl; }
    .ff-corner.tr{ animation-name: ff-mark-tr; }
    .ff-corner.br{ animation-name: ff-mark-br; }
    .ff-corner.bl{ animation-name: ff-mark-bl; }
    .ff-media{
      animation: ff-lag linear both;
      animation-timeline: --ff-pass;
      animation-range: cover 0% cover 100%;
    }
    .ff-l{
      animation: ff-depth linear both;
      animation-timeline: --ff-pass;
      animation-range: cover 0% cover 100%;
    }
  }
}
@supports (animation-timeline: view()){
  @media (prefers-reduced-motion: no-preference) and (max-width: 860px){
    .ff-stage{ animation-name: ff-open-narrow; }
  }
}

@media (prefers-reduced-motion: reduce){
  /* Nothing moves. The card is open, the marks are at the corners, and the
     media box is held where the frame is exactly in the window. */
  .ff-stage{ clip-path: none; }
  .ff-corner{ --ff-sx: 0%; --ff-sy: 0%; }
  .ff-l{ translate: none; }
  .ff-media{ translate: 0 -7.5%; }
}
