/* holo-stage.css — motion layer for the hologram stage (#dash-stage). Prefix: hs-
 *
 * Everything here hangs off classes that holo-stage.js sets on #dash-stage only when motion is allowed:
 *   .hs-on     module running            .hs-cv   its canvas is live (it then draws plumbob, beam and rings itself)
 *   .hs-paused tab hidden / off-screen   .hs-ptr  pointer is driving the depth layers
 * so with the script missing, failing, or under reduced motion the stage is exactly the static base.
 * The base page CSS is injected into <head> AFTER this file, hence the id-scoped selectors (they must win).
 * Every loop below is transform / opacity only (compositor); per-frame drawing lives on the canvas.
 * White only inside the stage (contract rule 4).
 */

/* ---------- canvas: behind the content, above the grid ---------- */
#dash-stage .hs-canvas{position:absolute;inset:0;width:100%;height:100%;z-index:-1;pointer-events:none;display:block}
/* the canvas re-draws these three with motion, so the static originals step aside (layout untouched) */
#dash-stage.hs-cv .plumbob-wrap,
#dash-stage.hs-cv .beam,
#dash-stage.hs-cv .rings{visibility:hidden}

/* pause this module's own loops while the tab is hidden or the stage is off-screen
   (only the elements holo-stage owns — .plate / .meter / .needs belong to other modules and are left alone) */
#dash-stage.hs-paused .stage-grid::before,
#dash-stage.hs-paused .stage-corner,
#dash-stage.hs-paused .stage-live i,
#dash-stage.hs-paused .stage-live i::after,
#dash-stage.hs-paused #dash-avatar,
#dash-stage.hs-paused .hs-shimmer{animation-play-state:paused!important}

/* ---------- HUD frame: grid, corner brackets, status line ---------- */
/* the grid pattern moves on a pseudo-element so the base radial mask stays put */
#dash-stage.hs-on .stage-grid{background-image:none}
#dash-stage.hs-on .stage-grid::before{content:'';position:absolute;inset:-26px;
  background-image:linear-gradient(rgba(255,255,255,.09) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.09) 1px,transparent 1px);
  background-size:26px 26px;animation:hs-grid-drift 11s linear infinite}
@keyframes hs-grid-drift{to{transform:translate3d(26px,26px,0)}}   /* one cell: seamless */

/* brackets fly in from the centre side, overshoot a touch and settle; then breathe */
#dash-stage.hs-on .stage-corner{--hs-cx:1;--hs-cy:1;
  animation:hs-corner-in .95s cubic-bezier(.34,1.5,.5,1) backwards,hs-corner-breathe 4.6s ease-in-out 1.4s infinite alternate}
#dash-stage.hs-on .stage-corner.c2{--hs-cx:-1;animation-delay:.07s,1.47s}
#dash-stage.hs-on .stage-corner.c3{--hs-cy:-1;animation-delay:.14s,1.54s}
#dash-stage.hs-on .stage-corner.c4{--hs-cx:-1;--hs-cy:-1;animation-delay:.21s,1.61s}
@keyframes hs-corner-in{from{opacity:0;transform:translate3d(calc(var(--hs-cx) * 22px),calc(var(--hs-cy) * 22px),0) scale(.5)}}
@keyframes hs-corner-breathe{from{opacity:.75}to{opacity:1}}

#dash-stage.hs-on .stage-hud-top{animation:hs-hud-in .7s cubic-bezier(.16,1,.3,1) .2s backwards}
@keyframes hs-hud-in{from{opacity:0;transform:translate3d(0,-6px,0)}}

/* status dot: soft blink + a ping ring (position:relative on a flex item does not move anything) */
#dash-stage.hs-on .stage-live i{position:relative;animation:hs-dot 2.6s cubic-bezier(.4,0,.2,1) infinite}
#dash-stage.hs-on .stage-live i::after{content:'';position:absolute;inset:-1px;border-radius:999px;border:1px solid #FFFFFF;
  animation:hs-ping 2.6s cubic-bezier(.16,1,.3,1) infinite}
@keyframes hs-dot{0%,100%{opacity:1}45%{opacity:.45}}
@keyframes hs-ping{0%{transform:scale(1);opacity:.85}60%,100%{transform:scale(2.4);opacity:0}}   /* 2.4: stays clear of the c1 bracket and the label */

/* ---------- character ---------- */
/* idle bob on `transform`; the script puts pointer depth on `translate` / `rotate` (inline), so they never fight.
   The one-off "materialise" intro (clip-path + a short flicker) is driven by the script on its own clock. */
#dash-stage.hs-on #dash-holo{perspective:900px}
#dash-stage.hs-on #dash-avatar,
#dash-stage.hs-on .hs-shimmer{transform-origin:50% 84%;animation:hs-bob 4.6s ease-in-out infinite alternate}
@keyframes hs-bob{from{transform:translate3d(0,0,0)}to{transform:translate3d(0,-6px,0)}}   /* 6px = BOB_PX in the script */

/* scan light over the sticker only: an overlay masked with the avatar PNG itself (never clips the artwork) */
#dash-stage .hs-shimmer{position:absolute;overflow:hidden;pointer-events:none;opacity:0;
  -webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;-webkit-mask-size:100% 100%;mask-size:100% 100%}
#dash-stage .hs-shimmer-band{position:absolute;left:0;right:0;top:0;display:block;
  background:linear-gradient(to bottom,rgba(255,255,255,0) 0%,rgba(255,255,255,.05) 50%,rgba(255,255,255,.2) 98.3%,rgba(255,255,255,.85) 98.5%,rgba(255,255,255,.85) 100%)}
#dash-stage .hs-shimmer-band.hs-up{background:linear-gradient(to top,rgba(255,255,255,0) 0%,rgba(255,255,255,.05) 50%,rgba(255,255,255,.2) 98.3%,rgba(255,255,255,.85) 98.5%,rgba(255,255,255,.85) 100%)}

#dash-stage.hs-ptr #dash-avatar{will-change:transform,translate,rotate}

/* ---------- reduced motion: the script never starts; this is the belt-and-braces fallback ---------- */
@media (prefers-reduced-motion: reduce){
  #dash-stage.hs-on .stage-grid::before,
  #dash-stage.hs-on .stage-corner,
  #dash-stage.hs-on .stage-hud-top,
  #dash-stage.hs-on .stage-live i,
  #dash-stage.hs-on .stage-live i::after,
  #dash-stage.hs-on #dash-avatar,
  #dash-stage.hs-on .hs-shimmer{animation:none!important}
  #dash-stage .hs-canvas,
  #dash-stage .hs-shimmer{display:none!important}
  #dash-stage.hs-cv .plumbob-wrap,
  #dash-stage.hs-cv .beam,
  #dash-stage.hs-cv .rings{visibility:visible}
  #dash-stage.hs-on .stage-grid{background-image:linear-gradient(rgba(255,255,255,.09) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.09) 1px,transparent 1px)}
  #dash-stage.hs-on .stage-grid::before,
  #dash-stage.hs-on .stage-live i::after{content:none}
}
