/* 
   Musical Viby Animations for C.T. Ngqobe Foundation
   Subtle, elegant animations that enhance the musical theme
*/

/* ========== MUSICAL NOTE ANIMATIONS ========== */

@keyframes floatNote {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
    opacity: 0.7;
  }
  50% {
    transform: translateY(-15px) rotate(5deg);
    opacity: 1;
  }
}

@keyframes pulseNote {
  0%, 100% {
    transform: scale(1);
    text-shadow: 0 0 5px rgba(212, 175, 55, 0.3);
  }
  50% {
    transform: scale(1.1);
    text-shadow: 0 0 15px rgba(212, 175, 55, 0.6);
  }
}

@keyframes musicalEntrance {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.9);
  }
  70% {
    opacity: 0.7;
    transform: translateY(-10px) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes vocalVibrato {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-1px);
  }
  75% {
    transform: translateX(1px);
  }
}

@keyframes conductorBeat {
  0%, 100% {
    transform: scale(1) rotate(0deg);
  }
  25% {
    transform: scale(1.05) rotate(2deg);
  }
  50% {
    transform: scale(1.1) rotate(0deg);
  }
  75% {
    transform: scale(1.05) rotate(-2deg);
  }
}

@keyframes choralRipple {
  0% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

@keyframes pianoKeyPress {
  0%, 100% {
    transform: scaleY(1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  }
  50% {
    transform: scaleY(0.95);
    box-shadow: 0 0 3px rgba(0,0,0,0.05);
  }
}

@keyframes crescendo {
  0% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes tempoPulse {
  0%, 100% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.03);
  }
  50% {
    transform: scale(1.05);
  }
  75% {
    transform: scale(1.03);
  }
}

@keyframes goldGlow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(212, 175, 55, 0.3);
  }
  50% {
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.7);
  }
}

@keyframes noteRain {
  0% {
    transform: translateY(-100px) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}

/* ========== ANIMATION CLASSES ========== */

/* Hero Section Animations */
.hero-title {
  animation: musicalEntrance 1.2s ease-out forwards;
}

.hero-subtitle {
  animation: musicalEntrance 1.2s ease-out 0.3s forwards;
  opacity: 0;
}

.hero-button {
  animation: musicalEntrance 1.2s ease-out 0.6s forwards;
  opacity: 0;
}

/* Musical Note Elements */
.musical-note {
  display: inline-block;
  animation: floatNote 3s ease-in-out infinite;
}

.musical-note.pulse {
  animation: pulseNote 2s ease-in-out infinite;
}

.musical-note.vibrato {
  animation: vocalVibrato 0.15s ease-in-out infinite;
}

/* Program Cards */
.program-card {
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.program-card:hover {
  animation: conductorBeat 0.8s ease-in-out;
  transform: translateY(-10px);
}

.program-icon {
  transition: all 0.3s ease;
}

.program-card:hover .program-icon {
  animation: pulseNote 1.5s infinite;
  background: linear-gradient(135deg, #d4af37, #f7d87c);
}

/* Buttons with Musical Feel */
.btn-musical {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn-musical:before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.btn-musical:hover:before {
  left: 100%;
}

.btn-musical:hover {
  animation: tempoPulse 0.5s ease-in-out;
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(212, 175, 55, 0.3);
}

/* Section Entrances */
.section-entrance {
  opacity: 0;
  animation: crescendo 0.8s ease-out forwards;
}

.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }

/* Testimonial Cards */
.testimonial-card {
  transition: all 0.4s ease;
}

.testimonial-card:hover {
  animation: vocalVibrato 0.3s ease-in-out;
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

/* Page Load Animation */
@keyframes pageLoad {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-load {
  animation: pageLoad 0.8s ease-out forwards;
}

/* Musical Background Elements */
.musical-bg {
  position: relative;
  overflow: hidden;
}

.musical-bg:before {
  content: '♪ ♫ ♬ ♩';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  font-size: 2rem;
  color: rgba(212, 175, 55, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: floatNote 10s ease-in-out infinite;
}

/* Choral Ripple Effect */
.choral-ripple {
  position: relative;
}

.choral-ripple:after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100px;
  height: 100px;
  background: rgba(212, 175, 55, 0.1);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  animation: choralRipple 2s linear infinite;
}

/* Piano Key Effect */
.piano-key {
  display: inline-block;
  background: white;
  border: 1px solid #ddd;
  padding: 10px 15px;
  margin: 2px;
  border-radius: 5px;
  transition: all 0.1s ease;
}

.piano-key:hover {
  animation: pianoKeyPress 0.2s ease-out;
  background: #f8f8f8;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Glowing Elements */
.glow-on-hover:hover {
  animation: goldGlow 1.5s infinite;
}

/* Music Staff Lines */
.music-staff {
  position: relative;
  height: 4px;
  background: linear-gradient(to right, transparent, #d4af37, transparent);
  margin: 20px 0;
  overflow: hidden;
}

.music-staff:before,
.music-staff:after {
  content: '';
  position: absolute;
  width: 20px;
  height: 4px;
  background: #d4af37;
  top: -8px;
  animation: floatNote 3s linear infinite;
}

.music-staff:after {
  top: 8px;
  animation-delay: 1.5s;
}

/* Note Rain Effect */
.note-rain {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.note-rain i {
  position: absolute;
  font-size: 20px;
  color: rgba(212, 175, 55, 0.3);
  animation: noteRain 5s linear infinite;
}

/* ========== UTILITY CLASSES ========== */

.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

.animation-delay-200 { animation-delay: 0.2s; }
.animation-delay-400 { animation-delay: 0.4s; }
.animation-delay-600 { animation-delay: 0.6s; }
.animation-delay-800 { animation-delay: 0.8s; }

.fade-in {
  animation: crescendo 1s ease-out forwards;
}

/* ========== SPECIFIC ELEMENT ANIMATIONS ========== */

/* Header logo animation */
.logo img {
  transition: transform 0.5s ease;
}

.logo:hover img {
  animation: conductorBeat 1s ease-in-out;
}

/* Navigation link hover effect */
.nav-links a {
  position: relative;
  overflow: hidden;
}

.nav-links a:after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--secondary);
  transition: all 0.3s ease;
}

.nav-links a:hover:after {
  width: 80%;
  left: 10%;
}

/* Hero section background notes */
.home-hero:before {
  animation: floatNote 20s ease-in-out infinite;
}

/* Program icons animation */
.program-icon i, .link-icon i {
  animation: floatNote 3s ease-in-out infinite;
}

/* Social icons animation */
.social-links a:hover i {
  animation: pulseNote 0.5s ease-in-out;
}

/* ========== RESPONSIVE ADJUSTMENTS ========== */

@media (max-width: 768px) {
  .hero-title {
    animation-duration: 1s;
  }
  
  .hero-subtitle {
    animation-duration: 1s;
    animation-delay: 0.2s;
  }
  
  .hero-button {
    animation-duration: 1s;
    animation-delay: 0.4s;
  }
  
  .program-card:hover {
    animation: none;
  }
  
  .note-rain {
    display: none;
  }
}

/* ========== PREFERS-REDUCED-MOTION ========== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

button:hover {
  transform: scale(1.05);
  transition: 0.3s;
}