/* RedBoxVM Website - Advanced Animations */

/* Scroll-triggered animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

/* Particle animations */
@keyframes particleFloat {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
    opacity: 0.7;
  }
  33% {
    transform: translateY(-20px) rotate(120deg);
    opacity: 1;
  }
  66% {
    transform: translateY(10px) rotate(240deg);
    opacity: 0.8;
  }
}

@keyframes particlePulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
}

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

@keyframes gradientRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* 3D Card animations */
@keyframes cardFloat {
  0%, 100% {
    transform: translateY(0px) rotateX(0deg) rotateY(0deg);
  }
  25% {
    transform: translateY(-10px) rotateX(5deg) rotateY(2deg);
  }
  50% {
    transform: translateY(-5px) rotateX(-2deg) rotateY(-5deg);
  }
  75% {
    transform: translateY(-15px) rotateX(3deg) rotateY(3deg);
  }
}

@keyframes cardHover {
  0% {
    transform: translateY(0px) rotateX(0deg) rotateY(0deg) scale(1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  }
  100% {
    transform: translateY(-20px) rotateX(10deg) rotateY(5deg) scale(1.05);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.2);
  }
}

/* Text animations */
@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

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

@keyframes textGlow {
  0%, 100% {
    text-shadow: 0 0 5px rgba(102, 126, 234, 0.5);
  }
  50% {
    text-shadow: 0 0 20px rgba(102, 126, 234, 0.8), 0 0 30px rgba(118, 75, 162, 0.6);
  }
}

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

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.7;
  }
}

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

/* Morphing animations */
@keyframes morphShape {
  0% {
    border-radius: 20px;
    transform: rotate(0deg);
  }
  25% {
    border-radius: 50px 20px;
    transform: rotate(90deg);
  }
  50% {
    border-radius: 50%;
    transform: rotate(180deg);
  }
  75% {
    border-radius: 20px 50px;
    transform: rotate(270deg);
  }
  100% {
    border-radius: 20px;
    transform: rotate(360deg);
  }
}

/* Glitch effects */
@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);
  }
}

@keyframes glitchColor {
  0% {
    filter: hue-rotate(0deg);
  }
  25% {
    filter: hue-rotate(90deg);
  }
  50% {
    filter: hue-rotate(180deg);
  }
  75% {
    filter: hue-rotate(270deg);
  }
  100% {
    filter: hue-rotate(360deg);
  }
}

/* Intersection Observer Animation Classes */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.animate-fade-in {
  opacity: 0;
  transition: opacity 1s ease-out;
}

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

.animate-slide-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.animate-slide-right {
  opacity: 0;
  transform: translateX(50px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.animate-scale {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* Staggered animations */
.stagger-animation {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.stagger-animation.animate {
  opacity: 1;
  transform: translateY(0);
}

.stagger-animation:nth-child(1) { transition-delay: 0.1s; }
.stagger-animation:nth-child(2) { transition-delay: 0.2s; }
.stagger-animation:nth-child(3) { transition-delay: 0.3s; }
.stagger-animation:nth-child(4) { transition-delay: 0.4s; }
.stagger-animation:nth-child(5) { transition-delay: 0.5s; }
.stagger-animation:nth-child(6) { transition-delay: 0.6s; }

/* Hover effects */
.hover-lift {
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hover-lift:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.hover-glow {
  transition: all 0.3s ease;
  position: relative;
}

.hover-glow::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, #667eea, #764ba2, #667eea);
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
  animation: gradientRotate 3s linear infinite;
}

.hover-glow:hover::before {
  opacity: 1;
}

.hover-scale {
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* Particle system */
.particles-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.8) 0%, transparent 70%);
  border-radius: 50%;
  animation: particleFloat 6s ease-in-out infinite;
}

.particle:nth-child(odd) {
  animation: particlePulse 4s ease-in-out infinite;
}

.particle:nth-child(1) { 
  top: 20%; 
  left: 10%; 
  animation-delay: 0s; 
  animation-duration: 8s;
}

.particle:nth-child(2) { 
  top: 60%; 
  left: 20%; 
  animation-delay: 1s; 
  animation-duration: 6s;
}

.particle:nth-child(3) { 
  top: 40%; 
  left: 80%; 
  animation-delay: 2s; 
  animation-duration: 7s;
}

.particle:nth-child(4) { 
  top: 80%; 
  left: 70%; 
  animation-delay: 3s; 
  animation-duration: 5s;
}

.particle:nth-child(5) { 
  top: 30%; 
  left: 50%; 
  animation-delay: 4s; 
  animation-duration: 9s;
}

/* Morphing background */
.morphing-bg {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, 
    rgba(102, 126, 234, 0.1) 0%, 
    rgba(118, 75, 162, 0.1) 25%, 
    rgba(102, 126, 234, 0.1) 50%, 
    rgba(118, 75, 162, 0.1) 75%, 
    rgba(102, 126, 234, 0.1) 100%);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  border-radius: 50%;
  animation: morphShape 20s ease-in-out infinite;
}

/* Loading states */
.loading-skeleton {
  background: linear-gradient(90deg, 
    rgba(255, 255, 255, 0.1) 25%, 
    rgba(255, 255, 255, 0.3) 50%, 
    rgba(255, 255, 255, 0.1) 75%);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

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

/* Advanced 3D transforms */
.card-3d {
  transform-style: preserve-3d;
  perspective: 1000px;
  transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.card-3d::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: inherit;
  transform: translateZ(-1px);
  filter: blur(10px);
  opacity: 0.3;
  transition: all 0.6s ease;
}

.card-3d:hover::before {
  transform: translateZ(-20px);
  opacity: 0.6;
}

/* Text reveal animations */
.text-reveal {
  overflow: hidden;
  position: relative;
}

.text-reveal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, white, transparent);
  transform: translateX(-100%);
  animation: textReveal 2s ease-out;
}

@keyframes textReveal {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Magnetic hover effect */
.magnetic {
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.magnetic:hover {
  transform: translate(var(--mouse-x, 0), var(--mouse-y, 0)) scale(1.05);
}

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

.ripple::before {
  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:hover::before {
  width: 300px;
  height: 300px;
}

/* Parallax scrolling */
.parallax {
  transform: translateZ(0);
  transition: transform 0.1s ease-out;
}

.parallax-slow {
  transform: translate3d(0, var(--scroll-y, 0), 0);
}

.parallax-fast {
  transform: translate3d(0, calc(var(--scroll-y, 0) * 1.5), 0);
}

/* Reduced motion preferences */
@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;
  }
  
  .parallax,
  .parallax-slow,
  .parallax-fast {
    transform: none !important;
  }
  
  .morphing-bg {
    animation: none !important;
  }
  
  .particle {
    animation: none !important;
    opacity: 0.3 !important;
  }
}

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

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

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

/* Custom easing functions */
.ease-out-expo {
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

.ease-out-back {
  transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ease-out-elastic {
  transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}