/* Claims in plain language: the conversation plays (user request of 15 November 2026:
   the picture "animée, un peu à l'image de ce qu'a fait Incident-io", from a film of
   incident.io's homepage). One source for the homepage picture and for the `h-claim`
   Stageshow scene (product-ui/src/home.tsx), which films the poster this play ends on.

   What plays, once each time the picture is looked at. It opens on the customer's whole
   message, the photograph and their words. Then the assistant works, one step at a
   time: an arc turns beside what it is doing ("Analysing the photo"), and becomes a
   tick as those words give way to what was done ("Photo analysed"); a thread is drawn
   down to the next step. Its answer is written in, line by line. After a beat the
   outcome arrives and closes the column, and its mark lands on it alone.
   The last frame is the filmed poster, and the picture holds it.
   (Until 16 November 2026 a grey row, "Screen repair, Booked", arrived last under the
   outcome: the user had it taken out of the picture, and the play ends on the outcome.)

   Taken from the reference: the manner (a step named while it is worked on, words that
   go out of focus and come into it, an indicator that turns into a tick, an answer
   written in). Nothing of incident.io's own.

   How it is built. Every piece that plays carries a class of this sheet:
     .clp__spin    the turning arc of a step (--n: 0, 1, 2)
     .clp__doing   what the step is called while it is worked on
     .clp__tick    its tick
     .clp__label   what it is called once done, .clp__more its chevron
     .clp__link    the thread that joins it to the step above
     .clp__reply   the answer, two lines
     .clp__result  the outcome, .clp__check its mark
   In the scene they are the interface's own elements. On the page they are cuts of
   the filmed poster (see "The page" below), so nothing is drawn twice and nothing is
   redrawn by hand. The root, .clp, is marked data-play: "ready" holds the first frame,
   "on" plays, anything else is the poster. data-size is "wide" or "compact".

   Lengths are the phone's own points (--p: the screen is 402 across), so the scene,
   where the phone is drawn at about 0.8, and the page, at any width, move alike. */

.clp {
  /* The clock, from the moment the play starts. The opening is held for --clp-steps-at.
     One step: the arc turns for --clp-work, then becomes the tick; the next begins
     --clp-beat after it began. The answer follows the last step; the outcome waits a
     beat after the answer; its mark lands alone, and the play is over once it has. */
  --clp-steps-at: .5s;
  --clp-beat: 1.1s;
  --clp-work: .9s;
  --clp-reply-at: calc(var(--clp-steps-at) + 2 * var(--clp-beat) + var(--clp-work) + .5s);
  --clp-reply-for: 1.15s;
  --clp-result-at: calc(var(--clp-reply-at) + var(--clp-reply-for) + .4s);
  --clp-end: calc(var(--clp-result-at) + 1.1s);
  /* The kit's curves: an arrival from nowhere, and a small mark that lands */
  --clp-arrive: cubic-bezier(.22, 1, .36, 1);
  --clp-land: cubic-bezier(.3, 1.35, .5, 1);
}
/* The phone column has no answer: the outcome follows the last step, after the same beat */
.clp[data-size='compact'] {
  --clp-result-at: calc(var(--clp-steps-at) + 2 * var(--clp-beat) + var(--clp-work) + .9s);
}
/* Where a step starts and where it resolves (--n is set on the step, or on each of its pieces) */
.clp__step, .clp--page > * {
  --clp-at: calc(var(--clp-steps-at) + var(--n, 0) * var(--clp-beat));
  --clp-done: calc(var(--clp-at) + var(--clp-work));
}

/* The arc (the kit's Spinner) and the words beside it are in the picture only while a step is being worked on */
.clp__spin, .clp__doing { opacity: 0; }

