/**
 * Connglo Landing Page - Modern Animation System
 * Hardware-accelerated, accessible, and performant animations
 */

/* ===== ANIMATION VARIABLES ===== */
:root {
  /* Animation Timing */
  --anim-duration-fast: 0.3s;
  --anim-duration-normal: 0.6s;
  --anim-duration-slow: 1.2s;
  
  /* Animation Easing */
  --anim-ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --anim-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --anim-ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --anim-ease-smooth: cubic-bezier(0.25, 0.1, 0.25, 1);
  
  /* Animation Delays for Staggered Effects */
  --anim-delay-1: 0.1s;
  --anim-delay-2: 0.2s;
  --anim-delay-3: 0.3s;
  --anim-delay-4: 0.4s;
  --anim-delay-5: 0.5s;
}

/* ===== BASE ANIMATION CLASSES ===== */

/* Progressive enhancement: Elements are visible by default */
/* Only hide them when JavaScript is available */
.js-enabled .animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: all var(--anim-duration-normal) var(--anim-ease-out);
  will-change: opacity, transform;
}

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

/* Fade animations */
.js-enabled .fade-in {
  opacity: 0;
  transition: opacity var(--anim-duration-normal) var(--anim-ease-out);
  will-change: opacity;
}

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

/* Slide animations */
.js-enabled .slide-up {
  opacity: 0;
  transform: translateY(50px);
  transition: all var(--anim-duration-normal) var(--anim-ease-out);
  will-change: opacity, transform;
}

.slide-up.animate-in {
  opacity: 1;
  transform: translateY(0);
}

.js-enabled .slide-left {
  opacity: 0;
  transform: translateX(50px);
  transition: all var(--anim-duration-normal) var(--anim-ease-out);
  will-change: opacity, transform;
}

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

.js-enabled .slide-right {
  opacity: 0;
  transform: translateX(-50px);
  transition: all var(--anim-duration-normal) var(--anim-ease-out);
  will-change: opacity, transform;
}

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

/* Scale animations */
.js-enabled .scale-in {
  opacity: 0;
  transform: scale(0.8);
  transition: all var(--anim-duration-normal) var(--anim-ease-bounce);
  will-change: opacity, transform;
}

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

/* ===== STAGGERED ANIMATIONS ===== */
/* Stagger animations are now handled by JavaScript for better control */

/* ===== PARALLAX EFFECTS ===== */
.parallax-slow {
  transform: translateY(0);
  transition: transform 0.1s linear;
  will-change: transform;
}

.parallax-medium {
  transform: translateY(0);
  transition: transform 0.1s linear;
  will-change: transform;
}

.parallax-fast {
  transform: translateY(0);
  transition: transform 0.1s linear;
  will-change: transform;
}

/* ===== HOVER ANIMATIONS ===== */
.hover-lift {
  transition: transform var(--anim-duration-fast) var(--anim-ease-out);
  will-change: transform;
}

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

.hover-scale {
  transition: transform var(--anim-duration-fast) var(--anim-ease-out);
  will-change: transform;
}

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

.hover-glow {
  transition: box-shadow var(--anim-duration-fast) var(--anim-ease-out);
  will-change: box-shadow;
}

.hover-glow:hover {
  box-shadow: 0 0 30px rgba(255, 111, 0, 0.4);
}

/* ===== MICRO-INTERACTIONS ===== */
.button-press {
  transition: transform var(--anim-duration-fast) var(--anim-ease-out);
  will-change: transform;
}

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

.icon-bounce {
  transition: transform var(--anim-duration-fast) var(--anim-ease-bounce);
  will-change: transform;
}

.icon-bounce:hover {
  transform: scale(1.2);
}

/* ===== LOADING ANIMATIONS ===== */
@keyframes pulse-glow {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}

.pulse-glow {
  animation: pulse-glow 2s var(--anim-ease-in-out) infinite;
  will-change: opacity, transform;
}

