/* ==========================================================================
   Animations - Keyframes, Transitions, Scroll Effects
   ========================================================================== */

/* ==========================================================================
   GLOBAL ANIMATION PERFORMANCE
   ========================================================================== */

/* Global font smoothing */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* GPU acceleration for animated elements */
.hero-content,
.phone-mockup,
.floating-badge,
.marquee-content,
.waveform-bar,
.pulse-dot,
.cta-button,
.stat-card,
.feature-card,
.animate-float {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Accessibility: Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

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

/* Fade Up Animation */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

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

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

/* Pulse Animation */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

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

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

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

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

/* Count Up (for number counters - handled by JS) */
@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Waveform bars */
@keyframes waveformBar1 {
  0%, 100% { height: 20%; }
  50% { height: 80%; }
}

@keyframes waveformBar2 {
  0%, 100% { height: 40%; }
  50% { height: 100%; }
}

@keyframes waveformBar3 {
  0%, 100% { height: 60%; }
  50% { height: 30%; }
}

@keyframes waveformBar4 {
  0%, 100% { height: 30%; }
  50% { height: 90%; }
}

@keyframes waveformBar5 {
  0%, 100% { height: 50%; }
  50% { height: 70%; }
}

/* Waveform animation for audio player */
@keyframes waveform {
  0%, 100% {
    transform: scaleY(0.5);
  }
  50% {
    transform: scaleY(1.2);
  }
}

.animate-waveform {
  animation: waveform 0.8s ease-in-out infinite;
}

/* Fade in animation utility */
.animate-fadeIn {
  animation: fadeIn 0.5s ease-in-out;
}

/* ==========================================================================
   SCROLL ANIMATION CLASSES
   ========================================================================== */

/* Base state for elements before animation */
.fade-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

/* Fade in */
.fade-in {
  opacity: 0;
  transition: opacity 0.6s ease-out;
}

.fade-in.visible {
  opacity: 1;
}

/* Scale in */
.scale-in {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

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

/* Slide from right */
.slide-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

/* Slide from left */
.slide-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

/* ==========================================================================
   STAGGER ANIMATION DELAYS
   ========================================================================== */

.stagger-1 { transition-delay: 0ms; }
.stagger-2 { transition-delay: 100ms; }
.stagger-3 { transition-delay: 200ms; }
.stagger-4 { transition-delay: 300ms; }
.stagger-5 { transition-delay: 400ms; }
.stagger-6 { transition-delay: 500ms; }
.stagger-7 { transition-delay: 600ms; }
.stagger-8 { transition-delay: 700ms; }
.stagger-9 { transition-delay: 800ms; }
.stagger-10 { transition-delay: 900ms; }
.stagger-11 { transition-delay: 1000ms; }
.stagger-12 { transition-delay: 1100ms; }

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

/* Card hover lift */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

/* Button hover scale */
.hover-scale {
  transition: transform var(--transition-fast);
}

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

/* Link underline animation */
.hover-underline {
  position: relative;
}

.hover-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  transition: width var(--transition-base);
}

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

/* Icon rotate on hover */
.hover-rotate {
  transition: transform var(--transition-base);
}

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

/* Glow effect */
.hover-glow {
  transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.4);
}

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

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

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

/* Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ==========================================================================
   SPECIAL ANIMATIONS
   ========================================================================== */

/* Hero orbs floating */
.hero-orb {
  animation: float 6s ease-in-out infinite;
}

.hero-orb-1 {
  animation-duration: 6s;
}

.hero-orb-2 {
  animation-duration: 8s;
  animation-direction: reverse;
}

/* Chart bars animation */
.chart-bar {
  transform-origin: bottom;
  animation: growBar 1s ease-out forwards;
}

@keyframes growBar {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

.chart-bar:nth-child(1) { animation-delay: 0ms; }
.chart-bar:nth-child(2) { animation-delay: 50ms; }
.chart-bar:nth-child(3) { animation-delay: 100ms; }
.chart-bar:nth-child(4) { animation-delay: 150ms; }
.chart-bar:nth-child(5) { animation-delay: 200ms; }
.chart-bar:nth-child(6) { animation-delay: 250ms; }
.chart-bar:nth-child(7) { animation-delay: 300ms; }
.chart-bar:nth-child(8) { animation-delay: 350ms; }
.chart-bar:nth-child(9) { animation-delay: 400ms; }
.chart-bar:nth-child(10) { animation-delay: 450ms; }
.chart-bar:nth-child(11) { animation-delay: 500ms; }
.chart-bar:nth-child(12) { animation-delay: 550ms; }

/* Progress bar animation */
.progress-animate {
  animation: progressFill 2s ease-out forwards;
}

@keyframes progressFill {
  from {
    width: 0%;
  }
}

/* Typing cursor */
.typing-cursor::after {
  content: '|';
  animation: blink 1s infinite;
}

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

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .fade-up,
  .fade-in,
  .scale-in,
  .slide-right,
  .slide-left {
    opacity: 1;
    transform: none;
  }

  .hero-orb {
    animation: none;
  }

  .marquee-content {
    animation: none;
  }
}

/* ==========================================================================
   MARQUEE ANIMATIONS
   ========================================================================== */

/* Marquee container with fade edges */
.marquee-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

/* Marquee content animation */
.marquee-content {
  display: flex;
  animation: marquee 30s linear infinite;
  will-change: transform;
}

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

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

/* Reverse direction marquee */
.marquee-reverse .marquee-content {
  animation-direction: reverse;
}

