/* Animation System */

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

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes slideInUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

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

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

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

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 5px var(--accent-glow), 0 0 10px var(--accent-glow);
  }
  50% {
    box-shadow: 0 0 10px var(--accent-glow), 0 0 20px var(--accent-glow), 0 0 30px var(--accent-glow);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* Animation classes */
.fade-in {
  animation: fadeIn var(--transition-base) ease-out;
}

.fade-in-up {
  animation: fadeInUp var(--transition-base) ease-out;
}

.fade-in-down {
  animation: fadeInDown var(--transition-base) ease-out;
}

.slide-in-up {
  animation: slideInUp var(--transition-slow) ease-out;
}

.scale-in {
  animation: scaleIn var(--transition-base) ease-out;
}

/* Scroll reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

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

/* Stagger children animations */
.stagger-container > * {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp var(--transition-base) ease-out forwards;
}

.stagger-container > *:nth-child(1) { animation-delay: 0ms; }
.stagger-container > *:nth-child(2) { animation-delay: 50ms; }
.stagger-container > *:nth-child(3) { animation-delay: 100ms; }
.stagger-container > *:nth-child(4) { animation-delay: 150ms; }
.stagger-container > *:nth-child(5) { animation-delay: 200ms; }
.stagger-container > *:nth-child(6) { animation-delay: 250ms; }
.stagger-container > *:nth-child(7) { animation-delay: 300ms; }
.stagger-container > *:nth-child(8) { animation-delay: 350ms; }
.stagger-container > *:nth-child(9) { animation-delay: 400ms; }
.stagger-container > *:nth-child(10) { animation-delay: 450ms; }

/* Button pulse animation */
.btn-pulse {
  animation: pulse 2s ease-in-out infinite;
}

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

/* Shimmer effect for loading */
.shimmer {
  background: linear-gradient(
    90deg,
    var(--bg-card) 0%,
    var(--bg-card-hover) 50%,
    var(--bg-card) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite linear;
}

/* Hero parallax background */
.hero-bg {
  position: relative;
  overflow: hidden;
}

.hero-bg::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle at center,
    rgba(0, 212, 255, 0.1) 0%,
    transparent 70%
  );
  animation: rotate 30s linear infinite;
}

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

/* Card reorder animation */
.card-reorder {
  transition: transform var(--transition-slow) ease-out, opacity var(--transition-base) ease-out;
}

/* Smooth scroll behavior */
html.smooth-scroll {
  scroll-behavior: smooth;
}

/* Reduce motion for accessibility */
@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 {
    opacity: 1;
    transform: none;
  }

  .stagger-container > * {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

/* Loading spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-card) 25%,
    var(--bg-card-hover) 50%,
    var(--bg-card) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Micro-interactions */
.hover-lift {
  transition: transform var(--transition-base);
}

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

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

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

.active-press {
  transition: transform var(--transition-fast);
}

.active-press:active {
  transform: scale(0.97);
}

/* Gradient text animation */
.gradient-text {
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    var(--text-main) 50%,
    var(--accent) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 3s ease infinite;
}

@keyframes gradient-shift {
  0%, 100% {
    background-position: 0% center;
  }
  50% {
    background-position: 100% center;
  }
}

/* Page transition */
.page-transition {
  animation: fadeIn 0.3s ease-out;
}
