/* ==========================================================================
   PREMIUM ANIMATIONS SYSTEM
   Smooth, sophisticated micro-interactions inspired by Linear & Stripe
   ========================================================================== */

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

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

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

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

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

@keyframes scaleUp {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.05);
  }
}

/* Shimmer Effect */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

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

/* Pulse Glow */
@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
  }
  50% {
    box-shadow: 0 0 40px rgba(168, 85, 247, 0.8);
  }
}

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

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

/* Skeleton Loading */
@keyframes skeleton {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Number Counter */
@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

/* Ripple Effect */
@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Bounce In */
@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

/* Glitch Effect */
@keyframes glitch {
  0% {
    transform: translate(0);
  }
  20% {
    transform: translate(-2px, 2px);
  }
  40% {
    transform: translate(-2px, -2px);
  }
  60% {
    transform: translate(2px, 2px);
  }
  80% {
    transform: translate(2px, -2px);
  }
  100% {
    transform: translate(0);
  }
}

/* Gradient Mesh Animation */
@keyframes meshAnimation {
  0%, 100% {
    background-position: 0% 0%;
  }
  25% {
    background-position: 50% 50%;
  }
  50% {
    background-position: 100% 100%;
  }
  75% {
    background-position: 50% 50%;
  }
}

/* Text Reveal */
@keyframes textReveal {
  from {
    opacity: 0;
    transform: translateY(20px);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

/* Marquee Scroll */
@keyframes marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

/* ==========================================================================
   ANIMATION CLASSES - Apply to Elements
   ========================================================================== */

/* Fade Animations */
.animate-fade-in {
  animation: fadeIn 0.6s var(--ease-premium) forwards;
}

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

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

/* Scale Animations */
.animate-scale-in {
  animation: scaleIn 0.5s var(--ease-premium) forwards;
}

.animate-bounce-in {
  animation: bounceIn 0.6s var(--ease-elastic) forwards;
}

/* Slide Animations */
.animate-slide-in-left {
  animation: slideInLeft 0.6s var(--ease-premium) forwards;
}

.animate-slide-in-right {
  animation: slideInRight 0.6s var(--ease-premium) forwards;
}

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

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

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

.animate-shimmer {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

/* Gradient Animations */
.animate-gradient {
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
}

.animate-mesh {
  background-size: 300% 300%;
  animation: meshAnimation 15s ease infinite;
}

/* Text Animations */
.animate-text-reveal {
  animation: textReveal 0.8s var(--ease-premium) forwards;
}

/* Stagger Delays - for list items */
.animate-stagger > *:nth-child(1) { animation-delay: 0ms; }
.animate-stagger > *:nth-child(2) { animation-delay: 100ms; }
.animate-stagger > *:nth-child(3) { animation-delay: 200ms; }
.animate-stagger > *:nth-child(4) { animation-delay: 300ms; }
.animate-stagger > *:nth-child(5) { animation-delay: 400ms; }
.animate-stagger > *:nth-child(6) { animation-delay: 500ms; }
.animate-stagger > *:nth-child(7) { animation-delay: 600ms; }
.animate-stagger > *:nth-child(8) { animation-delay: 700ms; }
.animate-stagger > *:nth-child(9) { animation-delay: 800ms; }
.animate-stagger > *:nth-child(10) { animation-delay: 900ms; }

/* ==========================================================================
   SCROLL-TRIGGERED ANIMATIONS
   ========================================================================== */

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

.scroll-animate.in-view {
  opacity: 1;
  transform: translateY(0);
}

.scroll-animate-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity 0.8s var(--ease-premium),
              transform 0.8s var(--ease-premium);
}

.scroll-animate-left.in-view {
  opacity: 1;
  transform: translateX(0);
}

.scroll-animate-right {
  opacity: 0;
  transform: translateX(50px);
  transition: opacity 0.8s var(--ease-premium),
              transform 0.8s var(--ease-premium);
}

.scroll-animate-right.in-view {
  opacity: 1;
  transform: translateX(0);
}

.scroll-animate-scale {
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.8s var(--ease-premium),
              transform 0.8s var(--ease-premium);
}

.scroll-animate-scale.in-view {
  opacity: 1;
  transform: scale(1);
}

/* ==========================================================================
   HOVER ANIMATIONS
   ========================================================================== */

/* Magnetic Button Effect */
.magnetic-hover {
  position: relative;
  transition: transform 0.3s var(--ease-premium);
}

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

/* Lift & Glow on Hover */
.hover-lift-glow {
  transition: all var(--duration-normal) var(--ease-premium);
}

.hover-lift-glow:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-2xl), var(--glow-lg);
}

/* Card Tilt 3D Effect */
.card-3d {
  transform-style: preserve-3d;
  transition: transform 0.6s var(--ease-premium);
}

.card-3d:hover {
  transform: perspective(1000px) rotateX(5deg) rotateY(5deg) translateZ(20px);
}

/* Border Glow on Hover */
.border-glow {
  position: relative;
  transition: all var(--duration-normal) var(--ease-out);
}

.border-glow::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
  z-index: -1;
  filter: blur(10px);
}

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

