/* ===== ANIMATIONS ===== */

/* Glitch Effect for Title */
.glitch {
  position: relative;
  display: inline-block;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  clip-path: inset(0 0 0 0);
  animation: glitch-anim 3s infinite linear alternate-reverse;
}

.glitch::before {
  left: 2px;
  text-shadow: -2px 0 var(--brand-accent);
  animation: glitch-anim-1 2s infinite linear alternate-reverse;
}

.glitch::after {
  left: -2px;
  text-shadow: 2px 0 var(--brand-secondary);
  animation: glitch-anim-2 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
  0% { clip-path: inset(40% 0 61% 0); }
  20% { clip-path: inset(92% 0 1% 0); }
  40% { clip-path: inset(43% 0 1% 0); }
  60% { clip-path: inset(25% 0 58% 0); }
  80% { clip-path: inset(54% 0 7% 0); }
  100% { clip-path: inset(58% 0 43% 0); }
}

@keyframes glitch-anim-1 {
  0% { clip-path: inset(80% 0 0 0); }
  20% { clip-path: inset(10% 0 85% 0); }
  40% { clip-path: inset(43% 0 1% 0); }
  60% { clip-path: inset(25% 0 58% 0); }
  80% { clip-path: inset(54% 0 7% 0); }
  100% { clip-path: inset(58% 0 43% 0); }
}

@keyframes glitch-anim-2 {
  0% { clip-path: inset(65% 0 0 0); }
  20% { clip-path: inset(10% 0 85% 0); }
  40% { clip-path: inset(43% 0 1% 0); }
  60% { clip-path: inset(25% 0 58% 0); }
  80% { clip-path: inset(54% 0 7% 0); }
  100% { clip-path: inset(58% 0 43% 0); }
}

/* Particle System */
.hero-particles::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(2px 2px at 20px 30px, var(--brand-primary), transparent),
    radial-gradient(2px 2px at 40px 70px, var(--brand-secondary), transparent),
    radial-gradient(1px 1px at 90px 40px, var(--brand-accent), transparent),
    radial-gradient(1px 1px at 130px 80px, var(--brand-primary), transparent),
    radial-gradient(2px 2px at 160px 30px, var(--brand-secondary), transparent);
  background-repeat: repeat;
  background-size: 200px 100px;
  animation: particle-float 20s linear infinite;
  opacity: 0.6;
}

@keyframes particle-float {
  0% { transform: translateY(0px); }
  100% { transform: translateY(-100px); }
}

/* Floating Elements */
.floating {
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

/* Pulse Animation */
.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Shake Animation */
.shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Bounce Animation */
.bounce {
  animation: bounce 1s infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

/* Rotate Animation */
.rotate {
  animation: rotate 2s linear infinite;
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Fade In Animation */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeIn 0.8s ease-out forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide In Animations */
.slide-in {
  opacity: 0;
  transform: translateY(24px);
  animation: slideInOverlay 0.5s ease-out forwards;
}

@keyframes slideInOverlay {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.slide-in-left {
  opacity: 0;
  transform: translateX(-50px);
  animation: slideInLeft 0.8s ease-out forwards;
}

.slide-in-right {
  opacity: 0;
  transform: translateX(50px);
  animation: slideInRight 0.8s ease-out forwards;
}

.slide-in-up {
  opacity: 0;
  transform: translateY(50px);
  animation: slideInUp 0.8s ease-out forwards;
}

@keyframes slideInLeft {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scale In Animation */
.scale-in {
  opacity: 0;
  transform: scale(0.8);
  animation: scaleIn 0.6s ease-out forwards;
}

@keyframes scaleIn {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Typing Effect */
.typing {
  overflow: hidden;
  border-right: 2px solid var(--brand-primary);
  white-space: nowrap;
  animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--brand-primary); }
}

/* Hover Effects */
.hover-lift {
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.hover-lift:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
}

.hover-scale {
  transition: transform var(--transition-normal);
}

.hover-scale:hover {
  transform: scale(1.05);
}

.hover-rotate {
  transition: transform var(--transition-normal);
}

.hover-rotate:hover {
  transform: rotate(5deg);
}

.hover-glow {
  transition: box-shadow var(--transition-normal);
}

.hover-glow:hover {
  box-shadow: 0 0 30px rgba(255, 216, 1, 0.5);
}

/* Button Animations */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width var(--transition-normal), height var(--transition-normal);
}

.btn:hover::after {
  width: 300px;
  height: 300px;
}

/* Card Hover Effects */
.card {
  transition: all var(--transition-normal);
}

.card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-lg);
}

/* Navigation Link Hover */
.nav-link {
  position: relative;
  transition: all var(--transition-fast);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--brand-primary);
  transition: width var(--transition-normal), left var(--transition-normal);
  transform: translateX(-50%);
}

