/* ============================================
   REUSABLE ANIMATION SYSTEM
   Can be used across entire website
   ============================================ */

/* ============================================
   ANIMATION KEYFRAMES
   ============================================ */

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

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

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes rotateIn {
  from {
    opacity: 0;
    transform: rotate(-10deg) scale(0.9);
  }
  to {
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* ============================================
   GENERAL ANIMATION CLASSES
   ============================================ */

/* Base animation properties for any element */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  /* Ensure elements are visible in DOM for debugging */
  visibility: visible !important;
  display: block !important;
}

/* Fallback for when JavaScript is disabled */
.no-js .animate-on-scroll {
  opacity: 1;
  transform: translateY(0);
}

/* When animation triggers */
.animate-on-scroll.animate-in.slide-up {
  opacity: 1;
  animation: slideInUp 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.animate-on-scroll.animate-in.slide-down {
  opacity: 1;
  animation: slideInDown 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.animate-on-scroll.animate-in.fade-scale {
  opacity: 1;
  animation: fadeInScale 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.animate-on-scroll.animate-in.fade-left {
  opacity: 1;
  animation: fadeInLeft 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.animate-on-scroll.animate-in.fade-right {
  opacity: 1;
  animation: fadeInRight 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.animate-on-scroll.animate-in.fade-in {
  opacity: 1;
  animation: fadeIn 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.animate-on-scroll.animate-in.zoom-in {
  opacity: 1;
  animation: zoomIn 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.animate-on-scroll.animate-in.rotate-in {
  opacity: 1;
  animation: rotateIn 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* ============================================
   STAGGERED ANIMATION DELAYS
   ============================================ */

/* For grid containers with staggered animation */
.animate-stagger .animate-on-scroll.animate-in:nth-child(1) { animation-delay: 0.1s; }
.animate-stagger .animate-on-scroll.animate-in:nth-child(2) { animation-delay: 0.15s; }
.animate-stagger .animate-on-scroll.animate-in:nth-child(3) { animation-delay: 0.2s; }
.animate-stagger .animate-on-scroll.animate-in:nth-child(4) { animation-delay: 0.25s; }
.animate-stagger .animate-on-scroll.animate-in:nth-child(5) { animation-delay: 0.3s; }
.animate-stagger .animate-on-scroll.animate-in:nth-child(6) { animation-delay: 0.35s; }
.animate-stagger .animate-on-scroll.animate-in:nth-child(7) { animation-delay: 0.4s; }
.animate-stagger .animate-on-scroll.animate-in:nth-child(8) { animation-delay: 0.45s; }
.animate-stagger .animate-on-scroll.animate-in:nth-child(9) { animation-delay: 0.5s; }
.animate-stagger .animate-on-scroll.animate-in:nth-child(10) { animation-delay: 0.55s; }
.animate-stagger .animate-on-scroll.animate-in:nth-child(11) { animation-delay: 0.6s; }
.animate-stagger .animate-on-scroll.animate-in:nth-child(12) { animation-delay: 0.65s; }

/* Quick stagger for faster animations */
.animate-stagger-fast .animate-on-scroll.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-stagger-fast .animate-on-scroll.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-stagger-fast .animate-on-scroll.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-stagger-fast .animate-on-scroll.animate-in:nth-child(4) { animation-delay: 0.2s; }
.animate-stagger-fast .animate-on-scroll.animate-in:nth-child(5) { animation-delay: 0.25s; }
.animate-stagger-fast .animate-on-scroll.animate-in:nth-child(6) { animation-delay: 0.3s; }

/* Slow stagger for dramatic effect */
.animate-stagger-slow .animate-on-scroll.animate-in:nth-child(1) { animation-delay: 0.2s; }
.animate-stagger-slow .animate-on-scroll.animate-in:nth-child(2) { animation-delay: 0.4s; }
.animate-stagger-slow .animate-on-scroll.animate-in:nth-child(3) { animation-delay: 0.6s; }
.animate-stagger-slow .animate-on-scroll.animate-in:nth-child(4) { animation-delay: 0.8s; }
.animate-stagger-slow .animate-on-scroll.animate-in:nth-child(5) { animation-delay: 1s; }

/* ============================================
   REUSABLE HOVER EFFECTS
   ============================================ */

.hover-lift {
  transition: all 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.15);
}

.hover-lift-subtle {
  transition: all 0.3s ease;
}

.hover-lift-subtle:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.hover-scale {
  transition: transform 0.3s ease;
}

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

.hover-rotate {
  transition: transform 0.3s ease;
}

.hover-rotate:hover {
  transform: rotate(5deg) scale(1.02);
}

.hover-brightness {
  transition: filter 0.3s ease;
}

.hover-brightness:hover {
  filter: brightness(1.1);
}

.hover-glow {
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(102, 126, 234, 0.4);
}

/* ============================================
   ANIMATION DURATION MODIFIERS
   ============================================ */

.animate-fast {
  animation-duration: 0.4s !important;
}

.animate-slow {
  animation-duration: 1.2s !important;
}

.animate-very-slow {
  animation-duration: 1.6s !important;
}

/* ============================================
   ANIMATION DIRECTION MODIFIERS
   ============================================ */

.animate-reverse {
  animation-direction: reverse;
}

.animate-alternate {
  animation-direction: alternate;
  animation-iteration-count: 2;
}

/* ============================================
   READY STATE
   ============================================ */

/* Active state when animation is triggered */
.animate-on-scroll.animate-in {
  /* Animation will be handled by the specific animation class */
}

/* ============================================
   USAGE EXAMPLES:
   
   Basic card animation:
   <div class="animate-on-scroll slide-up hover-lift">Content</div>
   
   Staggered cards:
   <div class="animate-stagger">
     <div class="animate-on-scroll fade-scale">Card 1</div>
     <div class="animate-on-scroll fade-scale">Card 2</div>
   </div>
   
   Different animations:
   <div class="animate-on-scroll fade-left">From left</div>
   <div class="animate-on-scroll fade-right">From right</div>
   <div class="animate-on-scroll zoom-in">Zoom effect</div>
   
   With hover effects:
   <div class="animate-on-scroll slide-up hover-lift">Lifts on hover</div>
   <div class="animate-on-scroll fade-in hover-scale">Scales on hover</div>
   
   ============================================ */