/* Underline Expand */
.underline-expand {
  position: relative;
}

.underline-expand::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  transition: width var(--duration-slow) var(--ease-premium);
}

.underline-expand:hover::after {
  width: 100%;
}

/* Ripple Click Effect */
.ripple-effect {
  position: relative;
  overflow: hidden;
}

.ripple-effect::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.ripple-effect:active::after {
  width: 300px;
  height: 300px;
}

/* ==========================================================================
   SKELETON LOADING STATES
   ========================================================================== */

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 200% 100%;
  animation: skeleton 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
}

.skeleton-heading {
  height: 2em;
  margin-bottom: 1em;
}

.skeleton-circle {
  border-radius: 50%;
}

/* ==========================================================================
   PAGE TRANSITION ANIMATIONS
   ========================================================================== */

.page-transition-enter {
  opacity: 0;
  transform: translateY(20px);
}

.page-transition-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s var(--ease-premium),
              transform 0.3s var(--ease-premium);
}

.page-transition-exit {
  opacity: 1;
  transform: translateY(0);
}

.page-transition-exit-active {
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.3s var(--ease-premium),
              transform 0.3s var(--ease-premium);
}

/* ==========================================================================
   MICRO-INTERACTIONS
   ========================================================================== */

/* Button Press Animation */
.btn-press {
  transition: transform var(--duration-fast) var(--ease-in-out);
}

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

/* Icon Spin on Hover */
.icon-spin:hover {
  animation: rotate 0.6s var(--ease-out);
}

/* Scale Bounce on Hover */
.scale-bounce:hover {
  animation: scaleUp 0.3s var(--ease-bounce);
}

/* Number Counter Animation */
.count-up {
  animation: countUp 0.6s var(--ease-premium);
}

/* Progress Bar Fill */
@keyframes progressFill {
  from {
    transform: scaleX(0);
    transform-origin: left;
  }
  to {
    transform: scaleX(1);
    transform-origin: left;
  }
}

.progress-fill {
  animation: progressFill 1s var(--ease-premium) forwards;
}

/* ==========================================================================
   MARQUEE EFFECTS
   ========================================================================== */

.marquee {
  display: flex;
  overflow: hidden;
  user-select: none;
  gap: var(--space-8);
}

.marquee-content {
  display: flex;
  gap: var(--space-8);
  animation: marquee 30s linear infinite;
  will-change: transform;
}

.marquee:hover .marquee-content {
  animation-play-state: paused;
}

/* ==========================================================================
   PARALLAX EFFECTS
   ========================================================================== */

.parallax-slow {
  transition: transform 0.3s ease-out;
  will-change: transform;
}

.parallax-medium {
  transition: transform 0.5s ease-out;
  will-change: transform;
}

.parallax-fast {
  transition: transform 0.7s ease-out;
  will-change: transform;
}

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

/* Holographic Effect */
.holographic {
  background: linear-gradient(
    135deg,
    #667eea 0%,
    #764ba2 25%,
    #f093fb 50%,
    #4facfe 75%,
    #00f2fe 100%
  );
  background-size: 400% 400%;
  animation: gradientShift 3s ease infinite;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Noise Texture Overlay */
.noise-texture {
  position: relative;
}

.noise-texture::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  mix-blend-mode: overlay;
}

/* Spotlight Effect */
.spotlight {
  position: relative;
  overflow: hidden;
}

.spotlight::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(168, 85, 247, 0.2) 0%,
    transparent 50%
  );
  opacity: 0;
  transition: opacity var(--duration-slow) var(--ease-out);
  pointer-events: none;
}

.spotlight:hover::before {
  opacity: 1;
}

/* ==========================================================================
   ACCESSIBILITY - 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-float,
  .animate-rotate,
  .animate-pulse-glow,
  .animate-shimmer,
  .animate-gradient,
  .animate-mesh,
  .marquee-content {
    animation: none !important;
  }
}

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

/* GPU Acceleration for Smooth Animations */
.gpu-accelerated {
  transform: translateZ(0);
  will-change: transform;
}

/* Contain Layout Shifts */
.contain-paint {
  contain: paint;
}

.contain-layout {
  contain: layout;
}

.contain-strict {
  contain: strict;
}

