:root {
  color-scheme: dark;
  --black: #000;
  --green: #27ff52;
  --green-hot: #d8ffe0;
  --font: "Courier New", "Lucida Console", Monaco, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--black);
}

body {
  font-family: var(--font);
}

.matrix {
  position: relative;
  isolation: isolate;
  width: 100vw;
  height: 100svh;
  overflow: hidden;
  background: var(--black);
}

.matrix__rain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.matrix__word {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  margin: 0;
  color: var(--green-hot);
  font-size: clamp(2.4rem, 6vw, 5.75rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.1em;
  text-transform: lowercase;
  white-space: nowrap;
  will-change: transform;
  text-shadow:
    0 0 4px #fff,
    0 0 10px var(--green),
    0 0 22px rgba(39, 255, 82, 0.74);
  filter: contrast(1.3);
}

.matrix__word::before {
  content: "";
  position: absolute;
  top: 44%;
  right: calc(100% + 0.18em);
  width: clamp(45px, 9vw, 150px);
  height: 0.12em;
  opacity: 0.7;
  background: repeating-linear-gradient(
    to bottom,
    rgba(39, 255, 82, 0.05) 0 1px,
    rgba(39, 255, 82, 0.85) 1px 2px,
    transparent 2px 4px
  );
  box-shadow:
    -30px 0 rgba(39, 255, 82, 0.3),
    -70px 0 rgba(39, 255, 82, 0.12);
}

.matrix__word::after {
  content: "";
  position: absolute;
  inset: 48% -0.08em auto;
  height: 0.05em;
  background: var(--black);
  opacity: 0;
  animation: word-glitch 5.2s steps(1, end) infinite;
}

.matrix__scanlines,
.matrix__vignette {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.matrix__scanlines {
  opacity: 0.12;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 3px,
    rgba(220, 255, 225, 0.45) 4px
  );
  animation: scan 8s linear infinite;
}

.matrix__vignette {
  z-index: 4;
  background:
    radial-gradient(circle at center, transparent 23%, rgba(0, 0, 0, 0.16) 58%, rgba(0, 0, 0, 0.76) 100%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.2), transparent 12%, transparent 88%, rgba(0, 0, 0, 0.32));
}

@keyframes scan {
  to {
    transform: translateY(4px);
  }
}

@keyframes word-glitch {
  0%,
  92%,
  94%,
  100% {
    opacity: 0;
  }

  93% {
    opacity: 0.85;
  }
}

@media (max-width: 700px) {
  .matrix__word {
    font-size: clamp(2.25rem, 13vw, 4.5rem);
  }

  .matrix__word::before {
    width: 15vw;
  }
}

@media (prefers-reduced-motion: reduce) {
  .matrix__word,
  .matrix__scanlines {
    animation: none;
  }
}
