/* ============================================
   EDRA Mexico - Animations CSS
   Keyframes, GSAP utilities, motion
   ============================================ */

/* --- Initial states for GSAP animations --- */
[data-animate] {
  opacity: 0;
}

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

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

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

[data-animate="scale-in"] {
  transform: scale(0.8);
}

[data-animate="clip-reveal"] {
  clip-path: inset(0 100% 0 0);
}

/* Animated state */
[data-animate].animated {
  opacity: 1;
  transform: none;
  clip-path: none;
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* --- Hero entrance animation --- */
.hero__eyebrow,
.hero__title,
.hero__subtitle,
.hero__description,
.hero__actions {
  opacity: 0;
  transform: translateY(30px);
}

.hero-animated .hero__eyebrow {
  animation: heroReveal 0.8s ease forwards 0s;
}

.hero-animated .hero__title {
  animation: heroReveal 0.8s ease forwards 0.2s;
}

.hero-animated .hero__subtitle {
  animation: heroReveal 0.8s ease forwards 0.4s;
}

.hero-animated .hero__description {
  animation: heroReveal 0.8s ease forwards 0.6s;
}

.hero-animated .hero__actions {
  animation: heroReveal 0.8s ease forwards 0.8s;
}

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

/* --- Preloader split reveal --- */
.preloader-split {
  animation: preloaderSplit 0.8s cubic-bezier(0.77, 0, 0.175, 1) forwards 2.3s;
}

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

/* --- Stagger children animation (CSS fallback) --- */
.stagger-children > *:nth-child(1) { transition-delay: 0s; }
.stagger-children > *:nth-child(2) { transition-delay: 0.1s; }
.stagger-children > *:nth-child(3) { transition-delay: 0.15s; }
.stagger-children > *:nth-child(4) { transition-delay: 0.2s; }
.stagger-children > *:nth-child(5) { transition-delay: 0.25s; }
.stagger-children > *:nth-child(6) { transition-delay: 0.3s; }

/* --- Card hover effects --- */
.hover-lift {
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
}

.hover-lift:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

.hover-zoom-img {
  overflow: hidden;
}

.hover-zoom-img img {
  transition: transform var(--transition-slow);
}

.hover-zoom-img:hover img {
  transform: scale(1.05);
}

/* --- Line draw animation (for process timeline) --- */
.line-draw {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
}

.line-draw.animated {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 2s ease;
}

/* --- Clip path reveal animation --- */
.clip-reveal-left {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.clip-reveal-left.animated {
  clip-path: inset(0 0 0 0);
}

.clip-reveal-right {
  clip-path: inset(0 0 0 100%);
  transition: clip-path 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.clip-reveal-right.animated {
  clip-path: inset(0 0 0 0);
}

.clip-reveal-bottom {
  clip-path: inset(100% 0 0 0);
  transition: clip-path 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.clip-reveal-bottom.animated {
  clip-path: inset(0 0 0 0);
}

/* --- Parallax utility --- */
.parallax {
  will-change: transform;
}

/* --- Pulse animation --- */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* --- Fade in animation (general use) --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* --- Rotate animation --- */
@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* --- Section line animation --- */
.section-header__line {
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.6s ease;
}

.section-header__line.animated {
  transform: scaleX(1);
}

/* --- Counter number animation --- */
.counter-number {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* --- Gallery item entrance --- */
.gallery-grid__item {
  opacity: 0;
  transform: translateY(30px) scale(0.95);
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-grid__item.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Stagger gallery items */
.gallery-grid__item:nth-child(6n+1) { transition-delay: 0s; }
.gallery-grid__item:nth-child(6n+2) { transition-delay: 0.08s; }
.gallery-grid__item:nth-child(6n+3) { transition-delay: 0.16s; }
.gallery-grid__item:nth-child(6n+4) { transition-delay: 0.24s; }
.gallery-grid__item:nth-child(6n+5) { transition-delay: 0.32s; }
.gallery-grid__item:nth-child(6n+6) { transition-delay: 0.4s; }

/* Legacy masonry support */
.gallery-masonry__item {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.gallery-masonry__item.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Magnetic button effect area --- */
.magnetic-btn {
  display: inline-block;
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* --- Loading skeleton --- */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  [data-animate] {
    opacity: 1;
    transform: none;
    clip-path: none;
  }

  .hero__eyebrow,
  .hero__title,
  .hero__subtitle,
  .hero__description,
  .hero__actions {
    opacity: 1;
    transform: none;
  }

  .marquee-track {
    animation: none;
  }

  .gallery-masonry__item,
  .gallery-grid__item {
    opacity: 1;
    transform: none;
  }

  .whatsapp-float__btn {
    animation: none;
  }

  .preloader {
    display: none;
  }

  .scroll-indicator__wheel {
    animation: none;
  }
}
