/* ============================================
   ANIMATIONS - Siddharth Rajpal Portfolio
   ============================================ */

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

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

/* Gradient Rotate (for borders) */
@keyframes gradientRotate {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

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

/* Gentle Float */
@keyframes floatGentle {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-8px) rotate(0.5deg);
  }
  75% {
    transform: translateY(-15px) rotate(-0.5deg);
  }
}

/* Orb Float (for background) */
@keyframes orbFloat {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(30px, -40px) scale(1.05);
  }
  50% {
    transform: translate(-20px, 30px) scale(0.95);
  }
  75% {
    transform: translate(-40px, -20px) scale(1.02);
  }
}

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

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

/* Scroll Wheel */
@keyframes scrollWheel {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(15px);
  }
}

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

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

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

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

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

/* Scale In Bounce */
@keyframes scaleInBounce {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  60% {
    transform: scale(1.05);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Glow Pulse */
@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.6);
  }
}

/* Shimmer */
@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Ripple */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

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

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

/* Particle Drift */
@keyframes particleDrift {
  0% {
    transform: translateY(100vh) translateX(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.6;
  }
  100% {
    transform: translateY(-100vh) translateX(100px) rotate(360deg);
    opacity: 0;
  }
}

/* Particle Float Random */
@keyframes particleFloat1 {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(50px, -30px) scale(1.1);
  }
  50% {
    transform: translate(-30px, -60px) scale(0.9);
  }
  75% {
    transform: translate(-50px, -30px) scale(1.05);
  }
}

@keyframes particleFloat2 {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  33% {
    transform: translate(-40px, 30px) rotate(120deg);
  }
  66% {
    transform: translate(30px, -40px) rotate(240deg);
  }
}

@keyframes particleFloat3 {
  0%, 100% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(60px, -20px);
  }
  40% {
    transform: translate(40px, -80px);
  }
  60% {
    transform: translate(-20px, -60px);
  }
  80% {
    transform: translate(-60px, -20px);
  }
}

/* Slide Up */
@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Slide Down */
@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Text Reveal */
@keyframes textReveal {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

/* Border Animation */
@keyframes borderDance {
  0%, 100% {
    border-color: var(--accent-primary);
  }
  33% {
    border-color: var(--accent-secondary);
  }
  66% {
    border-color: var(--accent-tertiary);
  }
}

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

/* Base reveal state (hidden) */
.reveal {
  opacity: 0;
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.active {
  opacity: 1;
}

/* Reveal Up */
.reveal-up {
  opacity: 0;
  transform: translateY(60px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-up.active {
  opacity: 1;
  transform: translateY(0);
}

/* Reveal Down */
.reveal-down {
  opacity: 0;
  transform: translateY(-60px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-down.active {
  opacity: 1;
  transform: translateY(0);
}

/* Reveal Left */
.reveal-left {
  opacity: 0;
  transform: translateX(-60px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-left.active {
  opacity: 1;
  transform: translateX(0);
}

/* Reveal Right */
.reveal-right {
  opacity: 0;
  transform: translateX(60px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-right.active {
  opacity: 1;
  transform: translateX(0);
}

/* Reveal Scale */
.reveal-scale {
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-scale.active {
  opacity: 1;
  transform: scale(1);
}

/* Reveal Rotate */
.reveal-rotate {
  opacity: 0;
  transform: rotate(-10deg) scale(0.9);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-rotate.active {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* === DELAY UTILITIES === */
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }
.delay-5 { transition-delay: 0.5s; }
.delay-6 { transition-delay: 0.6s; }
.delay-7 { transition-delay: 0.7s; }
.delay-8 { transition-delay: 0.8s; }

/* === DURATION UTILITIES === */
.duration-fast { transition-duration: 0.3s; }
.duration-normal { transition-duration: 0.5s; }
.duration-slow { transition-duration: 0.8s; }
.duration-slower { transition-duration: 1.2s; }

/* === INFINITE ANIMATION UTILITIES === */
.animate-float {
  animation: float 6s ease-in-out infinite;
}

.animate-float-slow {
  animation: floatGentle 8s ease-in-out infinite;
}

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

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

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

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

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

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

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

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

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

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

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

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

/* === PARTICLE STYLES === */
.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--accent-primary);
  border-radius: 50%;
  opacity: 0.5;
  pointer-events: none;
}

.particle:nth-child(odd) {
  background: var(--accent-secondary);
  animation: particleFloat1 20s ease-in-out infinite;
}

.particle:nth-child(even) {
  animation: particleFloat2 25s ease-in-out infinite;
}

.particle:nth-child(3n) {
  width: 6px;
  height: 6px;
  background: var(--accent-tertiary);
  opacity: 0.3;
  animation: particleFloat3 30s ease-in-out infinite;
}

.particle:nth-child(5n) {
  width: 3px;
  height: 3px;
  opacity: 0.7;
}

/* === 3D TILT EFFECT === */
.tilt-effect {
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
}

.tilt-effect .tilt-content {
  transform: translateZ(30px);
}

/* === TEXT ANIMATIONS === */
.text-animate-gradient {
  background: linear-gradient(
    90deg,
    var(--accent-primary),
    var(--accent-secondary),
    var(--accent-tertiary),
    var(--accent-primary)
  );
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 5s ease infinite;
}

/* Typewriter effect support */
.typewriter {
  overflow: hidden;
  white-space: nowrap;
  animation: textReveal 1s steps(30) forwards;
}

/* === STAGGER CHILDREN === */
.stagger-children > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.stagger-children.active > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-children.active > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-children.active > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-children.active > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-children.active > *:nth-child(5) { transition-delay: 0.5s; }
.stagger-children.active > *:nth-child(6) { transition-delay: 0.6s; }
.stagger-children.active > *:nth-child(7) { transition-delay: 0.7s; }
.stagger-children.active > *:nth-child(8) { transition-delay: 0.8s; }
.stagger-children.active > *:nth-child(9) { transition-delay: 0.9s; }
.stagger-children.active > *:nth-child(10) { transition-delay: 1s; }

.stagger-children.active > * {
  opacity: 1;
  transform: translateY(0);
}

/* === LOADING ANIMATIONS === */
.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  background: var(--accent-primary);
  border-radius: 50%;
  animation: pulse 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

/* === REDUCED MOTION === */
@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;
  }

  .reveal,
  .reveal-up,
  .reveal-down,
  .reveal-left,
  .reveal-right,
  .reveal-scale,
  .reveal-rotate {
    opacity: 1;
    transform: none;
  }

  .animate-float,
  .animate-float-slow,
  .animate-pulse,
  .animate-glow,
  .animate-spin,
  .animate-bounce {
    animation: none;
  }

  .particle {
    display: none;
  }

  .bg-gradient::before,
  .bg-gradient::after,
  .bg-orb {
    animation: none;
  }
}