@keyframes float-gentle {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

.float-gentle {
  animation: float-gentle 4s var(--anim-ease-in-out) infinite;
  will-change: transform;
}

@keyframes float-slow {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(180deg);
  }
}

.float-slow {
  animation: float-slow 8s var(--anim-ease-in-out) infinite;
  will-change: transform;
}

@keyframes drift-horizontal {
  0%, 100% {
    transform: translateX(0px);
  }
  50% {
    transform: translateX(30px);
  }
}

.drift-horizontal {
  animation: drift-horizontal 6s var(--anim-ease-in-out) infinite;
  will-change: transform;
}

/* ===== HERO BACKGROUND ANIMATIONS ===== */
@keyframes hero-particle-float {
  0%, 100% {
    transform: translateY(0px) translateX(0px) scale(1);
    opacity: 0.3;
  }
  33% {
    transform: translateY(-20px) translateX(10px) scale(1.1);
    opacity: 0.6;
  }
  66% {
    transform: translateY(-10px) translateX(-15px) scale(0.9);
    opacity: 0.4;
  }
}

.hero-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: linear-gradient(45deg, #ef5d00, #ff6b35);
  border-radius: 50%;
  animation: hero-particle-float 12s var(--anim-ease-in-out) infinite;
  will-change: transform, opacity;
}

.hero-particle:nth-child(1) { top: 20%; left: 10%; animation-delay: 0s; }
.hero-particle:nth-child(2) { top: 40%; left: 80%; animation-delay: 2s; }
.hero-particle:nth-child(3) { top: 60%; left: 20%; animation-delay: 4s; }
.hero-particle:nth-child(4) { top: 80%; left: 70%; animation-delay: 6s; }
.hero-particle:nth-child(5) { top: 30%; left: 50%; animation-delay: 8s; }

/* ===== SCROLL PROGRESS INDICATOR ===== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, #ef5d00, #ff6b35);
  z-index: 9999;
  transition: width 0.1s ease-out;
  will-change: width;
}

/* ===== ENHANCED GLASS MORPHISM EFFECTS ===== */
.glass-enhanced {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all var(--anim-duration-normal) var(--anim-ease-out);
  will-change: backdrop-filter, background, border, box-shadow;
}

.glass-enhanced:hover {
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 111, 0, 0.3);
  box-shadow:
    0 12px 40px rgba(255, 111, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}



/* ===== MAGNETIC BUTTON EFFECT ===== */
.magnetic-button {
  position: relative;
  transition: transform var(--anim-duration-fast) var(--anim-ease-out);
  will-change: transform;
}

.magnetic-button::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: inherit;
  background: linear-gradient(45deg, transparent, rgba(255, 111, 0, 0.1), transparent);
  opacity: 0;
  transition: opacity var(--anim-duration-fast) var(--anim-ease-out);
  pointer-events: none;
}

.magnetic-button:hover::before {
  opacity: 1;
}

/* ===== TEXT REVEAL ANIMATION ===== */
@keyframes text-reveal {
  0% {
    transform: translateY(100%);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.text-reveal {
  overflow: hidden;
}

.text-reveal span {
  display: inline-block;
  animation: text-reveal var(--anim-duration-normal) var(--anim-ease-out) forwards;
  opacity: 0;
}

.text-reveal.animate-in span {
  animation-play-state: running;
}

/* ===== 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;
  }
  
  .animate-on-scroll,
  .fade-in,
  .slide-up,
  .slide-left,
  .slide-right,
  .scale-in {
    opacity: 1;
    transform: none;
  }
  
  .parallax-slow,
  .parallax-medium,
  .parallax-fast {
    transform: none !important;
  }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
.gpu-accelerated {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Optimize for mobile */
@media (max-width: 768px) {
  .animate-on-scroll,
  .slide-up,
  .slide-left,
  .slide-right {
    transform: translateY(20px);
  }
  
  .animate-on-scroll.animate-in,
  .slide-up.animate-in,
  .slide-left.animate-in,
  .slide-right.animate-in {
    transform: translateY(0);
  }
}
