/* Ending: the styles, all inside #ending.
     the words     "That's lumi" (only its name in its own lettering, its colours moving through it)
                   and its line, beside the stage
     the stage     his chair photo on the floor shadow his About photo stands on (the same file);
                   Lumi at the far end, its bubble up and to its left; its four other looks float
                   over the floor, drift, press into each other softly and now and then say something
     under it      one soft panel: his closing words and his two AI credentials
   FULL WIDTH: every size is counted from the section's own width (cqw).
   THREE WIDTHS: over 1000 the words sit beside the stage; 641 to 1000 they sit above it;
   640 and under Lumi sits beside his head and its other looks walk the floor in front of him.
   Nothing here crops, masks or clips his photo, Lumi, its other looks or a shadow (the shadows fade
   out). Lumi, its bubble and the looks' small speech boxes are the shared helper's; this file only
   gives it a seat (e-seat). It floats by a translate that the section's script sets on its canvas
   and its words (nothing is laid out again). Its other looks are moved by the script (transform
   only); this file gives them a size and a shadow. The air above and below is the page's
   (--section-padding). */
@keyframes e-up { from { opacity: 0; transform: translateY(var(--space-600)); } to { opacity: 1; transform: none; } }
@keyframes e-drift { to { background-position: 200% 0; } }

