/* Hero parallax: stacked layers (background, shooting stars, dust, orb glow, particles,
   swirling orb, astronaut) that shift with the cursor. This file stacks the layers, so keep it;
   remove the hero-parallax.js <script> from index.html to turn off the movement. */
.hero-layers { position: relative; container-type: size; }

/* The stage keeps the artwork's 16:9 shape and covers the hero, like object-fit: cover,
   so all layers line up and the glow can scale from the orb's exact position. */
.hero-stage {
  --focus-x: .7;
  position: absolute; top: 50%;
  width: max(100cqw, 177.78cqh); aspect-ratio: 16 / 9;
  left: calc((100cqw - max(100cqw, 177.78cqh)) * var(--focus-x));
  transform: translateY(-50%) scale(1.05); /* overscan so moving layers never show an edge */
}
@media (max-width: 720px) {
  .hero-stage { --focus-x: .74; }
  /* Phones: nudge the astronaut and his glow up and left so more of him shows */
  .layer-astronaut, .layer-glow, .layer-particles, .layer-orb { --ox: -30px; --oy: -30px; }
}

.hero-layer {
  position: absolute; inset: 0;
  transform: translate3d(calc(var(--mx, 0) * var(--range) + var(--ox, 0px)), calc(var(--my, 0) * var(--range) * .6 + var(--oy, 0px)), 0);
  will-change: transform;
}
.hero-layer img { display: block; width: 100%; height: 100%; object-fit: fill; }
.layer-bg { --range: -8px; }
.layer-sky { --range: -8px; width: 100%; height: 100%; pointer-events: none; }
.layer-dust { --range: -15px; width: 100%; height: 100%; pointer-events: none; }
/* Particles (js/hero-particles.js) and the orb move with the astronaut so the orb stays in his hand */
.layer-particles { --range: -22px; width: 100%; height: 100%; pointer-events: none; }
.layer-orb { --range: -22px; pointer-events: none; }
/* The orb image is a 358px square cut from the 2560x1440 artwork at 1424, 408 */
.orb-box { position: absolute; left: 55.625%; top: 28.333%; width: 13.984%; aspect-ratio: 1; }
.layer-orb .orb-box img { position: absolute; inset: 0; width: 100%; height: 100%; }
/* Three.js orb canvas (js/hero-orb.js): larger than the orb so its glow has room (600px of artwork) */
.orb-box canvas { position: absolute; inset: -33.8%; width: 167.6%; height: 167.6%; opacity: 0; transition: opacity .6s; }
.orb-live canvas { opacity: var(--orb-opacity, 1); } /* set from opacity in js/hero-orb.js */
.orb-live img { opacity: 0; }
/* Orb reflection on the helmet visor. js/hero-orb.js places and sizes it (visorX/Y/W/H in its SETTINGS). */
.visor-reflect { position: absolute; mix-blend-mode: screen; pointer-events: none; opacity: 0; transition: opacity .6s; }
.orb-reflecting .visor-reflect { opacity: 1; }
/* No WebGL: the still orb image just turns slowly */
.orb-spin img { animation: orb-spin 20s linear infinite; }
.layer-astronaut, .layer-glow { --range: -22px; }

/* Glow sits behind the astronaut and pulses around the orb
   (orb center sits at 62.6% / 40.3% of the artwork) */
/* GLOW SETTINGS: edit these five values.
   --glow-opacity: overall strength of the glow (1 = full, .6 = 60%)
   --glow-min / --glow-max: smallest and largest size of the pulse.
   --glow-pulse: seconds for one grow or shrink of the pulse (higher = slower).
   --glow-spin: seconds for one full clockwise turn (higher = slower).
   At --glow-min .7 the glow's edge sits about 12px outside the orb. */
.layer-glow {
  --glow-opacity: .7;
  --glow-min: .7;
  --glow-max: .94;
  --glow-pulse: 5s;
  --glow-spin: 40s;
  opacity: var(--glow-opacity);
}
/* Pulse (scale) and a slow clockwise spin (rotate) run as separate properties so they combine */
.layer-glow img {
  transform-origin: 62.6% 40.3%;
  animation: orb-pulse var(--glow-pulse) ease-in-out infinite alternate, orb-spin var(--glow-spin) linear infinite;
}
@keyframes orb-pulse {
  from { scale: var(--glow-min); opacity: .8; }
  to { scale: var(--glow-max); opacity: 1; }
}
@keyframes orb-spin { to { rotate: 360deg; } }

@media (prefers-reduced-motion: reduce) {
  .hero-layer { transform: translate3d(var(--ox, 0px), var(--oy, 0px), 0); }
  .layer-glow img, .orb-spin img { animation: none !important; }
}
