/* ==========================================================================
   Tokens
   ========================================================================== */

:root {
  --bg: #0a0a12;
  --text: #e8e8f0;
  --neon-cyan: #00f0ff;
  --neon-magenta: #ff2bd6;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --glitch-cycle: 6s;
}

/* ==========================================================================
   Base
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

html {
  background: var(--bg);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 0 1rem;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-sans);
}

/* Scanlines */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgb(255 255 255 / 0.025) 0 1px,
    transparent 1px 3px
  );
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  text-align: left;
}

.hero__title {
  position: relative;
  font-size: clamp(2rem, 7vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-shadow:
    0 0 12px color-mix(in srgb, var(--neon-magenta) 45%, transparent),
    0 0 36px color-mix(in srgb, var(--neon-magenta) 35%, transparent),
    0 0 72px color-mix(in srgb, var(--neon-magenta) 20%, transparent);
  animation: glitch-shift var(--glitch-cycle) infinite;
}

/* Magenta ghost copy, visible only for a few frames of each glitch. */
.hero__title::before {
  content: attr(data-text);
  content: attr(data-text) / ""; /* Hidden from screen readers where supported. */
  position: absolute;
  inset: 0;
  color: var(--neon-magenta);
  opacity: 0;
  pointer-events: none;
  animation: glitch-slice var(--glitch-cycle) infinite;
}

.hero__subtitle {
  margin-top: 0.75rem;
  font-family: var(--font-mono);
  font-size: clamp(0.9rem, 2.4vw, 1.25rem);
  letter-spacing: 0.25em;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px color-mix(in srgb, var(--neon-cyan) 60%, transparent);
}

.hero__subtitle a {
  color: inherit;
}

.hero__subtitle::after {
  content: "▌";
  content: "▌" / "";
  margin-left: 0.15em;
  animation: blink 1.1s steps(1) infinite;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@keyframes glitch-shift {
  0%, 93%, 98%, 100% {
    transform: none;
  }
  94% {
    transform: translateX(-2px);
    text-shadow: 2px 0 var(--neon-magenta), -2px 0 var(--neon-cyan);
  }
  96% {
    transform: translateX(2px);
    text-shadow: -2px 0 var(--neon-magenta), 2px 0 var(--neon-cyan);
  }
}

@keyframes glitch-slice {
  0%, 93%, 99%, 100% {
    opacity: 0;
    clip-path: inset(0 0 100% 0);
  }
  94% {
    opacity: 0.8;
    clip-path: inset(15% 0 60% 0);
    transform: translateX(6px);
  }
  96% {
    opacity: 0.8;
    clip-path: inset(55% 0 20% 0);
    transform: translateX(-5px);
  }
  98% {
    opacity: 0.6;
    clip-path: inset(35% 0 45% 0);
    transform: translateX(3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero__title,
  .hero__title::before,
  .hero__subtitle::after {
    animation: none;
  }
}
