/* ================================================
   NinjaMinds.org - Animations
   Keyframes, Transitions, Effects
   ================================================ */

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

/* Fade In */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Fade In Up */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In Down */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In Left */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Fade In Right */
@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scale In */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

/* Pulse */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Glow Pulse */
@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(6, 182, 212, 0.6);
  }
}

/* Gradient Shift */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Rotate */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

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

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

/* Typing Cursor */
@keyframes blink {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
}

/* ================================================
   ANIMATION CLASSES
   ================================================ */

/* Base Animation Setup */
.animate {
  opacity: 0;
  animation-fill-mode: forwards;
  animation-duration: 0.6s;
  animation-timing-function: ease-out;
}

/* Animate on scroll - initial hidden state */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Fade animations */
.animate-fade-in {
  animation-name: fadeIn;
}

.animate-fade-in-up {
  animation-name: fadeInUp;
}

.animate-fade-in-down {
  animation-name: fadeInDown;
}

.animate-fade-in-left {
  animation-name: fadeInLeft;
}

.animate-fade-in-right {
  animation-name: fadeInRight;
}

.animate-scale-in {
  animation-name: scaleIn;
}

/* Continuous animations */
.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-glow {
  animation: glowPulse 2s ease-in-out infinite;
}

.animate-gradient {
  background-size: 200% 200%;
  animation: gradientShift 5s ease infinite;
}

.animate-rotate {
  animation: rotate 10s linear infinite;
}

.animate-bounce {
  animation: bounce 2s ease infinite;
}

/* Shimmer effect for loading states */
.animate-shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

/* Typing cursor */
.typing-cursor::after {
  content: '|';
  animation: blink 1s infinite;
  color: var(--color-primary-400);
}

/* ================================================
   ANIMATION DELAYS
   ================================================ */

.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }
.delay-600 { animation-delay: 600ms; }
.delay-700 { animation-delay: 700ms; }
.delay-800 { animation-delay: 800ms; }
.delay-900 { animation-delay: 900ms; }
.delay-1000 { animation-delay: 1000ms; }

/* ================================================
   ANIMATION DURATIONS
   ================================================ */

.duration-fast { animation-duration: 0.3s; }
.duration-normal { animation-duration: 0.6s; }
.duration-slow { animation-duration: 1s; }
.duration-slower { animation-duration: 1.5s; }

/* ================================================
   HOVER EFFECTS
   ================================================ */

/* Lift on hover */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Scale on hover */
.hover-scale {
  transition: transform var(--transition-fast);
}

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

/* Glow on hover */
.hover-glow {
  transition: box-shadow var(--transition-base);
}

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

/* Border glow on hover */
.hover-border-glow {
  position: relative;
  transition: all var(--transition-base);
}

.hover-border-glow::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-primary-500), var(--color-secondary-500));
  opacity: 0;
  z-index: -1;
  transition: opacity var(--transition-base);
}

.hover-border-glow:hover::before {
  opacity: 1;
}

/* ================================================
   SPECIAL EFFECTS
   ================================================ */

/* Glitch effect */
.glitch {
  position: relative;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.glitch::before {
  left: 2px;
  text-shadow: -2px 0 var(--color-primary-500);
  clip: rect(24px, 550px, 90px, 0);
  animation: glitch-anim-1 2s infinite linear alternate-reverse;
}

.glitch::after {
  left: -2px;
  text-shadow: -2px 0 var(--color-secondary-500);
  clip: rect(85px, 550px, 140px, 0);
  animation: glitch-anim-2 2s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
  0% { clip: rect(10px, 9999px, 31px, 0); }
  20% { clip: rect(85px, 9999px, 148px, 0); }
  40% { clip: rect(65px, 9999px, 93px, 0); }
  60% { clip: rect(43px, 9999px, 72px, 0); }
  80% { clip: rect(91px, 9999px, 125px, 0); }
  100% { clip: rect(22px, 9999px, 58px, 0); }
}

@keyframes glitch-anim-2 {
  0% { clip: rect(65px, 9999px, 119px, 0); }
  20% { clip: rect(28px, 9999px, 74px, 0); }
  40% { clip: rect(92px, 9999px, 140px, 0); }
  60% { clip: rect(15px, 9999px, 45px, 0); }
  80% { clip: rect(52px, 9999px, 88px, 0); }
  100% { clip: rect(78px, 9999px, 132px, 0); }
}

/* Particle background (CSS only - simple version) */
.particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: -1;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--color-primary-400);
  border-radius: 50%;
  opacity: 0.3;
  animation: float 6s ease-in-out infinite;
  box-shadow: 0 0 6px rgba(6, 182, 212, 0.5);
}

.particle:nth-child(2) { left: 20%; top: 30%; animation-delay: 1s; }
.particle:nth-child(3) { left: 40%; top: 60%; animation-delay: 2s; }
.particle:nth-child(4) { left: 60%; top: 20%; animation-delay: 3s; }
.particle:nth-child(5) { left: 80%; top: 50%; animation-delay: 4s; }
.particle:nth-child(6) { left: 10%; top: 70%; animation-delay: 5s; }

/* Enhanced particle glow */
.particle::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--color-primary-400) 0%, transparent 70%);
  opacity: 0.4;
  animation: pulse 3s ease-in-out infinite;
}

/* ================================================
   REDUCED MOTION
   ================================================ */

@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 {
    opacity: 1;
    transform: none;
  }
}
