/* ==========================================================================
   animations.css
   Custom keyframes + reveal-on-scroll / reveal-on-load system that replaces
   Framer Motion's `initial` / `animate` / `whileInView` props from the
   original React version. Works together with js/animations.js.
   ========================================================================== */

/* ---- generic reveal system --------------------------------------------
   Elements are authored with:
     data-reveal="fade-up | fade-in | scale-in | fade-left | fade-right"
     data-reveal-delay="0.1"           (seconds, optional)
     data-reveal-duration="0.6"        (seconds, optional)
     data-reveal-on="load | view"      (default: view)
   animations.js adds the `is-revealed` class either immediately (on load)
   or via IntersectionObserver (on view, "once" semantics matching the
   original viewport={{ once: true }} behavior).
------------------------------------------------------------------------- */

[data-reveal] {
  opacity: 0;
  transition-property: opacity, transform;
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  transition-duration: var(--reveal-duration, 0.6s);
  transition-delay: var(--reveal-delay, 0s);
  will-change: opacity, transform;
}

[data-reveal="fade-up"] {
  transform: translateY(28px);
}
[data-reveal="fade-up-sm"] {
  transform: translateY(16px);
}
[data-reveal="fade-in"] {
  transform: none;
}
[data-reveal="scale-in"] {
  transform: scale(0.92);
}
[data-reveal="scale-in-sm"] {
  transform: scale(0.95);
}
[data-reveal="fade-left"] {
  transform: translateX(-24px);
}
[data-reveal="fade-right"] {
  transform: translateX(24px);
}

[data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ---- staggered children helper ----------------------------------------
   Container marked data-reveal-stagger="0.08" auto-assigns incremental
   transition-delay to direct children carrying [data-reveal].
------------------------------------------------------------------------- */
[data-reveal-stagger] > [data-reveal] {
  transition-delay: calc(var(--stagger-index, 0) * var(--stagger-gap, 0.08s) + var(--reveal-base-delay, 0s));
}

/* ---- hero headline lines ------------------------------------------------ */
.hero-line {
  display: block;
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.hero-line.is-revealed {
  opacity: 1;
  transform: none;
}

/* ---- CTA floating translucent shapes ------------------------------------ */
@keyframes float-shape-a {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}
@keyframes float-shape-b {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(16px); }
}
.cta-shape-a {
  animation: float-shape-a 7s ease-in-out infinite;
}
.cta-shape-b {
  animation: float-shape-b 8s ease-in-out infinite;
  animation-delay: 0.5s;
}

/* ---- ambient pulsing points (network visualization) --------------------- */
@keyframes ambient-pulse {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 0.9; transform: scale(1.8); }
}
.ambient-pulse {
  animation: ambient-pulse 2.6s ease-in-out infinite;
}

/* ---- progress bar fill (hero floating card) ------------------------------ */
.progress-fill {
  width: 0;
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: 1.4s;
}
.progress-fill.is-revealed {
  width: 82%;
}

/* ---- lead funnel step activation ----------------------------------------- */
.funnel-step-icon {
  transition: background-color 0.4s ease, border-color 0.4s ease, transform 0.4s ease;
  transform: scale(0.92);
}
.funnel-step-icon.is-active {
  background-color: var(--aff-orange) !important;
  border-color: var(--aff-orange) !important;
  transform: scale(1);
}
.funnel-icon-svg {
  transition: color 0.3s ease;
}
.funnel-step-icon.is-active .funnel-icon-svg {
  color: #fff !important;
}
.funnel-step-title {
  transition: color 0.3s ease;
}
.funnel-step-title.is-active {
  color: var(--aff-black) !important;
}
.funnel-line-fill {
  transform-origin: left top;
  transform: scaleX(0);
  transition: transform 0.15s linear;
}
.funnel-line-fill.vertical {
  transform-origin: left top;
  transform: scaleY(0);
}

/* ---- solution card hover arrow ------------------------------------------- */
.solution-card:hover .solution-arrow {
  transform: translate(4px, -4px);
}
.solution-arrow {
  transition: transform 0.3s ease;
}

/* ---- mobile nav collapse animation ---------------------------------------- */
.mobile-menu {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.25s ease-in-out, opacity 0.25s ease-in-out;
}
.mobile-menu.open {
  max-height: 600px;
  opacity: 1;
}

/* ---- inline form spinner (already using Tailwind animate-spin, kept here
   only as a fallback if Tailwind's utility isn't present) ------------------ */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  animation: spin 0.7s linear infinite;
}

/* ---- toast / status message entrance -------------------------------------- */
.status-message {
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.status-message.is-visible {
  opacity: 1;
  transform: none;
}
