/**
 * Vaporwave Three.js hero canvas — drop-in styles for Krazy Takeout Go Box.
 * Pair with hero-vaporwave.js. Does not replace existing .hero-inner / terminal styles.
 */

/* Ensure stacking context so the canvas can sit behind copy */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden; /* soft clip of grid at edges */
}

/* Absolute fill behind .hero-inner content */
.hero-canvas-root,
#hero-canvas-root {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  /* Keep text readable: muted vaporwave behind copy */
  opacity: 0.42;
}

html[data-theme="dark"] .hero-canvas-root,
html[data-theme="dark"] #hero-canvas-root {
  opacity: 0.55;
}

html[data-theme="light"] .hero-canvas-root,
html[data-theme="light"] #hero-canvas-root {
  opacity: 0.32;
}

.hero-canvas-root canvas,
#hero-canvas-root canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Lift existing hero content above the canvas */
.hero > .hero-inner,
.hero > .wrap.hero-inner {
  position: relative;
  z-index: 1;
}

/* Optional soft veil so copy stays legible on busy frames */
.hero-canvas-root::after,
#hero-canvas-root::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--bg, #f5f9fc) 55%, transparent) 0%,
    color-mix(in srgb, var(--bg, #f5f9fc) 25%, transparent) 45%,
    color-mix(in srgb, var(--bg, #f5f9fc) 70%, transparent) 100%
  );
  z-index: 1;
}

/* Reduced motion: still show a static frame; JS pauses the loop */
@media (prefers-reduced-motion: reduce) {
  .hero-canvas-root,
  #hero-canvas-root {
    opacity: 0.28;
  }
}

/* Narrow: quieter and shifted down so the headline sits on open sky */
@media (max-width: 720px) {
  .hero-canvas-root,
  #hero-canvas-root {
    opacity: 0.18;
    transform: translateY(16%);
  }
  html[data-theme="dark"] .hero-canvas-root,
  html[data-theme="dark"] #hero-canvas-root {
    opacity: 0.28;
  }
}

/* Static swarm fallback (reduced-motion / no-WebGL) — site wiring */
.hero-canvas-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  margin: 0;
  pointer-events: none;
}
.hero-canvas-fallback img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
/* Canvas paints over the fallback when Three.js mounts */
.hero-canvas-root > canvas,
#hero-canvas-root > canvas {
  position: relative;
  z-index: 1;
}

/* Pause toggle: hide the live canvas so the still shows */
html.motion-paused .hero-canvas-root > canvas,
html.motion-paused #hero-canvas-root > canvas {
  display: none !important;
}
