/* animations.css - Scroll animations and transitions
 * Owns: fade-in, slide-up, stagger animations, scroll-triggered effects
 * Does NOT own: page-specific layouts (those are in home.css, insights.css, etc.)
 */

/* ── Keyframe animations ──────────────────────────────────────────── */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

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

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

@keyframes scaleUp {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ── Scroll animation classes ────────────────────────────────────── */
.fade-in {
  animation: fadeIn 0.8s ease-out forwards;
}

.scroll-fade {
  opacity: 0;
  animation: fadeIn 0.6s ease-out forwards;
}

.scroll-slide-up {
  opacity: 0;
  animation: slideUp 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.scroll-slide-left {
  opacity: 0;
  animation: slideInLeft 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.scroll-slide-right {
  opacity: 0;
  animation: slideInRight 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.scroll-scale {
  opacity: 0;
  animation: scaleUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ── Stagger delays for grid items ───────────────────────────────── */
.stagger-item {
  animation-fill-mode: forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0s; }
.stagger-item:nth-child(2) { animation-delay: 0.15s; }
.stagger-item:nth-child(3) { animation-delay: 0.3s; }
.stagger-item:nth-child(4) { animation-delay: 0.45s; }
.stagger-item:nth-child(5) { animation-delay: 0.6s; }
.stagger-item:nth-child(6) { animation-delay: 0.75s; }

/* ── Parallax effect on scroll ──────────────────────────────────── */
.parallax-section {
  position: relative;
  overflow: hidden;
}

.parallax-bg {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  will-change: transform;
}

/* ── Smooth transitions on interactive elements ─────────────────── */
/* Exclude .nav-hamburger — its transition is scoped in styles.css */
a, button:not(.nav-hamburger):not(.mobile-nav-close), .btn {
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Hero entrance animation ────────────────────────────────────── */
.hero-inner > * {
  opacity: 0;
}

.hero-copy {
  animation: slideUp 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0s forwards;
}

.hero-label {
  animation: slideUp 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s forwards;
}

.hero h1 {
  animation: slideUp 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s forwards;
}

.hero-sub {
  animation: slideUp 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s forwards;
}

.hero .btn {
  animation: slideUp 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s forwards;
}

.hero-accent {
  animation: scaleUp 1s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s forwards;
  opacity: 0;
}

/* ── Smooth scrolling for the whole page ───────────────────────── */
html {
  scroll-behavior: smooth;
}

/* ── Reduced motion respect for accessibility ──────────────────── */
@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;
  }
}