/* How a piece arrives. What is animated is one registered number, --clp-in, from 0 to 1,
   and the piece's place, size, opacity and focus are computed from it. Animated in the
   usual way (opacity, translate, a filter), a piece is drawn on a sheet of its own for as
   long as it moves, on that sheet's own pixels, and sat a pixel off the picture until the
   play was over: measured on the page, a line of text stood one pixel low and then
   stepped up. Computed from a number, each piece is drawn afresh where it stands, on the
   picture's own pixels, and lands exactly. (agent-cast.css floats its characters the
   same way, for the same reason.) Do not go back to animating opacity, translate, scale
   or filter directly on a piece that stays in the picture.
   The arc is the exception: it turns in the usual way, and is gone before anything rests. */
@property --clp-in { syntax: '<number>'; inherits: false; initial-value: 1; }
/* Until its moment a piece is not in the picture at all (visibility is hidden only at the
   very start of the keyframes: it is seen from the first step of its arrival) */
@keyframes clp-in { from { --clp-in: 0; visibility: hidden; } }
/* In for the length of the work, out as the tick lands */
@keyframes clp-doing { 0%, 100% { --clp-in: 0; visibility: hidden; } 22%, 84% { --clp-in: 1; visibility: visible; } }
@keyframes clp-turn { to { rotate: 1turn; } }
/* The arc turns before it is seen and through its leaving, and has left when the tick comes: one mark hands over to the other, they are never drawn together */
@keyframes clp-spin { 0% { opacity: 0; } 18%, 86% { opacity: 1; } 100% { opacity: 0; } }
/* The answer is written in: each line is uncovered from its start by a soft edge */
@keyframes clp-write {
  0% { -webkit-mask-position: 100% 0, 100% 100%; mask-position: 100% 0, 100% 100%; }
  50% { -webkit-mask-position: 0 0, 100% 100%; mask-position: 0 0, 100% 100%; }
  100% { -webkit-mask-position: 0 0, 0 100%; mask-position: 0 0, 0 100%; }
}
/* Nothing: its end is the end of the play (claim-play.js listens for it) */
@keyframes clp-clock { to { visibility: visible; } }

