/* ==========================================================================
   Checkpoint GTM — Animations
   Keyframes, scroll reveals, entrance animations
   ========================================================================== */

/* --- Scroll Reveal --- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays for grid children */
.reveal-stagger > .reveal:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger > .reveal:nth-child(2) { transition-delay: 80ms; }
.reveal-stagger > .reveal:nth-child(3) { transition-delay: 160ms; }
.reveal-stagger > .reveal:nth-child(4) { transition-delay: 240ms; }
.reveal-stagger > .reveal:nth-child(5) { transition-delay: 320ms; }
.reveal-stagger > .reveal:nth-child(6) { transition-delay: 400ms; }
.reveal-stagger > .reveal:nth-child(7) { transition-delay: 480ms; }

/* --- Hero Card Entrance --- */
.hero-card {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hero-card.is-entered {
  opacity: 1;
  transform:
    translate3d(
      calc(var(--cursor-x, 0px) + var(--float-x, 0px) + var(--parallax-x, 0px)),
      calc(var(--cursor-y, 0px) + var(--float-y, 0px) + var(--parallax-y, 0px)),
      0
    )
    rotate(var(--base-rotation, 0deg));
}

/* --- Hero Text Entrance --- */
.hero__content {
  opacity: 0;
  transform: translateY(20px);
  animation: heroFadeIn 0.8s ease forwards;
  animation-delay: 100ms;
}

@keyframes heroFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Nav Transition --- */
.nav {
  transition: background-color var(--transition-base),
              box-shadow var(--transition-base),
              backdrop-filter var(--transition-base);
}

/* --- Stat Counter Animation ---
   Slide in left-to-right, number counter driven by JS (js/scroll-animations.js) */
.stats-bar .stat-block {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.stats-bar .stat-block.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.stat-block__number {
  position: relative;
  display: inline-block;
}

.stat-block__suffix {
  display: inline;
}

/* 2D "pop" ring effect spawned when the counter finishes */
.stat-block__number::after {
  content: '';
  position: absolute;
  inset: -10% -15%;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.6);
}

.stat-block.is-popped .stat-block__number::after {
  animation: statPop 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes statPop {
  0%   { opacity: 0.55; transform: scale(0.6); }
  60%  { opacity: 0.35; transform: scale(1.15); }
  100% { opacity: 0;    transform: scale(1.4); }
}

/* --- Grid "click-in" sequential entrance (engagement cards, etc.) --- */
.click-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, opacity;
}

.click-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Subtle Float (for hero cards idle state) --- */
@keyframes subtleFloat {
  0%, 100% { transform: var(--base-transform) translateY(0px); }
  50% { transform: var(--base-transform) translateY(-6px); }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hero-card {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hero__content {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .stats-bar .stat-block,
  .click-in {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .stat-block.is-popped .stat-block__number::after {
    animation: none;
  }

  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* Image bank animations are scroll-driven via JS */

/* --- Logo Scroll Marquee --- */
@keyframes marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}
