/* ============================================================
   ANIMATIONS.CSS — Keyframe definitions and scroll-triggered
   reveal classes. Elements start invisible and animate in
   when the IntersectionObserver (scroll-reveal.js) adds
   the .is-visible class to them.
   ============================================================ */


/* ── Reveal on Scroll — Base State ──────────────────────── */

/* Elements with .reveal-up start translated down and invisible */
.reveal-up {
  opacity: 0;
  transform: translateY(32px);
  transition:
    opacity  0.65s var(--ease-out),
    transform 0.65s var(--ease-out);
  /* Each element can declare --delay via inline style for staggering */
  transition-delay: var(--delay, 0s);
}

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

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

/* ── Visible State — added by scroll-reveal.js ─────────────
   When the IntersectionObserver fires, .is-visible is added
   and the element animates into its natural position.
   ──────────────────────────────────────────────────────── */
.reveal-up.is-visible,
.reveal-left.is-visible,
.reveal-right.is-visible {
  opacity: 1;
  transform: translate(0, 0);
}


/* ── Keyframes ───────────────────────────────────────────── */

/* Floating orb drift — hero background blobs */
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(20px, -30px) scale(1.04); }
  66%       { transform: translate(-15px, 20px) scale(0.97); }
}

/* Scroll-hint arrow bouncing down */
@keyframes scrollBounce {
  0%, 100% { transform: rotate(45deg) translate(0, 0); opacity: 0.5; }
  50%       { transform: rotate(45deg) translate(5px, 5px); opacity: 1; }
}

/* Subtle infinite pulse on the red CTA button */
@keyframes pulseBorder {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 40, 74, 0.4); }
  50%       { box-shadow: 0 0 0 8px rgba(232, 40, 74, 0); }
}

/* Hero headline lines — individual letter stagger (CSS only) */
@keyframes heroLineFade {
  from {
    opacity: 0;
    transform: translateY(20px) skewX(-4deg);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) skewX(0);
    filter: blur(0);
  }
}


/* ── Applied Animations ──────────────────────────────────── */

/* Hero headline lines animate on page load */
.hero__line {
  display: block;
  opacity: 0;
  animation: heroLineFade 0.7s var(--ease-out) forwards;
}

/* Stagger each headline line using its inline --delay */
.hero__line:nth-child(1) { animation-delay: 0.1s; }
.hero__line:nth-child(2) { animation-delay: 0.22s; }
.hero__line:nth-child(3) { animation-delay: 0.34s; }
.hero__line:nth-child(4) { animation-delay: 0.46s; }

/* Hero eyebrow, sub, ctas, stats — staggered fade up on load */
.hero__eyebrow,
.hero__sub,
.hero__ctas,
.hero__stats {
  opacity: 0;
  animation: heroLineFade 0.65s var(--ease-out) forwards;
}

.hero__eyebrow { animation-delay: 0.05s; }
.hero__sub     { animation-delay: 0.55s; }
.hero__ctas    { animation-delay: 0.65s; }
.hero__stats   { animation-delay: 0.75s; }

/* Pulse animation on the primary CTA for attention */
.hero__ctas .btn--primary {
  animation: pulseBorder 2.5s ease-in-out 1.5s infinite;
}

/* Scroll hint fades in last */
.hero__scroll-hint {
  animation: heroLineFade 0.6s var(--ease-out) 1.4s both;
}

/* Timeline marker — red ring pulse when item is hovered */
.timeline__item:hover .timeline__marker {
  animation: pulseBorder 1.2s ease-in-out infinite;
}

/* Reduce motion — respect user's OS accessibility preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  /* Still show content — just no animation */
  .reveal-up,
  .reveal-left,
  .reveal-right {
    opacity: 1;
    transform: none;
  }
}
