/* Hero: its own styles, all inside #hero.
   ONE UNIT: the stage is a picture 100 wide and 60 high on a computer (200 high on a phone); --u is one
   unit of it, so every size and place scales with the screen. At 1440 wide one unit is 14.4 px, which
   makes the type the home page's: heading 9.6 (138 px), line and small label 1.667 (24 px), figure
   3.333 (48 px), its label 1.111 (16 px).
   LAYERS, back to front: the room, the chat's glow, Lumi's other looks, Lumi, the words, the chat window.
   Nothing crops Lumi, a look or a glow: no overflow, clip or mask.
   GROUNDS: plain white with no card (data-ground="white") is the light version, the black room ("dark")
   the dark one. Only the colours change between them; hero.js follows the theme. */
@keyframes h-flow { to { background-position: -200% 0; } }
@property --h-angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes h-spin { to { --h-angle: 360deg; } }
@keyframes h-dot { 0%, 60%, 100% { opacity: 0.3; } 30% { opacity: 1; } }
#hero {
  /* ---- the stage ---- */
  .hero {
    --hh: clamp(40rem, 100svh, 80rem); --u: min(1cqw, calc(var(--hh) / 60)); --fh: 60;
    --edge: calc((100% - 100 * var(--u)) / 2);      /* the screen beyond the picture, each side */
    /* the widest the stage gets (WIDE CASE picks, 25 Nov 2026): the page column plus the side air each side,
       or the picture itself if wider. Past it the stage sits centred, so Lumi stays by the words. On a
       phone and up to about 2080 wide the stage is narrower than this, so nothing there moves. */
    --hw: max(calc(var(--container-wide) / 0.92 + 2 * var(--space-900)), 100 * var(--u)); /* lint-ok: 0.92 undoes --container-wide's 92vw, as page.css's --cs-side does */
    max-width: var(--hw); margin-inline: auto;
    --more: max(0px, min(100cqw, var(--hw)) - 100 * var(--u)); /* the same, both sides: outer parts spread into it */
    --gut: calc(5 * var(--u)); --x0: var(--gut);    /* where the words start */
    --ground: var(--neutral-0); --room: var(--neutral-950);
    --room-inset: var(--space-300); --room-radius: calc(var(--radius-xl) * 1.6);
    --ink: var(--neutral-0); --soft: var(--neutral-300); --quiet: var(--neutral-500); --line: var(--neutral-800);
    /* "guardrails": the six moving colours, in a loop */
    --flow: var(--fx-spectrum-2), var(--fx-spectrum-1), var(--fx-spectrum-6), var(--fx-spectrum-5), var(--fx-spectrum-4), var(--fx-spectrum-3), var(--fx-spectrum-2);
    /* Lumi and its chat. Lumi's body is about 57% of its box: a 70 box gives a body 40 across, whole inside the
       room with its light. The end of the heading's first line runs over Lumi's top left; its eyes sit past it.
       The window is the work card's shape: about 24 of its own letters wide, and it grows upward as the chat
       does, to Lumi's eyes at most. */
    --lx: 26; --ly: 30.2; --ls: 70;
    --wR: calc(4.2 * var(--u)); --wb: 5; --ww: 27.6; --wh: 21; --wz: clamp(var(--size-xs), calc(1.15 * var(--u)), var(--size-xl));
    /* the words' own shade: the room's colour, hugging each letter and fading out, so no word ever sits on something bright */
    --shade-on: 0 0 calc(0.12 * var(--u)) var(--room), 0 0 calc(0.12 * var(--u)) var(--room), 0 0 calc(0.2 * var(--u)) var(--room), 0 0 calc(0.2 * var(--u)) var(--room), 0 0 calc(0.3 * var(--u)) var(--room), 0 0 calc(0.3 * var(--u)) var(--room), 0 0 calc(0.6 * var(--u)) var(--room), 0 0 calc(0.6 * var(--u)) var(--room), 0 0 calc(0.6 * var(--u)) var(--room), 0 0 calc(0.6 * var(--u)) var(--room), 0 0 calc(1.2 * var(--u)) var(--room), 0 0 calc(1.2 * var(--u)) var(--room), 0 0 calc(2.6 * var(--u)) var(--room);
    position: relative; z-index: 1; box-sizing: border-box;
    height: calc(var(--fh) * var(--u));
    background: var(--ground); color: var(--ink);
  }
  .h-room { position: absolute; inset: var(--room-inset); border-radius: var(--room-radius); background: var(--room); z-index: -2; }
  .hero[data-snap] *, .hero[data-snap] { transition: none !important; }

  /* ---- the words: small label, heading, its line, then the numbers, as one block ---- */
  .h-type {
    position: absolute; z-index: 3; left: var(--x0); bottom: calc(var(--tb, 5.3) * var(--u));
    max-width: calc(var(--tw, 64) * var(--u)); text-align: left;
  }
  .h-type > * { transition: opacity var(--duration-flourish) var(--ease-default), transform var(--duration-expressive) var(--ease-emphasized); }
  .h-type > :nth-child(2) { transition-delay: calc(var(--duration-stagger) * 2); }
  .h-type > :nth-child(3) { transition-delay: calc(var(--duration-stagger) * 4); }
  .hero:not([data-on~="type"]) .h-type > :not(.h-nums), .hero:not([data-on~="nums"]) .h-nums { opacity: 0; transform: translateY(var(--space-500)); }
  /* each part of the words is only as wide as its own text, so the room beside it stays free for the picture */
  .h-eb, .h-title, .h-nums { width: fit-content; }
  .h-eb {
    margin: 0 0 calc(1.1 * var(--u));
    font-family: var(--font-mono); font-weight: var(--weight-medium); font-size: var(--ebz, calc(1.667 * var(--u)));
    line-height: 1; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--quiet); text-shadow: var(--shade-on);
  }
  .h-title {
    margin: 0; font-family: var(--font-display); font-weight: var(--display-weight);
    font-size: calc(var(--tz, 9.6) * var(--u)); line-height: var(--line-display); letter-spacing: var(--display-tight); color: var(--ink);
    /* where the heading runs over Lumi, a soft shade in the room's colour hugs the letters, so white type never
       sits on Lumi's white edge. It fades out; no hard edge. */
    text-shadow: var(--shade-on);
  }
  /* "guardrails": the moving colours, on this word only, on its own line */
  .h-em {
    display: block; width: fit-content; padding-bottom: 0.06em; text-shadow: none;
    transform: translateZ(0); /* its own layer: the moving colours repaint this word only, never the shaded line above it */
    background: linear-gradient(90deg, var(--flow)) 0 0 / 200% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: h-flow calc(var(--fx-spectrum-spin) * 3) linear infinite;
  }
  .h-sub {
    margin: calc(1.5 * var(--u)) 0 0; max-width: calc(var(--sw, 39) * var(--u));
    font-size: var(--sz, calc(1.667 * var(--u))); font-weight: var(--weight-regular); line-height: var(--line-snug); color: var(--soft);
    text-wrap: balance;
  }
  /* the numbers: the figure over its label, a line between each. Lighter and smaller than the line above them. */
  .h-nums { display: flex; margin: calc(var(--ng, 3.2) * var(--u)) 0 0; padding: 0; list-style: none; }
  .h-nums li { display: grid; align-content: start; gap: calc(0.7 * var(--u)); padding: 0 calc(var(--np, 2.4) * var(--u)); border-left: 1px solid var(--line); } /* lint-ok: a hairline between the numbers */
  .h-nums li:first-child { padding-left: 0; border-left: 0; }
  .h-nums strong { font-family: var(--font-display); font-weight: var(--display-weight); font-size: calc(var(--nz, 3.333) * var(--u)); line-height: 1; font-variant-numeric: tabular-nums; color: var(--ink); }
  .h-nums span { font-size: var(--nl, max(var(--size-xs), calc(1.111 * var(--u)))); font-weight: var(--weight-regular); line-height: var(--line-title); color: var(--quiet); }

  /* ---- Lumi, the largest thing on the stage. The wrapper holds Lumi's place and size; the Brief section copies
          them for the one Lumi it carries, so the wrapper stays a square, placed by its middle. ---- */
  .h-lumi-w {
    position: absolute; z-index: 1; pointer-events: none;
    left: calc(50% + var(--lx) * var(--u) + var(--more) * var(--lm, 0.25)); top: calc(var(--ly) * var(--u)); width: calc(var(--ls) * var(--u)); aspect-ratio: 1;
    translate: -50% -50%;
  }
  .h-lumi { display: block; width: 100%; height: 100%; transition: opacity var(--duration-flourish) var(--ease-default), transform var(--duration-expressive) var(--ease-emphasized); }
  .hero:not([data-on~="lumi"]) .h-lumi { opacity: 0; transform: scale(1.08); }

  /* ---- the chat window: the Lumi work card's window (portfolio/work/lumi/card.html), its chat half.
          Sizes are in em so the whole window scales with the stage. .h-win has no z-index and no
          transform on purpose: its glow can then sit under Lumi while the window sits over Lumi. ---- */
  .h-win {
    position: absolute; right: var(--wR); bottom: calc(var(--wb) * var(--u)); width: calc(var(--ww) * var(--u));
    font-size: var(--wz); line-height: var(--line-snug); text-align: left;
    --glow-on: 0; --glow-lv: var(--alpha-600); --plate: var(--room);
    --w-fg: var(--color-text-primary); --w-me-bg: var(--color-text-primary); --w-me-fg: var(--color-bg); --w-track: var(--color-border-strong);
  }
  .h-win-m {
    position: relative; z-index: 4; display: flex; max-height: calc(var(--wh) * var(--u)); transform-origin: 50% 100%;
    transition: opacity var(--duration-slow) var(--ease-default), transform var(--duration-expressive) var(--ease-emphasized);
  }
  .hero:not([data-on~="win"]) .h-win-m { opacity: 0; transform: translateY(var(--space-500)) scale(0.96); }
  .hero[data-on~="win"] .h-win[data-glow] { --glow-on: 1; }
  /* The glow, as on the card: the colour wheel a little bigger than the window, blurred, turning slowly,
     behind Lumi. A plate in the room's colour, the window's shape, sits on it, so the glass never picks
     the colour up and it shows outside the window only. On while Lumi thinks and once the booking is done. */
  .h-halo { position: absolute; inset: 0; z-index: -1; border-radius: var(--radius-xl); pointer-events: none; }
  .h-halo i {
    position: absolute; border-radius: inherit; opacity: calc(var(--glow-on) * var(--glow-lv) * var(--part)); transition: opacity var(--duration-slow) var(--ease-default);
    background: conic-gradient(from var(--h-angle), var(--fx-spectrum-1), var(--fx-spectrum-2), var(--fx-spectrum-3), var(--fx-spectrum-4), var(--fx-spectrum-5), var(--fx-spectrum-6), var(--fx-spectrum-1));
    animation: h-spin calc(var(--fx-spectrum-spin) * 5) linear infinite;
  }
  .h-halo i:first-child { inset: calc(-1 * var(--space-50)); filter: blur(var(--space-200)); --part: var(--alpha-700); }
  /* the wide glow is sized from the stage on small screens, so it fades out inside the room */
  .h-halo i + i { inset: calc(-1 * min(var(--space-300), 0.8 * var(--u))); filter: blur(min(var(--space-600), calc(1.6 * var(--u)))); --part: var(--alpha-500); }
  .h-halo b { position: absolute; inset: 0; border-radius: inherit; background: var(--plate); opacity: var(--glow-on); transition: opacity var(--duration-slow) var(--ease-default); }
  .hc-win {
    position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.6em; padding: 0.8em;
    border-radius: var(--radius-xl); background: var(--glass-tint-scrolled); color: var(--w-fg); /* the stronger glass tint: Lumi is much larger and brighter behind this window than on the card, and its words must hold 4.5 to 1 over it */
    -webkit-backdrop-filter: blur(var(--glass-blur-webkit)) saturate(var(--glass-saturate)); backdrop-filter: blur(var(--glass-blur-webkit)) saturate(var(--glass-saturate));
    box-shadow: var(--glass-shadow), var(--glass-specular);
  }
  /* the clinic's lockup: lumi, IMAGING small under it */
  .hc-name { flex: none; display: inline-grid; gap: 0.32em; padding: 0.25em 0.5em 0; font-size: 1.125em; font-weight: var(--weight-medium); letter-spacing: var(--tracking-tight); line-height: 1; white-space: nowrap; } /* lint-ok: the clinic wordmark's own gaps, scaled with the window */
  .hc-name b { font-weight: inherit; }
  .hc-name small { font-size: 0.61em; font-weight: var(--weight-medium); letter-spacing: 0.32em; text-transform: uppercase; padding-left: 0.1em; } /* lint-ok: the clinic lockup's IMAGING tracking */
  .hc-body { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; } /* lint-ok: the card's own chat panel; a message that no longer fits leaves whole (hero.js), so nothing is cut */
  .hc-log { flex: none; margin: 0; padding: 0.2em 0.3em; list-style: none; display: flex; flex-direction: column; gap: 0.6em; }
  .hc-log:empty { display: none; }
  .hc-log, .hc-chips { transition: opacity var(--duration-flourish) var(--ease-default); }
  .h-win-m[data-out] :is(.hc-log, .hc-chips) { opacity: 0; }
  .hc-log li { flex: none; max-width: 90%; text-wrap: pretty; transition: opacity var(--duration-base) var(--ease-default), translate var(--duration-moderate) var(--ease-emphasized); }
  .hc-log li.hc-new { opacity: 0; translate: 0 var(--space-200); }
  .hc-log .hc-bot { align-self: flex-start; }
  .hc-log .hc-me { align-self: flex-end; padding: 0.35em 0.8em; border-radius: var(--radius-lg); background: var(--w-me-bg); color: var(--w-me-fg); }
  .hc-log .hc-done { display: flex; align-items: center; gap: 0.5em; font-weight: var(--weight-semibold); }
  .hc-ok { flex: none; display: grid; place-items: center; width: 1.5em; height: 1.5em; border-radius: var(--dot-radius); background: var(--w-me-bg); color: var(--w-me-fg); }
  /* the tick is drawn, not an icon file: two edges of a small box, turned */
  .hc-ok::after { content: ""; width: 0.32em; height: 0.62em; margin-top: -0.12em; border: solid currentColor; border-width: 0 0.16em 0.16em 0; rotate: 45deg; }
  .hc-log .hc-typing { display: flex; gap: 0.3em; padding: 0.7em 0.8em; }
  .hc-typing i { width: 0.4em; height: 0.4em; border-radius: var(--dot-radius); background: currentColor; animation: h-dot var(--duration-expressive) var(--ease-default) infinite; }
  .hc-typing i:nth-child(2) { animation-delay: calc(var(--duration-expressive) / 6); }
  .hc-typing i:nth-child(3) { animation-delay: calc(var(--duration-expressive) / 3); }
  .hc-chips { flex: none; display: flex; flex-wrap: wrap; gap: 0.4em; min-height: 0; }
  .hc-chips span { padding: 0.3em 0.8em; border-radius: var(--radius-full); box-shadow: inset 0 0 0 1px var(--w-track); font-size: 0.8em; font-weight: var(--weight-semibold); white-space: nowrap; transition: background-color var(--duration-fast) var(--ease-default), color var(--duration-fast) var(--ease-default); } /* lint-ok: a hairline edge; a step under the messages */
  .hc-chips span.hc-tap { background: var(--w-me-bg); color: var(--w-me-fg); box-shadow: none; }
  .hc-chips:empty { display: none; }

  /* ---- Lumi's other looks ---- */
  .h-cast { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
  /* Lumi's four other looks, in the background, blurred, in and out of focus; they bump into each other and
     squish and move. Each is live, from the shared engine by name, on its own canvas.
     .h-m is placed and squished by hero.js (transform only); .h-mf takes the focus: one look at a time comes
     near and sharp, the rest sit back, soft. Nothing clips them: the blur and the edge fade on their own. */
  .h-m { position: absolute; left: 0; top: 0; width: calc(var(--s) * var(--u)); aspect-ratio: 1; margin: calc(var(--s) * var(--u) / -2) 0 0 calc(var(--s) * var(--u) / -2); z-index: 1; }
  .h-mf {
    display: block; width: 100%; height: 100%; opacity: var(--alpha-700); scale: 1; filter: blur(calc(0.2 * var(--u)));
    transition: opacity calc(var(--duration-expressive) * 3) var(--ease-default), scale calc(var(--duration-expressive) * 3) var(--ease-default), filter calc(var(--duration-expressive) * 3) var(--ease-default); /* lint-ok: the focus pull is a blur by design; one look changes at a time */
  }
  .h-m canvas { display: block; width: 100%; height: 100%; }
  .h-m[data-f="far"] { z-index: 0; }
  .h-m[data-f="far"] .h-mf { opacity: var(--alpha-600); scale: 0.78; filter: blur(calc(0.5 * var(--u))); }
  .h-m[data-f="near"] { z-index: 2; }
  .h-m[data-f="near"] .h-mf { opacity: 1; scale: 1.22; filter: blur(0); }
  .hero:not([data-on~="cast"]) .h-mf { opacity: 0; scale: 0.6; transition-duration: var(--duration-flourish); }
  /* =====================================================================
     THE LIGHT VERSION: the same hero on plain white with no card. Dark words; the chat window takes the light theme's glass through data-theme (set by hero.js).
     "guardrails" keeps to the three colours that read on a light ground (red, purple, blue), each a
     step deeper, so the heading holds 3 to 1 as large type; yellow, green and orange cannot on white.
     ===================================================================== */
  .hero[data-ground="white"] {
    --ink: var(--neutral-950); --soft: var(--neutral-700); --quiet: var(--neutral-600); --line: var(--neutral-300);
    --f1: color-mix(in oklch, var(--fx-spectrum-1) 82%, var(--neutral-950)); --f6: color-mix(in oklch, var(--fx-spectrum-6) 82%, var(--neutral-950)); --f5: color-mix(in oklch, var(--fx-spectrum-5) 82%, var(--neutral-950));
    --flow: var(--f1), var(--f6), var(--f5), var(--f6), var(--f1);
    --room: var(--ground);
  }

  @media (prefers-reduced-motion: reduce) {
    .hero *, .hero { transition: none !important; }
    .h-em, .h-halo i, .hc-typing i { animation: none; }
  }
  .hero[data-away] :is(.h-em, .h-halo i, .hc-typing i) { animation-play-state: paused; }

  /* =====================================================================
     PHONE: its own stack (the stage is 100 wide, 200 high). Words and numbers first, then the picture.
     ===================================================================== */
  @container row (max-width: 1000px) {
    .hero {
      --hh: clamp(38rem, 100svh, 60rem); --u: min(1cqw, calc(var(--hh) / 200)); --fh: 200;
      --room-inset: var(--space-200); --gut: calc(7 * var(--u)); --x0: calc(var(--edge) + var(--gut));
      --tz: 12.6; --ebz: max(var(--size-xs), calc(3.2 * var(--u))); --sz: max(var(--size-sm), calc(3.9 * var(--u)));
      --nz: 8.2; --nl: max(var(--size-xs), calc(3.1 * var(--u))); --ng: 5; --np: 3;
      --lx: 0; --ly: 128; --ls: 128; --lm: 0;
      --wR: calc(50% - 40 * var(--u)); --wb: 6; --ww: 80; --wh: 50; --wz: max(var(--size-xs), calc(3.3 * var(--u)));
    }
    .h-type { top: calc(var(--tt, 9) * var(--u)); bottom: auto; right: var(--x0); max-width: none; }
    .h-eb { margin-bottom: calc(2.4 * var(--u)); }
    .h-sub { margin-top: calc(3 * var(--u)); max-width: none; }
    .h-nums { width: auto; }
    .h-nums li { flex: 1 1 0; gap: calc(1.2 * var(--u)); }
  }
}
