/* ============================================================
   MOLVERN LABS — Animations
   Scroll reveals, micro-interactions, hover effects
   ============================================================ */

/* ── Reveal Animations (Intersection Observer driven) ─────── */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity var(--duration-reveal) var(--ease-out),
    transform var(--duration-reveal) var(--ease-out);
}

.reveal--visible {
  opacity: 1;
  /* none, not translateY(0) — a zero-offset transform still promotes the
     element to its own GPU compositing layer. On Android Chrome that layer
     can fight with the native <select> popup's own overlay and bleed page
     content into it (reported on the contact form's budget dropdown, which
     sits right above the reveal-staggered FAQ list). transform: none drops
     the layer once the reveal finishes; the transition still animates
     correctly since translateY(24px) → none resolves to the same identity
     matrix as → translateY(0). */
  transform: none;
}

/* Stagger children */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity var(--duration-reveal) var(--ease-out),
    transform var(--duration-reveal) var(--ease-out);
}

.reveal-stagger--visible > *:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger--visible > *:nth-child(2) { transition-delay: 100ms; }
.reveal-stagger--visible > *:nth-child(3) { transition-delay: 200ms; }
.reveal-stagger--visible > *:nth-child(4) { transition-delay: 300ms; }
.reveal-stagger--visible > *:nth-child(5) { transition-delay: 400ms; }
.reveal-stagger--visible > *:nth-child(6) { transition-delay: 500ms; }

.reveal-stagger--visible > * {
  opacity: 1;
  /* none, not translateY(0) — see .reveal--visible above. */
  transform: none;
}

/* Slide from left */
.reveal--left {
  opacity: 0;
  transform: translateX(-40px);
  transition:
    opacity var(--duration-reveal) var(--ease-out),
    transform var(--duration-reveal) var(--ease-out);
}

.reveal--left.reveal--visible {
  opacity: 1;
  transform: none;
}

/* Slide from right */
.reveal--right {
  opacity: 0;
  transform: translateX(40px);
  transition:
    opacity var(--duration-reveal) var(--ease-out),
    transform var(--duration-reveal) var(--ease-out);
}

.reveal--right.reveal--visible {
  opacity: 1;
  transform: none;
}

/* Scale up */
.reveal--scale {
  opacity: 0;
  transform: scale(0.95);
  transition:
    opacity var(--duration-reveal) var(--ease-out),
    transform var(--duration-reveal) var(--ease-out);
}

.reveal--scale.reveal--visible {
  opacity: 1;
  transform: none;
}

/* ── Hero Entrance ────────────────────────────────────────── */
@keyframes heroFadeUp {
  0% {
    opacity: 0;
    transform: translateY(40px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes heroFadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.hero-animate {
  animation: heroFadeUp 1s var(--ease-out) forwards;
  opacity: 0;
}

.hero-animate--delay-1 { animation-delay: 200ms; }
.hero-animate--delay-2 { animation-delay: 400ms; }
.hero-animate--delay-3 { animation-delay: 600ms; }
.hero-animate--delay-4 { animation-delay: 800ms; }

/* ── Dot Grid Background ─────────────────────────────────── */
@keyframes dotPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

.dot-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 30%, transparent 70%);
  pointer-events: none;
}

/* ── Radial Glow ──────────────────────────────────────────── */
.radial-glow {
  position: absolute;
  width: 800px;
  height: 800px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.2) 0%, rgba(59, 130, 246, 0.05) 40%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  filter: blur(80px);
  animation: glowBreathe 8s ease-in-out infinite;
}

/* ── Subtle shimmer effect ────────────────────────────────── */
@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.shimmer {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(59, 130, 246, 0.06) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 8s linear infinite;
}

/* ── Gradient border (for premium cards) ──────────────────── */
.gradient-border {
  position: relative;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--color-blue), transparent 50%);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.gradient-border:hover::before {
  opacity: 1;
}

/* ── Float animation (for decorative elements) ────────────── */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.float {
  animation: float 4s ease-in-out infinite;
}

/* ── Pulse glow (for active CTA) ──────────────────────────── */
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 20px var(--color-blue-glow); }
  50% { box-shadow: 0 0 30px var(--color-blue-glow), 0 0 60px rgba(59, 130, 246, 0.15); }
}

.pulse-glow {
  animation: pulseGlow 3s ease-in-out infinite;
}

/* ── Line draw (for decorative dividers) ──────────────────── */
@keyframes lineDraw {
  0% { width: 0; }
  100% { width: 100%; }
}

.line-draw {
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-blue), transparent);
}

.line-draw--visible {
  animation: lineDraw 1.5s var(--ease-out) forwards;
}

/* ── Counter animation ────────────────────────────────────── */
@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.count-up {
  animation: countUp 0.6s var(--ease-out) forwards;
  opacity: 0;
}

/* ── Kinetic Typography — Word-by-word reveal ─────────────── */
@keyframes wordReveal {
  0% {
    opacity: 0;
    transform: translateY(40px) rotateX(15deg);
    filter: blur(6px);
  }
  60% {
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotateX(0);
    filter: blur(0);
  }
}

