/* =============================================================
   Manta X - Animations
   GSAP-driven reveal classes + base CSS transitions.
   ============================================================= */

/* --- Initial hidden states (activated by GSAP ScrollTrigger) --- */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  will-change: opacity, transform;
}

.reveal-left {
  opacity: 0;
  transform: translateX(-32px);
  will-change: opacity, transform;
}

.reveal-right {
  opacity: 0;
  transform: translateX(32px);
  will-change: opacity, transform;
}

/* On mobile, keep horizontal reveal offsets small so they cannot cause
   visible overflow before GSAP fires (parent clipping is also in place). */
@media (max-width: 768px) {
  .reveal-left { transform: translateX(-12px); }
  .reveal-right { transform: translateX(12px); }
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.96);
  will-change: opacity, transform;
}

.reveal-fade {
  opacity: 0;
  will-change: opacity;
}

/* Applied by ScrollTrigger onEnter */
.revealed {
  opacity: 1 !important;
  transform: none !important;
}

/* --- Staggered children --- */
.stagger > * {
  opacity: 0;
  transform: translateY(20px);
  will-change: opacity, transform;
}

/* Hero word reveal - initial state */
.hero-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(100%);
  will-change: opacity, transform;
}

/* Counter number styling helper - GSAP mutates text */
[data-counter] { font-variant-numeric: tabular-nums; }

/* Process line connector - GSAP draws this */
.process-line {
  position: absolute;
  top: 36px;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--mx-hairline) 12%, var(--mx-hairline) 88%, transparent);
  transform-origin: left;
  transform: scaleX(0);
  z-index: 0;
}

@media (max-width: 768px) {
  .process-line { display: none; }
}

/* --- Hero parallax scene --- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding-top: var(--nav-height);
}

/* Mobile hero rebuild: aggressive sizing, full-width CTAs, muted brand stamp */
@media (max-width: 768px) {
  .hero {
    min-height: auto;
    align-items: flex-start;
    padding-top: calc(var(--nav-height) + var(--space-5));
    padding-bottom: var(--space-6);
  }
  /* Hard visibility fallbacks: hero text + CTAs always visible on mobile,
     regardless of whether GSAP fires. */
  .hero .hero-word,
  .hero [data-hero-sub],
  .hero [data-hero-ctas],
  .hero [data-hero-meta] {
    opacity: 1 !important;
    transform: none !important;
  }
  .hero .container {
    padding-inline: 20px;
  }
  .hero [data-hero-ctas] {
    flex-direction: column;
    align-items: stretch;
    gap: 12px !important;
    margin-top: var(--space-5) !important;
  }
  .hero [data-hero-ctas] .btn {
    width: 100%;
    justify-content: center;
  }
  /* Brand stamp on mobile: muted whisper below the CTAs, centred,
     overrides the inline style attributes via !important */
  .hero [data-hero-meta]:not(:first-child) {
    display: block !important;
    margin-top: var(--space-5) !important;
    margin-bottom: 0 !important;
    font-size: 11px !important;
    letter-spacing: 0.30em !important;
    color: var(--mx-text-muted) !important;
    text-transform: uppercase;
    text-align: center;
    width: 100%;
  }
  /* Eyebrow stays but tightens */
  .hero [data-hero-meta]:first-child {
    font-size: 11px !important;
    letter-spacing: 0.15em !important;
  }
  .scroll-indicator { display: none; }
}

@media (max-width: 480px) {
  .hero h1.display {
    font-size: clamp(28px, 8vw, 36px) !important;
    line-height: 1.05;
    margin-top: var(--space-3) !important;
    margin-bottom: var(--space-4) !important;
  }
  .hero [data-hero-sub] {
    font-size: 16px !important;
    line-height: 1.5;
  }
}

.hero-3d {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.hero-3d canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* 3D fallback (no WebGL) */
.hero-3d[data-fallback="true"] {
  background:
    radial-gradient(ellipse at 70% 30%, rgba(209, 30, 62, 0.08), transparent 55%),
    radial-gradient(ellipse at 20% 80%, rgba(255, 255, 255, 0.03), transparent 50%);
}

.hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
}

.hero-vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg,
    rgba(0, 0, 0, 0.2) 0%,
    rgba(0, 0, 0, 0) 40%,
    rgba(0, 0, 0, 0) 60%,
    rgba(0, 0, 0, 0.6) 100%
  );
  pointer-events: none;
}

/* --- Gentle motion defaults --- */
@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale,
  .reveal-fade,
  .stagger > *,
  .hero-word {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* =============================================================
   Scroll-reveal section: static, fixed-height, with a passive
   Three.js scene as background. No pin, no scrub, no scroll
   dependency. Behaves like any other section in the page flow.
   ============================================================= */
#scroll-reveal {
  padding: 0;
  background: var(--mx-black);
  position: relative;
  overflow: hidden;
  border-top: 1px solid var(--mx-surface-1);
  border-bottom: 1px solid var(--mx-surface-1);
  height: 100vh;
}

.scroll-reveal-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  padding-bottom: 10vh;
}

.scroll-reveal-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.scroll-reveal-canvas canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  will-change: contents;
}
.scroll-reveal-canvas[data-fallback="true"] {
  background:
    radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.03), transparent 55%),
    radial-gradient(ellipse at 50% 50%, rgba(209, 30, 62, 0.05), transparent 40%);
}

.scroll-reveal-vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(ellipse at center,
    transparent 35%,
    rgba(0, 0, 0, 0.55) 95%);
  pointer-events: none;
}

.scroll-reveal-content {
  position: relative;
  z-index: 2;
  pointer-events: none;
  max-width: var(--content-max);
}
.scroll-reveal-content .eyebrow { display: inline-block; }

@media (max-width: 768px) {
  #scroll-reveal { height: 70vh; }
  .scroll-reveal-stage {
    height: 70vh;
    position: relative;
    padding-bottom: 6vh;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }
  .scroll-reveal-canvas {
    display: block !important;
    position: absolute;
    inset: 0;
    z-index: 0;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }
  /* Soften vignette on mobile so it cannot mask the canvas */
  .scroll-reveal-vignette {
    background: radial-gradient(ellipse at center,
      transparent 45%,
      rgba(0, 0, 0, 0.35) 100%);
  }
}

/* Mobile SVG fallback element kept in DOM but never rendered.
   Belt-and-braces: hide and zero-size so iOS cannot composite it. */
.scroll-reveal-mobile {
  display: none !important;
  visibility: hidden !important;
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

/* --- Scroll-reveal text ---
   Desktop: hidden by default, GSAP scrub timeline reveals on scroll.
   Mobile: always visible (no scrub on mobile). */
.sr-eyebrow,
.sr-word,
.sr-sub {
  opacity: 0;
  will-change: opacity, transform, filter;
}
.sr-word { display: inline-block; }

@media (max-width: 767px) {
  .sr-eyebrow, .sr-word, .sr-sub {
    opacity: 1;
    will-change: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sr-eyebrow, .sr-word, .sr-sub { opacity: 1; }
}
