/* Agent-led shopping: the four agents' characters, each in a white disc, floating.
   One source for the homepage picture and for the `h-agent` Stageshow scene
   (product-ui/src/home.tsx), which films the poster this layer rests on.

   On the page the picture is the filmed plate (`h-agent-plate-<language>-<size>.webp`:
   the scene without its characters) with this layer over it, so the characters can
   move. At rest the two together are the filmed poster, pixel for pixel
   (`h-agent-<language>-<size>.webp`); with reduced motion they stay at rest.

   Lengths are the scene's own design pixels, 600 x 440 wide and 358 x 358 compact,
   scaled to the picture by --u. The layer reads which of the two it is from the
   picture's shape, so the page and the scene need say nothing. */
.agc { position: absolute; inset: 0; container: agc / size; pointer-events: none; }

/* A disc: the centre (--x, --y) and diameter (--d) of where it rests, back to front in
   the markup. No two edges kiss: neighbours overlap by 8px or more or stand 8px or more
   apart, and a disc crosses the phone's edge by 10px or more or stays 8px clear of it.
   The float only ever lifts a disc from where it rests, so the screen and the shopper's
   words are never approached, and neighbours keep 5px or more of their overlap.
   Every character is whole: a disc drawn over a neighbour's never comes within 5px of
   that neighbour's character. Dots fills its disc at its lower corners, so it is stood
   over at its upper sides only, in a disc with room to spare; Instinct is stood over at
   its sides, never at its head or feet; nothing stands over Grok Bot or Muse.
   Since 14 November 2026 the picture is a phone's screen. Wide, the cluster floats at the
   phone's left: Muse on the ground, Instinct above it, Grok Bot over the phone's edge,
   beside the status bar and above the steps, where the screen is empty, Dots below. Each
   disc has a hairline, so its edge holds where it stands on the white screen.
   product-ui/scripts/cast-room.mjs measures all of this in seven languages, at rest and
   through the float: run it after any change to a disc or to the screen. */
.agc__face, .agc__pay, .agc__room { --stage: 600; --u: calc(100cqw / var(--stage)); }
.agc__face {
  position: absolute; left: calc((var(--x) - var(--d) / 2) * var(--u)); top: calc((var(--y) - var(--d) / 2) * var(--u)); width: calc(var(--d) * var(--u)); height: calc(var(--d) * var(--u));
  display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 calc(.75 * var(--u)) #06333a17, 0 var(--u) calc(2 * var(--u)) #06333a33, 0 calc(14 * var(--u)) calc(28 * var(--u)) calc(-12 * var(--u)) #06333a8c;
}
/* A character: its owner's art, whole, never redrawn (product-ui/assets/BRAND-MARKS.md).
   --w by --h is its footprint in its disc: the families fill their own boxes differently,
   so each is sized for the four to read as one size. --up lifts a shape that carries its
   weight low onto its optical centre. */
.agc__face > img { display: block; width: calc(var(--w) * var(--u)); height: calc(var(--h) * var(--u)); max-width: none; object-fit: contain; translate: 0 calc(var(--up, 0) * -1 * var(--u)); }

/* Dots (Alfred): a triangle reads smaller than a round shape, so a little larger, and raised; its disc has room to be stood over */
.agc__face--dots { --x: 152; --y: 258; --d: 90; --w: 66; --h: 66; --up: 3; }
/* Instinct: a tall figure, the one image supplied */
.agc__face--instinct { --x: 168; --y: 128; --d: 78; --w: 22; --h: 59; }
/* Grok Bot (Tyler): a drop carries its weight low, raised a pixel */
.agc__face--grok { --x: 225; --y: 131; --d: 64; --w: 46; --h: 46; --up: 1; }
/* Muse: a portrait that fills its disc, the body running out under the rim */
.agc__face--muse { --x: 96; --y: 180; --d: 120; --w: 120; --h: 120; }

/* The compact picture is square, and the phone stands in it with a gutter on either side: the
   four stand on the phone's top edge, between the clock and the status glyphs, each partly on
   the ground and partly on the screen (Grok Bot, Dots, Muse, Instinct, at four heights) */
