/* InMerch hero3d · Option A-GL (h3agl) — Web Design 2026-11-09
   WebGL scene drawn by h3agl.js (ES module). Blue #477BFF · violet #A58BFF · neutrals. NO green.
   Theme: dark default; light under html[data-theme=light], .im-theme-light, [data-theme=light] on any
   ancestor, or .h3a--light on the canvas.
   v2.3 poster: shown INSTANTLY under every stage (also when JS/three.js never loads); h3agl.js adds .h3a-stage--live only after
   the first frame is drawn and verified, which hides the poster and reveals the canvas. On timeout / no WebGL / shader error /
   context loss the stage stays (or returns) on the poster and gets .h3a-stage--poster. The canvas is never shown unrendered.
   v2.5 fallback motion: while the poster is showing, a CSS-only float + light-sweep runs (transform/opacity only) unless
   the user prefers reduced motion, in which case the poster stays fully static. */
.h3a-stage{position:relative;box-sizing:border-box;padding:var(--h3a-pad,32px);display:flex;align-items:center;justify-content:center;min-width:0;overflow:hidden;--h3a-p:url(poster-full-dark.png?v=e33b8e8160);--h3a-pc:url(poster-compact-dark.png?v=9e3aa1bc7a);--h3a-img:var(--h3a-p)}
html[data-theme=light] .h3a-stage,.im-theme-light .h3a-stage,[data-theme=light] .h3a-stage{--h3a-p:url(poster-full-light.png?v=c50f1d4bfe);--h3a-pc:url(poster-compact-light.png?v=e89727984e)}
.h3a-stage:has(canvas[data-h3agl=compact]){--h3a-img:var(--h3a-pc)}
/* poster lives on ::before so it can float independently of the stage box; background-origin matches the previous content-box poster */
.h3a-stage::before{content:"";position:absolute;inset:0;box-sizing:border-box;padding:inherit;background:var(--h3a-img) center/contain no-repeat;background-origin:content-box;pointer-events:none;z-index:0}
/* light sweep: a rotated gradient slab that travels across the chip (transform + opacity only) */
.h3a-stage::after{content:"";position:absolute;top:-20%;bottom:-20%;left:0;width:30%;background:linear-gradient(90deg,transparent 0%,rgba(71,123,255,.0) 18%,rgba(165,139,255,.30) 50%,rgba(71,123,255,.20) 72%,transparent 100%);pointer-events:none;z-index:1;opacity:0;transform:translate3d(-140%,0,0) rotate(14deg)}
html[data-theme=light] .h3a-stage::after,.im-theme-light .h3a-stage::after,[data-theme=light] .h3a-stage::after{background:linear-gradient(90deg,transparent 0%,rgba(51,102,240,0) 18%,rgba(124,99,232,.22) 50%,rgba(51,102,240,.16) 72%,transparent 100%)}
.h3a-stage.h3a-stage--live{background-image:none!important}
.h3a-stage.h3a-stage--live::before,.h3a-stage.h3a-stage--live::after{content:none;animation:none!important;opacity:0}
.h3a-stage:not(.h3a-stage--live) canvas[data-h3agl]{visibility:hidden}
canvas[data-h3agl]{display:block;width:100%;height:auto;max-width:100%;max-height:100%;pointer-events:none;position:relative;z-index:2}
/* the canvas is transparent: the renderer fades its own edges to alpha 0, so it sits seamlessly on any page background */
canvas[data-h3agl=full]{aspect-ratio:16/9}
canvas[data-h3agl=compact]{aspect-ratio:480/420}
.h3a-stage--fill > canvas[data-h3agl]{height:100%;aspect-ratio:auto}

/* below 640px a data-h3agl="full" canvas renders the compact framing (h3agl.js switches on the same media query) */
@media (max-width:639.98px){
  canvas[data-h3agl=full]{aspect-ratio:480/420}
  .h3a-stage:has(canvas[data-h3agl=full]){--h3a-img:var(--h3a-pc)}
}

/* CSS-only poster motion: runs whenever the WebGL canvas is not live, including no-JS and every fallback
   except true prefers-reduced-motion / .h3agl--static / .h3a-stage--still (the reduced-motion path). */
@media (prefers-reduced-motion:no-preference){
  html:not(.h3agl--static):not(.reduced-motion) .h3a-stage:not(.h3a-stage--live):not(.h3a-stage--still)::before{
    animation:h3a-fb-float 11s ease-in-out infinite;
    will-change:transform
  }
  html:not(.h3agl--static):not(.reduced-motion) .h3a-stage:not(.h3a-stage--live):not(.h3a-stage--still)::after{
    animation:h3a-fb-sweep 6.8s ease-in-out infinite;
    will-change:transform,opacity
  }
}
@keyframes h3a-fb-float{
  0%,100%{transform:translate3d(0,0,0) scale(1)}
  50%{transform:translate3d(0,-1.8%,0) scale(1.03)}
}
@keyframes h3a-fb-sweep{
  0%{transform:translate3d(-140%,0,0) rotate(14deg);opacity:0}
  12%{opacity:.5}
  55%{opacity:.38}
  70%,100%{transform:translate3d(280%,0,0) rotate(14deg);opacity:0}
}
@media (prefers-reduced-motion:reduce){
  .h3a-stage::before,.h3a-stage::after{animation:none!important;transform:none;opacity:0}
  .h3a-stage::before{opacity:1}
}
html.h3agl--static .h3a-stage::before,html.reduced-motion .h3a-stage::before,
.h3a-stage--still::before{animation:none!important;transform:none}
html.h3agl--static .h3a-stage::after,html.reduced-motion .h3a-stage::after,
.h3a-stage--still::after{animation:none!important;transform:none;opacity:0}

/* per-canvas poster override: <canvas data-poster="x.png"> → set --h3a-img by h3agl.js on fallback */
/* still frame: .h3agl--static / .aih--static on the canvas or any ancestor (same result as prefers-reduced-motion) */
