.scan-lines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: var(--z-effects);
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15) 0px,
    rgba(0, 0, 0, 0) 1px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.15) 3px
  );
  animation: scanLineScroll 8s linear infinite;
  opacity: var(--scan-line-opacity);
}

.crt-vignette {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: var(--z-effects);
  background: radial-gradient(
    ellipse at center,
    transparent 0%,
    transparent 60%,
    rgba(0, 0, 0, 0.3) 100%
  );
  opacity: var(--vignette-opacity);
}

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

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

.glitch::before {
  color: var(--color-primary);
  text-shadow: 2px 0 var(--color-primary);
  animation: glitchBefore 3s infinite;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}

.glitch::after {
  color: var(--color-secondary);
  text-shadow: -2px 0 var(--color-secondary);
  animation: glitchAfter 2s infinite;
  clip-path: polygon(0 60%, 100% 60%, 100% 100%, 0 100%);
}

.glitch.active::before,
.glitch.active::after {
  opacity: 0.8;
}

a.glitch-hover:hover::before,
a.glitch-hover:hover::after {
  opacity: 0.8;
}

.ascii-banner {
  position: relative;
  animation: asciiGlitch 3s infinite;
}

@keyframes asciiGlitch {
  0%, 94% {
    text-shadow: none;
    transform: translate(0);
  }
  95% {
    text-shadow:
      2px 0 0 var(--color-primary),
      -2px 0 0 var(--color-secondary);
    transform: translate(-2px, 1px);
  }
  96% {
    text-shadow:
      -2px 0 0 var(--color-primary),
      2px 0 0 var(--color-secondary);
    transform: translate(2px, -1px);
  }
  97% {
    text-shadow:
      2px 0 0 var(--color-primary),
      -2px 0 0 var(--color-secondary);
    transform: translate(-1px, -1px);
  }
  98%, 100% {
    text-shadow: none;
    transform: translate(0);
  }
}

.glow-text {
  text-shadow: var(--glow-cyan);
}

.glow-text-strong {
  text-shadow: var(--glow-cyan-strong);
}

.glow-magenta {
  text-shadow: var(--glow-magenta);
}

.glow-green {
  text-shadow: var(--glow-green);
}

a.chromatic {
  position: relative;
  transition: all var(--duration-normal) ease;
}

a.chromatic:hover {
  animation: chromaticShift 0.3s ease;
}

.screen-flicker {
  animation: flicker 0.15s ease-in-out;
}

.border-glow {
  box-shadow: var(--glow-cyan);
  transition: box-shadow var(--duration-normal) ease;
}

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

.neon-border {
  border: 1px solid var(--color-primary);
  box-shadow:
    0 0 5px rgba(0, 240, 255, 0.5),
    inset 0 0 5px rgba(0, 240, 255, 0.2);
}

.noise-overlay {
  position: relative;
  overflow: hidden;
}

.noise-overlay::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="4" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noise)" opacity="0.05"/></svg>');
  pointer-events: none;
  opacity: 0.3;
  animation: noiseMove 8s steps(10) infinite;
}

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

.matrix-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.02;
  background-image:
    linear-gradient(transparent 50%, rgba(0, 255, 65, 0.5) 50%);
  background-size: 2px 4px;
  animation: matrixRain 20s linear infinite;
}

.hologram {
  position: relative;
  animation: hologramFlicker 0.1s infinite;
}

.hologram::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 240, 255, 0.1),
    transparent
  );
  animation: hologramScan 3s linear infinite;
}

.scanline-hover {
  position: relative;
  overflow: hidden;
}

.scanline-hover::after {
  content: '';
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(
    to bottom,
    transparent,
    var(--color-primary),
    transparent
  );
  opacity: 0;
  transition: opacity var(--duration-fast) ease;
}

.scanline-hover:hover::after {
  opacity: 0.8;
  animation: scanlineSlide 1s linear infinite;
}

@media (max-width: 768px) {
  .scan-lines {
    opacity: calc(var(--scan-line-opacity) * 0.5);
  }

  .crt-vignette {
    opacity: calc(var(--vignette-opacity) * 0.7);
  }

  .glitch::before,
  .glitch::after {
    display: none;
  }

  .noise-overlay::after {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scan-lines,
  .crt-vignette,
  .glitch::before,
  .glitch::after,
  .noise-overlay::after,
  .matrix-bg {
    animation: none;
    opacity: 0;
  }

  .glow-text,
  .glow-text-strong {
    text-shadow: none;
  }
}
