/* ═══════════════════════════════════════════════════════════════
   RADIANT OPTIMIZER — LANDING PAGE ANIMATION LAYER
   All scroll-triggered and micro-interaction animations.
   ═══════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────
   1. HERO HEADLINE — word-by-word stagger
   ─────────────────────────────────────────────
   Cancel the parent fade-in-up so word stagger
   fully controls the reveal. JS adds .word-visible
   with staggered delays.
*/

/* Override the parent animation so words control the reveal */
.hero-headline {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}

/* Each word starts hidden */
.hero-headline .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}
.hero-headline .word.word-visible {
  opacity: 1;
  transform: translateY(0);
}
/* Accent words — same brand blue (#0052FF) used site-wide.
   Must override premium-fx.css which forces #FFFFFF via -webkit-text-fill-color */
.hero-headline .word.accent {
  color: #0052FF !important;
  -webkit-text-fill-color: #0052FF !important;
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
}

/* ─────────────────────────────────────────────
   2. PROBLEM STATS / CREDIBILITY / AI TICKER
      Count-up number reveal
   ─────────────────────────────────────────────
   The number wrapper gets .counting class when
   in view. The actual count-up is driven by JS.
   Add a subtle scale pop when counting starts.
*/
.countup-num {
  display: inline-block;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.countup-num.pop {
  animation: countup-pop 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes countup-pop {
  0%   { transform: scale(0.88); opacity: 0.4; }
  60%  { transform: scale(1.06); }
  100% { transform: scale(1);    opacity: 1; }
}

/* ─────────────────────────────────────────────
   3. HOW IT WORKS — connector line draw
   ─────────────────────────────────────────────
   A line sits between the 3 step cards.
   It draws from left to right via scaleX.
*/
.hiw-connector {
  position: absolute;
  top: 52px; /* aligns with icon center */
  left: calc(33.33% - 12px);
  width: calc(33.33% + 24px);
  height: 2px;
  background: linear-gradient(90deg, #0052FF 0%, #3B82F6 100%);
  transform-origin: left center;
  transform: scaleX(0);
  opacity: 0;
  transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.3s,
              opacity 0.3s ease 0.3s;
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(0, 82, 255, 0.5);
  pointer-events: none;
  z-index: 0;
}
.hiw-connector-2 {
  left: calc(66.66% - 12px);
  transition-delay: 0.55s, 0.55s;
}
.hiw-steps.line-visible .hiw-connector {
  transform: scaleX(1);
  opacity: 1;
}
/* Connector only on desktop (3 column) */
@media (max-width: 800px) {
  .hiw-connector { display: none; }
}

/* Step icon pulse when line reaches it */
.hiw-step-icon {
  transition: box-shadow 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.hiw-steps.line-visible .hiw-step:nth-child(2) .hiw-step-icon {
  animation: icon-arrive 0.5s cubic-bezier(0.16, 1, 0.3, 1) 1.1s both;
}
.hiw-steps.line-visible .hiw-step:nth-child(3) .hiw-step-icon {
  animation: icon-arrive 0.5s cubic-bezier(0.16, 1, 0.3, 1) 1.4s both;
}
@keyframes icon-arrive {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.18); box-shadow: 0 0 28px rgba(0,82,255,0.65); }
  100% { transform: scale(1); }
}

/* ─────────────────────────────────────────────
   4. TOOLS GRID — staggered card entrance
   ─────────────────────────────────────────────
   Each .tool-card starts hidden. JS adds
   .tool-card-visible with nth-based delays.
*/
.tool-card {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.65s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.3s,
              box-shadow 0.3s;
}
.tool-card.tool-visible {
  opacity: 1;
  transform: translateY(0);
}
/* Keep hover working after reveal */
.tool-card.tool-visible:hover {
  transform: translateY(-6px);
}

/* ─────────────────────────────────────────────
   5. FEATURE VIEWER — crossfade between images
   ─────────────────────────────────────────────
   Replace the snap show/hide with a crossfade.
*/
.feat-viewer-frame img {
  display: block !important; /* override the display:none toggle */
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  border-radius: calc(var(--r-xl, 28px) - 6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  transform: scale(0.98) translateY(6px);
}
.feat-viewer-frame {
  position: relative;
  overflow: hidden;
}
.feat-viewer-frame img.active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1) translateY(0);
  position: relative; /* take space */
  animation: none; /* override old animation */
}
/* Ensure the frame has height from the active image */
.feat-viewer-frame img:not(.active) {
  position: absolute;
}

/* ─────────────────────────────────────────────
   6. PRICING CHECKLIST — staggered tick-in
   ─────────────────────────────────────────────
   Each .pricing-feat starts hidden.
   JS adds .feat-tick class staggered.
*/
.pricing-feat {
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.3s;
}
.pricing-feat.feat-tick {
  opacity: 1;
  transform: translateX(0);
}
.pricing-feat-check {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.3s;
}
.pricing-feat.feat-tick .pricing-feat-check {
  animation: check-pop 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes check-pop {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* ─────────────────────────────────────────────
   7. FINAL CTA — pulsing glow ring
   ─────────────────────────────────────────────
   A decorative radial glow that pulses slowly
   behind the CTA headline. Added via JS wrapper.
*/
.final-cta {
  position: relative;
  overflow: hidden;
}
.cta-glow-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(0, 82, 255, 0.10) 0%,
    rgba(59, 130, 246, 0.06) 35%,
    transparent 65%
  );
  animation: cta-pulse 4s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}
.cta-glow-ring-2 {
  width: 900px;
  height: 900px;
  background: radial-gradient(
    circle,
    rgba(0, 82, 255, 0.05) 0%,
    transparent 55%
  );
  animation: cta-pulse 4s ease-in-out 2s infinite;
}
.final-cta-wrap {
  position: relative;
  z-index: 1;
}
@keyframes cta-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1);    opacity: 1; }
  50%       { transform: translate(-50%, -50%) scale(1.12); opacity: 0.7; }
}

/* ─────────────────────────────────────────────
   8. ANSWER FEATURES — slide in from left
   ─────────────────────────────────────────────
*/
.answer-feat {
  opacity: 0;
  transform: translateX(-18px);
  transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.3s;
}
.answer-feat.feat-slide-in {
  opacity: 1;
  transform: translateX(0);
}
/* Keep hover working */
.answer-feat.feat-slide-in:hover {
  transform: translateX(4px);
}

/* ─────────────────────────────────────────────
   REDUCED MOTION — respect user preference
   ─────────────────────────────────────────────
*/
@media (prefers-reduced-motion: reduce) {
  .hero-headline .word,
  .tool-card,
  .pricing-feat,
  .answer-feat {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .hiw-connector {
    transform: scaleX(1) !important;
    opacity: 1 !important;
    transition: none !important;
  }
  .cta-glow-ring {
    animation: none !important;
  }
  .countup-num.pop {
    animation: none !important;
  }
}
