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

:root {
  --night: #08081a;
  --concrete: #12122a;
  --haze: #1e1e3a;
  --neon: #ff2a6d;
  --neon-dim: rgba(255, 42, 109, 0.12);
  --ink: #d0d0e8;
  --ink-mid: #8888a8;
  --ink-dim: #555578;
  --mono: 'SF Mono', 'Cascadia Code', 'Fira Code', 'JetBrains Mono', ui-monospace, monospace;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--mono);
  background: var(--night);
  color: var(--ink);
  min-height: 100vh;
  overflow: hidden;
}

/* --- Corridor --- */

.corridor {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}

.corridor-floor,
.corridor-ceiling {
  position: absolute;
  left: -50%;
  width: 200%;
  height: 65%;
  background:
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 79px,
      rgba(255, 42, 109, 0.04) 79px,
      rgba(255, 42, 109, 0.04) 80px
    ),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 39px,
      rgba(255, 42, 109, 0.06) 39px,
      rgba(255, 42, 109, 0.06) 40px
    );
}

.corridor-floor {
  bottom: 0;
  transform-origin: center top;
  transform: perspective(400px) rotateX(55deg);
  animation: descend 3s linear infinite;
}

.corridor-ceiling {
  top: 0;
  transform-origin: center bottom;
  transform: perspective(400px) rotateX(-55deg);
  animation: descend 3s linear infinite;
}

.corridor-left,
.corridor-right {
  position: absolute;
  top: -50%;
  width: 60%;
  height: 200%;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 79px,
      rgba(255, 42, 109, 0.04) 79px,
      rgba(255, 42, 109, 0.04) 80px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 39px,
      rgba(255, 42, 109, 0.05) 39px,
      rgba(255, 42, 109, 0.05) 40px
    );
}

.corridor-left {
  left: 0;
  transform-origin: right center;
  transform: perspective(400px) rotateY(55deg);
  animation: descend-v 3s linear infinite;
}

.corridor-right {
  right: 0;
  transform-origin: left center;
  transform: perspective(400px) rotateY(-55deg);
  animation: descend-v 3s linear infinite;
}

.corridor-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 50% 50% at center,
    transparent 0%,
    var(--night) 100%
  );
}

@keyframes descend {
  from { background-position: 0 0; }
  to   { background-position: 0 40px; }
}

@keyframes descend-v {
  from { background-position: 0 0; }
  to   { background-position: 0 40px; }
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  gap: 2.5rem;
  position: relative;
  z-index: 1;
}

/* --- Header --- */

header {
  text-align: center;
}

h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(4rem, 14vw, 9rem);
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 0.9;
  color: #fff;
  text-shadow:
    0 0 7px var(--neon),
    0 0 30px rgba(255, 42, 109, 0.4),
    0 0 80px rgba(255, 42, 109, 0.15);
}

header p {
  margin-top: 1.25rem;
  font-size: clamp(0.875rem, 2vw, 1.125rem);
  font-weight: 400;
  color: var(--ink-mid);
  line-height: 1.6;
  letter-spacing: 0.02em;
}

/* --- Glitch --- */

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

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

/* "Agent-first" — 4.7s cycle, glitches around 90% */
.glitch-a::before {
  color: #0ff;
  animation: a-cyan 4.7s infinite linear;
}
.glitch-a::after {
  color: var(--neon);
  animation: a-neon 4.7s infinite linear;
}

/* "inevitable" — 3.3s cycle, glitches around 85% */
.glitch-b::before {
  color: #0ff;
  animation: b-cyan 3.3s infinite linear;
}
.glitch-b::after {
  color: var(--neon);
  animation: b-neon 3.3s infinite linear;
}

@keyframes a-cyan {
  0%, 89% { clip-path: inset(0 0 100% 0); transform: none; }
  90%     { clip-path: inset(10% 0 60% 0); transform: translateX(-3px); }
  91%     { clip-path: inset(50% 0 20% 0); transform: translateX(2px); }
  92%     { clip-path: inset(70% 0 5% 0);  transform: translateX(-1px); }
  93%, 100% { clip-path: inset(0 0 100% 0); transform: none; }
}

@keyframes a-neon {
  0%, 88% { clip-path: inset(0 0 100% 0); transform: none; }
  89%     { clip-path: inset(55% 0 15% 0); transform: translateX(3px); }
  90%     { clip-path: inset(20% 0 50% 0); transform: translateX(-2px); }
  91%     { clip-path: inset(80% 0 0% 0);  transform: translateX(1px); }
  92%, 100% { clip-path: inset(0 0 100% 0); transform: none; }
}

@keyframes b-cyan {
  0%, 84% { clip-path: inset(0 0 100% 0); transform: none; }
  85%     { clip-path: inset(30% 0 40% 0); transform: translateX(2px); }
  87%     { clip-path: inset(5% 0 65% 0);  transform: translateX(-3px); }
  88%     { clip-path: inset(60% 0 10% 0); transform: translateX(1px); }
  90%, 100% { clip-path: inset(0 0 100% 0); transform: none; }
}

@keyframes b-neon {
  0%, 83% { clip-path: inset(0 0 100% 0); transform: none; }
  84%     { clip-path: inset(15% 0 55% 0); transform: translateX(-2px); }
  86%     { clip-path: inset(45% 0 25% 0); transform: translateX(3px); }
  88%     { clip-path: inset(75% 0 0% 0);  transform: translateX(-1px); }
  89%, 100% { clip-path: inset(0 0 100% 0); transform: none; }
}

/* --- Nav --- */

nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

nav a {
  font-family: var(--mono);
  font-size: 0.875rem;
  color: #fff;
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  letter-spacing: 0.06em;
  text-shadow:
    0 0 4px var(--neon),
    0 0 16px rgba(255, 42, 109, 0.3);
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

nav a:hover {
  text-shadow:
    0 0 7px var(--neon),
    0 0 30px rgba(255, 42, 109, 0.5),
    0 0 60px rgba(255, 42, 109, 0.15);
}

nav a:focus-visible {
  outline: 1px solid var(--neon);
  outline-offset: 4px;
  border-radius: 2px;
}

.cursor {
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}
