/* ===== Animation System ===== */

/* --- Keyframe Definitions --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: 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 scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.4); }
  70% { box-shadow: 0 0 0 15px rgba(96, 165, 250, 0); }
  100% { box-shadow: 0 0 0 0 rgba(96, 165, 250, 0); }
}

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

/* --- Scroll Reveal Base --- */
.scroll-reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Reveal variants */
.scroll-reveal.from-left {
  transform: translateX(-40px);
}
.scroll-reveal.from-left.revealed {
  transform: translateX(0);
}

.scroll-reveal.from-right {
  transform: translateX(40px);
}
.scroll-reveal.from-right.revealed {
  transform: translateX(0);
}

.scroll-reveal.scale-up {
  transform: scale(0.9);
}
.scroll-reveal.scale-up.revealed {
  transform: scale(1);
}

/* Stagger animation delays for grid children */
.stagger-grid > *:nth-child(1) { transition-delay: 0s; }
.stagger-grid > *:nth-child(2) { transition-delay: 0.1s; }
.stagger-grid > *:nth-child(3) { transition-delay: 0.2s; }
.stagger-grid > *:nth-child(4) { transition-delay: 0.3s; }
.stagger-grid > *:nth-child(5) { transition-delay: 0.4s; }
.stagger-grid > *:nth-child(6) { transition-delay: 0.5s; }
.stagger-grid > *:nth-child(7) { transition-delay: 0.6s; }
.stagger-grid > *:nth-child(8) { transition-delay: 0.7s; }
.stagger-grid > *:nth-child(9) { transition-delay: 0.8s; }
.stagger-grid > *:nth-child(10) { transition-delay: 0.9s; }

/* --- Hero Animation --- */
.hero-content {
  animation: fadeInUp 1s ease forwards;
}

.hero-content h1 {
  animation: fadeInUp 1s ease 0.2s both;
}

.hero-content p {
  animation: fadeInUp 1s ease 0.4s both;
}

.hero-content .hero-buttons {
  animation: fadeInUp 1s ease 0.6s both;
}

.hero-stats {
  animation: fadeInUp 1s ease 0.8s both;
}

/* --- Card Hover Effects --- */
.news-card,
.program-card,
.staff-card {
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.news-card:hover,
.program-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.staff-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .news-card:hover,
[data-theme="dark"] .program-card:hover {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .staff-card:hover {
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
}

/* --- News/Event Card Image Zoom --- */
.news-card .news-image img {
  transition: transform 0.5s ease;
}

.news-card:hover .news-image img {
  transform: scale(1.08);
}

.news-card .news-image {
  overflow: hidden;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* --- Button Micro-Interactions --- */
.primary-btn,
.secondary-btn,
.apply-btn {
  position: relative;
  overflow: hidden;
}

.primary-btn::after,
.apply-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.5s ease, height 0.5s ease;
}

.primary-btn:hover::after,
.apply-btn:hover::after {
  width: 300px;
  height: 300px;
}

/* --- Section Header Animation --- */
.section-header h2 {
  position: relative;
}

.section-header h2::after {
  transition: width 0.6s ease;
}

.scroll-reveal.revealed .section-header h2::after,
.section-header.revealed h2::after {
  width: 80px;
}

/* --- Footer Link Hover --- */
.footer-links a {
  transition: color 0.25s ease, padding-left 0.25s ease;
}

.footer-links a:hover {
  padding-left: 6px;
}

/* --- Social icon hover --- */
.footer-social a {
  transition: transform 0.25s ease, color 0.25s ease;
}

.footer-social a:hover {
  transform: translateY(-3px);
}

/* --- Chat toggle pulse --- */
.chat-toggle {
  animation: pulse 2s infinite;
}

/* --- Gallery image hover --- */
.gallery-grid img,
.gallery-item img {
  transition: transform 0.4s ease, filter 0.4s ease;
}

.gallery-grid img:hover,
.gallery-item img:hover {
  transform: scale(1.05);
  filter: brightness(1.1);
}

/* --- Stat counter animation --- */
.hero-stat-number {
  display: inline-block;
  transition: transform 0.3s ease;
}

.hero-stat-number:hover {
  transform: scale(1.1);
}

/* --- Testimonial card transition --- */
.testimonial-content {
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* --- Smooth page transitions --- */
.page-transition {
  animation: fadeInUp 0.5s ease forwards;
}

/* --- Reduce motion for accessibility --- */
@media (prefers-reduced-motion: reduce) {
  .scroll-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  
  .hero-content,
  .hero-content h1,
  .hero-content p,
  .hero-content .hero-buttons,
  .hero-stats {
    animation: none;
  }
  
  .chat-toggle {
    animation: none;
  }
  
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