@media (prefers-reduced-motion: no-preference) {
  .clp:is([data-play='ready'], [data-play='on']) { animation: clp-clock var(--clp-end) linear both; }
  .clp:is([data-play='ready'], [data-play='on']) .clp__spin { transform-origin: 50% 50%; animation: clp-turn .8s linear infinite, clp-spin var(--clp-work) linear var(--clp-at) both; }
  /* What the step is doing: into focus with the arc, out of it as the tick lands */
  .clp:is([data-play='ready'], [data-play='on']) .clp__doing {
    opacity: var(--clp-in); filter: blur(calc((1 - var(--clp-in)) * 3 * var(--p)));
    animation: clp-doing calc(var(--clp-work) + .14s) linear var(--clp-at) both;
  }
  /* The tick lands where the arc was */
  .clp:is([data-play='ready'], [data-play='on']) .clp__tick {
    opacity: var(--clp-in); scale: calc(.4 + .6 * var(--clp-in)); transform-origin: 50% 50%;
    animation: clp-in .36s var(--clp-land) var(--clp-done) both;
  }
  /* What was done comes into focus where the other words were, as the kit's Stream sets words */
  .clp:is([data-play='ready'], [data-play='on']) :is(.clp__label, .clp__more) {
    opacity: var(--clp-in); filter: blur(calc((1 - var(--clp-in)) * 3 * var(--p)));
    animation: clp-in .42s ease-out calc(var(--clp-done) + .08s) both;
  }
  .clp:is([data-play='ready'], [data-play='on']) .clp__more { animation-delay: calc(var(--clp-done) + .18s); }
  /* The thread is drawn down to the next step */
  .clp:is([data-play='ready'], [data-play='on']) .clp__link {
    opacity: calc(var(--clp-in) * 3); scale: 1 var(--clp-in); transform-origin: 50% 0;
    animation: clp-in .3s var(--clp-arrive) calc(var(--clp-at) - .16s) both;
  }
  .clp:is([data-play='ready'], [data-play='on']) .clp__reply {
    -webkit-mask-image: linear-gradient(90deg, #000 45.4%, #0000 52.4%), linear-gradient(90deg, #000 45.4%, #0000 52.4%);
    mask-image: linear-gradient(90deg, #000 45.4%, #0000 52.4%), linear-gradient(90deg, #000 45.4%, #0000 52.4%);
    -webkit-mask-size: 220% 50%; mask-size: 220% 50%;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    animation: clp-write var(--clp-reply-for) linear var(--clp-reply-at) both;
  }
  /* The outcome rises into the column; its mark lands once the card is there, alone */
  .clp:is([data-play='ready'], [data-play='on']) .clp__result {
    opacity: var(--clp-in); translate: 0 calc((1 - var(--clp-in)) * 10 * var(--p));
    animation: clp-in .6s var(--clp-arrive) var(--clp-result-at) both;
  }
  .clp:is([data-play='ready'], [data-play='on']) .clp__check {
    opacity: var(--clp-in); scale: calc(.35 + .65 * var(--clp-in)); transform-origin: 50% 50%;
    animation: clp-in .46s var(--clp-land) calc(var(--clp-result-at) + .3s) both;
  }
  /* The first frame, held until the picture is looked at. The rules above set `animation` whole,
     which would start each piece again: this one has to win over them. */
  .clp[data-play='ready'], .clp[data-play='ready'] * { animation-play-state: paused !important; }
}

/* ---- The page ----
   The homepage shows the filmed poster (product-ui/renders/h-claim-<language>-<size>.webp).
   claim-play.js lays this layer over it: a sheet of the screen's white over the part of
   the conversation that plays, and over that sheet the poster again, cut into the pieces
   named above. Each cut shows its own part of the poster, in register, so at rest the
   layer and the poster are one picture; the cuts are what the play moves.
   The customer's message is not covered: it is in the picture from the first frame.
   What a step is called while it is worked on is not in the poster: those three lines
   are a second picture, the poster's size and white but for them
   (renders/h-claim-doing-<language>-<size>.webp, made by product-ui/export-claim.py),
   cut the same way.

   Boxes are in the picture's design pixels (540 x 460 wide, 358 x 358 compact), the same
   in every language: the screen is laid out alike in all seven. A cut only ever ends in
   the white between two pieces. product-ui/scripts/claim-cuts.mjs proves all of it
   against the poster and against the scene, in seven languages: run it after any change
   to the screen or to a box. */
[data-claim-play] { position: relative; }
.clp--page { position: absolute; inset: 0; container: clp / size; pointer-events: none; }
/* Shown once the poster it is cut from has arrived, and never where it cannot be placed */
.clp--page:not([data-play]) { display: none; }
/* A piece: its box (--x, --y, --w, --h) in design pixels, from the corner of what holds it (--ox, --oy) */
.clp--page :is(.clp__room, .clp__cover, .clp__cut, .clp__spin, .clp__patch) {
  --u: calc(100cqw / var(--stage));
  position: absolute; 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));
}
.clp--page .clp__cover { background: #fff; }
/* A cut is a window onto the poster. The poster inside it is the picture's own size and stands
   exactly where the picture stands, so the browser sets it on the same pixels as the picture
   under it; only the window's edges, which fall in white, are placed by the cut's own box.
   (Drawn as the cut's background at an offset, each cut was rounded to the screen's pixels on
   its own, and a line of text could sit a pixel off the picture's.) */
.clp--page .clp__cut { overflow: hidden; }
.clp--page .clp__cut > b { position: absolute; left: calc(var(--x) * var(--u) * -1); top: calc(var(--y) * var(--u) * -1); width: 100cqw; height: 100cqh; background: var(--clp-poster) 0 0 / 100% 100% no-repeat; }
.clp--page .clp__doing > b { background-image: var(--clp-doing); }
/* Where the picture of the steps in progress could not be had, the arcs turn without words beside them */
.clp--page[data-plain] .clp__doing { display: none; }
/* The arc, in the ticks' ink */
.clp--page .clp__spin { color: #271d35; }
.clp--page .clp__spin > svg { display: block; width: 100%; height: 100%; }
/* The outcome's mark is part of the outcome's cut. So that it can land after its card, the
   card's own green is laid over it there (--card-y and --card-h place the scene's gradient
   in register), and the mark's own cut, a disc, is set over that. */
.clp--page .clp__patch { background: var(--card) 0 calc((var(--card-y) - var(--y)) * var(--u)) / 100% calc(var(--card-h) * var(--u)) no-repeat; }
.clp--page .clp__check { border-radius: 50%; }

/* Wide: the phone is 326 across, so a point of its screen is 326 / 402 of a design pixel.
   .clp__room is what has to be in the window before the play starts: from the top of the
   customer's photograph to the foot of the last piece (claim-play.js). */
.clp--page { --stage: 540; --p: calc(100cqw / 540 * 326 / 402); --row: 21.8955; --row-0: 275.88; }
.clp--page .clp__room { --x: 120; --y: 119; --w: 300; --h: 327; }
.clp--page .clp__cover { --x: 120; --y: 266; --w: 300; --h: 180; }
.clp--page .clp__spin { --x: 124.84; --y: calc(var(--row-0) + 5.27 + var(--n) * var(--row)); --w: 11.35; --h: 11.35; }
.clp--page .clp__tick { --x: 123; --y: calc(var(--row-0) + 5.9 + var(--n) * var(--row)); --w: 15; --h: 10; }
.clp--page .clp__link { --x: 128; --y: calc(var(--row-0) - 6.2 + var(--n) * var(--row)); --w: 5; --h: 12.4; }
.clp--page :is(.clp__label, .clp__doing) { --x: 142; --y: calc(var(--row-0) + var(--n) * var(--row)); --w: 256; --h: var(--row); }
.clp--page .clp__more { --x: 402; --y: calc(var(--row-0) + 3 + var(--n) * var(--row)); --w: 16; --h: 16; }
.clp--page .clp__reply { --x: 120; --y: 349.68; --w: 300; --h: 35.68; }
.clp--page .clp__result { --x: 120; --y: 395; --w: 300; --h: 49; }
.clp--page .clp__result > i { --ox: 120; --oy: 395; --x: 136; --y: 409.4; --w: 20; --h: 20; --card-y: 396.71; --card-h: 45.41; --card: linear-gradient(180deg, #dcf0e4 0%, #e9f6ee 100%); }

/* Compact: the phone is 310 across. No answer. */
.clp--page[data-size='compact'] { --stage: 358; --p: calc(100cqw / 358 * 310 / 402); --row: 20.8209; --row-0: 222.57; }
.clp--page[data-size='compact'] .clp__room { --x: 36; --y: 110; --w: 286; --h: 227; }
.clp--page[data-size='compact'] .clp__cover { --x: 36; --y: 216; --w: 286; --h: 121; }
.clp--page[data-size='compact'] .clp__spin { --x: 40.97; --y: calc(var(--row-0) + 5.01 + var(--n) * var(--row)); --w: 10.8; --h: 10.8; }
.clp--page[data-size='compact'] .clp__tick { --x: 39.5; --y: calc(var(--row-0) + 5.6 + var(--n) * var(--row)); --w: 14; --h: 9.5; }
.clp--page[data-size='compact'] .clp__link { --x: 44; --y: calc(var(--row-0) - 5.9 + var(--n) * var(--row)); --w: 5; --h: 11.8; }
.clp--page[data-size='compact'] :is(.clp__label, .clp__doing) { --x: 57.5; --y: calc(var(--row-0) + var(--n) * var(--row)); --w: 244; --h: var(--row); }
.clp--page[data-size='compact'] .clp__more { --x: 304.5; --y: calc(var(--row-0) + 2.9 + var(--n) * var(--row)); --w: 15; --h: 15; }
.clp--page[data-size='compact'] .clp__result { --x: 36; --y: 293; --w: 286; --h: 41.5; }
.clp--page[data-size='compact'] .clp__result > i { --ox: 36; --oy: 293; --x: 51; --y: 303.5; --w: 20; --h: 20; --card-y: 294.29; --card-h: 38.56; --card: linear-gradient(180deg, #dcf0e4 0%, #e9f6ee 100%); }
.clp--page[data-size='compact'] .clp__reply { display: none; }
