/* WebGL stage spans the frame and stays fixed while the document scrolls.
   The source portfolio keeps its canvas rect stationary; individual objects
   move through that stage on time and scroll instead of following the hero. */
#frame-content{--motion-left:48px;--motion-top:49px;--motion-width:calc(100vw - 56px);--motion-height:calc(100dvh - 96px)}
#frame-content > canvas#three-canvas.motion-stage-canvas,
#frame-content > .route-scene-layer.motion-stage{
 position:fixed!important;
 inset:auto!important;
 left:var(--motion-left)!important;
 top:var(--motion-top)!important;
 width:var(--motion-width)!important;
 height:var(--motion-height)!important;
 z-index:1!important;
 overflow:hidden;
 pointer-events:none!important;
 transform:none!important;
 margin:0!important;
}
#frame-content > canvas#three-canvas.motion-stage-canvas{
 display:block!important;
 will-change:opacity;
}
#frame-content > .route-scene-layer.motion-stage canvas{
 position:absolute!important;inset:0!important;
 width:100%!important;height:100%!important;
 display:block!important;transform:none!important;
}
#frame-content > main{position:relative;z-index:2}
#frame-content #start.hero{
 background:transparent!important;
}
#frame-content #start.hero::before{
 background:transparent!important;
}
body[data-page] #frame-content .route-hero{
 background:transparent!important;
}
body[data-page] #frame-content .route-hero::before{
 background:transparent!important;
}
/* Keep all interactions and hero copy above the non-interactive canvas.
   Existing section glows and route backgrounds remain usable. */
#frame-content .hero-content,
body[data-page] #frame-content .route-hero .section-heading,
body[data-page] #frame-content .route-hero h1,
body[data-page] #frame-content .route-hero .route-eyebrow,
body[data-page] #frame-content .route-hero p{
 position:relative;z-index:5;
}
@media(prefers-reduced-motion:reduce){
 #frame-content > .route-scene-layer.motion-stage,
 #frame-content > #three-canvas.motion-stage-canvas{display:none!important}
}


/* Stefano's backdrop stays gently kinetic while pointer is stationary.
   A low-opacity moving light field reinforces the 3D orbit without masking
   page content. The light stays inside the framed viewport. */
body{--motion-light-left:rgba(78,165,70,.38);--motion-light-right:rgba(62,131,65,.28)}
body[data-page="about"]{--motion-light-left:rgba(56,104,198,.33);--motion-light-right:rgba(48,96,184,.29)}
body[data-page="work"]{--motion-light-left:rgba(189,58,76,.33);--motion-light-right:rgba(169,47,71,.29)}
body[data-page="contact"]{--motion-light-left:rgba(75,123,168,.27);--motion-light-right:rgba(80,133,167,.29)}
body[data-page="achievements"]{--motion-light-left:rgba(172,130,58,.27);--motion-light-right:rgba(140,111,55,.24)}
body #frame-content::before{
 content:"";
 position:fixed;
 inset:auto;
 top:var(--motion-top);
 left:var(--motion-left);
 width:var(--motion-width);
 height:var(--motion-height);
 z-index:0;
 pointer-events:none;
 background:
   radial-gradient(ellipse 42% 66% at 3% 82%,var(--motion-light-left),transparent 80%),
   radial-gradient(ellipse 42% 67% at 99% 6%,var(--motion-light-right),transparent 81%);
 mix-blend-mode:screen;
 opacity:.82;
 transform-origin:50% 50%;
 animation:motion-ambient-drift 9.5s cubic-bezier(.45,0,.55,1) infinite alternate;
 will-change:transform,opacity;
}
@keyframes motion-ambient-drift{
 0%{transform:translate3d(-22px,17px,0) scale(1.03);opacity:.69}
 50%{transform:translate3d(14px,-5px,0) scale(1.10);opacity:.86}
 100%{transform:translate3d(31px,-22px,0) scale(1.06);opacity:.74}
}
@media(prefers-reduced-motion:reduce){
 body #frame-content::before{animation:none;opacity:.44;transform:none}
}


/* Home's .home-flow wrapper previously had an opaque #0e0e0e background,
   masking the fixed 3D canvas behind it. Keep its backdrop transparent so
   the 3D sculpture and animated light field are actually visible. */
#frame-content .home-flow{
 background:transparent!important;
 background-color:transparent!important;
}


/* The sticky Home→About backdrop also painted an opaque gradient across the
   fixed canvas. Preserve its floating green light elements, but remove only
   the opaque backing layer so the actual WebGL stage is visible. */
#frame-content .home-flow .flow-backdrop{
  background:transparent!important;
  background-color:transparent!important;
}


/* Opacity is already critically damped in the WebGL render loop.
   CSS transitions on every RAF opacity write created a second interpolation
   layer and made response feel late/sticky at higher refresh rates. */
#frame-content > canvas#three-canvas.motion-stage-canvas,
#frame-content > .route-scene-layer.motion-stage,
#frame-content > .route-scene-layer.motion-stage canvas {
  transition:none!important;
  -webkit-transition:none!important;
}


/* Performance audit: three oversized blurred and screen-blended layers in
   flow-backdrop were costing >200 ms/frame in software WebGL. The persistent
   frame ::before already draws the same green ambient light more cheaply. */
#frame-content .home-flow .flow-light,
#frame-content .home-flow .flow-backdrop-grid{
  display:none!important;
}
/* Screen blending forces expensive full-viewport offscreen composition.
   These radial gradients already have transparent falloff. */
body #frame-content::before{
  mix-blend-mode:normal!important;
}
