/* ============================================
   COMBAT ROBOTICS TEAM - ANIMATIONS
   Keyframes, transitions, and effects
   ============================================ */

/* ============================================
   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);
  }
}

@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);
  }
}

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

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

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(239, 68, 68, 0.5);
  }
  50% {
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.8), 0 0 50px rgba(239, 68, 68, 0.4);
  }
}

@keyframes pulseRing {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

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

@keyframes floatSlow {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(1deg); }
}

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

@keyframes rotateSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

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

@keyframes glitchText {
  0%, 100% {
    text-shadow: 
      -2px 0 #ff0000,
      2px 0 #00ffff;
  }
  25% {
    text-shadow: 
      2px 0 #ff0000,
      -2px 0 #00ffff;
  }
  50% {
    text-shadow: 
      -2px 2px #ff0000,
      2px -2px #00ffff;
  }
  75% {
    text-shadow: 
      2px -2px #ff0000,
      -2px 2px #00ffff;
  }
}

@keyframes glitchSlice {
  0%, 100% {
    clip-path: inset(0 0 0 0);
  }
  25% {
    clip-path: inset(10% 0 60% 0);
  }
  50% {
    clip-path: inset(40% 0 20% 0);
  }
  75% {
    clip-path: inset(70% 0 5% 0);
  }
}

/* Scanline Effect */
@keyframes scanline {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

/* Noise/Static Effect */
@keyframes noise {
  0%, 100% { background-position: 0 0; }
  10% { background-position: -5% -10%; }
  20% { background-position: -15% 5%; }
  30% { background-position: 7% -25%; }
  40% { background-position: -5% 25%; }
  50% { background-position: -15% 10%; }
  60% { background-position: 15% 0; }
  70% { background-position: 0 15%; }
  80% { background-position: 3% 35%; }
  90% { background-position: -10% 10%; }
}

/* Progress Bar Fill */
@keyframes progressFill {
  from { width: 0; }
  to { width: var(--progress-value, 100%); }
}

/* Typing Effect */
@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blinkCursor {
  0%, 100% { border-color: transparent; }
  50% { border-color: var(--color-red); }
}

/* Wave Animation */
@keyframes wave {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.5); }
}

/* Bounce Animation */
@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(-25%);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

/* Shake Animation */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

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

/* Border Glow */
@keyframes borderGlow {
  0%, 100% {
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.1);
  }
  50% {
    border-color: rgba(239, 68, 68, 0.8);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
  }
}

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

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

/* Base Animation Utilities */
.animate-fadeIn { animation: fadeIn 0.5s ease forwards; }
.animate-fadeInUp { animation: fadeInUp 0.6s ease forwards; }
.animate-fadeInDown { animation: fadeInDown 0.6s ease forwards; }
.animate-fadeInLeft { animation: fadeInLeft 0.6s ease forwards; }
.animate-fadeInRight { animation: fadeInRight 0.6s ease forwards; }
.animate-scaleIn { animation: scaleIn 0.5s ease forwards; }
.animate-pulse { animation: pulse 2s ease infinite; }
.animate-pulseGlow { animation: pulseGlow 2s ease infinite; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-floatSlow { animation: floatSlow 6s ease-in-out infinite; }
.animate-rotate { animation: rotate 20s linear infinite; }
.animate-bounce { animation: bounce 1s ease infinite; }

/* Glitch Effects */
.glitch-effect {
  position: relative;
}

.glitch-effect:hover {
  animation: glitch 0.3s ease;
}

.glitch-text {
  position: relative;
  display: inline-block;
}

.glitch-text:hover {
  animation: glitchText 0.3s ease;
}

.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
}

.glitch-text:hover::before {
  animation: glitchSlice 0.3s ease;
  color: #ff0000;
  left: 2px;
  opacity: 0.8;
}

.glitch-text:hover::after {
  animation: glitchSlice 0.3s ease reverse;
  color: #00ffff;
  left: -2px;
  opacity: 0.8;
}

/* Scanline Overlay */
.scanlines::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.1) 0px,
    rgba(0, 0, 0, 0.1) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 10;
}

.scanline-moving::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(239, 68, 68, 0.05) 50%,
    transparent 100%
  );
  animation: scanline 4s linear infinite;
  pointer-events: none;
  z-index: 10;
}

/* Noise Overlay */
.noise-overlay::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 5;
}

/* Gradient Border Animation */
.gradient-border {
  position: relative;
  background: var(--color-black);
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(45deg, var(--color-red), transparent, var(--color-red));
  background-size: 200% 200%;
  border-radius: inherit;
  z-index: -1;
  animation: gradientFlow 3s ease infinite;
}

/* Shimmer Loading */
.shimmer {
  background: linear-gradient(
    90deg,
    var(--color-charcoal) 0%,
    var(--color-charcoal-light) 50%,
    var(--color-charcoal) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

/* ============================================
   SCROLL REVEAL ANIMATIONS
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(50px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Staggered reveal children */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.reveal-stagger.revealed > * {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   HOVER EFFECTS
   ============================================ */

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

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

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

.hover-glow:hover {
  box-shadow: var(--shadow-glow);
}

/* Hover Scale */
.hover-scale {
  transition: transform var(--transition-base);
}

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

/* Hover Brightness */
.hover-bright {
  transition: filter var(--transition-base);
}

.hover-bright:hover {
  filter: brightness(1.2);
}

/* Hover Border Glow */
.hover-border-glow {
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.hover-border-glow:hover {
  border-color: var(--color-red);
  box-shadow: var(--shadow-glow);
}

/* Hover Text Glow */
.hover-text-glow:hover {
  text-shadow: 0 0 10px var(--color-red-glow);
}

/* Pulse Ring Effect */
.pulse-ring {
  position: relative;
}

.pulse-ring::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--color-red);
  border-radius: inherit;
  animation: pulseRing 1.5s ease-out infinite;
}

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

/* Skeleton Loader */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-charcoal) 25%,
    var(--color-charcoal-light) 50%,
    var(--color-charcoal) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

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

.skeleton-title {
  height: 2em;
  width: 60%;
}

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

/* Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-charcoal);
  border-top-color: var(--color-red);
  border-radius: 50%;
  animation: rotate 1s linear infinite;
}

/* ============================================
   PARALLAX EFFECTS
   ============================================ */
.parallax-wrapper {
  overflow: hidden;
  position: relative;
}

.parallax-layer {
  position: absolute;
  inset: -20%;
  will-change: transform;
}

.parallax-slow {
  transform: translateY(calc(var(--scroll) * 0.3));
}

.parallax-medium {
  transform: translateY(calc(var(--scroll) * 0.5));
}

.parallax-fast {
  transform: translateY(calc(var(--scroll) * 0.7));
}

/* ============================================
   COUNTER ANIMATION
   ============================================ */
.counter-animated {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* ============================================
   TYPING EFFECT
   ============================================ */
.typing-effect {
  overflow: hidden;
  white-space: nowrap;
  animation: typing 3s steps(30, end) forwards;
}

.typing-cursor {
  border-right: 3px solid var(--color-red);
  animation: blinkCursor 0.75s step-end infinite;
}

/* ============================================
   PARTICLE CONTAINER STYLES
   ============================================ */
#particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale {
    opacity: 1;
    transform: none;
  }
  
  .parallax-layer {
    transform: none !important;
  }
}
