/* The hero's Online tile: the checkout plays (user request of 16 November 2026: "Il faut
   aussi animer l'image « En ligne » d'une façon similaire à ce qu'on a pu faire pour les
   autres animations sur le site"). One source for the homepage's hero and for the tile's
   Stageshow scene (`Online` in product-ui/src/heroes/commerce-grid/index.tsx), which films
   the poster this play ends on.

   What plays, once, when the hero is looked at. The tile opens on the whole checkout: the
   three options, none chosen yet, and the order as it stands without a cover (the
   smartphone, its total, the button). Then, in 2.3s:
   - the two-year option is chosen: it gives a little, as under a tap, its mark fills and
     its tick is drawn, and its ring and its tint come in;
   - the cover's line arrives in the order: what stands under it (the total, the button)
     makes room, and the line comes into that room from just above;
   - the total follows: the amount without the cover goes out of focus as the amount
     with it comes into focus in its place.
   The last frame is the filmed poster. Nothing else moves, nothing moves once it has
   played, and it does not loop. No pointer is drawn, and nothing stands in for one. On
   phones the tile has no order, and what plays is the choice alone.

   How it is built. Every piece that plays carries a class of this sheet:
     .hon__opt    the option that is chosen, whole: what gives under the tap
     .hon__blank  the option as it stands before it is chosen
     .hon__pick   the option, chosen
     .hon__mark   its mark while it is being made: .hon__disc fills, .hon__tick is drawn
     .hon__line   the cover's line in the order
     .hon__rest   what stands under that line and makes room for it
     .hon__was    the total before the cover
     .hon__now    the total with it
   In the scene they are the interface's own elements (the kit's rows and button). On
   the page they are windows onto pictures (see "The page" below). The mark is the kit's
   own glyph (its Check's disc and tick), drawn alike on both sides; once the chosen
   option is whole it gives way to that option's own mark. The root, .hon, is marked
   data-play: "ready" holds the first frame, "on" plays, anything else is the poster.
   data-size is "wide" or "compact".

   The pace was set after the fresh-eye review of 16 November 2026 (product-ui/REHEARSAL.md
   has its list): a first version cross-faded the option's two states with no press and no
   mark made, which read as the page choosing the cover by itself; opened the room slowly
   and brought the line in late, so a gap stood empty; and changed the total while the
   tile below it was still arriving.

   Lengths are the picture's design pixels (--u), so the scene and the page, at any
   width, move alike. */

.hon {
  --u: 1px;
  /* The clock, from the moment the play starts */
  --hon-at-press: .5s;                                  /* the option gives: the opening is held until then */
  --hon-at-pick: calc(var(--hon-at-press) + .11s);      /* and is chosen, at the foot of the tap */
  --hon-at-line: .95s;                                  /* the order makes room, and the cover's line arrives */
  --hon-at-total: 1.75s;                                /* the total follows */
  --hon-end: 2.3s;
  /* How far the total and the button stand above their place before the cover's line is
     there: the line's own 40 pixels and the 14 between two lines of the order */
  --hon-room: 54;
  /* The kit's curve for an arrival from nowhere (a quick start and a long landing), and the one its Check draws its tick on */
  --hon-arrive: cubic-bezier(.22, 1, .36, 1);
  --hon-draw: cubic-bezier(.65, 0, .35, 1);
}
/* On phones the choice is all there is */
.hon[data-size='compact'] { --hon-end: 1.5s; }

/* How a piece arrives and leaves. What is animated is a registered number per piece
   (--hon-in from 0 to 1 as it arrives, --hon-out from 0 to 1 as it leaves, --hon-press up
   to 1 and back for the tap), and the piece's place, size, opacity and focus are computed
   from them, as claim-play.css and hero-agent.css do, and for the same reason: animated
   in the usual way a piece is drawn on a sheet of its own for as long as it moves and
   steps a pixel when it comes to rest. Do not go back to animating opacity, translate,
   scale or filter directly. */
@property --hon-in { syntax: '<number>'; inherits: false; initial-value: 1; }
@property --hon-out { syntax: '<number>'; inherits: false; initial-value: 0; }
@property --hon-press { syntax: '<number>'; inherits: false; initial-value: 0; }
@keyframes hon-in { from { --hon-in: 0; } }
/* Once it has left, a piece is out of the picture */
@keyframes hon-out { to { --hon-out: 1; visibility: hidden; } }
@keyframes hon-press { 0%, 100% { --hon-press: 0; } 38% { --hon-press: 1; } }
/* Nothing: its end is the end of the play (hero-online.js listens for it) */
@keyframes hon-clock { to { visibility: visible; } }