/* Hide scrollbar for marquee */
.marquee-container::-webkit-scrollbar {
  display: none;
}

.marquee-container {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ==========================================================================
   GLASSMORPHISM EFFECTS
   ========================================================================== */

/* Standard glass effect */
.glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Dark glass effect */
.glass-dark {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Subtle glass effect */
.glass-subtle {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Frosted glass effect */
.glass-frosted {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   GRADIENT TEXT EFFECTS
   ========================================================================== */

/* Primary gradient text */
.gradient-text {
  background: linear-gradient(135deg, #06B6D4 0%, #3B82F6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Purple gradient text */
.gradient-text-purple {
  background: linear-gradient(135deg, #6C5DD3 0%, #A855F7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Rainbow gradient text */
.gradient-text-rainbow {
  background: linear-gradient(135deg, #FF6B6B, #4ECDC4, #45B7D1, #96E6A1);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease infinite;
}

/* ==========================================================================
   GRADIENT BORDERS
   ========================================================================== */

/* Gradient border wrapper */
.gradient-border {
  position: relative;
  background: linear-gradient(135deg, #06B6D4, #3B82F6, #6C5DD3);
  padding: 2px;
  border-radius: 1rem;
}

.gradient-border > * {
  background: white;
  border-radius: calc(1rem - 2px);
}

/* Animated gradient border */
.gradient-border-animated {
  position: relative;
  background: linear-gradient(135deg, #06B6D4, #3B82F6, #6C5DD3, #A855F7, #06B6D4);
  background-size: 400% 400%;
  padding: 2px;
  border-radius: 1rem;
  animation: gradientShift 4s ease infinite;
}

.gradient-border-animated > * {
  background: white;
  border-radius: calc(1rem - 2px);
}

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

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

/* Card 3D tilt hover */
.card-tilt {
  transition: transform 0.3s ease-out;
  transform-style: preserve-3d;
}

.card-tilt:hover {
  transform: perspective(1000px) rotateX(5deg) rotateY(-5deg) translateY(-5px);
}

/* Button press effect */
.btn-press {
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-press:active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Icon bounce on hover */
.icon-bounce:hover {
  animation: bounce 0.5s ease;
}

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

.ripple::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(255,255,255,0.3) 10%, transparent 10.01%);
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(10, 10);
  opacity: 0;
  transition: transform 0.5s, opacity 1s;
}

.ripple:active::after {
  transform: scale(0, 0);
  opacity: 0.3;
  transition: 0s;
}

/* ==========================================================================
   COUNTER ANIMATIONS
   ========================================================================== */

/* Counter element styling */
[data-counter] {
  font-variant-numeric: tabular-nums;
}

/* Counter reveal animation */
.counter-reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.counter-reveal.counted {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   FLOATING ANIMATIONS
   ========================================================================== */

/* Float animation variations */
.float-slow {
  animation: float 6s ease-in-out infinite;
}

.float-medium {
  animation: float 4s ease-in-out infinite;
}

.float-fast {
  animation: float 2s ease-in-out infinite;
}

/* Float with rotation */
@keyframes floatRotate {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-15px) rotate(5deg);
  }
}

.float-rotate {
  animation: floatRotate 5s ease-in-out infinite;
}

/* Delayed float animations */
.float-delay-1 { animation-delay: 0.5s; }
.float-delay-2 { animation-delay: 1s; }
.float-delay-3 { animation-delay: 1.5s; }
.float-delay-4 { animation-delay: 2s; }

/* ==========================================================================
   PROGRESSIVE REVEAL ON SCROLL
   ========================================================================== */

/* Elements visible after scroll trigger */
.animate-visible {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* Scroll-triggered fade and slide */
.scroll-reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Scroll-triggered scale */
.scroll-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

/* ==========================================================================
   PING ANIMATION (for pulsing indicators)
   ========================================================================== */

@keyframes ping {
  75%, 100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

.animate-ping {
  animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* Slower ping variation */
.animate-ping-slow {
  animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* ==========================================================================
   PAGE LOAD - SCROLL TO TOP SUPPORT
   ========================================================================== */

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  overflow-x: hidden;
}

/* ==========================================================================
   OPTIMIZED HOVER EFFECTS (60FPS)
   ========================================================================== */

/* Button hovers */
.cta-button {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  will-change: transform;
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(6, 182, 212, 0.3);
}

.cta-button:active {
  transform: translateY(0);
}

/* Optimized glassmorphism */
.glass-effect {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transform: translateZ(0);
  will-change: transform;
}

/* ==========================================================================
   SCROLL-TRIGGERED FADE IN
   ========================================================================== */

.fade-in-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ==========================================================================
   MOBILE ANIMATION OPTIMIZATIONS
   ========================================================================== */

@media (max-width: 768px) {
  /* Disable expensive animations */
  .phone-mockup,
  .floating-badge,
  .animate-float {
    animation: none !important;
    transform: none !important;
  }

  /* Slower marquee = less processing */
  .marquee-content {
    animation-duration: 40s;
  }

  /* No hover transforms on mobile (touch devices don't benefit) */
  .cta-button:hover,
  .stat-card:hover,
  .feature-card:hover,
  .bar:hover {
    transform: none;
  }

  /* Disable will-change on mobile to save memory */
  * {
    will-change: auto !important;
  }

  /* Simplify hero animations */
  .hero-content {
    animation-duration: 0.3s;
  }

  /* Disable glassmorphism blur on mobile for performance */
  .glass-effect,
  .glass,
  .glass-subtle {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(255, 255, 255, 0.95);
  }
}
