/* ---------------------------------------------------------------------------
   3D layer — progressive enhancement on top of styles.css / mockups.css.
   All effects are driven by JS adding classes / inline transforms, so with
   JS disabled the page renders exactly as before. Motion is fully disabled
   under prefers-reduced-motion.
--------------------------------------------------------------------------- */

/* Perspective containers: give each interactive scene real depth so child
   rotateX/rotateY transforms read as 3D rather than flat skews. */
.hero-visual {
  perspective: 1400px;
  perspective-origin: 50% 40%;
}

.feature-grid,
.tour-grid,
.showcase-strip,
.download-grid,
.system-grid,
.model-row {
  perspective: 1100px;
}

/* Tilt targets get a smooth settle and a 3D coordinate space for inner layers.
   The class is added by JS, so it never touches no-JS layout. */
.js-tilt {
  transform-style: preserve-3d;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

/* Floating hero chips sit above the mockup in Z and parallax with the cursor. */
.hero-chip {
  will-change: transform;
}
.js-parallax {
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Scroll reveal: elements start pushed back in depth + rotated slightly, then
   settle flush as they enter the viewport. JS adds .reveal-3d (so content is
   never hidden without JS) and toggles .is-visible via IntersectionObserver. */
.reveal-3d {
  opacity: 0;
  transform: perspective(1000px) translate3d(0, 34px, -80px) rotateX(7deg);
  transition:
    opacity 0.7s ease,
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-3d.is-visible {
  opacity: 1;
  transform: perspective(1000px) translate3d(0, 0, 0) rotateX(0);
}

/* Stagger children within a revealed group for a cascading depth effect. */
.reveal-3d.stagger-1 { transition-delay: 0.06s; }
.reveal-3d.stagger-2 { transition-delay: 0.12s; }
.reveal-3d.stagger-3 { transition-delay: 0.18s; }
.reveal-3d.stagger-4 { transition-delay: 0.24s; }
.reveal-3d.stagger-5 { transition-delay: 0.30s; }

/* A soft glare that follows the cursor across tilted cards, positioned via the
   --gx / --gy custom properties JS sets. Pointer-events off so it never blocks
   clicks on the card content. */
.tilt-glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  background: radial-gradient(
    260px circle at var(--gx, 50%) var(--gy, 0%),
    rgba(255, 255, 255, 0.16),
    rgba(255, 255, 255, 0) 60%
  );
  z-index: 2;
}
.js-tilt:hover .tilt-glare {
  opacity: 1;
}
/* Cards need a positioning context + clipping for the glare overlay. */
.feature-card,
.tour-card,
.showcase-item,
.download-card {
  position: relative;
}

@media (prefers-reduced-motion: reduce) {
  .js-tilt,
  .js-parallax {
    transition: none !important;
    transform: none !important;
  }
  .reveal-3d {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .tilt-glare {
    display: none;
  }
}

@media (max-width: 780px), (hover: none) and (pointer: coarse) {
  .hero-visual,
  .feature-grid,
  .tour-grid,
  .showcase-strip,
  .download-grid,
  .system-grid,
  .model-row {
    perspective: none;
  }

  .js-tilt,
  .js-parallax {
    transform: none !important;
    will-change: auto;
  }

  .reveal-3d,
  .reveal-3d.is-visible {
    opacity: 1;
    transform: none;
  }

  .tilt-glare {
    display: none;
  }
}
