/* ═══════════════════════════════════════════════════════════
   MATRIX ELECTRIC INTERFERENCE BACKGROUND
   ═══════════════════════════════════════════════════════════ */

/* Matrix Background Container */
.matrix-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #050505;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  padding: 15px;
}

/* Matrix Column - clean glowing numbers */
.matrix-column {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.3;
  color: #00ff41;
  text-shadow: 0 0 8px #00ff41, 0 0 20px rgba(0, 255, 65, 0.5);
  white-space: pre;
  animation: matrix-fall linear infinite;
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 2px;
  flex: 1;
  min-width: 0;
  text-align: center;
  opacity: 0.9;
}

/* Falling animation */
@keyframes matrix-fall {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

/* Stagger animations */
.matrix-column:nth-child(odd) { animation-duration: 15s; }
.matrix-column:nth-child(even) { animation-duration: 20s; }
.matrix-column:nth-child(3n) { animation-duration: 12s; }
.matrix-column:nth-child(5n) { animation-duration: 18s; }
.matrix-column:nth-child(7n) { animation-duration: 25s; }
.matrix-column:nth-child(4n) { animation-delay: -5s; }
.matrix-column:nth-child(6n) { animation-delay: -10s; }
.matrix-column:nth-child(8n) { animation-delay: -15s; }

/* Dark overlay - reveals around cursor */
.matrix-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: rgba(5, 5, 5, 0.96);
  pointer-events: none;
  -webkit-mask-image: radial-gradient(
    ellipse var(--mask-width, 100px) var(--mask-height, 80px) at var(--mouse-x, -200px) var(--mouse-y, -200px),
    transparent 0%,
    transparent 60%,
    black 100%
  );
  mask-image: radial-gradient(
    ellipse var(--mask-width, 100px) var(--mask-height, 80px) at var(--mouse-x, -200px) var(--mouse-y, -200px),
    transparent 0%,
    transparent 60%,
    black 100%
  );
}

/* Effects container */
.ripple-container {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════
   ELECTRIC CRACKLE & SPARK EFFECTS
   ═══════════════════════════════════════════════════════════ */

/* Electric arc / lightning bolt */
.electric-arc {
  position: absolute;
  width: 2px;
  height: 30px;
  background: linear-gradient(180deg, #00ff41, #fff, #00ff41);
  transform-origin: top center;
  animation: arc-flash 0.15s ease-out forwards;
  box-shadow: 
    0 0 4px #00ff41,
    0 0 8px #00ff41,
    0 0 16px rgba(0, 255, 65, 0.8),
    0 0 32px rgba(0, 255, 65, 0.4);
  filter: blur(0.5px);
}

.electric-arc::before,
.electric-arc::after {
  content: '';
  position: absolute;
  width: 2px;
  height: 15px;
  background: linear-gradient(180deg, #00ff41, transparent);
  box-shadow: 0 0 6px #00ff41;
}

.electric-arc::before {
  top: 30%;
  left: -8px;
  transform: rotate(-30deg);
}

.electric-arc::after {
  top: 50%;
  right: -8px;
  transform: rotate(25deg);
}

@keyframes arc-flash {
  0% { opacity: 1; transform: scaleY(0.3); }
  20% { opacity: 1; transform: scaleY(1); }
  100% { opacity: 0; transform: scaleY(1.2); }
}

/* Bright spark point */
.spark-point {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #fff;
  border-radius: 50%;
  animation: spark-burst 0.3s ease-out forwards;
  box-shadow: 
    0 0 2px #fff,
    0 0 6px #00ff41,
    0 0 12px #00ff41,
    0 0 24px rgba(0, 255, 65, 0.6);
}

@keyframes spark-burst {
  0% { 
    opacity: 1; 
    transform: translate(-50%, -50%) scale(2);
  }
  50% { 
    opacity: 0.8; 
    transform: translate(-50%, -50%) scale(1);
  }
  100% { 
    opacity: 0; 
    transform: translate(-50%, -50%) scale(0);
  }
}

/* Flying spark particles */
.crackle-spark {
  position: absolute;
  width: 3px;
  height: 3px;
  background: #fff;
  box-shadow: 
    0 0 2px #fff,
    0 0 6px #00ff41,
    0 0 10px #00ff41;
  border-radius: 50%;
  animation: spark-fly 0.4s ease-out forwards;
}

@keyframes spark-fly {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--spark-x, 40px), var(--spark-y, -40px)) scale(0.2);
  }
}

