/**
 * Elegant School - Animation Styles
 * Origin Global-inspired animations: subtle, smooth, premium
 * Timing: 300-600ms | Easing: ease-out, ease-in-out
 */

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */

/* Fade In + Slide Up (Hero, Content Blocks) */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In (General) */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Slide In From Left (Numbering) */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 0.3;
    transform: translateX(0);
  }
}

/* Scale Up (Images, Cards) */
@keyframes scaleUp {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Zoom In (Gallery Images) */
@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ============================================
   HERO SECTION ANIMATIONS
   ============================================ */

/* Hero Content - Initial Load Animation */
.hero-content {
  animation: fadeInUp 600ms ease-out forwards;
  animation-delay: 200ms;
  opacity: 0;
}

.hero-content > * {
  animation: fadeInUp 600ms ease-out forwards;
  opacity: 0;
}

.hero-content > *:nth-child(1) { animation-delay: 300ms; }
.hero-content > *:nth-child(2) { animation-delay: 500ms; }
.hero-content > *:nth-child(3) { animation-delay: 700ms; }
.hero-content > *:nth-child(4) { animation-delay: 900ms; }

/* Hero Image/Badge Animation */
.hero-image {
  animation: fadeIn 800ms ease-out forwards;
  animation-delay: 400ms;
  opacity: 0;
}

/* Looping Text Container */
.text-loop {
  display: inline-block;
  position: relative;
  vertical-align: bottom;
}

.text-loop-word {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  transition: opacity 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

.text-loop-word.active {
  opacity: 1;
  position: relative;
}

/* ============================================
   PROGRAM CARDS ANIMATIONS
   ============================================ */

/* Program Card Container */
.program-card {
  position: relative;
  transition: all 400ms cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

/* Card Hover Effect - Origin Global Style (Subtle) */
.program-card:hover {
  transform: scale(1.03);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
              0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Animated Card Number */
.program-card-number {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 4rem;
  font-weight: 700;
  line-height: 1;
  opacity: 0;
  transform: translateX(-20px);
  animation: slideInLeft 500ms ease-out forwards;
  pointer-events: none;
  z-index: 0;
}

.program-card:nth-child(1) .program-card-number { animation-delay: 200ms; }
.program-card:nth-child(2) .program-card-number { animation-delay: 300ms; }
.program-card:nth-child(3) .program-card-number { animation-delay: 400ms; }
.program-card:nth-child(4) .program-card-number { animation-delay: 500ms; }

/* Card Icon Animation */
.program-card-icon {
  transition: transform 300ms ease-out;
}

.program-card:hover .program-card-icon {
  transform: scale(1.1);
}

/* ============================================
   NEWS CARD ANIMATIONS
   ============================================ */

/* News Card */
.news-card {
  transition: all 400ms ease-out;
}

/* News Card Image Zoom (Origin Global Style) */
.news-card-image-wrapper {
  overflow: hidden;
  border-radius: 0.75rem;
}

.news-card-image {
  transition: transform 600ms ease-out;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.news-card:hover .news-card-image {
  transform: scale(1.05);
}

/* News Headline with Underline Animation */
.news-headline {
  position: relative;
  display: inline-block;
}

.news-headline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0%;
  height: 2px;
  background-color: currentColor;
  transition: width 400ms ease-in-out;
}

.news-headline:hover::after {
  width: 100%;
}

/* Arrow Icon Slide (News Read More) */
.news-arrow {
  display: inline-block;
  transition: transform 300ms ease-out;
}

.news-card:hover .news-arrow {
  transform: translateX(4px);
}

/* ============================================
   GALLERY ANIMATIONS
   ============================================ */

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

/* Gallery Item */
.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
  opacity: 0;
  animation: zoomIn 600ms ease-out forwards;
}

/* Stagger Gallery Items */
.gallery-item:nth-child(1) { animation-delay: 100ms; }
.gallery-item:nth-child(2) { animation-delay: 180ms; }
.gallery-item:nth-child(3) { animation-delay: 260ms; }
.gallery-item:nth-child(4) { animation-delay: 340ms; }
.gallery-item:nth-child(5) { animation-delay: 420ms; }
.gallery-item:nth-child(6) { animation-delay: 500ms; }
.gallery-item:nth-child(7) { animation-delay: 580ms; }
.gallery-item:nth-child(8) { animation-delay: 660ms; }

/* Gallery Image */
.gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 200ms ease-out;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

/* ============================================
   FOOTER ANIMATIONS
   ============================================ */

/* Social Icons Container */
.social-icons {
  display: flex;
  gap: 1rem;
}

/* Social Icon */
.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 400ms ease-out forwards;
  transition: all 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stagger Social Icons */
.social-icon:nth-child(1) { animation-delay: 100ms; }
.social-icon:nth-child(2) { animation-delay: 180ms; }
.social-icon:nth-child(3) { animation-delay: 260ms; }
.social-icon:nth-child(4) { animation-delay: 340ms; }

/* Social Icon Hover - 360° Rotation */
.social-icon:hover {
  transform: rotate(360deg) translateY(0);
}

/* ============================================
   SCROLL REVEAL UTILITIES (AOS Enhancement)
   ============================================ */

/* Base scroll reveal element */
.scroll-reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: all 500ms ease-out;
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   PARALLAX EFFECTS
   ============================================ */

/* Parallax container for hero backgrounds */
.parallax-bg {
  will-change: transform;
  transition: transform 0.1s ease-out;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Respect user's motion 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;
  }
  
  .parallax-bg {
    transform: none !important;
  }
  
  .program-card:hover {
    transform: none;
  }
  
  .news-card-image,
  .gallery-item img {
    transform: none !important;
  }
  
  .social-icon:hover {
    transform: none;
  }
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
  /* Reduce animation intensity on mobile */
  .program-card:hover {
    transform: scale(1.01);
  }
  
  .news-card-image {
    transition: transform 400ms ease-out;
  }
  
  .news-card:hover .news-card-image {
    transform: scale(1.02);
  }
  
  /* Smaller card numbers on mobile */
  .program-card-number {
    font-size: 3rem;
  }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Fade in utility */
.fade-in {
  animation: fadeIn 500ms ease-out forwards;
}

/* Slide up utility */
.slide-up {
  animation: fadeInUp 600ms ease-out forwards;
}

/* Stagger delays */
.stagger-1 { animation-delay: 100ms; }
.stagger-2 { animation-delay: 200ms; }
.stagger-3 { animation-delay: 300ms; }
.stagger-4 { animation-delay: 400ms; }
.stagger-5 { animation-delay: 500ms; }
