/* ==========================================================================
   tokens.css — BritBox Apollo design tokens (desktop)
   --------------------------------------------------------------------------
   Source of truth: the Figma variable collection in file
   VTwXbZhC5eXcRZcW0J4fwF. Naming mirrors the Figma variable paths 1:1, so a
   token traces back to the design file: `color/on-surface` ->
   `--color-on-surface`, `space/5xl` -> `--space-5xl`, `component/avatar/s`
   -> `--avatar-s`, `radius/s` -> `--radius-s`.

   The paths were re-read this session with `get_variable_defs` on node
   9633:295441 and match what is written here exactly. See source.md §2 for
   what that call does and does not establish.

   COLOUR LIVES ELSEWHERE — css/theme.britbox.css, loaded BEFORE this file,
   exactly as in the home prototype.

   WHAT IS NOT CARRIED OVER. The home prototype's tokens.css also holds the
   hero carousel's rhythm (--dwell, --dur-kenburns), the trailer-preview
   morph (--ease-morph-in, --chrome-stagger) and the cinema drop. None of
   those components exist on these screens, and a token nothing reads is a
   token that goes stale without anyone noticing. Everything that IS shared
   keeps its value to the pixel.
   ========================================================================== */

:root {
  /* ---- Typography ------------------------------------------------------ */
  --type-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --type-body-xl-size: 20px;  /* rail titles, avatar glyph, shelf titles     */
  --type-body-l-size:  18px;  /* shelf standfirst, entry titles              */
  --type-body-m-size:  16px;  /* nav items, buttons, reasons, footer links   */
  --type-body-s-size:  14px;  /* rail subtitles, card meta, bylines, badges  */
  /* `--type-body-xs-size` was here and was 14px, the same as the line
     above it, and nothing in the set read it. A second name for one
     number is a scale with a hole in it: the next person to need a
     smaller badge changes the one that is wired up or the one that is
     not, and there is no way to tell which from the file. Deleted;
     badges take the `s` step. source.md §10.9. */

  /* ---- The headings ------------------------------------------------------
     THERE WAS NO HEADING SCALE, ONLY FIFTEEN HAND-SET NUMBERS. Six
     distinct sizes — 52, 44, 40, 32, 28 and the Top 10 numeral's 158 —
     written one at a time in app.css as each screen was built, with no
     rule anywhere saying which to reach for. These are those same numbers
     given names. NOTHING MOVES: this is the scale being written down, not
     changed, so the pass can be read as a no-op and the next change to it
     is a decision in one file rather than a search through 4,500 lines.

     What the names make visible is the drift, which is the point of
     doing it: `l` and `xl` are 12 apart and `s` and `m` are 4, so the
     bottom of the scale is nearly flat while the top is nearly an
     octave. 44 is the contained hero's name against the full-bleed
     hero's 52 — a deliberate variant rather than a step, and it is named
     as one. Whether the set really wants five sizes is the question
     source.md §10.7 asks and this does not answer. */
  --type-heading-xl-size: 52px;  /* the full-bleed hero's name               */
  --type-heading-l-size:  40px;  /* page titles — who's watching, head       */
  --type-heading-m-size:  32px;  /* the short page title                     */
  --type-heading-s-size:  28px;  /* account sub-heads, prices, step digits   */
  --type-heading-hero-contained-size: 44px; /* the variant, not a step       */

  --type-weight-regular:   400;
  --type-weight-semi-bold: 600;
  /* NOT A TEXT SIZE. The initial inside a 24px byline disc, which has to
     fit the circle rather than sit on the type scale — the scale stops
     at 14 and 14 in a 24 disc touches the edges. Named so that the one
     number in the set below the scale is a decision rather than a
     leftover; see the audit note in source.md §7b. */
  --avatar-glyph-s: 12px;
  /* AND THE OTHER TWO, for the same reason. The initial is sized to the
     disc it sits in, not to the type scale — 12 in a 24 byline disc, 40
     in the account page's 100, 56 in the picker's 148 tile — and all
     three were written as bare numbers in app.css, which made them look
     like headings when they are a ratio. They are roughly a half of the
     disc each; nothing here changes that, it only says so. */
  --avatar-glyph-m: 40px;     /* the 100px account disc                     */
  --avatar-glyph-l: 56px;     /* the 148px picker tile                      */

  --type-line-height: 1.5;    /* every text style in the frame uses 1.5      */

  /* ---- Spacing --------------------------------------------------------- */
  --space-2xs:  2px;
  --space-xs:   4px;
  --space-s:    8px;
  --space-m:   12px;
  --space-l:   16px;
  --space-xl:  20px;
  --space-2xl: 24px;
  --space-3xl: 32px;
  --space-4xl: 40px;
  --space-5xl: 64px;
  --space-huge: 116px;

  /* ---- Radius ---------------------------------------------------------- */
  --radius-xs:   4px;
  --radius-s:    8px;
  --radius-full: 9999px;

  /* ---- Component sizes ------------------------------------------------- */
  --icon-xs: 20px;
  --icon-s:  24px;
  --icon-m:  32px;
  --icon-l:  48px;
  --icon-xl: 64px;
  --avatar-s: 40px;

  /* ---- Frame geometry -------------------------------------------------- */
  --frame-width:   1440px;   /* the Figma artboard; reference only          */
  --appbar-height:   88px;
  /* What a page has to clear when the back control is on it: the bar, the
     24 above the control, the control's own 44, and 24 under it. Written
     once because five shells read it and they drifted the first time.

     IT USED TO BE 188 AND IS NOW 180, AND MORE OF THE PAGE SHOWS THAN
     THAT SUGGESTS. The control carries the page's name now, so the kicker
     and the heading that used to sit under it are gone from three screens
     — which is where the real 80–150px came from, not from this. */
  --back-clear:      calc(var(--appbar-height) + var(--space-2xl) + 44px + var(--space-2xl));

  --frame-gutter:  clamp(24px, 4.5vw, 64px);    /* 64px at >=1422px         */
  --menu-gap:      clamp(32px, 8.06vw, 116px);  /* 116px at 1440px          */
  --footer-gutter: clamp(24px, 8.06vw, 116px);  /* 116px at 1440px          */

  --card-vertical-width:   202px;  /* poster card — unchanged from home     */
  --card-vertical-height:  303px;
  /* The shelf card. Deliberately the home prototype's Continue Watching
     box, 424 x 238.5 — see source.md §5.2. Three of them plus their gaps
     land on the same 64px right gutter as the poster rails. */
  --card-horizontal-width:  424px;
  --card-horizontal-height: 238.5px;
  --rail-gap: var(--space-xl);     /* 20px between cards                    */

  /* ---- Interaction ----------------------------------------------------- */
  --card-outline:       var(--color-white-20);      /* white @20 — resting  */
  --card-outline-hover: rgba(255, 255, 255, 0.8);   /* white @80 — hover    */
  --card-zoom:          1.06;

  /* THE GENRE TILE'S OWN HOVER. It used to borrow the card zoom: 6% in
     0.2s, which on the one card that still zooms reads as a flinch — the
     tile snaps the moment the pointer crosses it, and a row of six of them
     snaps six times on the way past. Half the travel, three times the
     duration, and it waits out a short hold before it starts, so moving
     ACROSS the row costs nothing and only stopping on a tile moves it. The
     hold is on the way in only; leaving is immediate, because a tile that
     lingers after the pointer has gone is a tile that feels stuck. */
  --genre-zoom:         1.035;
  --dur-genre:          0.62s;
  --genre-hold:         0.18s;

  /* THE SHELF CARD IS NOT A GENRE TILE, and the timing has been argued
     about for four rounds in both directions: 0.2s read as a flinch,
     0.62s with the tile's 0.18s hold read as no response at all, 0.34s
     read as jumpy. None of those were really about the numbers. The
     card was rotating three posters about their own centres and then
     translating each one outwards to compensate — nine small motions in
     opposing directions, which stutters at any speed.

     It fans from a pivot now, one rotation per poster, and the duration
     can afford to be generous because a single interpolating value does
     not fight itself.

     SLOWER AGAIN, AND THE CURVE IS WHY IT CAN BE. Half a second on a
     quintic ease-out spends nearly all its speed in the first few
     frames: the leaves were at rest, and then they were open. That
     reads as a flick at any duration, and stretching a curve shaped
     like that only lengthens the tail of nothing at the end of it —
     which is why the three previous attempts at "slower" did not help.

     The spread has a curve of its own now, eased at BOTH ends, so the
     leaves take up the movement from rest the way a hand opening a fan
     does, and are a long time arriving. 0.72s on the middle leaf, 0.86
     on the outer two.

     And it waits longer before anything moves. 0.14s is a real pause
     rather than a debounce, so crossing a rail of shelf cards still
     costs nothing and stopping on one is answered deliberately instead
     of with a flinch. The follow between leaves is up from 60ms to
     100, which is most of what makes it read as one object unfurling
     rather than three agreeing to move.

     Closing keeps the ease-out and stays quicker than opening, because
     a fan falls shut rather than being pushed shut. */
  --dur-fan:            0.72s;
  --dur-fan-outer:      0.86s;   /* further to travel, so longer         */
  --dur-fan-close:      0.44s;   /* falling shut is not being pushed open */
  --fan-hold:           0.14s;
  --fan-follow:         0.10s;   /* the outer leaves follow the middle    */
  /* The same curve as `--ease-enter` further down, and it is the same
     curve on purpose: a quintic ease-out is what everything in this set
     that ARRIVES uses. Aliased rather than written twice, so the pair
     cannot drift the way the durations above it did. source.md §10.2. */
  --ease-fan:           var(--ease-enter);
  /* THE ONE CURVE IN THIS FILE THAT IS NOT AN ARRIVAL. Everything else
     here eases out, because everything else is something turning up.
     The fan is a thing being OPENED from rest, which is a different
     gesture and needs easing at both ends — and it is only the spread:
     the close is still `--ease-fan` above. */
  --ease-fan-spread:    cubic-bezier(0.32, 0.04, 0.16, 1);
  --scrim-hover:        rgba(0, 0, 0, 0.75);

  /* NOT FROM THE FIGMA COLLECTION. The variable collection has no elevation
     scale — the product's surfaces are told apart by colour, not by depth —
     so these two are invented for the picker, where four flat squares on a
     flat ground had nothing holding them off it. Deep rather than wide,
     because a soft shadow on a near-black ground has to be most of the way
     to black before it reads at all. */
  --shadow-tile:        0 6px 18px rgba(0, 0, 0, 0.38);
  --shadow-tile-hover:  0 12px 30px rgba(0, 0, 0, 0.52);
  --accent-ring:        var(--color-primary-30);

  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-zoom:     cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-grow:     cubic-bezier(0.22, 0.8, 0.28, 1);

  --dur-overlay: 0.2s;
  /* The outline and the overlay are the same 0.2: both are the instant
     answer to a pointer arriving, and if one of them ever stops being
     that it should be because somebody decided so. */
  --dur-outline: var(--dur-overlay);
  --dur-ring:    0.15s;
  --dur-nav-fade: 0.35s;
  --dur-reveal:  0.32s;   /* a field opening a second question under itself */

  /* THE SHARE PANEL OPENS SLOWER THAN A FIELD DOES. It was borrowing
     `--dur-reveal`, which is sized for a short row appearing under an
     input — and this is a 290px panel carrying a plate, a paragraph, a
     link and four buttons. The same duration over nine times the
     height reads as the block being dealt onto the page.

     Its own duration and its own curve, eased at both ends: the panel
     is at rest when you press, so it should take up the movement
     rather than leave at speed, exactly as the fan's leaves do. */
  --dur-send:    0.52s;
  --ease-send:   cubic-bezier(0.32, 0.04, 0.16, 1);
  /* THE PICKER CHANGING MODE, all of it at once — and at 0.26s all of it
     at once was a blink. The shape of the move was right by then (one
     property, one curve, no stagger); it was simply over before the eye
     had followed it, which on four tiles the size of these reads as a
     cut rather than as a change. 0.46 on the fan's curve is the same
     move at a pace you can watch: most of the distance early, then a
     long settle. It is deliberately close to the fan's own half-second,
     because they are the two mode changes in this set and they should
     feel like one hand. */
  --dur-manage:  0.46s;

  /* THE TWO LABELS DO NOT CROSS-FADE THROUGH EACH OTHER. At the mode's
     own duration both words sat at half opacity in the same cell for a
     quarter of a second, which in 40px type is two headings printed on
     top of one another. One leaves, then the other arrives: the going
     word takes --dur-swap-out and starts immediately, the coming word
     waits exactly that long and then takes --dur-swap-in. The pair is
     0.38s, comfortably inside the mode's 0.46, so the words have
     resolved by the time the tiles stop. */
  --dur-swap-out: 0.14s;
  --dur-swap-in:  0.24s;

  /* The rating control. One disc widening into a pill of three.

     EASED BOTH WAYS AND SLOWER THAN IT WAS. 0.30s on an overshoot curve
     snapped open and bounced at the end, which is a lot of personality for
     a control you use thirty times on one page. This accelerates and
     decelerates evenly, takes half again as long, and closes on exactly
     the same curve over exactly the same time — so opening and shutting
     are one gesture played each way rather than two different ones.

     The panel's open width is 3 x 40 + 2 x 2 of padding + 2 of border. It
     is a token because the pill animates to a number and `auto` is not
     one. */
  /* The beat a control plays when its answer changes. One value, read by
     all four of them — the rating disc, My List as a word, My List as a
     disc, and Save to your shelves — because four controls that answer at
     four different speeds is four products. */
  --dur-landed:  0.26s;

  /* ---- The shelf's two views, morphing ---------------------------------
     THE CURVE WAS THE HARSH PART, NOT THE DURATION. The first morph ran
     on --ease-fan, which is a quintic ease-OUT: nearly all of its speed
     is in the first few frames. That is right for something answering a
     pointer, which should feel like it was already moving — and wrong
     for this, where every poster is sitting still at the moment you
     press and then bolts four hundred pixels. Twelve of them bolting
     together is a slab of the page jumping.

     An ease-in-out instead. The cards accelerate out of rest, which is
     what an object at rest does, and then take a long time arriving.
     Slightly longer overall, because a curve that starts gently needs
     the room, and a view toggle is a deliberate press rather than a
     hover — it can afford half a second.

     AND THEY DO NOT ALL GO AT ONCE. 20ms between cards in reading
     order, capped at 120 so a long shelf does not turn into a queue.
     The cap matters: this is meant to read as one movement with a grain
     to it, not as twelve movements.

     --morph-lead is the pause before the posters travel on the way back
     to the grid, which the reading rows' type uses to get out of the
     way first. Going the other direction it is the same beat spent the
     other way round — the posters land, then the type arrives. Either
     way the two things that change never change at the same time. */
  --dur-morph:   0.52s;
  --ease-morph:  cubic-bezier(0.45, 0, 0.15, 1);
  --morph-step:  0.02s;
  --morph-cap:   0.12s;
  --morph-lead:  0.13s;

  --dur-rate:    0.42s;
  /* `--ease-standard` under another name — see `--ease-fan`. */
  --ease-rate:   var(--ease-standard);
  --rate-panel-width: 128px;
  /* A rail paging and a genre tile zooming are the same 0.62 — the
     longest thing in the set that is still a response rather than an
     entrance. */
  --dur-rail-page: var(--dur-genre);

  /* ---- The hover panel's chrome ----------------------------------------
     Carried over from the home prototype: the chrome waits out most of the
     box's growth, then resolves in a short stagger. Leaving is quicker than
     arriving, so the box is bare again before it starts retracting. */
  --dur-chrome:       0.34s;
  --dur-chrome-out:   0.18s;
  --chrome-stagger:   0.06s;
  --chrome-lift:      6px;

  /* ---- Entrance --------------------------------------------------------
     ONE system, and the budget is written here so js/app.js can read the
     total rather than keeping a second copy of it. See source.md §6.

     SOFTER THAN IT WAS: 0.52s over 14px on the standard curve was fine the
     first time you saw it and wrong every time after, because the one
     moment anybody actually watches this is switching profile, and there it
     read as a flick. Longer, over less distance, on a curve that spends
     most of its time decelerating — and a tighter step between siblings, so
     the longer duration does not also make the page later to arrive.

     --ease-enter and --dur-media were BOTH missing from this file until
     now, while app.css referred to them: an undefined custom property makes
     the whole declaration invalid at computed-value time, so the entrance
     had silently been running on the initial `ease` curve and the media
     fade had no duration at all, which is to say the pictures were still
     snapping in. Verified by reading the computed styles rather than by
     reading the rules. */
  --dur-enter:   0.78s;
  --enter-lift:  9px;
  --enter-step:  0.055s;  /* between siblings in a staggered group          */
  --ease-enter:  cubic-bezier(0.22, 1, 0.36, 1);
  --dur-media:   0.55s;   /* one picture fading up as it decodes            */
  /* The whole budget, in ms, read by js/app.js rather than kept as a second
     copy there. The longest screen stages fourteen groups: 13 * 55ms of
     stagger plus one 780ms rise lands at 1495, and the class comes off at
     2100 so nothing is cut short — including the media fades, which start
     whenever their image decodes rather than on a schedule. */
  --enter-total: 2100;
}