.nav-link:hover::after {
  width: 100%;
}

/* Loading Animations */
.loading-dots {
  display: inline-block;
}

.loading-dots::after {
  content: '';
  animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* Progress Bar Animation */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
  border-radius: 2px;
  animation: progress-fill 2s ease-out forwards;
}

@keyframes progress-fill {
  from { width: 0%; }
  to { width: 100%; }
}

/* Counter Animation */
.counter {
  display: inline-block;
  animation: count-up 2s ease-out forwards;
}

@keyframes count-up {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Parallax Effect */
.parallax {
  transform: translateZ(0);
  will-change: transform;
}

/* Stagger Animation for Lists */
.stagger-item {
  opacity: 0;
  transform: translateY(20px);
  animation: stagger-in 0.6s ease-out forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.1s; }
.stagger-item:nth-child(2) { animation-delay: 0.2s; }
.stagger-item:nth-child(3) { animation-delay: 0.3s; }
.stagger-item:nth-child(4) { animation-delay: 0.4s; }
.stagger-item:nth-child(5) { animation-delay: 0.5s; }

@keyframes stagger-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Morphing Shapes */
.morph {
  animation: morph 8s ease-in-out infinite;
}

@keyframes morph {
  0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  50% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
}

/* Neon Glow */
.neon-glow {
  animation: neon-glow 2s ease-in-out infinite alternate;
}

@keyframes neon-glow {
  from { box-shadow: 0 0 20px var(--brand-primary); }
  to { box-shadow: 0 0 30px var(--brand-primary), 0 0 40px var(--brand-primary); }
}

/* Text Reveal */
.text-reveal {
  overflow: hidden;
  position: relative;
}

.text-reveal::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  animation: text-reveal 1.5s ease-out forwards;
}

@keyframes text-reveal {
  0% { transform: translateX(0); }
  100% { transform: translateX(100%); }
}

/* Section Transitions */
.section {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
}

.section.active,
.section.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Ensure sections are visible when they have content */
.section:not(:empty) {
  min-height: 100px;
}

/* Intersection Observer Animations */
.fade-in-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: all var(--transition-normal);
}

.fade-in-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

.slide-in-on-scroll {
  opacity: 0;
  transform: translateX(-50px);
  transition: all var(--transition-normal);
}

.slide-in-on-scroll.visible {
  opacity: 1;
  transform: translateX(0);
}

.scale-in-on-scroll {
  opacity: 0;
  transform: scale(0.8);
  transition: all var(--transition-normal);
}

.scale-in-on-scroll.visible {
  opacity: 1;
  transform: scale(1);
}

/* Hover State Animations */
.hover-state {
  transition: all var(--transition-normal);
}

.hover-state:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Focus Animations */
.focus-ring {
  transition: box-shadow var(--transition-fast);
}

.focus-ring:focus {
  box-shadow: 0 0 0 3px rgba(255, 216, 1, 0.3);
}

/* Active State Animations */
.active-state {
  transition: all var(--transition-fast);
}

.active-state:active {
  transform: scale(0.95);
}

/* Disabled State */
.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Loading States */
.loading {
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid transparent;
  border-top: 2px solid var(--brand-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Success Animation */
.success {
  animation: success-pulse 0.6s ease-out;
}

@keyframes success-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* Error Animation */
.error {
  animation: error-shake 0.6s ease-out;
}

@keyframes error-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Attention Animation */
.attention {
  animation: attention-bounce 1s ease-out infinite;
}

@keyframes attention-bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

/* Smooth Scrolling: defer to base.css setting to avoid conflicts */

/* Reduced Motion Support */
@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;
  }
  
  .glitch::before,
  .glitch::after {
    animation: none;
  }
  
  .hero-particles::before {
    animation: none;
  }
  
  .hero-grid {
    animation: none;
  }
}
