/* ============================================
   ANIMATION KEYFRAMES
   ============================================ */

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

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

/* Floating Animation for Shapes */
@keyframes float {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  33% {
    transform: translate(30px, -30px) rotate(120deg);
  }
  66% {
    transform: translate(-20px, 20px) rotate(240deg);
  }
}

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

/* Scroll Wheel Animation */
@keyframes scroll-wheel {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
}

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

/* Heartbeat Animation */
@keyframes heartbeat {
  0%, 100% {
    transform: scale(1);
  }
  10%, 30% {
    transform: scale(0.9);
  }
  20%, 40%, 60%, 80% {
    transform: scale(1.1);
  }
  50%, 70% {
    transform: scale(1.05);
  }
}

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

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

/* Slide In From Left */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide In From Right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

/* Rotate In Animation */
@keyframes rotateIn {
  from {
    opacity: 0;
    transform: rotate(-90deg) scale(0.8);
  }
  to {
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }
}

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

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

/* Shake Animation */
@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

/* Glow Pulse Animation */
@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 40px rgba(0, 217, 255, 0.8);
  }
}

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

/* Loading Dots Animation */
@keyframes loadingDots {
  0%, 20% {
    opacity: 0.2;
  }
  40% {
    opacity: 1;
  }
  100% {
    opacity: 0.2;
  }
}

/* Staggered Fade In (for skill items) */
.skill-item.fade-in {
  animation: slideUp 0.6s ease forwards;
  animation-delay: var(--delay, 0s);
}

/* Progress Bar Fill Animation */
@keyframes progressFill {
  from {
    width: 0%;
  }
  to {
    width: var(--progress, 100%);
  }
}

/* Number Counter Animation - handled by JS but smooth transition */
.stat-number {
  transition: all 0.3s ease;
}

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

/* Card Lift on Hover */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 40px rgba(0, 217, 255, 0.2);
}

/* Glow on Hover */
.hover-glow:hover {
  box-shadow: 0 0 30px rgba(0, 217, 255, 0.5);
}

/* Scale on Hover */
.hover-scale {
  transition: transform 0.3s ease;
}

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

/* Rotate on Hover */
.hover-rotate:hover {
  transform: rotate(5deg);
}

/* ============================================
   SCROLL ANIMATIONS
   ============================================ */

/* Fade In from Bottom */
.fade-in-bottom {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in-bottom.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Fade In from Left */
.fade-in-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in-left.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Fade In from Right */
.fade-in-right {
  opacity: 0;
  transform: translateX(50px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in-right.visible {
  opacity: 1;
  transform: translateX(0);
}

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

.scale-in.visible {
  opacity: 1;
  transform: scale(1);
}

/* ============================================
   LOADING ANIMATIONS
   ============================================ */

/* Loading Spinner */
.loading-spinner {
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top: 3px solid var(--accent-primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

/* Loading Dots */
.loading-dots span {
  animation: loadingDots 1.4s infinite;
  animation-delay: calc(var(--delay, 0) * 0.2s);
}

/* ============================================
   PARTICLE ANIMATIONS
   ============================================ */

/* Particle Fade */
@keyframes particleFade {
  0%, 100% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}

/* Particle Float */
@keyframes particleFloat {
  0% {
    transform: translateY(0) translateX(0);
  }
  50% {
    transform: translateY(-100px) translateX(50px);
  }
  100% {
    transform: translateY(-200px) translateX(-50px);
  }
}

/* ============================================
   ENTRANCE ANIMATIONS FOR PAGE LOAD
   ============================================ */

/* Hero Title Entrance */
.hero-title {
  animation: slideInLeft 1s ease-out 0.2s both;
}

/* Hero Subtitle Entrance */
.hero-subtitle {
  animation: slideInRight 1s ease-out 0.4s both;
}

/* Hero Buttons Entrance */
.hero-buttons {
  animation: slideUp 1s ease-out 0.6s both;
}

/* ============================================
   ACCESSIBILITY - REDUCED MOTION
   ============================================ */

/* Respect user's motion preferences */
@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;
  }

  .floating-shapes {
    display: none;
  }

  .scroll-indicator {
    animation: none;
  }

  .hero-title,
  .hero-subtitle,
  .hero-buttons {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* ============================================
   CUSTOM CURSOR EFFECT (Optional)
   ============================================ */

/* Custom cursor trail effect - enabled via JS */
.cursor-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-primary);
  border-radius: 50%;
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  transition: transform 0.15s ease;
  box-shadow: 0 0 20px var(--glow-primary);
  opacity: 0.8;
}

.cursor-outline {
  width: 40px;
  height: 40px;
  border: 2px solid var(--accent-primary);
  border-radius: 50%;
  position: fixed;
  pointer-events: none;
  z-index: 9998;
  transition: transform 0.2s ease;
  opacity: 0.5;
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Use transform and opacity for animations (GPU accelerated) */
.optimized-animation {
  will-change: transform, opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* ============================================
   SMOOTH SCROLLING ENHANCEMENTS
   ============================================ */

/* Smooth scroll with offset for fixed navbar */
html {
  scroll-padding-top: 80px;
}

/* Section Transitions */
.section {
  opacity: 1;
  transition: opacity 0.6s ease;
}

/* ============================================
   INTERACTIVE ANIMATIONS
   ============================================ */

/* Button Press Animation */
.btn:active {
  transform: scale(0.98);
}

/* Input Focus Animation */
.form-group input:focus,
.form-group textarea:focus {
  animation: pulse 0.3s ease;
}

/* Card Hover Animation */
.project-card {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card:hover {
  animation: glowPulse 2s infinite;
}

/* Skill Icon Rotation */
.skill-item:hover .skill-icon {
  animation: rotateIn 0.6s ease;
}

/* ============================================
   MOBILE MENU ANIMATIONS
   ============================================ */

@keyframes slideInFromTop {
  from {
    opacity: 0;
    transform: translateY(-100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Mobile menu animation when opened */
.nav-links.mobile-open {
  animation: slideInFromTop 0.4s ease;
}

/* ============================================
   IMAGE LAZY LOAD ANIMATION
   ============================================ */

img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.6s ease;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* ============================================
   TEXT REVEAL ANIMATIONS
   ============================================ */

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

.text-reveal {
  animation: textReveal 1.2s cubic-bezier(0.77, 0, 0.175, 1) both;
}

/* ============================================
   GRADIENT BORDER ANIMATION
   ============================================ */

@keyframes gradientBorder {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.gradient-border {
  position: relative;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary), var(--accent-primary));
  background-size: 200% 200%;
  animation: gradientBorder 3s ease infinite;
}

/* ============================================
   TOOLTIP ANIMATIONS
   ============================================ */

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

.tooltip {
  animation: tooltipFadeIn 0.3s ease;
}