#ending {
  .e10 {
    --g: var(--cs-side);                       /* the side air (page.css): stops at the page column */
    --ink: var(--neutral-950); --sub: var(--neutral-600);
    --d: min(17.25cqw, 19.5rem);               /* Lumi's width */
    --ph: min(42cqw, 46rem);                   /* his photo's height */
    --pw: calc(var(--ph) * 0.5625);            /* his photo's width (675 by 1200) */
    --step: calc(var(--duration-stagger) * 4); /* one beat between two parts landing */
    position: relative; color: var(--ink);
    scroll-margin-top: var(--section-padding);
  }
  .e10 [hidden] { display: none; }
  .e-in { box-sizing: border-box; padding-inline: var(--g); }

  /* ---- Lumi's layer (the shared helper places it) ---- */
  .e-lumi { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; opacity: 0; transition: opacity var(--duration-slow) var(--ease-default); }
  .e10[data-on~="lumi"] .e-lumi { opacity: 1; }
  .lumi-say { z-index: 5; }
  /* dark: the sections read the grey ramp the other way round (page.css), which turned the bubble's light ink
     dark on the dark room (2.1:1); its two inks take the ramp's own steps back, as the chat windows do */
  html[data-theme="dark"] & .lumi-say { --neutral-150: var(--cs-n150); --neutral-950: var(--cs-n950); }
  /* what it says, once, for a screen reader: its bubble's lines change, so the bubble itself is hidden from it */
  .e-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
  .lumi-say.e-chat { z-index: 4; pointer-events: none; }   /* what its other looks say: the helper's own plain box, under its own words */

  /* ---- the words: the heading, then its line. Nothing else in the section is set as large as either. ---- */
  .m-top { display: grid; grid-template-columns: minmax(min-content, 5fr) minmax(0, 7fr); gap: var(--g); align-items: end; }
  .m-words { align-self: center; }
  /* "That's" in the page's own heading face; only its name in its own lettering */
  .e-h {
    margin: 0; font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: var(--display-tight);
    font-size: min(clamp(var(--size-2xl), 6.6cqw, 6.2rem), var(--cap, 100rem));   /* its own ceiling, so the scene keeps its room whatever the hero does; and under the hero title (the page's rule): --cap is read by the section's script */
    line-height: var(--line-display); color: var(--ink);
  }
  .e-h > span { display: block; white-space: nowrap; }
  /* its name as its chat window and his teaser film set it: the body face, medium, tight, lower case.
     1.17 of the heading's size, so its l stands as tall as the heading's capital T */
  .e-name { font-family: var(--font-body); font-weight: var(--weight-medium); letter-spacing: var(--tracking-tight); font-size: 1.17em; line-height: 0; }
  /* its colours moving through its name. Only the three of its colours that hold 3 to 1 on
     this white ground along the whole blend: red, purple, blue (3.52 to 4.05). Still under Reduce motion. */
  @supports ((-webkit-background-clip: text) or (background-clip: text)) {
    .e-name {
      margin: -0.08em -0.04em; padding: 0.08em 0.04em;   /* room for the letters' tops and tails, so no letter loses its colour */
      background: linear-gradient(90deg, var(--fx-spectrum-1), var(--fx-spectrum-6), var(--fx-spectrum-5), var(--fx-spectrum-6), var(--fx-spectrum-1)) 0 0 / 200% 100%;
      -webkit-background-clip: text; background-clip: text; color: transparent;
      animation: e-drift calc(var(--fx-spectrum-spin) * 3) linear infinite;
    }
    .e10:is([data-motion-paused], [data-away]) .e-name { animation-play-state: paused; }
  }
  .e-sub {
    margin: clamp(var(--space-400), 2cqw, var(--space-600)) 0 0; max-width: 30ch;
    font-size: clamp(var(--size-lg), 2.1cqw, 2.25rem); font-weight: var(--weight-medium); line-height: var(--line-snug); text-wrap: balance; color: var(--sub);
  }
  .e-label {
    display: block; font: var(--weight-semibold) var(--text-label)/1.4 var(--font-mono);
    letter-spacing: var(--tracking-eyebrow); text-transform: uppercase; color: var(--color-text-tertiary);
  }

  /* ---- the stage: he sits with his shoes on its bottom edge; that edge is the floor ---- */
  .m-stage { position: relative; height: calc(var(--ph) * 0.885); }   /* his shoes end 88.5% down his photo */
  .m-stage .e-chair { position: absolute; z-index: 1; left: 0; bottom: calc(var(--front, 0px) - var(--ph) * 0.115); display: block; width: auto; max-width: none; height: var(--ph); }
  /* his floor shadow: the home hero's own (shadow-00, his pick 21 Nov 2026, chat CHAIR LEGS), laid as the hero lays it
     (hero-me.js lay()): a box 1.2 times his width, a tenth of his width left of him, its lower 500 of 1200 rows */
  .m-stage .e-floor {
    position: absolute; z-index: 0; left: calc(var(--pw) * -0.1); bottom: calc(var(--front, 0px) - var(--ph) * 0.115);
    display: block; width: calc(var(--pw) * 1.2); max-width: none; height: calc(var(--ph) * 0.41667); pointer-events: none;
  }
  .e-seat {
    position: absolute; display: block; width: var(--d); height: var(--d); pointer-events: none;
    top: calc(var(--ph) * 0.34 - var(--d) / 2);                 /* level with his shoulder */
    /* at the far end, further right: its body may stand up to a tenth of its
       width past the words' edge, and always keeps 0.14 of its width inside the row's side. Its
       drawn glow reaches about 0.05 past its body and its float 0.05 more, so nothing of it is cut;
       only the empty part of its canvas runs past the row. */
    right: max(calc(var(--d) * -0.1), calc(var(--d) * 0.14 - var(--g)));
  }

  /* its other looks: live, floating over the floor. The script moves and squashes them (transform);
     each throws a soft light in its own colours onto the floor under it, the home hero's own (critter.js) */
  .e-m { position: absolute; z-index: 2; left: 0; bottom: 0; width: var(--dm); height: var(--dm); pointer-events: none; }
  .e-mb { position: absolute; inset: 0; display: block; transform-origin: 50% 100%; }
  .e-m canvas {
    position: absolute; left: 50%; top: 50%; display: block;
    width: calc(var(--dm) / 0.56); height: calc(var(--dm) / 0.56);   /* the engine's own square: its body is 0.56 of it */
    margin: calc(var(--dm) / -1.12) 0 0 calc(var(--dm) / -1.12);
  }
  .e-talk { position: absolute; left: 0; top: 0; z-index: 2; display: block; pointer-events: none; }   /* one of them while it talks: its canvas out of its wrapper's squash, placed by the shared helper (ending.js lift) */
  /* each one's floor light (critter.js, Critter.floorLight) sits under its body, behind it; the clear Lumi's on the stage's floor */
  .e-m .lumi-fl { z-index: 0; }
  .m-stage .e-lfl { z-index: 1; }
  .e-m[data-look="sunny"] { --dm: calc(var(--ph) * 0.16); }
  .e-m[data-look="nerdy"] { --dm: calc(var(--ph) * 0.115); }
  .e-m[data-look="calm"] { --dm: calc(var(--ph) * 0.13); }
  .e-m[data-look="funny"] { --dm: calc(var(--ph) * 0.14); }

  /* the pause control: the stage itself, see-through (the site's one pattern; nothing is ever shown) */
  .e-pause {
    position: absolute; inset: 0; z-index: 6; display: block; width: 100%; height: 100%; margin: 0; padding: 0; border: 0;
    background: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .e-pause:focus-visible { outline: var(--space-50) solid var(--color-focus-ring); outline-offset: calc(var(--space-50) * -1); }
  .e10:not([data-js]) .e-pause { display: none; }

  /* ---- under the stage: one soft panel: his closing words, and his two AI credentials ---- */
  .m-low { margin-top: clamp(var(--space-700), 5cqw, var(--space-900)); }
  .m-close {
    box-sizing: border-box; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--space-500); row-gap: var(--space-600); align-items: center;
    padding: clamp(var(--space-500), 3cqw, var(--space-800)); border-radius: var(--radius-xl); background: var(--neutral-100);
  }
  .c-main { grid-column: 1 / span 7; }
  .c-say {
    margin: 0; max-width: 34ch; font-size: clamp(var(--size-lg), 1.75cqw, 1.75rem); font-weight: var(--weight-regular);
    line-height: var(--line-snug); color: var(--ink); text-wrap: pretty;
  }
  .c-me { margin: var(--space-500) 0 0; font-size: var(--size-sm); line-height: var(--line-title); color: var(--sub); }
  .c-me b { margin-right: var(--space-200); font-size: var(--size-base); font-weight: var(--weight-semibold); color: var(--ink); }
  /* his two AI credentials, as his site names them, with their own marks in their own colours */
  .c-creds { grid-column: 9 / -1; display: grid; gap: var(--space-500); margin: 0; padding: 0; list-style: none; }
  .c-creds li { display: grid; grid-template-columns: var(--space-800) minmax(0, 1fr); column-gap: var(--space-400); align-items: center; }
  .c-creds img { display: block; justify-self: center; width: var(--space-700); height: var(--space-700); object-fit: contain; }
  .c-creds img.c-wide { width: var(--space-800); height: auto; }
  .c-creds li > span { display: grid; font-size: var(--size-sm); line-height: var(--line-title); color: var(--sub); }
  .c-creds b { font-size: var(--size-base); font-weight: var(--weight-semibold); color: var(--ink); text-wrap: balance; }

  /* ================= NEXT CASE STUDY: the Bupa film on its own ground, edge to edge, to the page end (his pick, 19 Nov 2026) =================
     No card and no tile. The Hiring line closes the Lumi story above the label; the label stays where it
     was. Then a full-bleed band in the film's own lilac ground (--nx-g, measured from the film as the
     browser draws it and from its still, within 1 to 3 levels) runs from a soft fade out of the page down
     to the page's end, and the film sits on it at its foot, so its lower edge (where its tiles' shadows
     run out of the frame) is the end of the page. Its sides and its top 1.8% fade into the band, over
     ground only: its tiles start 2.2% from its top. In dark a fade from black to lilac reads as a grey
     smear, so the band starts with a clean full-bleed edge; its words keep dark ink there. The film
     shows at most 960 px wide, its own 1920 at 2x. The section has no bottom air (data-seam="bottom"). */
  .e-next { display: flex; flex-direction: column; margin-top: clamp(var(--space-800), 8cqw, var(--space-1000)); }
  .e-next-k { margin-bottom: var(--space-400); }
  .e-next-link {
    --nx-g: rgb(236 235 242); /* lint-ok: the Bupa film's own ground, measured */
    --ink: var(--cs-n950, var(--neutral-950)); --sub: var(--cs-n600, var(--neutral-600));
    box-sizing: border-box; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: end;
    gap: var(--space-700); margin-inline: calc(-1 * var(--g)); padding: var(--space-1000) var(--g) 0;
    background: linear-gradient(to bottom, transparent, var(--nx-g) var(--space-1000)); color: var(--ink); text-decoration: none;
  }
  html[data-theme="dark"] & .e-next-link { background: var(--nx-g); }
  .e-next-img { position: relative; order: 2; display: block; justify-self: end; width: 100%; max-width: calc(var(--space-1000) * 7.5); aspect-ratio: 16 / 9; }
  .e-next-img :is(img, video) {
    position: absolute; inset: 0; display: block; width: 100%; height: 100%;
    -webkit-mask: linear-gradient(to right, transparent, black 7%, black 93%, transparent), linear-gradient(to bottom, transparent, black 1.8%); -webkit-mask-composite: source-in;
    mask: linear-gradient(to right, transparent, black 7%, black 93%, transparent), linear-gradient(to bottom, transparent, black 1.8%); mask-composite: intersect;
  }
  .e-next-film { opacity: 0; transition: opacity var(--duration-base) var(--ease-default); }
  .e-next-film[data-on] { opacity: 1; }
  .e-next-text { display: flex; flex-direction: column; align-items: flex-start; align-self: center; padding-bottom: var(--space-800); }
  .e-next-logo img { display: block; width: auto; height: clamp(4.5rem, 7vw, 6rem); border-radius: var(--radius-sm); }
  .e-next-name {
    margin-top: var(--space-400); font-family: var(--font-display); font-weight: var(--display-weight); text-transform: uppercase;
    font-size: clamp(3.5rem, 7.5vw, 6.5rem); line-height: 0.95; color: var(--ink); /* lint-ok: his live card's own size */
  }
  .e-next-title { margin-top: var(--space-200); font-size: var(--size-xl); line-height: var(--line-title); max-width: 30ch; color: var(--sub); }
  .e-next-cta {
    display: inline-flex; align-items: center; gap: var(--btn-gap); box-sizing: border-box; min-height: var(--touch-target-min);
    margin-top: var(--space-500); padding: var(--btn-pad-y) var(--btn-pad-x); border-radius: var(--btn-radius);
    background: var(--btn-primary-bg); color: var(--btn-primary-fg); font-size: var(--btn-font-size); font-weight: var(--btn-font-weight);
    transition: var(--btn-transition);
  }
  .e-next-cta i {
    flex: none; width: var(--btn-glyph); height: var(--btn-glyph); background: currentColor;
    -webkit-mask: url(media/arrow-right.svg) center / contain no-repeat; mask: url(media/arrow-right.svg) center / contain no-repeat;
    transition: translate var(--duration-base) var(--ease-default);
  }
  .e-next-link:hover .e-next-cta i, .e-next-link:focus-visible .e-next-cta i { translate: var(--space-100) 0; }
  .e-next-link:focus-visible { outline: var(--space-50) solid var(--color-focus-ring); outline-offset: calc(-1 * var(--space-200)); }   /* inside the band: the screen's edge would hide it outside */
  .e-ask { order: -1; margin: 0 0 var(--space-900); padding-top: var(--space-500); border-top: var(--border-hairline); font-size: var(--text-nav); color: var(--color-text-secondary); }
  .e-ask a { color: var(--color-text-primary); font-weight: var(--weight-semibold); text-underline-offset: var(--space-100); }

  /* ================= MOTION: the parts land once the section is in view =================
     The words, then he rises onto his shadow; Lumi arrives and speaks; its other looks appear one
     by one and play on (the script). The stage is the pause control. */
  @media (prefers-reduced-motion: no-preference) {
    .e10[data-js]:not([data-on~="in"]) :is(.m-words > *, .m-stage .e-chair, .m-stage .e-floor, .m-close) { opacity: 0; }
    .e10[data-on~="in"] :is(.m-words > *, .m-stage .e-chair, .m-close) {
      animation: e-up var(--duration-flourish) var(--ease-emphasized) both; animation-delay: calc(var(--i, 0) * var(--step));
    }
    .e10[data-on~="in"] .m-stage .e-floor { transition: opacity var(--duration-flourish) var(--ease-default) calc(6 * var(--step)); }
    .m-words > :nth-child(1) { --i: 0; } .m-words > :nth-child(2) { --i: 2; }
    .m-stage .e-chair { --i: 3; } .m-close { --i: 9; }
    /* its other looks: out of sight until the script brings each one in */
    .e-m { transition: opacity var(--duration-slow) var(--ease-default); }
    .e10[data-js] .e-m:not(.is-in) { opacity: 0; }
  }

  /* ================= 1001 to 1240: the same, a little smaller, so its words keep their room ================= */
  @container row (max-width: 1240px) {
    .e10 { --d: 16cqw; --ph: 38cqw; }
  }

  /* ================= 641 to 1000: the words above, the same stage under them ================= */
  @container row (max-width: 1000px) {
    .e10 { --d: min(25cqw, 13.75rem); --ph: min(70cqw, 40rem); }
    .m-top { grid-template-columns: minmax(0, 1fr); gap: var(--space-600); }
    .m-words { align-self: start; }
    .e-h { font-size: min(clamp(var(--size-2xl), 11.5cqw, 4rem), var(--cap, 100rem)); }
    .e-sub { margin-top: var(--space-400); font-size: clamp(1.25rem, 5.2cqw, var(--size-xl)); }
    .m-low { margin-top: var(--space-700); }
    .c-main, .c-creds { grid-column: 1 / -1; }
    .c-say { font-size: clamp(var(--size-lg), 4.4cqw, 1.375rem); }   /* never over the heading's line */
  }

  /* ================= 640 and under: Lumi beside his head, its words above it; its other looks walk the floor in front of him ================= */
  @container row (max-width: 640px) {
    .e10 { --d: clamp(5.75rem, 34cqw, 12.5rem); --ph: clamp(18rem, 96cqw, 34rem); }
    .m-stage {
      --lrow: calc(var(--d) * 0.78);            /* the room above his head: its words sit in it, up and to its left */
      --front: calc(var(--ph) * 0.38);          /* the floor in front of his shoes: its other looks walk here, with room over their heads for what they say */
      height: calc(var(--lrow) + var(--ph) * 0.885 + var(--front));
    }
    .e-seat { top: calc(var(--d) * 0.46); }
    /* four on a phone: they have the whole width of the floor in front of him */
    .e-m[data-look="sunny"] { --dm: calc(var(--ph) * 0.15); }
    .e-m[data-look="nerdy"] { --dm: calc(var(--ph) * 0.11); }
    .e-m[data-look="calm"] { --dm: calc(var(--ph) * 0.125); }
    .e-m[data-look="funny"] { --dm: calc(var(--ph) * 0.135); }
  }

  /* the Next band on phones: the words first, then the film the full width of the screen, at the page's end */
  @container row (max-width: 767px) {
    .e-next-link { grid-template-columns: minmax(0, 1fr); gap: var(--space-600); padding: var(--space-900) 0 0; }
    .e-next-text { padding: 0 var(--g); }
    .e-next-img { max-width: none; }
    .e-next-logo img { height: var(--space-800); }
    .e-next-name { font-size: clamp(2rem, 10vw, 2.75rem); } /* lint-ok: his live card's own size */
  }

  @media (prefers-reduced-motion: reduce), (scripting: none) { .e-pause { display: none; } }   /* nothing loops, so there is nothing to pause */
  @media (prefers-reduced-motion: reduce) { .e10 *, .e10 { transition: none !important; animation: none !important; } }
}
