/* Hero exit (home only, 2026-11-18). Switchable: delete the <link> to this file in index.html and the hero and doors go back to
   today's static behavior. CSS only, no JS, no library. Loads after kronos-hero.css. Changes no copy, color or layout.

   Spec (WEB_DESIGN_REFERENCE.md section 6)
   TYPE      unchanged, inherited from the page (kronos-hero.css and glass.css set it)
   PALETTE   unchanged, inherited. The only new paint is the scrim, flat #04080b (--kx-bg) at up to .55 over the motif only.
   EASING    --kx-ease cubic-bezier(.2,.8,.2,1). The motion is scroll-linked, so the timeline is linear in scroll distance
             and the curve is applied across the whole exit range on the slab; the layers run linear; the door stagger keeps polish.css's linear reveal.
   PROPERTIES transform only (scale and translateY). opacity on the decorative scrim pseudo-element only. Never opacity on text
             (PW-020 contrast rule). No top, left, width, height, margin or padding anywhere in the keyframes, so CLS stays 0.00.
   RANGE     .hero view timeline, animation-range: exit 0% exit 100%. 0 is the slab's bottom edge starting to leave the top of the
             viewport, 100 is the slab fully gone.
   VALUES    slab scale 1 to .96 (origin 50% 100%, so it recedes toward the doors without opening a gap)
             .kx-svg translateY 0 to -6% (slower layer, see note)
             .hero-copy translateY 0 to -48px
             .hero-card translateY 0 to -24px and scale 1 to 1.03 (comes forward)
             scrim opacity 0 to .55
             doors: polish.css pl-rise (20px) with entry ranges offset 0 / 6% / 12% / 18% by nth-child
   PHONES    max-width 720px is lighter: slab scale .98, half the distances, no card scale.
   GATES     off under prefers-reduced-motion: reduce (the whole file sits in no-preference), off under body.motion-paused, off while
             the chat is open (same selector as kronos-hero.css L53: body:has(#chat:not([hidden]))).
   FALLBACK  everything is inside @supports (animation-timeline: view()). Browsers without it, print, and every gate above show
             today's static hero. Content is visible by default, nothing is hidden when the feature is missing.
   LAYOUT    the scrim lives on .kx-stage::before. .kx-stage is already position:absolute and the scrim is absolute inset:0 inside it, so
             no position change on the hero (it already has position:relative in styles.css) and nothing shifts. Transforms only
             shrink or move inside the slab, so no horizontal overflow at 390.
   NOTE      the brief asked for .kx-stage to drift. The stage is the clipping box (overflow:hidden, rounded), so moving it would
             poke its top edge out of the slab. The drift is applied to the .kx-svg motif inside it, which the stage clips. Same
             visual, no spill. #hero-end and its render-blocking expect link are untouched.

   Chosen of three
   (A) push back and depth separation: the slab recedes, layers drift at different speeds, a scrim dims the motif, the doors rise in a stagger.
   (B) pin the hero with position:sticky while the doors slide over it like a curtain.
   (C) motif-only exit: candles speed up and the beam sweeps out while the copy holds still.
   A won. It is transform-only, touches no layout, works on a phone, and the doors stagger gives the moment a second beat. B changes
   the hero's flow (sticky holds it in place and adds scroll height), so it risks CLS and the #hero-end render target, and a pinned
   hero over doors fights the Oct 22 white-space rhythm. C hides the moment inside the decorative layer: the SVG is aria-hidden,
   stops under Pause motion and does almost nothing on a 390px screen where the stage sits behind the copy.
   Comparison method: reasoning against this spec (screenshots of the three alternatives are not part of this file). */

@supports (animation-timeline: view()) {
  @media screen and (prefers-reduced-motion: no-preference) {
    body[data-page="home"]:not(.motion-paused):not(:has(#chat:not([hidden]))) .hero{
      --hx-scale:.96;--hx-svg:-6%;--hx-copy:-48px;--hx-card:-24px;--hx-card-scale:1.03;
      view-timeline:--hx block;
      transform-origin:50% 100%;
      animation:hx-slab var(--kx-ease) both;animation-timeline:--hx;animation-range:exit 0% exit 100%}
    body[data-page="home"]:not(.motion-paused):not(:has(#chat:not([hidden]))) .hero .kx-svg{
      animation:hx-svg linear both;animation-timeline:--hx;animation-range:exit 0% exit 100%}
    body[data-page="home"]:not(.motion-paused):not(:has(#chat:not([hidden]))) .hero .hero-copy{
      animation:hx-copy linear both;animation-timeline:--hx;animation-range:exit 0% exit 100%}
    body[data-page="home"]:not(.motion-paused):not(:has(#chat:not([hidden]))) .hero .hero-card{
      animation:hx-card linear both;animation-timeline:--hx;animation-range:exit 0% exit 100%}
    /* At 1000px and up home.css gives the card its hc-in entrance. Layer both so the exit does not drop it. */
    @media (min-width:1000px) {
      body[data-page="home"]:not(.motion-paused):not(:has(#chat:not([hidden]))) .hero .hero-card{
        animation:hc-in .9s cubic-bezier(.2,.7,.2,1) both,hx-card linear forwards;animation-timeline:auto,--hx;animation-range:normal,exit 0% exit 100%}
    }
    /* The scrim: the only opacity animated here, on a decorative, aria-hidden layer above the motif and below the copy. */
    body[data-page="home"]:not(.motion-paused):not(:has(#chat:not([hidden]))) .hero .kx-stage::before{
      content:"";position:absolute;inset:0;z-index:1;background:var(--kx-bg);opacity:0;
      animation:hx-scrim linear both;animation-timeline:--hx;animation-range:exit 0% exit 100%}

    /* Doors: same pl-rise (20px), staggered by nth-child. polish.css is not edited; these out-rank its selector. */
    body:not(.motion-paused):not(:has(#chat:not([hidden]))) .doors>.door:nth-child(2){animation-range:entry 6% entry 66%}
    body:not(.motion-paused):not(:has(#chat:not([hidden]))) .doors>.door:nth-child(3){animation-range:entry 12% entry 72%}
    body:not(.motion-paused):not(:has(#chat:not([hidden]))) .doors>.door:nth-child(4){animation-range:entry 18% entry 78%}

    @media (max-width:720px) {
      body[data-page="home"]:not(.motion-paused):not(:has(#chat:not([hidden]))) .hero{--hx-scale:.98;--hx-svg:-3%;--hx-copy:-24px;--hx-card:-12px;--hx-card-scale:1}
    }
  }
}

@keyframes hx-slab{to{transform:scale(var(--hx-scale))}}
@keyframes hx-svg{to{transform:translateY(var(--hx-svg))}}
@keyframes hx-copy{to{transform:translateY(var(--hx-copy))}}
@keyframes hx-card{to{transform:translateY(var(--hx-card)) scale(var(--hx-card-scale))}}
@keyframes hx-scrim{to{opacity:.55}}

/* Belt and braces: if a gate flips after paint, nothing keeps a half-played exit. */
@media (prefers-reduced-motion: reduce) {
  body[data-page="home"] .hero,body[data-page="home"] .hero :is(.kx-svg,.hero-copy,.hero-card),body[data-page="home"] .kx-stage::before{animation:none}
}
body.motion-paused[data-page="home"] .hero,body.motion-paused[data-page="home"] .hero :is(.kx-svg,.hero-copy,.hero-card),body.motion-paused[data-page="home"] .kx-stage::before{animation:none}
@media print{body[data-page="home"] .hero,body[data-page="home"] .hero *{animation:none!important;transform:none!important}}
