/* ===== KEYFRAME ANIMATIONS ===== */

/* Firefly Glow Animation */
@keyframes firefly-glow {
  0% {
    filter: drop-shadow(0 0 5px var(--accent-rust));
    opacity: 0.8;
  }
  100% {
    filter: drop-shadow(0 0 20px var(--accent-rust));
    opacity: 1;
  }
}

/* Pulse Animation */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
}

/* Loading Progress Animation */
@keyframes loading-progress {
  0% {
    width: 0%;
  }
  50% {
    width: 60%;
  }
  100% {
    width: 100%;
  }
}

/* Fade In Up Animation */
@keyframes fade-in-up {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In Down Animation */
@keyframes fade-in-down {
  0% {
    opacity: 0;
    transform: translateY(-30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In Left Animation */
@keyframes fade-in-left {
  0% {
    opacity: 0;
    transform: translateX(-30px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Fade In Right Animation */
@keyframes fade-in-right {
  0% {
    opacity: 0;
    transform: translateX(30px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scale In Animation */
@keyframes scale-in {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Scroll Bounce Animation */
@keyframes scroll-bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

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

/* Rotate Animation */
@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Shimmer Animation */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Glow Animation */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 5px var(--accent-rust);
  }
  50% {
    box-shadow: 0 0 20px var(--accent-rust), 0 0 30px var(--accent-rust);
  }
}

/* Slide In From Left */
@keyframes slide-in-left {
  0% {
    opacity: 0;
    transform: translateX(-100%);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide In From Right */
@keyframes slide-in-right {
  0% {
    opacity: 0;
    transform: translateX(100%);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Bounce In Animation */
@keyframes bounce-in {
  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);
  }
}

/* Wiggle Animation */
@keyframes wiggle {
  0%, 7% {
    transform: rotateZ(0);
  }
  15% {
    transform: rotateZ(-15deg);
  }
  20% {
    transform: rotateZ(10deg);
  }
  25% {
    transform: rotateZ(-10deg);
  }
  30% {
    transform: rotateZ(6deg);
  }
  35% {
    transform: rotateZ(-4deg);
  }
  40%, 100% {
    transform: rotateZ(0);
  }
}

/* ===== SCROLL ANIMATIONS ===== */
.scroll-animate,
.scroll-animate-left,
.scroll-animate-right,
.scroll-animate-scale {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1) translateZ(0);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform;
}

.scroll-animate.animate,
.scroll-animate-left.animate,
.scroll-animate-right.animate,
.scroll-animate-scale.animate {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1) translateZ(0);
}

/* ===== HOVER ANIMATIONS ===== */
.hover-lift {
  transition: transform var(--transition-normal);
}

.hover-lift:hover {
  transform: translateY(-5px);
}

.hover-glow {
  transition: box-shadow var(--transition-normal);
}

.hover-glow:hover {
  box-shadow: 0 8px 25px var(--hover-glow);
}

.hover-scale {
  transition: transform var(--transition-normal);
}

.hover-scale:hover {
  transform: scale(1.05);
}

.hover-rotate {
  transition: transform var(--transition-normal);
}

.hover-rotate:hover {
  transform: rotate(5deg);
}

/* ===== LOADING ANIMATIONS ===== */
.loading-dots {
  display: inline-block;
}

.loading-dots::after {
  content: '';
  animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
  0%, 20% {
    content: '';
  }
  40% {
    content: '.';
  }
  60% {
    content: '..';
  }
  80%, 100% {
    content: '...';
  }
}

/* ===== PARTICLE ANIMATIONS ===== */
.particle {
  position: absolute;
  pointer-events: none;
  animation: particle-float 6s linear infinite;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.3);
  will-change: transform, opacity;
  backface-visibility: hidden;
}

@keyframes particle-float {
  0% {
    transform: translateY(100vh) translateX(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  50% {
    transform: translateY(50vh) translateX(20px) rotate(180deg);
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-100px) translateX(-10px) rotate(360deg);
    opacity: 0;
  }
}

.particle-slow {
  animation-duration: 8s;
}

.particle-fast {
  animation-duration: 4s;
}

/* Particle size variations */
.particle-small {
  width: 2px;
  height: 2px;
}

.particle-medium {
  width: 3px;
  height: 3px;
}

.particle-large {
  width: 4px;
  height: 4px;
}

/* Particle animation delays */
.particle-delay-1 { animation-delay: 0s; }
.particle-delay-2 { animation-delay: 1s; }
.particle-delay-3 { animation-delay: 2s; }
.particle-delay-4 { animation-delay: 3s; }
.particle-delay-5 { animation-delay: 4s; }

/* ===== CARD ANIMATIONS ===== */
.card-flip {
  perspective: 1000px;
}

.card-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.card-flip:hover .card-flip-inner {
  transform: rotateY(180deg);
}

.card-flip-front,
.card-flip-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
}

.card-flip-back {
  transform: rotateY(180deg);
}

/* ===== BUTTON ANIMATIONS ===== */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-ripple:active::before {
  width: 300px;
  height: 300px;
}

/* ===== TEXT ANIMATIONS ===== */
.typewriter {
  overflow: hidden;
  border-right: 2px solid var(--accent-rust);
  white-space: nowrap;
  animation: typewriter 3s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink-caret {
  from, to {
    border-color: transparent;
  }
  50% {
    border-color: var(--accent-rust);
  }
}

/* ===== GLASSMORPHISM ANIMATIONS ===== */
.glass-shimmer {
  position: relative;
  overflow: hidden;
}

.glass-shimmer::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  animation: shimmer 2s infinite;
}

/* ===== STATS COUNTER ANIMATION ===== */
.counter-animate {
  animation: counter-increment 2s ease-out;
}

@keyframes counter-increment {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ===== MUSIC VISUALIZER ===== */
.music-visualizer {
  display: flex;
  align-items: end;
  gap: 2px;
  height: 40px;
}

.visualizer-bar {
  width: 3px;
  background: var(--accent-rust);
  border-radius: 2px;
  animation: visualizer-bounce 1s ease-in-out infinite;
}

.visualizer-bar:nth-child(1) { animation-delay: 0s; }
.visualizer-bar:nth-child(2) { animation-delay: 0.1s; }
.visualizer-bar:nth-child(3) { animation-delay: 0.2s; }
.visualizer-bar:nth-child(4) { animation-delay: 0.3s; }
.visualizer-bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes visualizer-bounce {
  0%, 100% {
    height: 10px;
  }
  50% {
    height: 30px;
  }
}

/* ===== EASTER EGG ANIMATIONS ===== */
.easter-egg {
  animation: easter-egg-bounce 0.5s ease-in-out;
}

@keyframes easter-egg-bounce {
  0%, 100% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.2) rotate(5deg);
  }
  50% {
    transform: scale(0.9) rotate(-5deg);
  }
  75% {
    transform: scale(1.1) rotate(2deg);
  }
}

/* ===== REDUCED MOTION SUPPORT ===== */
@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;
  }
  
  .particle {
    animation: none;
  }
  
  .scroll-animate,
  .scroll-animate-left,
  .scroll-animate-right,
  .scroll-animate-scale {
    opacity: 1;
    transform: none;
  }
}
