/* ============================================
   DentAlign - Immersive 3D Animations
   Cinematic scroll experience
   ============================================ */

/* ========== LENIS SMOOTH SCROLL ========== */

html.lenis, html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

/* ========== GLOBAL 3D SCENE ========== */

/* Let WebGL shader canvas be the page background */
html {
  background: var(--bg-primary);
}
body {
  background: transparent !important;
}

/* perspective moved to individual 3D containers — NOT on body (breaks position:fixed) */

.section {
  position: relative;
  z-index: 1;
}

.header {
  z-index: 1000;
}

/* 3D perspective only where needed */
.card-3d,
.pricing-card,
.tool-card,
.mode-card,
.why-benefit,
.studio-card,
.alignment-feature {
  perspective: 1200px;
}

/* ========== HERO IMMERSIVE ZOOM ========== */

.hero {
  overflow: hidden;
}

.hero-video-container {
  will-change: transform;
}

.hero-content {
  transform-style: preserve-3d;
  will-change: transform, opacity;
}

.hero-icon {
  will-change: transform;
}

.hero-title {
  will-change: transform, opacity;
}

.hero-title-line {
  display: block;
  overflow: hidden;
}

.hero-title .split-char {
  display: inline-block;
  will-change: transform, opacity;
}

.hero-subtitle {
  will-change: transform, opacity;
}

.hero-cta {
  will-change: transform, opacity;
}

.hero-stats {
  will-change: transform, opacity;
}

/* ========== 3D CARD EFFECTS (DEEP) ========== */

.card-3d {
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1),
              box-shadow 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  will-change: transform, box-shadow;
}

/* Glow layer behind card */
.card-3d::before {
  content: '';
  position: absolute;
  inset: -4px;
  background: linear-gradient(135deg,
    rgba(0, 179, 198, 0.6),
    rgba(0, 79, 124, 0.4),
    rgba(0, 179, 198, 0.6));
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  z-index: -1;
  filter: blur(20px);
}

.card-3d:hover::before {
  opacity: 1;
}

/* Inner elements float at different depths */
.card-3d .mode-card-icon,
.card-3d .pricing-card-header {
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.card-3d:hover .mode-card-icon {
  transform: translateZ(40px) scale(1.1);
}

.card-3d:hover .pricing-card-header {
  transform: translateZ(30px);
}

.card-3d h3 {
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.card-3d:hover h3 {
  transform: translateZ(25px);
}

.card-3d .mode-card-video {
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.card-3d:hover .mode-card-video {
  transform: translateZ(15px);
}

/* Shadow that moves with tilt */
.card-3d-shadow {
  position: absolute;
  inset: 10px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: inherit;
  filter: blur(30px);
  z-index: -2;
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.6s ease;
  transform: translateY(20px) translateZ(-60px);
}

.card-3d:hover .card-3d-shadow {
  opacity: 0.6;
}

/* ========== SECTION 3D STORYTELLING ========== */

.section {
  will-change: transform, opacity;
}

/* ========== FLOATING ATMOSPHERE ORBS ========== */

/* Atmosphere orbs — all styles set via inline JS */

.atmosphere-orb-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(0, 179, 198, 0.8) 0%, transparent 70%);
  top: -200px;
  left: -200px;
}

.atmosphere-orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(0, 79, 124, 0.8) 0%, transparent 70%);
  bottom: -150px;
  right: -150px;
}

.atmosphere-orb-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(0, 179, 198, 0.5) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* ========== TEXT REVEAL ANIMATIONS ========== */

.text-reveal-line {
  overflow: hidden;
  display: block;
}

.text-reveal-line > span {
  display: inline-block;
  will-change: transform;
}

/* Split text characters */
.split-char {
  display: inline-block;
  will-change: transform, opacity;
}

/* ========== SCROLL-DRIVEN REVEAL ========== */

.gsap-reveal {
  opacity: 0;
  transform: translateY(80px) translateZ(-50px);
}

.gsap-reveal-left {
  opacity: 0;
  transform: translateX(-100px) rotateY(8deg);
}

.gsap-reveal-right {
  opacity: 0;
  transform: translateX(100px) rotateY(-8deg);
}

.gsap-reveal-scale {
  opacity: 0;
  transform: scale(0.8) translateZ(-100px);
}

/* ========== MAGNETIC ELEMENTS ========== */

.magnetic {
  transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  will-change: transform;
}

/* ========== SCROLL INDICATOR PULSE ========== */

.scroll-indicator {
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(10px); opacity: 0.5; }
}

/* ========== FEATURE SECTIONS DEPTH ========== */

.alignment-demo,
.retouch-demo,
.studio-video-container {
  transform-style: preserve-3d;
  will-change: transform;
}

/* ========== STEP COUNTERS 3D ========== */

.alignment-step-number {
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.alignment-step:hover .alignment-step-number {
  transform: translateZ(20px) scale(1.15) rotateY(15deg);
}

/* ========== PRICING CARD POPULAR GLOW ========== */

.pricing-card.is-popular.card-3d::before {
  opacity: 0.3;
  background: linear-gradient(135deg,
    rgba(0, 179, 198, 0.8),
    rgba(255, 200, 0, 0.4),
    rgba(0, 179, 198, 0.8));
}

.pricing-card.is-popular.card-3d:hover::before {
  opacity: 1;
}

/* ========== VIDEO CONTAINERS DEPTH ========== */

.mode-card-video video,
.alignment-video,
.retouch-demo video {
  transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.mode-card:hover .mode-card-video video {
  transform: scale(1.05);
}

/* ========== GSAP OVERRIDES ==========
   When GSAP is active, disable CSS-based reveal transitions
   to prevent conflicts with GSAP inline styles */

.reveal,
.reveal-left,
.reveal-right,
.reveal-scale {
  transition: none !important;
}

/* ========== REDUCED MOTION ========== */

@media (prefers-reduced-motion: reduce) {
  body {
    perspective: none;
  }

  .card-3d,
  .magnetic,
  .gsap-reveal,
  .gsap-reveal-left,
  .gsap-reveal-right,
  .gsap-reveal-scale,
  .section,
  .hero-content,
  .hero-video-container {
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
    will-change: auto !important;
  }

  .card-3d::before,
  .card-3d-shadow,
  .atmosphere-orb {
    display: none;
  }

  .scroll-indicator {
    animation: none;
  }
}
