/* ============================================
   A WHOLE NEW BEAST - Animations & Effects
   ============================================ */

/* --- Glitch Text Effect --- */
.glitch {
  position: relative;
  display: inline-block;
}

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

.glitch::before {
  animation: glitch-1 3s infinite linear alternate-reverse;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
  color: var(--accent-cyan);
}

.glitch::after {
  animation: glitch-2 3s infinite linear alternate-reverse;
  clip-path: polygon(0 60%, 100% 60%, 100% 100%, 0 100%);
  color: var(--accent-crimson);
}

@keyframes glitch-1 {
  0%, 90%, 100% { transform: translate(0); }
  91% { transform: translate(-2px, 1px); }
  93% { transform: translate(2px, -1px); }
  95% { transform: translate(-1px, 2px); }
  97% { transform: translate(1px, -2px); }
}

@keyframes glitch-2 {
  0%, 90%, 100% { transform: translate(0); }
  92% { transform: translate(2px, 1px); }
  94% { transform: translate(-2px, -1px); }
  96% { transform: translate(1px, 2px); }
  98% { transform: translate(-1px, -2px); }
}

/* --- Pulse Glow --- */
.pulse-glow {
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(0, 240, 255, 0.3); }
  50% { box-shadow: 0 0 25px rgba(0, 240, 255, 0.6), 0 0 50px rgba(0, 240, 255, 0.3); }
}

.pulse-glow--crimson {
  animation: pulse-glow-crimson 2s ease-in-out infinite;
}

@keyframes pulse-glow-crimson {
  0%, 100% { box-shadow: 0 0 5px rgba(255, 45, 45, 0.3); }
  50% { box-shadow: 0 0 25px rgba(255, 45, 45, 0.6), 0 0 50px rgba(255, 45, 45, 0.3); }
}

.pulse-glow--amber {
  animation: pulse-glow-amber 2s ease-in-out infinite;
}

@keyframes pulse-glow-amber {
  0%, 100% { box-shadow: 0 0 5px rgba(255, 170, 0, 0.3); }
  50% { box-shadow: 0 0 25px rgba(255, 170, 0, 0.6), 0 0 50px rgba(255, 170, 0, 0.3); }
}

/* --- Scan Line Effect --- */
.scanlines {
  position: relative;
  overflow: hidden;
}

.scanlines::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15),
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 2px
  );
  z-index: 1;
}

/* --- Flicker Effect --- */
.flicker {
  animation: flicker 4s infinite;
}

@keyframes flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
    opacity: 1;
    text-shadow: 0 0 10px var(--accent-cyan);
  }
  20%, 24%, 55% {
    opacity: 0.6;
    text-shadow: none;
  }
}

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

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

/* --- Slide In Animations --- */
.slide-in-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.slide-in-right {
  opacity: 0;
  transform: translateX(50px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.slide-in-up {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.fade-in {
  opacity: 0;
  transition: opacity 0.8s ease;
}

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

/* --- Stagger Delay Utilities --- */
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }
.delay-5 { transition-delay: 0.5s; }

/* --- Electric Crackling Effect --- */
.electric-border {
  position: relative;
}

.electric-border::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(
    45deg,
    var(--accent-cyan),
    transparent,
    var(--accent-crimson),
    transparent,
    var(--accent-amber)
  );
  background-size: 400% 400%;
  z-index: -1;
  animation: electric-flow 3s ease infinite;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.electric-border:hover::before {
  opacity: 1;
}

@keyframes electric-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* --- Sound Wave Animation --- */
.sound-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 30px;
}

.sound-wave__bar {
  width: 4px;
  background: var(--accent-cyan);
  animation: sound-wave 1s ease-in-out infinite;
}

.sound-wave__bar:nth-child(1) { height: 40%; animation-delay: 0s; }
.sound-wave__bar:nth-child(2) { height: 70%; animation-delay: 0.1s; }
.sound-wave__bar:nth-child(3) { height: 100%; animation-delay: 0.2s; }
.sound-wave__bar:nth-child(4) { height: 60%; animation-delay: 0.3s; }
.sound-wave__bar:nth-child(5) { height: 80%; animation-delay: 0.4s; }

@keyframes sound-wave {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.5); }
}

/* --- Typing Effect --- */
.typing {
  overflow: hidden;
  border-right: 2px solid var(--accent-cyan);
  white-space: nowrap;
  animation: typing 3s steps(40) forwards, blink 0.75s step-end infinite;
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink {
  50% { border-color: transparent; }
}

/* --- Parallax Layer --- */
.parallax {
  position: relative;
  overflow: hidden;
}

.parallax__layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 120%;
  will-change: transform;
}

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

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

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

.text-glow:hover {
  text-shadow: 0 0 10px currentColor, 0 0 20px currentColor;
}

/* --- Reveal on Scroll --- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* --- Spinner Loading --- */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay--hidden {
  opacity: 0;
  visibility: hidden;
}

.loader {
  width: 60px;
  height: 60px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* --- Starfield Background --- */
.starfield {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -1;
}

.starfield__star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: #fff;
  border-radius: 50%;
  animation: twinkle var(--duration) ease-in-out infinite;
  opacity: 0;
}

@keyframes twinkle {
  0%, 100% { opacity: 0; }
  50% { opacity: var(--max-opacity, 0.8); }
}

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

/* --- Hero Logo Glitch Effect --- */
.hero__logo {
  opacity: 0.85;
  filter: drop-shadow(0 0 30px rgba(0, 240, 255, 0.5)) drop-shadow(0 0 60px rgba(0, 240, 255, 0.3));
  animation: logo-pulse 4s ease-in-out infinite;
  display: block;
  margin: 0 auto;
}

