/*
File: animations.css
Purpose: All keyframe animations and reusable animation utilities
Dependencies: style.css (for CSS custom properties and timing variables)
Load Order: 3rd (before components that use these animations)
*/

/* ===== DROPDOWN MENU ANIMATIONS ===== */
/* Smooth dropdown reveal animation */
@keyframes smoothSlideDown {
  0% {
    max-height: 0;
    opacity: 0;
    padding: 0;
    transform: scaleY(0);
  }
  40% {
    max-height: 200px;
    opacity: 1;
    padding: 8px 0;
    transform: scaleY(0.9);
  }
  80% {
    max-height: 280px;
    opacity: 1;
    padding: 12px 0;
    transform: scaleY(1.02);
  }
  100% {
    max-height: 300px;
    opacity: 1;
    padding: 10px 0;
    transform: scaleY(1);
  }
}

/* Smooth dropdown hide animation */
@keyframes smoothSlideUp {
  0% {
    max-height: 300px;
    opacity: 1;
    padding: 10px 0;
    transform: scaleY(1);
  }
  60% {
    max-height: 100px;
    opacity: 0.4;
    padding: 5px 0;
    transform: scaleY(0.8);
  }
  100% {
    max-height: 0;
    opacity: 0;
    padding: 0;
    transform: scaleY(0);
  }
}

