/* ==========================================================================
   NEXGLAB Cinematic Motion System
   Inspired by premium scroll-driven storytelling & motion design
   ========================================================================== */

:root {
  --ease-cinematic: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-subtle: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-reveal: 0.85s;
  --duration-fast: 0.28s;
  --duration-medium: 0.45s;
}

/* ─── Base Reveal Element ─────────────────────────────────────────────────── */
[data-reveal] {
  opacity: 0;
  transform: translate3d(0, 32px, 0);
  transition:
    opacity var(--duration-reveal) var(--ease-cinematic),
    transform var(--duration-reveal) var(--ease-cinematic);
  will-change: opacity, transform;
}

[data-reveal].is-visible,
[data-reveal='visible'] {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* ─── Reveal Directional & Spatial Variants ───────────────────────────────── */
[data-reveal='left'] {
  transform: translate3d(-36px, 0, 0);
}

[data-reveal='right'] {
  transform: translate3d(36px, 0, 0);
}

[data-reveal='left'].is-visible,
[data-reveal='right'].is-visible {
  transform: translate3d(0, 0, 0);
}

[dir='rtl'] [data-reveal='left'] {
  transform: translate3d(36px, 0, 0);
}

[dir='rtl'] [data-reveal='right'] {
  transform: translate3d(-36px, 0, 0);
}

[dir='rtl'] [data-reveal='left'].is-visible,
[dir='rtl'] [data-reveal='right'].is-visible {
  transform: translate3d(0, 0, 0);
}

[data-reveal='scale'] {
  transform: scale(0.95) translate3d(0, 20px, 0);
}

[data-reveal='scale'].is-visible {
  transform: scale(1) translate3d(0, 0, 0);
}

/* Card reveal: subtle lift with scale settle */
[data-reveal='card'] {
  opacity: 0;
  transform: translate3d(0, 38px, 0) scale(0.975);
  transition:
    opacity 0.9s var(--ease-cinematic),
    transform 0.9s var(--ease-cinematic),
    border-color var(--duration-medium) var(--ease-cinematic),
    box-shadow var(--duration-medium) var(--ease-cinematic);
}

[data-reveal='card'].is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

/* ─── Hero Cinematic Choreography ─────────────────────────────────────────── */
.hero-home {
  perspective: 1000px;
}

.hero-video {
  transition: transform 0.2s ease-out, filter 0.8s var(--ease-cinematic);
  will-change: transform;
}

.hero-copy-block {
  transition:
    opacity 1s var(--ease-cinematic),
    transform 1s var(--ease-cinematic),
    box-shadow var(--duration-medium) var(--ease-cinematic);
}

.hero-copy-block h1 {
  background-size: 200% auto;
  animation: heroGradientShift 12s ease infinite alternate;
}

@keyframes heroGradientShift {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}

.hero-actions .button-primary,
.hero-actions .button-secondary {
  position: relative;
  overflow: hidden;
  transition:
    transform var(--duration-fast) var(--ease-cinematic),
    box-shadow var(--duration-fast) var(--ease-cinematic),
    border-color var(--duration-fast) var(--ease-cinematic),
    background var(--duration-fast) var(--ease-cinematic);
}

@media (hover: hover) and (pointer: fine) {
  .hero-actions .button-primary:hover {
    transform: translate3d(0, -2px, 0) scale(1.02);
    box-shadow: 0 14px 34px rgba(48, 210, 190, 0.32), 0 0 20px rgba(11, 163, 96, 0.24);
  }

  .hero-actions .button-secondary:hover {
    transform: translate3d(0, -2px, 0);
    border-color: rgba(48, 210, 190, 0.45);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24), 0 0 16px rgba(48, 210, 190, 0.12);
  }

  .problem-card:hover {
    transform: translate3d(0, -5px, 0);
    border-color: rgba(48, 210, 190, 0.42);
    box-shadow:
      0 20px 48px rgba(2, 11, 16, 0.38),
      0 0 24px rgba(48, 210, 190, 0.12),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }

  html[data-theme='light'] .problem-card:hover {
    box-shadow:
      0 18px 44px rgba(16, 43, 48, 0.12),
      0 0 20px rgba(48, 210, 190, 0.14);
    border-color: rgba(11, 163, 96, 0.4);
  }

  .problem-card:hover .problem-icon-wrap {
    transform: scale(1.06);
    border-color: var(--brand-teal);
    background: rgba(48, 210, 190, 0.14);
  }

  .solution-item:hover {
    transform: translate3d(0, -5px, 0);
    border-color: rgba(48, 210, 190, 0.42);
    box-shadow:
      0 20px 48px rgba(2, 11, 16, 0.38),
      0 0 24px rgba(48, 210, 190, 0.12),
      inset 0 1px 0 rgba(255, 255, 255, 0.18);
  }

  html[data-theme='light'] .solution-item:hover {
    box-shadow:
      0 18px 44px rgba(16, 43, 48, 0.12),
      0 0 20px rgba(48, 210, 190, 0.14);
    border-color: rgba(11, 163, 96, 0.4);
  }

  .solution-item:hover .solution-index {
    transform: scale(1.05);
    background: rgba(48, 210, 190, 0.22);
    border-color: var(--brand-teal);
    box-shadow: 0 0 16px rgba(48, 210, 190, 0.22);
  }
}

/* ─── Solution Panel Tab Switching Transition ─────────────────────────────── */
.solution-panel {
  opacity: 0;
  transform: translate3d(0, 12px, 0);
  transition:
    opacity 0.4s var(--ease-cinematic),
    transform 0.4s var(--ease-cinematic);
}

.solution-panel.is-active {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* ─── Section Ambient Video Parallax Depth ────────────────────────────────── */
.section-ambient-video video,
.solution-video-bg video {
  transition: transform 0.25s ease-out;
  will-change: transform;
}

/* ─── Reduced Motion Support ──────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  [data-reveal],
  [data-reveal='left'],
  [data-reveal='right'],
  [data-reveal='scale'],
  [data-reveal='card'],
  .solution-panel {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .hero-video,
  .section-ambient-video video,
  .solution-video-bg video {
    transform: none !important;
    transition: none !important;
  }

  .hero-copy-block h1 {
    animation: none !important;
  }

  .problem-card:hover,
  .solution-item:hover,
  .hero-actions .button-primary:hover,
  .hero-actions .button-secondary:hover {
    transform: none !important;
  }
}