.hero__logo--glitch {
  animation: logo-pulse 4s ease-in-out infinite, logo-glitch 5s ease-in-out infinite;
}

@keyframes logo-pulse {
  0%, 100% {
    filter: drop-shadow(0 0 30px rgba(0, 240, 255, 0.5)) drop-shadow(0 0 60px rgba(0, 240, 255, 0.3));
  }
  50% {
    filter: drop-shadow(0 0 50px rgba(0, 240, 255, 0.8)) drop-shadow(0 0 100px rgba(0, 240, 255, 0.5)) drop-shadow(0 0 150px rgba(255, 45, 45, 0.3));
  }
}

@keyframes logo-glitch {
  0%, 89%, 100% {
    transform: scale(1) skew(0deg);
    opacity: 0.85;
  }
  90% {
    transform: scale(1.02) skew(-2deg);
    opacity: 1;
    filter: drop-shadow(0 0 50px rgba(255, 45, 45, 0.8)) hue-rotate(90deg);
  }
  91% {
    transform: scale(0.98) skew(2deg);
    opacity: 0.7;
    filter: drop-shadow(0 0 50px rgba(0, 240, 255, 0.8)) hue-rotate(-90deg);
  }
  92% {
    transform: scale(1.01) skew(-1deg);
    opacity: 1;
    filter: drop-shadow(0 0 60px rgba(255, 170, 0, 0.8)) hue-rotate(45deg);
  }
  93% {
    transform: scale(1) skew(0deg);
    opacity: 0.85;
  }
}

/* --- Shooting Stars --- */
.shooting-star {
  position: fixed;
  width: 100px;
  height: 2px;
  background: linear-gradient(90deg, rgba(0, 240, 255, 0), rgba(0, 240, 255, 1), rgba(255, 255, 255, 1));
  border-radius: 2px;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  animation: shoot 1s ease-out forwards;
}

.shooting-star::after {
  content: '';
  position: absolute;
  right: 0;
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 10px 2px rgba(0, 240, 255, 0.8), 0 0 20px 4px rgba(0, 240, 255, 0.5);
  top: -2px;
}

@keyframes shoot {
  0% {
    opacity: 1;
    transform: translateX(0) translateY(0) rotate(-35deg);
  }
  100% {
    opacity: 0;
    transform: translateX(400px) translateY(200px) rotate(-35deg);
  }
}

/* --- Alien Tractor Beam Cursor --- */
.alien-cursor {
  position: fixed;
  width: 40px;
  height: 40px;
  border: 2px solid rgba(0, 240, 255, 0.6);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  transition: transform 0.1s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  transform: translate(-50%, -50%);
  mix-blend-mode: screen;
}

.alien-cursor::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  background: var(--accent-cyan);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px var(--accent-cyan), 0 0 20px var(--accent-cyan);
  animation: cursor-pulse 1.5s ease-in-out infinite;
}

.alien-cursor::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80px;
  height: 80px;
  border: 1px solid rgba(0, 240, 255, 0.15);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: cursor-ring 2s linear infinite;
}

.alien-cursor--hover {
  transform: translate(-50%, -50%) scale(1.5);
  border-color: var(--accent-crimson);
  box-shadow: 0 0 30px rgba(255, 45, 45, 0.5), inset 0 0 20px rgba(255, 45, 45, 0.2);
}

.alien-cursor--hover::before {
  background: var(--accent-crimson);
  box-shadow: 0 0 15px var(--accent-crimson), 0 0 30px var(--accent-crimson);
}

@keyframes cursor-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(1.3); opacity: 0.7; }
}

@keyframes cursor-ring {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* --- Star Twinkle Enhancement --- */
.starfield__star--bright {
  width: 3px;
  height: 3px;
  box-shadow: 0 0 6px 1px rgba(0, 240, 255, 0.6);
}

.starfield__star--colored {
  background: var(--accent-cyan);
}

/* --- Floating Particles --- */
.particle {
  position: fixed;
  width: 4px;
  height: 4px;
  background: var(--accent-cyan);
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  opacity: 0;
  animation: float-particle 8s ease-in-out infinite;
}

@keyframes float-particle {
  0% { opacity: 0; transform: translateY(100vh) scale(0); }
  10% { opacity: 0.6; }
  90% { opacity: 0.6; }
  100% { opacity: 0; transform: translateY(-100px) scale(1); }
}

/* --- Page Transition --- */
.page-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  z-index: 9998;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.page-transition--active {
  opacity: 1;
}

/* --- Hover Glow Effect --- */
.hover-glow {
  transition: all 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.4), 0 0 40px rgba(0, 240, 255, 0.2);
  transform: translateY(-2px);
}

/* --- Text Reveal Animation --- */
.text-reveal {
  overflow: hidden;
}

.text-reveal__inner {
  animation: text-reveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transform: translateY(100%);
}

@keyframes text-reveal {
  to { transform: translateY(0); }
}

/* --- Nav Link Hover Effect --- */
.nav__link {
  position: relative;
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-cyan);
  transition: width 0.3s ease;
  box-shadow: 0 0 10px var(--accent-cyan);
}

.nav__link:hover::after {
  width: 100%;
}

/* --- Supernova Click Explosion --- */
@keyframes supernova-flash {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(8); opacity: 0.8; }
  100% { transform: translate(-50%, -50%) scale(15); opacity: 0; }
}

@keyframes supernova-ring {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(25); opacity: 0; }
}
