/* ============================================
   ANIMATIONS.CSS - Shared Animations for All Chapters
   ============================================ */

/* === KEYFRAME ANIMATIONS === */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  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);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* === ANIMATION CLASSES === */

/* Elements hidden by default, shown when scrolled into view */
.animate-on-scroll {
  opacity: 0;
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.animated {
  opacity: 1;
}

/* Fade animations */
.fade-in {
  animation: fadeIn 0.8s ease-out forwards;
}

.fade-in-up {
  animation: fadeInUp 0.8s ease-out forwards;
}

.fade-in-down {
  animation: fadeInDown 0.8s ease-out forwards;
}

.fade-in-left {
  animation: fadeInLeft 0.8s ease-out forwards;
}

.fade-in-right {
  animation: fadeInRight 0.8s ease-out forwards;
}

/* Scale animation */
.scale-in {
  animation: scaleIn 0.6s ease-out forwards;
}

/* Slide animations */
.slide-in-left {
  animation: slideInLeft 0.8s ease-out forwards;
}

.slide-in-right {
  animation: slideInRight 0.8s ease-out forwards;
}

/* Continuous animations */
.pulse {
  animation: pulse 2s ease-in-out infinite;
}

.bounce {
  animation: bounce 2s ease-in-out infinite;
}

/* === STAGGER DELAYS === */
.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }
.animate-delay-6 { animation-delay: 0.6s; }

/* === HOVER EFFECTS === */

.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.hover-glow {
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

.hover-scale {
  transition: transform 0.3s ease;
}

.hover-scale:hover {
  transform: scale(1.05);
}

/* === INTERACTIVE TABLE ENHANCEMENTS === */

.interactive-table tbody tr {
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.interactive-table tbody tr:hover {
  background-color: rgba(59, 130, 246, 0.05);
  transform: translateX(5px);
}

/* === VISUAL BLOCK ENHANCEMENTS === */

.visual-block {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.visual-block.visible {
  opacity: 1;
  transform: translateY(0);
}

/* === ICON ANIMATIONS === */

.animated-icon {
  display: inline-block;
  transition: transform 0.3s ease;
}

.animated-icon:hover {
  transform: rotate(10deg) scale(1.2);
}

/* === SECTION ANIMATIONS === */

.chapter-section {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.chapter-section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* === CARD ANIMATIONS === */

.subject-card,
.value-item,
.role-box {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.subject-card.visible,
.value-item.visible,
.role-box.visible {
  opacity: 1;
  transform: scale(1);
}

/* Add hover effect to cards */
.subject-card,
.value-item,
.role-box {
  transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.5s ease;
}

.subject-card:hover,
.value-item:hover,
.role-box:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

/* === RESPONSIVE ADJUSTMENTS === */

@media (max-width: 768px) {
  /* Reduce animation distances on mobile */
  @keyframes fadeInUp {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  @keyframes fadeInLeft {
    from {
      opacity: 0;
      transform: translateX(-15px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }
  
  @keyframes fadeInRight {
    from {
      opacity: 0;
      transform: translateX(15px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }
}

/* === 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;
  }
  
  .animate-on-scroll,
  .visual-block,
  .chapter-section,
  .subject-card,
  .value-item,
  .role-box {
    opacity: 1;
    transform: none;
  }
}
