/* =============================================================================
   ANIMATIONS.CSS — CR8TIF Scroll Reveal & Keyframes
   ============================================================================= */

/* ---------------------------------------------------------------------------
   Scroll Reveal System — [data-reveal]
   Base state: hidden. Add .is-revealed via JS IntersectionObserver.
   --------------------------------------------------------------------------- */
[data-reveal] {
  opacity: 0;
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

/* Direction variants */
[data-reveal="fade-up"] {
  transform: translateY(40px);
}

[data-reveal="fade-down"] {
  transform: translateY(-40px);
}

[data-reveal="fade-left"] {
  transform: translateX(-60px);
}

[data-reveal="fade-right"] {
  transform: translateX(60px);
}

[data-reveal="scale-in"] {
  transform: scale(0.95);
}

[data-reveal="fade-in"] {
  /* opacity only — no transform needed */
}

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

/* ---------------------------------------------------------------------------
   Delay Attributes — data-reveal-delay
   --------------------------------------------------------------------------- */
[data-reveal-delay="100"] { transition-delay: 0.1s; }
[data-reveal-delay="200"] { transition-delay: 0.2s; }
[data-reveal-delay="300"] { transition-delay: 0.3s; }
[data-reveal-delay="400"] { transition-delay: 0.4s; }
[data-reveal-delay="500"] { transition-delay: 0.5s; }
[data-reveal-delay="600"] { transition-delay: 0.6s; }
[data-reveal-delay="700"] { transition-delay: 0.7s; }
[data-reveal-delay="800"] { transition-delay: 0.8s; }
[data-reveal-delay="900"] { transition-delay: 0.9s; }
[data-reveal-delay="1000"] { transition-delay: 1s; }

/* ---------------------------------------------------------------------------
   Stagger Children — Auto delay increments
   --------------------------------------------------------------------------- */
.stagger-children > *:nth-child(1) { transition-delay: 0s; }
.stagger-children > *:nth-child(2) { transition-delay: 0.08s; }
.stagger-children > *:nth-child(3) { transition-delay: 0.16s; }
.stagger-children > *:nth-child(4) { transition-delay: 0.24s; }
.stagger-children > *:nth-child(5) { transition-delay: 0.32s; }
.stagger-children > *:nth-child(6) { transition-delay: 0.4s; }
.stagger-children > *:nth-child(7) { transition-delay: 0.48s; }
.stagger-children > *:nth-child(8) { transition-delay: 0.56s; }
.stagger-children > *:nth-child(9) { transition-delay: 0.64s; }
.stagger-children > *:nth-child(10) { transition-delay: 0.72s; }

/* Slower stagger variant for larger elements */
.stagger-children--slow > *:nth-child(1) { transition-delay: 0s; }
.stagger-children--slow > *:nth-child(2) { transition-delay: 0.12s; }
.stagger-children--slow > *:nth-child(3) { transition-delay: 0.24s; }
.stagger-children--slow > *:nth-child(4) { transition-delay: 0.36s; }
.stagger-children--slow > *:nth-child(5) { transition-delay: 0.48s; }
.stagger-children--slow > *:nth-child(6) { transition-delay: 0.6s; }

/* ---------------------------------------------------------------------------
   Keyframe Animations
   --------------------------------------------------------------------------- */

/* Marquee infinite scroll */
@keyframes marqueeScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Simple fade in */
@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* Slide up from below */
@keyframes slideUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Clip-path reveal — left to right wipe */
@keyframes clipReveal {
  0% {
    clip-path: inset(0 100% 0 0);
  }
  100% {
    clip-path: inset(0 0 0 0);
  }
}

/* Draw line — for decorative elements */
@keyframes drawLine {
  0% {
    transform: scaleX(0);
    transform-origin: left;
  }
  100% {
    transform: scaleX(1);
    transform-origin: left;
  }
}

/* Draw line vertical */
@keyframes drawLineVertical {
  0% {
    transform: scaleY(0);
    transform-origin: top;
  }
  100% {
    transform: scaleY(1);
    transform-origin: top;
  }
}

/* Subtle floating bob */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* Subtle pulse for CTA elements */
@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(184, 115, 51, 0.3);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(184, 115, 51, 0);
  }
}

/* Counter number roll */
@keyframes countUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Spin — for loading states */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ---------------------------------------------------------------------------
   Hero-Specific Animations
   --------------------------------------------------------------------------- */

/* Hero image — clip-path reveal from right */
.hero-image-reveal {
  clip-path: inset(0 100% 0 0);
  animation: heroImageReveal 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
}

@keyframes heroImageReveal {
  0% {
    clip-path: inset(0 100% 0 0);
  }
  100% {
    clip-path: inset(0 0 0 0);
  }
}

/* Hero text — staggered fade up */
.hero-text-reveal {
  opacity: 0;
  transform: translateY(30px);
  animation: heroTextReveal 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero-text-reveal:nth-child(1) { animation-delay: 0.5s; }
.hero-text-reveal:nth-child(2) { animation-delay: 0.65s; }
.hero-text-reveal:nth-child(3) { animation-delay: 0.8s; }
.hero-text-reveal:nth-child(4) { animation-delay: 0.95s; }
.hero-text-reveal:nth-child(5) { animation-delay: 1.1s; }

@keyframes heroTextReveal {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hero vertical line draw */
.hero-line-reveal {
  transform: scaleY(0);
  transform-origin: top;
  animation: drawLineVertical 1s cubic-bezier(0.16, 1, 0.3, 1) 0.8s forwards;
}

/* ---------------------------------------------------------------------------
   Parallax Helper Classes
   --------------------------------------------------------------------------- */
.parallax-container {
  overflow: hidden;
  position: relative;
}

.parallax-element {
  will-change: transform;
  transition: transform 0.1s linear;
}

/* Parallax slow — moves at 50% scroll speed */
.parallax--slow {
  transform: translateY(calc(var(--parallax-offset, 0) * 0.5));
}

/* Parallax medium — moves at 30% scroll speed */
.parallax--medium {
  transform: translateY(calc(var(--parallax-offset, 0) * 0.3));
}

/* Parallax fast — moves at 15% scroll speed */
.parallax--fast {
  transform: translateY(calc(var(--parallax-offset, 0) * 0.15));
}

/* Parallax image — scale up slightly to prevent gaps */
.parallax-image {
  width: 100%;
  height: 120%;
  object-fit: cover;
  will-change: transform;
}

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

  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }

  .marquee-track {
    animation: none;
  }

  .hero-image-reveal {
    clip-path: inset(0 0 0 0);
    animation: none;
    opacity: 1;
  }

  .hero-text-reveal {
    opacity: 1;
    transform: none;
    animation: none;
  }
}