/* Individual menu item fade-in with stagger support */
@keyframes itemFadeIn {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Alternative dropdown slide animation */
@keyframes dropdownSlideDown {
  0% {
    transform: translateY(-20px) scaleY(0.3);
    opacity: 0;
  }
  40% {
    transform: translateY(5px) scaleY(1.05);
    opacity: 0.8;
  }
  100% {
    transform: translateY(0) scaleY(1);
    opacity: 1;
  }
}

/* ===== TITLE BOX REVEAL ANIMATIONS ===== */
/* Text reveal mask animation */
@keyframes revealMask {
  0% { 
    width: 100%; 
  }
  100% { 
    width: 0; 
  }
}

/* Complex bar slide and morph animation for title boxes */
@keyframes barSlideAndMorph {
  0% {
    border-radius: 0;
    height: 90px;
    left: 0;
    margin-left: -40px;
    opacity: 1;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
  }
  83.33% {
    border-radius: 0;
    height: 90px;
    left: 100%;
    margin-left: 32px;
    opacity: 1;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
  }
  94.44% {
    border-radius: 50%;
    bottom: 15px;
    height: 12px;
    left: 100%;
    margin-left: 32px;
    opacity: 1;
    top: auto;
    transform: translateY(0);
    width: 12px;
  }
  100% {
    border-radius: 50%;
    bottom: 12px;
    height: 12px;
    left: 100%;
    margin-left: 32px;
    opacity: 1;
    top: auto;
    transform: translateY(0);
    width: 12px;
  }
}

/* First circle slide animation */
@keyframes slideCircle1 {
  0% { 
    margin-left: 32px; 
    opacity: 0; 
    bottom: 12px;
    transform: none;
    width: 12px;
    height: 12px;
  }
  100% { 
    margin-left: 52px; 
    opacity: 1; 
    bottom: 12px;
    transform: none;
    width: 12px;
    height: 12px;
  }
}

/* Second circle slide animation */
@keyframes slideCircle2 {
  0% { 
    margin-left: 32px; 
    opacity: 0; 
    bottom: 12px;
    transform: none;
    width: 12px;
    height: 12px;
  }
  100% { 
    margin-left: 72px; 
    opacity: 1; 
    bottom: 12px;
    transform: none;
    width: 12px;
    height: 12px;
  }
}

/* ===== TRIANGLE ANIMATIONS (UNUSED BUT PRESERVED) ===== */
/* Triangle slide down animation */
@keyframes triangleSlideDown {
  0% {
    top: -50px;
    opacity: 0;
    transform: scaleY(0.5);
  }
  30% {
    top: -20px;
    opacity: 0.7;
    transform: scaleY(0.8);
  }
  70% {
    top: -8px;
    opacity: 1;
    transform: scaleY(1.1);
  }
  100% {
    top: -6px;
    opacity: 1;
    transform: scaleY(1);
  }
}

/* Triangle slide to dropdown position */
@keyframes triangleSlideToDropdown {
  0% {
    top: -50px;
    transform: scaleY(1);
    opacity: 1;
    border-top-color: var(--highlight-color);
  }
  25% {
    top: -35px;
    transform: scaleY(0.75);
    opacity: 1;
    border-top-color: var(--highlight-color);
  }
  75% {
    top: -8px;
    transform: scaleY(1.1);
    opacity: 1;
    border-top-color: var(--highlight-color);
  }
  100% {
    top: -6px;
    transform: scaleY(1);
    opacity: 1;
    border-top-color: var(--highlight-color);
  }
}

/* Triangle drawer animations */
@keyframes triangleDrawerOpen {
  0% {
    border-top-width: 6px;
    transform: scaleY(1) translateY(0);
    bottom: -6px;
  }
  25% {
    border-top-width: 4px;
    transform: scaleY(0.75) translateY(-2px);
    bottom: -4px;
  }
  50% {
    border-top-width: 8px;
    transform: scaleY(1.1) translateY(3px);
    bottom: -8px;
  }
  100% {
    border-top-width: 6px;
    transform: scaleY(1) translateY(0);
    bottom: -6px;
  }
}

@keyframes triangleDrawerClose {
  0% {
    border-top-width: 6px;
    transform: scaleY(1) translateY(0);
    bottom: -6px;
  }
  50% {
    border-top-width: 4px;
    transform: scaleY(0.8) translateY(-1px);
    bottom: -4px;
  }
  100% {
    border-top-width: 6px;
    transform: scaleY(1) translateY(0);
    bottom: -6px;
  }
}

/* Triangle pull animation */
@keyframes trianglePull {
  0% {
    transform: scaleY(1);
    bottom: -6px;
  }
  30% {
    transform: scaleY(0.75);
    bottom: -4px;
  }
  70% {
    transform: scaleY(1.1);
    bottom: -8px;
  }
  100% {
    transform: scaleY(1);
    bottom: -6px;
  }
}

/* ===== QUOTE ANIMATIONS ===== */
/* Quote mark zoom in animation */
@keyframes quoteZoomIn {
  0% { 
    transform: scale(0.5);
    opacity: 0;
  }
  60% { 
    transform: scale(1.1);
    opacity: 0.5;
  }
  100% { 
    transform: scale(1);
    opacity: 0.3;
  }
}

/* Quote scale animation */
@keyframes quoteScale {
  0% { 
    transform: scale(3); 
  }
  60% { 
    transform: scale(0.9); 
  }
  100% { 
    transform: scale(1); 
  }
}

/* Text scale animation */
@keyframes textScale {
  0% { 
    transform: scale(0.5); 
  }
  60% { 
    transform: scale(1.1); 
  }
  100% { 
    transform: scale(1); 
  }
}

/* ===== DIRECTIONAL SLIDE ANIMATIONS ===== */
/* Slide in from left */
@keyframes slideInLeft {
  0% { 
    transform: translateX(-100%); 
  }
  80% { 
    transform: translateX(-8px); 
  }
  100% { 
    transform: translateX(12px); 
  }
}

/* Slide in from right */
@keyframes slideInRight {
  0% { 
    transform: translateX(100%); 
  }
  80% { 
    transform: translateX(8px); 
  }
  100% { 
    transform: translateX(-12px); 
  }
}

/* ===== REUSABLE ANIMATION UTILITY CLASSES ===== */
/* Fade animations */
.animate-fade-in {
  animation: fadeIn var(--transition-slow) ease forwards;
}

.animate-fade-out {
  animation: fadeOut var(--transition-slow) ease forwards;
}

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

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

/* Scale animations */
.animate-scale-in {
  animation: scaleIn var(--transition-base) var(--transition-smooth) forwards;
}

.animate-scale-out {
  animation: scaleOut var(--transition-base) var(--transition-smooth) forwards;
}

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

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

/* Slide animations */
.animate-slide-up {
  animation: slideUp var(--transition-base) var(--transition-smooth) forwards;
}

.animate-slide-down {
  animation: slideDown var(--transition-base) var(--transition-smooth) forwards;
}

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

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

/* Bounce animation */
.animate-bounce-in {
  animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Pulse animation for loading states */
.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Rotate animation */
.animate-spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ===== ANIMATION STATE CLASSES ===== */
/* Paused state for animations */
.animation-paused {
  animation-play-state: paused !important;
}

/* Running state for animations */
.animation-running {
  animation-play-state: running !important;
}

/* Animation delays for staggered effects */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
/* GPU acceleration for smooth animations */
.animate-gpu {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  perspective: 1000px;
  -webkit-perspective: 1000px;
  will-change: transform, opacity;
}

/* Remove will-change after animation completes */
.animate-gpu.animation-complete {
  will-change: auto;
}

/* ===== ACCESSIBILITY & REDUCED MOTION ===== */
/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
  /* Disable all animations for users who prefer reduced motion */
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  /* Override specific animation classes */
  .animate-fade-in,
  .animate-fade-out,
  .animate-scale-in,
  .animate-scale-out,
  .animate-slide-up,
  .animate-slide-down,
  .animate-bounce-in {
    animation: none !important;
  }
  
  /* Provide instant state changes instead */
  .animate-fade-in { opacity: 1; }
  .animate-fade-out { opacity: 0; }
  .animate-scale-in { opacity: 1; transform: scale(1); }
  .animate-scale-out { opacity: 0; transform: scale(1); }
  .animate-slide-up { opacity: 1; transform: translateY(0); }
  .animate-slide-down { opacity: 1; transform: translateY(0); }
  .animate-bounce-in { opacity: 1; transform: scale(1); }
}

/* ===== HOVER PAUSE FUNCTIONALITY ===== */
/* Pause animations on hover for better UX */
.pause-on-hover:hover {
  animation-play-state: paused !important;
}

.pause-on-hover:hover * {
  animation-play-state: paused !important;
}