@container agc (max-aspect-ratio: 6 / 5) {
  .agc__face, .agc__pay, .agc__room { --stage: 358; }
  /* On a phone the discs stand on the screen's top edge: a shorter fall, so their shadow does not pool on the white under them */
  .agc__face { box-shadow: 0 0 0 calc(.75 * var(--u)) #06333a17, 0 var(--u) calc(2 * var(--u)) #06333a33, 0 calc(8 * var(--u)) calc(16 * var(--u)) calc(-8 * var(--u)) #06333a80; }
  .agc__face--dots { --x: 139; --y: 62; --d: 52; --w: 30; --h: 30; --up: 2; }
  .agc__face--instinct { --x: 220; --y: 43; --d: 42; --w: 11; --h: 30; }
  .agc__face--grok { --x: 112; --y: 42; --d: 34; --w: 25; --h: 25; --up: 1; }
  .agc__face--muse { --x: 180; --y: 46; --d: 56; --w: 56; --h: 56; }
}

/* The float (user request of 13 November 2026: a small animation that gives the feeling
   the characters float, "léger, pas excessif"). Each disc rises a few pixels from where
   it rests and comes back, and leans a pixel or so to one side on a slower clock, so
   its path never quite repeats. Every disc has its own two clocks and is already
   somewhere along them when the picture appears (the negative delays): four things in
   the air, not one cluster going up and down, from the first second.
   --rise and --lean are percentages of the disc: 4 to 5px up and under 2px across on the
   wide picture, about 2.5px and 1px on the compact one. Move them only by small steps, and
   keep 5px of every overlap and 5px round every character a neighbour stands over:
   Instinct, with Muse over its rim, has the least room on the wide picture, and Dots,
   with Grok Bot over its rim, on the compact one.

   How it is drawn. A transform animated in the usual way moves a picture of the disc,
   taken once, to fractions of a pixel, and the characters go soft while they travel:
   measured in Chromium, their edges fell to between a half and three quarters of their
   strength at rest, on ordinary and on dense screens alike. So what is animated is two
   registered numbers, --agc-rise and --agc-lean, from 0 to 1, and the disc's place is
   computed from them: the browser then draws each character afresh where it stands, as
   sharp as at rest. The price is a little work on the page's own thread (about a
   millisecond a frame) while the picture is on the screen, and none while it is not.
   Do not go back to animating `translate` or `transform` directly.
   The animations' names are registered values too: a browser that cannot register a
   property reads them as `none` and has no float, where it would otherwise jump. */
@property --agc-rise { syntax: '<number>'; inherits: false; initial-value: 0; }
@property --agc-lean { syntax: '<number>'; inherits: false; initial-value: 0; }
@property --agc-rises { syntax: '<custom-ident>'; inherits: false; initial-value: agc-rise; }
@property --agc-leans { syntax: '<custom-ident>'; inherits: false; initial-value: agc-lean; }
@keyframes agc-rise { to { --agc-rise: 1; } }
@keyframes agc-lean { to { --agc-lean: 1; } }
@media (prefers-reduced-motion: no-preference) {
  .agc__face {
    translate: calc(var(--agc-lean, 0) * var(--lean, 0) * 1%) calc(var(--agc-rise, 0) * var(--rise, 0) * -1%);
    animation: var(--agc-rises, none) var(--rise-for) cubic-bezier(.37, 0, .63, 1) var(--rise-in, 0s) infinite alternate, var(--agc-leans, none) var(--lean-for) cubic-bezier(.37, 0, .63, 1) var(--lean-in, 0s) infinite alternate;
  }
  .agc__face--dots { --rise: 5; --rise-for: 3.3s; --rise-in: -2s; --lean: -1.1; --lean-for: 5.3s; --lean-in: -6.4s; }
  .agc__face--instinct { --rise: 6; --rise-for: 2.9s; --rise-in: -4.6s; --lean: .9; --lean-for: 4.7s; --lean-in: -1.4s; }
  .agc__face--grok { --rise: 6.6; --rise-for: 2.6s; --rise-in: -2.9s; --lean: -2.2; --lean-for: 4.3s; --lean-in: -3.4s; }
  .agc__face--muse { --rise: 3.9; --rise-for: 3.9s; --lean: 1.3; --lean-for: 6.1s; --lean-in: -9.2s; }
  /* Held at rest for the filmed poster, and stopped while the picture is off the screen */
  .agc[data-still] .agc__face { animation: none; }
  .agc[data-away] .agc__face { animation-play-state: paused; }
  /* The floating layer is drawn on its own: each frame the browser redraws four discs on a
     clear sheet and nothing of the page under them. Without this the page's own tiles were
     redrawn sixty times a second, and on a machine without graphics acceleration that
     stalled the page for over half a second at a time. */
  .agc:not([data-still]) { will-change: transform; }
}

/* The wink (user request of 13 November 2026: when "Check out" is clicked in the picture,
   Muse winks; since 16 November 2026 the page also plays the payment and the wink by itself
   when a reader arrives at the picture, see "The arrival" below). Two things, both here so
   that the page and the scene have them alike.

   The button. "Check out" is part of the filmed picture, so what is clicked is a clear
   element laid exactly over it. Its box is the button as the film painted it: since
   14 November 2026 the picture is a phone's screen and the button runs the width of the
   cart, a capsule, so it is the same box in every language (270.5px from the picture's
   left edge, 353.5px from its top, 259.2px by 39px, in the picture's design pixels: the
   scene lays the button out a quarter of a pixel wider, and the film sets its edges on
   the picture's half pixels). product-ui/scripts/qa-home.mjs reads the
   button's edges off each plate and holds this box to them, so film the plates and run it
   after any change to the screen. Under the pointer the violet
   deepens a step, and another when pressed, as the kit's button does. It is done by
   filtering what lies under the element, not by laying a tint over it: a tint would grey
   the white word with the violet, and would show as a line on the card
   wherever the element stood a fraction of a pixel off the button. The filter dims by a
   twentieth (a tenth when pressed) and then raises the contrast by just what brings
   white back to white, so the violet deepens and the word and the card do not change
   (the card is a pale grey since 14 November 2026, and moves by less than one level):
   keep the two numbers of each pair in step (contrast = 0.5 / (brightness - 0.5)). The
   step is eased over 0.16s, as the kit's button eases its own, and the press over half
   that; white stays white all the way between two steps. It is not a
   control: it does nothing but confirm the payment and make Muse wink, so it takes no
   focus and is hidden from a screen reader, with the rest of this layer. The phone's
   picture has the button as well, with its own box (below).

   The eye. Muse's portrait is not touched. Over it lies a second picture of the same
   size, clear everywhere but round one eye, where that eye is shut
   (product-ui/scripts/prepare-muse-wink.py). At rest it is not shown. For the wink it is
   shown through a mask with a soft oval hole over the eye, as wide as the eye, through
   which the open eye is still seen; the hole flattens onto the eye's own line (61.76% by
   52.35% of the disc) until nothing of it is left, so the bead is seen to flatten into
   the shut eye, as lids close, and never to fade into it. --agc-wink, 0 to 1, is how far
   shut: the hole's half height is what is left of 4.3% of the disc, and at 0.14 its
   clear part just holds the whole bead, which is where the wink starts and ends, so the
   lids are seen to move from the first frame. Then it is held shut for half a second and
   opened again a little more slowly: 0.8s in all. It was 0.62s at first, with a third of
   a second shut; the fresh-eye review found the wink easy to miss, since the click is at
   the picture's other corner, and asked for a longer hold and no other motion.
   Nothing else moves; the disc goes on floating as it was. --agc-wink is a registered
   number, like the float's, so the eye is drawn afresh on every frame; a browser that
   cannot register it shuts and opens the eye in one step each. With reduced motion the
   eye is shut and opened with no travel, and the disc stays at rest. agent-cast.js
   starts it (data-wink on the layer) and ends it. */
.agc__pay {
  position: absolute; left: calc(270.5 * var(--u)); top: calc(353.5 * var(--u)); width: calc(259.2 * var(--u)); height: calc(39 * var(--u));
  border-radius: calc(19.5 * var(--u)); cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  transition: -webkit-backdrop-filter .16s ease, backdrop-filter .16s ease;
}
/* It takes the pointer only where a click can make Muse wink: agent-cast.js marks the page as it starts.
   Without it the button is a picture of a button, as before: no hand, no deepening, nothing to click. */
.agc-winks .agc__pay { pointer-events: auto; }
@media (hover: hover) {
  .agc__pay:hover { -webkit-backdrop-filter: brightness(.95) contrast(1.112); backdrop-filter: brightness(.95) contrast(1.112); }
}
.agc__pay:active { -webkit-backdrop-filter: brightness(.9) contrast(1.25); backdrop-filter: brightness(.9) contrast(1.25); transition-duration: .08s; }
/* The phone's picture has the button too, since 14 November 2026 (the user was asked, and wanted the
   click answered on phones as well): its own box there, read off the compact plates as the wide one is */
@container agc (max-aspect-ratio: 6 / 5) {
  .agc__pay { left: calc(61.73 * var(--u)); top: calc(279.36 * var(--u)); width: calc(234.62 * var(--u)); height: calc(34.02 * var(--u)); border-radius: calc(17.01 * var(--u)); }
}

/* The payment (user request of 14 November 2026: a click on "Check out" must answer on
   the button itself, and must not be repeatable at once; the user's own example was the
   button turning into a violet tick). The button gathers itself into a disc, a tick is
   drawn in it, it is held for two seconds, and the button comes back: 3.4s in all, and
   for that time the element takes no pointer, so a second click finds nothing to press.
   Muse winks while the tick is held (agent-cast.js starts the wink a second after the
   click, when the tick has landed and the eye has had time to leave the button).

   The button is in the filmed picture and its word is set in the picture's own face,
   which the page does not load, so nothing here writes a word. Three layers do it:
   - ::before, a capsule in the button's own violet, exactly over the painted one. It
     appears first, in a tenth of a second, so the painted word is seen to fade into the
     button; it is what then narrows to a disc, by its clip, and widens again;
   - the card's grey under it, which hides the painted button from the moment the capsule
     covers it until the capsule covers it again. It is switched, never faded: half
     shown it would pale the button. It is the layer's own ::before, drawn under the
     button's element: a plain rectangle three pixels larger than the button all round,
     so the grey is one shape with room to spare. A ground of the button's own shape
     with a ring round it left a seam between the two, and the painted button's corners
     showed through it as a faint arc (found by the fresh-eye review of 14 November
     2026). Its square corners do not show: the card round the button is that same grey
     for 11px on every side. Its edge is soft (a shadow of the same grey, four pixels
     deep), so that a level's difference with the picture would draw no line. The
     button's element keeps its box throughout: nothing changes size when the layer is
     marked;
   - ::after, the tick, white, wiped in from the left as a hand draws it.
   The violet and the grey are the plate's own, as its compression gives them and as a
   browser shows them (#6435e9 and #f6f5f8 in all seven languages: one level off the
   scene's #6335e8 and #f5f5f7), so nothing steps where the layers meet the picture.
   Read them off the plates again if the plates are ever made another way.
   At the end the capsule fades and the painted word comes back through it. Nothing is
   scaled, so the disc and the tick are drawn sharp at every step; the clips animate by
   themselves in every browser, with no registered property.
   The three animations have one length; agent-cast.js marks the layer data-paid for it
   and takes the mark off when the grey's own (agc-paid) has ended. Marked without an
   animation, the button is the disc with its tick: that is what reduced motion shows, in
   place, for two seconds. The pressed violet goes back to the plain one as the capsule
   appears, since the element no longer takes the pointer. */
.agc__pay::before, .agc__pay::after { content: ''; position: absolute; visibility: hidden; pointer-events: none; }
.agc__pay::before { inset: 0; border-radius: calc(19.5 * var(--u)); background: #6435e9; --agc-disc: inset(0 calc(110.1 * var(--u)) round calc(19.5 * var(--u))); --agc-pill: inset(0 0 round calc(19.5 * var(--u))); }
.agc__pay::after {
  left: 50%; top: 50%; width: calc(26 * var(--u)); height: calc(26 * var(--u)); margin: calc(-13 * var(--u)) 0 0 calc(-13 * var(--u)); background: #fff;
  --tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23000' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.6 10.5l3.7 3.7 7.1-8.2'/%3E%3C/svg%3E");
  -webkit-mask: var(--tick) 0 0 / 100% 100% no-repeat; mask: var(--tick) 0 0 / 100% 100% no-repeat;
}
.agc::before { --stage: 600; --u: calc(100cqw / var(--stage)); content: ''; position: absolute; left: calc(267.5 * var(--u)); top: calc(350.5 * var(--u)); width: calc(265.2 * var(--u)); height: calc(45 * var(--u)); visibility: hidden; }
.agc[data-paid]::before { visibility: visible; background-color: #f6f5f8; box-shadow: 0 0 calc(4 * var(--u)) #f6f5f8; }
.agc[data-paid] .agc__pay { pointer-events: none; }
.agc[data-paid] .agc__pay::before { visibility: visible; clip-path: var(--agc-disc); }
.agc[data-paid] .agc__pay::after { visibility: visible; }
/* The same three layers on the phone's picture, at its button's size */
@container agc (max-aspect-ratio: 6 / 5) {
  .agc::before { --stage: 358; left: calc(58.73 * var(--u)); top: calc(276.36 * var(--u)); width: calc(240.62 * var(--u)); height: calc(40.02 * var(--u)); }
  .agc__pay::before { border-radius: calc(17.01 * var(--u)); --agc-disc: inset(0 calc(100.3 * var(--u)) round calc(17.01 * var(--u))); --agc-pill: inset(0 0 round calc(17.01 * var(--u))); }
  .agc__pay::after { width: calc(22.6 * var(--u)); height: calc(22.6 * var(--u)); margin: calc(-11.3 * var(--u)) 0 0 calc(-11.3 * var(--u)); }
}
@media (prefers-reduced-motion: no-preference) {
  .agc[data-paid]::before { animation: agc-paid 3.4s step-end both; }
  .agc[data-paid] .agc__pay::before { animation: agc-paid-pill 3.4s linear both; }
  .agc[data-paid] .agc__pay::after { animation: agc-paid-tick 3.4s linear both; }
}
/* The card's grey under the button: on once the capsule covers the painted button (0.12s), off once it covers it again (3.23s) */
@keyframes agc-paid {
  0% { background-color: #f6f5f800; box-shadow: 0 0 calc(4 * var(--u)) #f6f5f800; }
  3.5% { background-color: #f6f5f8; box-shadow: 0 0 calc(4 * var(--u)) #f6f5f8; }
  95%, 100% { background-color: #f6f5f800; box-shadow: 0 0 calc(4 * var(--u)) #f6f5f800; }
}
/* The capsule: in (0.12s), gathered into a disc (0.34s), held, opened again (0.34s), out (0.17s) */
@keyframes agc-paid-pill {
  0% { opacity: 0; clip-path: var(--agc-pill); }
  3.5% { opacity: 1; clip-path: var(--agc-pill); animation-timing-function: cubic-bezier(.65, 0, .2, 1); }
  13.5% { opacity: 1; clip-path: var(--agc-disc); }
  82% { opacity: 1; clip-path: var(--agc-disc); animation-timing-function: cubic-bezier(.65, 0, .2, 1); }
  92%, 95% { opacity: 1; clip-path: var(--agc-pill); }
  100% { opacity: 0; clip-path: var(--agc-pill); }
}
/* The tick: drawn as the disc closes (0.27s), held two seconds, gone before the button opens */
@keyframes agc-paid-tick {
  0%, 12% { opacity: 1; clip-path: inset(0 100% 0 0); animation-timing-function: cubic-bezier(.3, 0, .3, 1); }
  20%, 77% { opacity: 1; clip-path: inset(0 0 0 0); }
  82%, 100% { opacity: 0; clip-path: inset(0 0 0 0); }
}

/* The arrival (user request of 16 November 2026: the payment must play by itself when the
   reader arrives at the picture, where it took a click on "Check out"). agent-cast.js plays
   it, by the same two marks as a click, once each time the picture is looked at; a click
   plays it still. Nothing of the payment or of the wink changed for it.
   .agc__room is what has to be in the window, under the page's header, before it plays:
   the screen from the top of Muse's disc, at the height of its float, to the foot of the
   cart, so that the button and the eye that answer are both seen. It is the script's own
   element, set in the layer on the page only, and nothing of it is drawn. Wide, Muse's disc
   rests 120px down and rises under 5px, and the cart's foot is 36px from the picture's
   (404px down); on the phone's picture Muse's head is 18px down and the cart's foot 322px.
   A window that cannot hold the room with room to spare is asked for the button whole
   instead (.agc__pay, above): agent-cast.js says why. */
.agc__room { position: absolute; left: 0; width: 100%; top: calc(115 * var(--u)); height: calc(289 * var(--u)); visibility: hidden; pointer-events: none; }
@container agc (max-aspect-ratio: 6 / 5) {
  .agc__room { top: calc(15 * var(--u)); height: calc(307 * var(--u)); }
}

@property --agc-wink { syntax: '<number>'; inherits: false; initial-value: 0; }
.agc__face--muse > img, .agc__face--muse::after { grid-area: 1 / 1; }
.agc__face--muse::after {
  content: ''; width: calc(var(--w) * var(--u)); height: calc(var(--h) * var(--u)); visibility: hidden;
  background: url(product-ui/assets/agents/muse-wink.webp) 0 0 / 100% 100% no-repeat;
  /* The hole: clear to 72% of its radius, so its soft rim starts outside the bead when the eye is open.
     It is never asked to have no height at all, which browsers need not draw alike: it stops at a quarter
     of a percent, and for the last two hundredths of the travel a plain second layer lets the whole
     picture through (--shut: nothing below 0.98, everything at 1), so shut is shut in every browser. */
  --hole: radial-gradient(ellipse 3.9% max(.25%, (1 - var(--agc-wink, 0)) * 4.3%) at 61.76% 52.35%, #0000 72%, #000);
  --shut: clamp(0%, (var(--agc-wink, 0) - .98) * 5000%, 100%);
  -webkit-mask: var(--hole), linear-gradient(#000, #000) 0 0 / var(--shut) 100% no-repeat;
  mask: var(--hole), linear-gradient(#000, #000) 0 0 / var(--shut) 100% no-repeat;
}
.agc[data-wink] .agc__face--muse::after { visibility: visible; animation: agc-wink .8s linear both; }
/* The lids fall gathering speed (0.1s), stay shut for half a second, and part more gently (0.18s) */
@keyframes agc-wink {
  0% { --agc-wink: .14; animation-timing-function: cubic-bezier(.4, 0, .85, .7); }
  12.5% { --agc-wink: 1; }
  77.5% { --agc-wink: 1; animation-timing-function: cubic-bezier(.2, .5, .4, 1); }
  100% { --agc-wink: .14; }
}
/* With reduced motion nothing animates on this site (redesign.css), so the eye is simply shut
   while the layer is marked, and agent-cast.js takes the mark off after half a second */
@media (prefers-reduced-motion: reduce) {
  .agc[data-wink] .agc__face--muse::after { animation: none; --agc-wink: 1; }
}

/* On the page the layer waits for its picture: it is shown, in one soft step, once the
   plate and the four characters have all arrived (agent-cast.js marks it data-ready), so
   a slow connection never shows discs on an empty frame or empty discs on the picture.
   If one of the five cannot be had, the script puts the filmed poster in the plate's
   place and takes the layer away. Without JavaScript nothing waits. If the script never
   runs (it marks the layer data-wait as it starts), the layer shows itself. */
.js .agc[data-agent-cast] { opacity: 0; transition: opacity .4s ease; }
.js .agc[data-agent-cast][data-ready] { opacity: 1; }
.js .agc[data-agent-cast]:not([data-ready]):not([data-wait]) { animation: agc-arrive .4s ease 8s forwards; }
@keyframes agc-arrive { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .js .agc[data-agent-cast] { transition: none; }
}

/* A browser too old to size the layer from its picture shows the poster whole instead (agent-cast.js) */
@supports not (container-type: size) {
  .agc { display: none; }
}
