/* Matrix Background Effects */

/* Matrix Background Container */
.matrix-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: var(--z-matrix-bg);
  overflow: hidden;
}

/* Matrix Characters */
.matrix-char {
  position: absolute;
  font-size: var(--text-xl);
  color: var(--color-matrix-dim);
  font-weight: 300;
  opacity: 0.3;
  transition: var(--matrix-char-transition);
  will-change: transform, top;
  font-family: var(--font-mono);
  user-select: none;
}

.matrix-char.active {
  color: var(--color-matrix-active);
  font-weight: bold;
  text-shadow: var(--shadow-matrix-text);
  opacity: 1;
  transform: scale(1.2);
}

/* Matrix animation keyframes */
@keyframes matrix-fall {
  0% {
    transform: translateY(-100vh);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(100vh);
    opacity: 0;
  }
}

@keyframes matrix-flicker {
  0%, 100% {
    opacity: 0.3;
    color: var(--color-matrix-dim);
  }
  50% {
    opacity: 1;
    color: var(--color-matrix-active);
    text-shadow: var(--shadow-matrix-text);
  }
}

/* Responsive matrix character sizes */
@media (max-width: 480px) {
  .matrix-char {
    font-size: var(--text-lg);
  }
  
  .matrix-char.active {
    font-size: var(--text-xl);
    transform: scale(1.1);
  }
}

@media (max-width: 375px) {
  .matrix-char {
    font-size: var(--text-base);
  }
  
  .matrix-char.active {
    font-size: var(--text-lg);
    transform: scale(1.05);
  }
}

/* Matrix pulse animation for special effects */
@keyframes matrix-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

.matrix-char.pulse {
  animation: matrix-pulse 1s infinite;
}

/* Matrix grid pattern overlay (optional) */
.matrix-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: var(--z-matrix-bg);
  background-image: 
    linear-gradient(rgba(0, 255, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 0, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.1;
}

/* Matrix scanline effect (optional) */
.matrix-scanline {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    var(--color-primary) 50%, 
    transparent 100%);
  box-shadow: 0 0 10px var(--color-primary);
  animation: scanline 3s linear infinite;
  z-index: var(--z-matrix-bg);
  pointer-events: none;
}

@keyframes scanline {
  0% {
    top: -2px;
    opacity: 1;
  }
  100% {
    top: 100vh;
    opacity: 0;
  }
}