.hero__word {
  display: inline-block;
  opacity: 0;
  animation: wordReveal 0.9s var(--ease-out) forwards;
  animation-delay: calc(var(--word-index) * 100ms + 200ms);
}

/* ── Animated gradient text flow ──────────────────────────── */
@keyframes gradientFlow {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}

.hero__title-accent {
  display: block;
}

.hero__title-accent .hero__word {
  background: linear-gradient(
    90deg,
    #ffffff 0%,
    #60a5fa 25%,
    #3b82f6 50%,
    #60a5fa 75%,
    #ffffff 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation:
    wordReveal 0.9s var(--ease-out) forwards,
    gradientFlow 6s linear 1.2s infinite;
  animation-delay: calc(var(--word-index) * 100ms + 200ms), 1.2s;
}

/* ── Glow breathing animation ─────────────────────────────── */
@keyframes glowBreathe {
  0%, 100% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(1.12);
  }
}

/* ── Hero subtitle entrance ───────────────────────────────── */
@keyframes subtitleReveal {
  0% {
    opacity: 0;
    transform: translateY(20px);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

.hero-badge-animate {
  opacity: 0;
  animation: subtitleReveal 0.8s var(--ease-out) forwards;
  animation-delay: 100ms;
}

.hero-subtitle-animate {
  opacity: 0;
  animation: subtitleReveal 1s var(--ease-out) forwards;
  animation-delay: 900ms;
}

.hero-actions-animate {
  opacity: 0;
  animation: subtitleReveal 1s var(--ease-out) forwards;
  animation-delay: 1100ms;
}

.hero-trust-animate {
  opacity: 0;
  animation: subtitleReveal 1s var(--ease-out) forwards;
  animation-delay: 1400ms;
}

/* ── Card spotlight cursor tracking ───────────────────────── */
.spotlight-card {
  --mouse-x: 50%;
  --mouse-y: 50%;
}

.spotlight-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    500px circle at var(--mouse-x) var(--mouse-y),
    rgba(59, 130, 246, 0.08),
    transparent 40%
  );
  opacity: 0;
  transition: opacity var(--duration-slow) var(--ease-out);
  pointer-events: none;
  z-index: 1;
}

.spotlight-card:hover::before {
  opacity: 1;
}

/* Glowing border that follows cursor */
.spotlight-card::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: radial-gradient(
    400px circle at var(--mouse-x) var(--mouse-y),
    rgba(59, 130, 246, 0.35),
    transparent 40%
  );
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  padding: 1px;
  opacity: 0;
  transition: opacity var(--duration-slow) var(--ease-out);
  pointer-events: none;
  z-index: 0;
}

.spotlight-card:hover::after {
  opacity: 1;
}

/* ── 3D Card tilt ─────────────────────────────────────────── */
.tilt-card {
  transition:
    transform var(--duration-slow) var(--ease-out),
    box-shadow var(--duration-slow) var(--ease-out);
  transform-style: preserve-3d;
  will-change: transform;
}

/* ── Magnetic button ──────────────────────────────────────── */
.magnetic-btn {
  transition:
    transform var(--duration-normal) var(--ease-spring),
    background-color var(--duration-normal) var(--ease-out),
    box-shadow var(--duration-normal) var(--ease-out),
    color var(--duration-normal) var(--ease-out);
}

/* ── Animated gradient border for CTA card ────────────────── */
@keyframes borderGradientRotate {
  0%   { --border-angle: 0deg; }
  100% { --border-angle: 360deg; }
}

/* ── Spinner rotation ─────────────────────────────────────── */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}


/* ── Accessibility: Reduced Motion ────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.15s !important;
    scroll-behavior: auto !important;
  }

  .hero__word {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    animation: none !important;
  }

  .hero__title-accent .hero__word {
    animation: none !important;
    background: var(--color-blue-light) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }

  .hero-subtitle-animate,
  .hero-actions-animate,
  .hero-trust-animate {
    opacity: 1 !important;
    animation: none !important;
  }

  .reveal,
  .reveal--left,
  .reveal--right,
  .reveal--scale {
    opacity: 1 !important;
    transform: none !important;
  }

  .reveal-stagger > * {
    opacity: 1 !important;
    transform: none !important;
  }

  .pulse-glow {
    animation: none !important;
  }

  /* Timeline & Wizard (Phase 2/3) */
  .timeline__step {
    opacity: 1 !important;
  }

  .timeline__step .timeline__node {
    border-color: var(--color-blue) !important;
    color: var(--color-blue) !important;
  }

  .timeline__line-fill {
    height: 100% !important;
  }

  .wizard__step {
    animation: none !important;
  }

  .parallax-bg {
    transform: none !important;
  }

  /* Page transitions: reduced motion handled in transitions.css */

  .footer__gradient-border {
    animation: none !important;
    background-position: 0% 0% !important;
  }

  .float {
    animation: none !important;
  }

  .radial-glow {
    animation: none !important;
  }
}