/* Static noise burst */
.static-noise {
  position: absolute;
  width: 100px;
  height: 100px;
  transform: translate(-50%, -50%);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' 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;
  mix-blend-mode: overlay;
  animation: static-flash 0.2s steps(3) forwards;
  border-radius: 50%;
}

@keyframes static-flash {
  0% { opacity: 0.4; transform: translate(-50%, -50%) scale(0.5); }
  50% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); }
}

/* Screen crack / break effect */
.screen-crack {
  position: absolute;
  width: 150px;
  height: 150px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: crack-appear 0.5s ease-out forwards;
}

.screen-crack::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    linear-gradient(45deg, transparent 48%, rgba(0,255,65,0.3) 49%, rgba(0,255,65,0.3) 51%, transparent 52%),
    linear-gradient(-45deg, transparent 48%, rgba(0,255,65,0.2) 49%, rgba(0,255,65,0.2) 51%, transparent 52%),
    linear-gradient(90deg, transparent 48%, rgba(0,255,65,0.15) 49%, rgba(0,255,65,0.15) 51%, transparent 52%);
  filter: blur(0.5px);
}

@keyframes crack-appear {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.3); }
  30% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.2); }
}

/* Glitch line */
.glitch-line {
  position: absolute;
  width: 200px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #00ff41, #fff, #00ff41, transparent);
  box-shadow: 0 0 8px #00ff41;
  animation: glitch-flash 0.15s ease-out forwards;
  transform-origin: center;
}

@keyframes glitch-flash {
  0% { opacity: 1; transform: scaleX(0.3); }
  30% { opacity: 1; transform: scaleX(1); }
  100% { opacity: 0; transform: scaleX(1.2); }
}

/* Electric ring pulse */
.electric-ring {
  position: absolute;
  width: 60px;
  height: 60px;
  border: 2px solid #00ff41;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: ring-expand 0.4s ease-out forwards;
  box-shadow: 
    0 0 4px #00ff41,
    0 0 8px rgba(0, 255, 65, 0.5),
    inset 0 0 4px rgba(0, 255, 65, 0.3);
}

@keyframes ring-expand {
  0% { 
    opacity: 1; 
    transform: translate(-50%, -50%) scale(0.2);
    border-width: 4px;
  }
  100% { 
    opacity: 0; 
    transform: translate(-50%, -50%) scale(2);
    border-width: 1px;
  }
}

/* Mouse glow - electric aura */
.mouse-glow {
  position: fixed;
  width: 150px;
  height: 150px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 3;
  transition: opacity 0.2s ease;
  background: radial-gradient(
    circle,
    rgba(0, 255, 65, 0.08) 0%,
    rgba(0, 255, 65, 0.02) 40%,
    transparent 70%
  );
  border-radius: 50%;
  animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
  50% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
}

/* Scanlines */
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.02) 2px,
    rgba(0, 0, 0, 0.02) 4px
  );
  opacity: 0.4;
}

/* CRT flicker */
.matrix-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 255, 65, 0.01);
  animation: crt-flicker 0.08s infinite;
  pointer-events: none;
}

@keyframes crt-flicker {
  0%, 100% { opacity: 0.01; }
  50% { opacity: 0.02; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .matrix-column,
  .electric-arc,
  .crackle-spark,
  .static-noise,
  .screen-crack,
  .electric-ring {
    animation: none;
  }
}
