/* ================================================
   Animations & Transitions
   Scroll-triggered animations, hover effects, etc.
   ================================================ */

/* ========== Fade In Animations ========== */

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

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

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

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

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ========== Scale Animations ========== */

@keyframes scaleUp {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ========== Utility Classes for Scroll Animations ========== */

.fade-in {
  animation: fadeIn 0.8s var(--ease-out);
}

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

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

.slide-in-left {
  animation: slideInLeft 0.8s var(--ease-out);
}

.slide-in-right {
  animation: slideInRight 0.8s var(--ease-out);
}

.scale-up {
  animation: scaleUp 0.6s var(--ease-out);
}

/* ========== Scroll-Triggered Animation (via JS) ========== */

.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s var(--ease-out);
}

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

/* ========== Count-Up Animation (for 100% badge) ========== */

.count-up {
  display: inline-block;
  transition: all 0.5s var(--ease-out);
}

/* ========== Hover Effects ========== */

.hover-lift {
  transition: transform var(--duration-normal) var(--ease-out);
}

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

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

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

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

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(0, 113, 227, 0.3);
}

/* ========== Loading Spinner ========== */

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: var(--color-accent-blue);
  animation: spin 1s linear infinite;
}

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

/* ========== Pulse Animation ========== */

@keyframes pulse-ring {
  0% {
    transform: scale(0.95);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.7;
  }
  100% {
    transform: scale(0.95);
    opacity: 1;
  }
}

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

/* ========== Shimmer Effect (Loading skeleton) ========== */

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

.shimmer {
  animation: shimmer 2s linear infinite;
  background: linear-gradient(
    to right,
    var(--color-bg-secondary) 0%,
    var(--color-bg-tertiary) 50%,
    var(--color-bg-secondary) 100%
  );
  background-size: 1000px 100%;
}

/* ========== Reveal Animations (stagger effect) ========== */

.stagger-item {
  opacity: 0;
  transform: translateY(20px);
}

.stagger-item.is-visible {
  animation: fadeInUp 0.6s var(--ease-out) forwards;
}

.stagger-item:nth-child(1).is-visible {
  animation-delay: 0s;
}

.stagger-item:nth-child(2).is-visible {
  animation-delay: 0.1s;
}

.stagger-item:nth-child(3).is-visible {
  animation-delay: 0.2s;
}

.stagger-item:nth-child(4).is-visible {
  animation-delay: 0.3s;
}

.stagger-item:nth-child(5).is-visible {
  animation-delay: 0.4s;
}

.stagger-item:nth-child(6).is-visible {
  animation-delay: 0.5s;
}

/* ========== Parallax Effect ========== */

.parallax {
  transform: translateZ(0);
  will-change: transform;
}

/* ========== Smooth Transitions ========== */

.transition-all {
  transition: all var(--duration-normal) var(--ease-in-out);
}

.transition-fast {
  transition: all var(--duration-fast) var(--ease-in-out);
}

.transition-slow {
  transition: all var(--duration-slow) var(--ease-in-out);
}

/* ========== Navbar Scroll Effect ========== */

.navbar.scrolled {
  box-shadow: var(--shadow-sm);
  background-color: rgba(255, 255, 255, 0.95);
}

/* ========== Performance Optimizations ========== */

.will-change-transform {
  will-change: transform;
}

.will-change-opacity {
  will-change: opacity;
}

/* ========== Logo Marquee Animation (Anthropic-inspired) ========== */

@keyframes marquee-scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* Disable animations for users who prefer 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,
  .stagger-item {
    opacity: 1;
    transform: none;
  }

  .media-marquee-content {
    animation: none;
  }
}