/* The mark while it is being made: the kit's Check, its disc and its tick, in the retailer's accent */
.hon__mark { display: block; }
.hon__mark > svg { display: block; width: 100%; height: 100%; overflow: visible; }
.hon__disc { fill: #6335e8; transform-origin: 8px 8px; }
.hon__tick { fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; }

/* What is in the picture only while it plays: with reduced motion, never. (?online=parts,
   in the studio, shows the option and the total as they stand before the choice, each where
   the poster has its own: product-ui/export-hero-online.py films them for the page.) */
.hon :is(.hon__blank, .hon__was, .hon__mark) { visibility: hidden; }
.hon[data-play='parts'] :is(.hon__blank, .hon__was) { visibility: visible; }
.hon[data-play='parts'] :is(.hon__pick, .hon__now) { visibility: hidden; }

@media (prefers-reduced-motion: no-preference) {
  .hon:is([data-play='ready'], [data-play='on']) :is(.hon__blank, .hon__was, .hon__mark) { visibility: visible; }
  /* The tap: the option gives a little and comes back, as a card does under a finger or a click */
  .hon:is([data-play='ready'], [data-play='on']) .hon__opt {
    scale: calc(1 - .015 * var(--hon-press)); transform-origin: 50% 50%;
    animation: hon-press .29s ease-out var(--hon-at-press) both;
  }
  /* At the foot of the tap the option is chosen. Its mark is made first: the disc fills from
     its middle over the empty ring and the tick is drawn on it, as the kit's Check turns on. */
  .hon:is([data-play='ready'], [data-play='on']) .hon__mark {
    opacity: calc(1 - var(--hon-out));
    animation: hon-out .16s linear calc(var(--hon-at-pick) + .7s) both;
  }
  .hon:is([data-play='ready'], [data-play='on']) .hon__disc {
    opacity: min(1, calc(var(--hon-in) * 8)); scale: calc(.35 + .65 * var(--hon-in));
    animation: hon-in .28s var(--hon-arrive) var(--hon-at-pick) both;
  }
  .hon:is([data-play='ready'], [data-play='on']) .hon__tick {
    opacity: min(1, calc(var(--hon-in) * 50)); stroke-dashoffset: calc(1 - var(--hon-in));
    animation: hon-in .24s var(--hon-draw) calc(var(--hon-at-pick) + .12s) both;
  }
  /* Its ring and its tint come in a moment behind the disc, which by then covers the chosen
     option's own mark, so one mark is ever seen. In the scene the chosen option fades in
     over the one that was there, which then leaves the picture, unseen; on the page the
     layer holds the chosen option under the one that was there, which fades off it. One
     picture either way. */
  .hon:not(.hon--page):is([data-play='ready'], [data-play='on']) .hon__pick {
    opacity: var(--hon-in);
    animation: hon-in .2s ease-out calc(var(--hon-at-pick) + .06s) both;
  }
  .hon:not(.hon--page):is([data-play='ready'], [data-play='on']) .hon__blank {
    opacity: calc(1 - var(--hon-out));
    animation: hon-out .08s linear calc(var(--hon-at-pick) + .26s) both;
  }
  .hon--page:is([data-play='ready'], [data-play='on']) .hon__blank {
    opacity: calc(1 - var(--hon-out));
    animation: hon-out .2s ease-out calc(var(--hon-at-pick) + .06s) both;
  }
  /* The order makes room: the total and the button go down to their place, quick to leave
     and long to settle, so that the room is two thirds open within a tenth of a second */
  .hon:is([data-play='ready'], [data-play='on']) .hon__rest {
    translate: 0 calc((1 - var(--hon-in)) * var(--hon-room) * var(--u) * -1);
    animation: hon-in .55s var(--hon-arrive) var(--hon-at-line) both;
  }
  /* and the cover's line comes into the room from just above, whole, as soon as the room
     can hold it: any sooner and the total, on its way down, would cross the line's own
     words; any later and a gap would stand empty (the kit's Collapse fades a row's content
     in as its height finishes) */
  .hon:is([data-play='ready'], [data-play='on']) .hon__line {
    opacity: var(--hon-in); translate: 0 calc((1 - var(--hon-in)) * -6 * var(--u));
    animation: hon-in .4s var(--hon-arrive) calc(var(--hon-at-line) + .11s) both;
  }
  /* The total follows: the amount without the cover goes out of focus as the amount with it
     comes into focus in its place, as the claims picture sets what was done. The two
     overlap: at no moment is the total's place empty. */
  .hon:is([data-play='ready'], [data-play='on']) .hon__was {
    opacity: calc(1 - var(--hon-out)); filter: blur(calc(var(--hon-out) * 2.5 * var(--u)));
    animation: hon-out .26s linear var(--hon-at-total) both;
  }
  .hon:is([data-play='ready'], [data-play='on']) .hon__now {
    opacity: var(--hon-in); filter: blur(calc((1 - var(--hon-in)) * 2.5 * var(--u)));
    animation: hon-in .34s ease-out calc(var(--hon-at-total) + .05s) both;
  }
  /* The play's clock runs on the page's layer alone, where hero-online.js listens for its end */
  .hon--page:is([data-play='ready'], [data-play='on']) { animation: hon-clock var(--hon-end) linear both; }
  /* The first frame, held until the hero is looked at. The rules above set `animation` whole,
     which would start each piece again: this one has to win over them. */
  .hon[data-play='ready'], .hon[data-play='ready'] * { animation-play-state: paused !important; }
}

/* ---- The page ----
   The homepage's hero is one filmed picture of five tiles, so nothing can be moved in it.
   A layer is laid over the picture, written in the page itself (index.html):
   - what the poster holds (the chosen option, the cover's line, the total, the button)
     is the page's own picture again, seen through windows: the picture inside a window
     is the hero's own size and stands exactly where the hero stands, and the play moves
     the windows (claim-play.css and care-play.css say what it cost to do otherwise). The
     windows show an image, as the picture under them is, and not a background;
   - what the poster does not hold (the option before it is chosen, the total before the
     cover) is one more picture, the hero's own size and clear but for those two pieces,
     each where the poster has its own: product-ui/renders/h-hero-online-first-<language>-<size>.webp,
     filmed from the same scene by product-ui/export-hero-online.py, which holds the boxes
     below to the scene in seven languages;
   - the page's white is laid under the option, which gives under the tap, and the order's
     own ground under the windows that move (.hon__paper, .hon__panel, .hon__slot): the
     windows over them cover them from edge to edge at rest, so that, played out, no pixel
     of the layer is a colour laid here.
   So nothing on the page is redrawn by hand but the mark while it is made, and no word is
   written there: the page does not load the picture's face.

   The layer is not shown until hero-online.js marks it, which it does as the hero's
   picture arrives, and only where the layer can play: with a script, without reduced
   motion, in a browser that can place it (--hon-can is 1 only where a number can be
   registered) and not on a page that has just changed language, which arrives as it was
   left (redesign.css, lang-swap). Everywhere else the picture is the poster. The script
   holds the first frame ("ready"), plays ("on") once the checkout is in the window, and
   rests ("done"). Where the poster has been seen with its option chosen before the layer
   could be marked (the script, or the layer's own picture, came late), the script puts
   the layer aside ("off") rather than undo a choice the visitor has seen.

   The layer stays once the play is over, and everything that crosses from one state to
   another does so inside it. Where the hero is drawn at its own size the layer at rest is
   the poster, pixel for pixel. Where the hero is scaled, the browser draws the layer's
   windows on the layer's own sheet, up to a pixel of the screen off the picture under
   them: a first version took the layer away once played, and at some widths the order
   was seen to hop by that pixel (fresh-eye review). So nothing is handed back to the
   picture under the layer while it can be seen.

   Boxes are in the hero's design pixels, 1200 x 668 wide and 358 x 716 compact, the same
   in every language: the checkout is laid out alike in all seven, on whole pixels. */
@property --hon-can { syntax: '<number>'; inherits: false; initial-value: 1; }

/* A sheet of its own (will-change), as the terminal's layer has and for its reason: without
   it the browser draws the whole hero another way as soon as anything else is painted with
   it (terminal-rise.css). */
.hon--page { position: absolute; inset: 0; display: none; overflow: hidden; container: hon / size; pointer-events: none; will-change: transform; --stage: 1200; --u: calc(100cqw / var(--stage)); }
@media (prefers-reduced-motion: no-preference) {
  @supports (container-type: size) and (translate: 0 1px) {
    html.js:not(.lang-swap) .hon--page[data-play] { display: block; opacity: var(--hon-can, 0); }
  }
}
/* Put aside: the layer is out of the picture, which is the poster */
.hon--page[data-play='off'] { visibility: hidden; }

/* A piece: its box (--x, --y, --w, --h) in design pixels, from the corner of what holds it (--ox, --oy) */
.hon--page :is(.hon__paper, .hon__opt, .hon__pick, .hon__blank, .hon__mark, .hon__panel, .hon__line, .hon__rest, .hon__slot, .hon__was, .hon__now) {
  position: absolute; display: block; left: calc((var(--x) - var(--ox, 0)) * var(--u)); top: calc((var(--y) - var(--oy, 0)) * var(--u)); width: calc(var(--w) * var(--u)); height: calc(var(--h) * var(--u));
}
/* A window onto a picture, which stands in it exactly where the hero's picture stands */
.hon--page .hon__cut { overflow: hidden; }
.hon.hon--page .hon__cut > picture > img { position: absolute; display: block; left: calc(var(--x) * var(--u) * -1); top: calc(var(--y) * var(--u) * -1); width: 100cqw; height: 100cqh; max-width: none; aspect-ratio: auto; }
/* The page's white, and the order's ground as the posters' compression gives it in all seven languages */
.hon--page .hon__paper { background: #fff; }
.hon--page :is(.hon__panel, .hon__slot) { background: #f8f5fb; }

/* Wide: the tile is the picture's top left corner, 840 x 380 at 0, 0.
   - the option: its row (376 x 58 at 102, 181) and two pixels of the page's white round
     it. The white under it, what gives under the tap and its two states share that box;
     its mark is the kit's Check in that row, 18 x 18 at 114, 201;
   - the order's ground, from the middle of the gap under the smartphone's line down to a
     pixel short of the tile's foot, a pixel inside the order's edges: it ends in the
     order's own ground on all four sides. Two windows share it, edge to edge: the
     cover's line (its row is 219 x 40 at 523, 201), and what stands under it (the total
     at 523, 255, the button at 523, 304). They part a pixel over the total's rule, so
     that the window that travels has no ground of its own over that rule to lay on the
     line's words while the room opens;
   - the total's figure (its words end at 742 and are 44 wide at the most), with room
     for it to go out of focus in;
   - .hon__room is what has to be in the window before the play starts: the checkout
     from the top of the first option to the foot of the total. It stands in the hero
     itself and not in the layer, which has no box until it is marked. */
.hon--page :is(.hon__paper, .hon__opt) { --x: 100; --y: 179; --w: 380; --h: 62; }
.hon--page :is(.hon__pick, .hon__blank) { --ox: 100; --oy: 179; --x: 100; --y: 179; --w: 380; --h: 62; }
.hon--page .hon__mark { --ox: 100; --oy: 179; --x: 114; --y: 201; --w: 18; --h: 18; }
.hon--page .hon__panel { --x: 504; --y: 194; --w: 257; --h: 185; }
.hon--page .hon__line { --x: 504; --y: 194; --w: 257; --h: 60; }
.hon--page .hon__rest { --x: 504; --y: 254; --w: 257; --h: 125; }
.hon--page :is(.hon__slot, .hon__was, .hon__now) { --ox: 504; --oy: 254; --x: 688; --y: 264; --w: 60; --h: 32; }
.hero__art > .hon__room { --x: 102; --y: 181; --w: 640; --h: 109; }
.hero__art > .hon__room { position: absolute; left: calc(var(--x) / var(--stage, 1200) * 100%); top: calc(var(--y) / var(--foot, 668) * 100%); width: calc(var(--w) / var(--stage, 1200) * 100%); height: calc(var(--h) / var(--foot, 668) * 100%); visibility: hidden; pointer-events: none; }

/* Compact, the picture the page shows at 900px and under (the breakpoint of its <picture>): the
   tile is 358 x 272 at 0, 0 and has no order. The option's row is 242 x 58 at 58, 131, its mark
   at 70, 151. There the choice is all that plays, so the play waits for the whole tile to be
   in the window: with the row alone it was spent while the visitor was still on the page's
   title (fresh-eye review). */
@media (max-width: 900px) {
  .hon--page { --stage: 358; --hon-end: 1.5s; }
  .hon--page :is(.hon__panel, .hon__line, .hon__rest) { display: none; }
  .hon--page :is(.hon__paper, .hon__opt) { --x: 56; --y: 129; --w: 246; --h: 62; }
  .hon--page :is(.hon__pick, .hon__blank) { --ox: 56; --oy: 129; --x: 56; --y: 129; --w: 246; --h: 62; }
  .hon--page .hon__mark { --ox: 56; --oy: 129; --x: 70; --y: 151; --w: 18; --h: 18; }
  .hero__art > .hon__room { --x: 0; --y: 0; --w: 358; --h: 272; --stage: 358; --foot: 716; }
}
