:root {
  --bg: #07090b;
  --bg-2: #0c1014;
  --ink: #e9edf0;
  --muted: #7d878f;
  --accent: #7fd68a;
  --accent-2: #ffb454;
  --line: rgba(127, 214, 138, 0.14);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --display: "Chakra Petch", "Segoe UI", system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--display);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

/* ---------- background layers ---------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg > div { position: absolute; inset: 0; }

.bg__grid {
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 78%);
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 78%);
  animation: grid-drift 24s linear infinite;
}

.bg__radar {
  --size: min(160vmax, 1800px);
  inset: auto;
  top: 50%;
  left: 50%;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background:
    repeating-radial-gradient(circle at center,
      transparent 0,
      transparent 118px,
      rgba(127, 214, 138, 0.10) 119px,
      rgba(127, 214, 138, 0.10) 120px);
  -webkit-mask-image: radial-gradient(circle, #000 0%, #000 42%, transparent 62%);
  mask-image: radial-gradient(circle, #000 0%, #000 42%, transparent 62%);
}

.bg__radar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg,
    rgba(127, 214, 138, 0.00) 0deg,
    rgba(127, 214, 138, 0.00) 300deg,
    rgba(127, 214, 138, 0.10) 340deg,
    rgba(127, 214, 138, 0.28) 359deg,
    rgba(127, 214, 138, 0.00) 360deg);
  animation: sweep 7s linear infinite;
}

.bg__glow {
  background:
    radial-gradient(ellipse 60% 40% at 50% 55%, rgba(127, 214, 138, 0.16), transparent 70%),
    radial-gradient(ellipse 30% 20% at 50% 55%, rgba(255, 180, 84, 0.08), transparent 70%);
  animation: glow-pulse 6s ease-in-out infinite;
}

.bg__scan {
  background-image: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.035) 0px,
    rgba(255, 255, 255, 0.035) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

.bg__scan::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 18vh;
  top: -20vh;
  background: linear-gradient(180deg,
    transparent,
    rgba(127, 214, 138, 0.06) 50%,
    transparent);
  animation: scan-bar 9s linear infinite;
}

.bg__vignette {
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.75) 100%);
}

/* ---------- viewport frame ---------- */

.frame {
  position: fixed;
  inset: calc(var(--gutter) * 0.6);
  z-index: 1;
  pointer-events: none;
}

.frame__corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 1.5px solid rgba(127, 214, 138, 0.55);
}

.frame__corner--tl { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.frame__corner--tr { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.frame__corner--bl { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.frame__corner--br { bottom: 0; right: 0; border-left: 0; border-top: 0; }

/* ---------- HUD bars ---------- */

.hud {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: calc(var(--gutter) * 0.9) var(--gutter);
  font-family: var(--mono);
  font-size: clamp(10px, 0.75vw + 6px, 12px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  animation: fade-in 1.2s ease-out both;
  animation-delay: 0.9s;
}

.hud__item--status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
}

.hud--bottom {
  text-transform: none;
  letter-spacing: 0.04em;
  font-size: clamp(10px, 0.7vw + 6px, 12px);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent), 0 0 20px rgba(127, 214, 138, 0.6);
  animation: blink 1.6s steps(2, start) infinite;
}

/* ---------- centre stage ---------- */

.stage {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 var(--gutter);
}

.eyebrow {
  margin: 0 0 clamp(12px, 2vh, 24px);
  font-family: var(--mono);
  font-size: clamp(11px, 0.8vw + 7px, 14px);
  letter-spacing: 0.28em;
  color: var(--accent-2);
  animation: fade-in 1s ease-out both;
  animation-delay: 0.2s;
}

.title {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-weight: 700;
  text-transform: uppercase;
  line-height: 0.88;
  letter-spacing: -0.01em;
  font-size: clamp(3.2rem, 15vw, 11.5rem);
}

.title__line {
  display: block;
  clip-path: inset(0 0 100% 0);
  transform: translateY(0.25em);
  animation: reveal 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.title__line--1 {
  color: var(--ink);
  text-shadow: 0 0 40px rgba(233, 237, 240, 0.12);
  animation-delay: 0.35s;
}

.title__line--2 {
  position: relative;
  color: var(--accent);
  text-shadow:
    0 0 24px rgba(127, 214, 138, 0.45),
    0 0 80px rgba(127, 214, 138, 0.25);
  animation-delay: 0.55s;
}

/* glitch ghosts on NEXUS, occasional */
.title__line--2::before,
.title__line--2::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: var(--accent);
  opacity: 0;
  pointer-events: none;
}

.title__line--2::before {
  color: var(--accent-2);
  animation: glitch-a 7s steps(1, end) infinite;
  animation-delay: 2s;
}

.title__line--2::after {
  color: #6bd3ff;
  animation: glitch-b 7s steps(1, end) infinite;
  animation-delay: 2s;
}

.status {
  margin: clamp(20px, 4vh, 40px) 0 0;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  border: 1px solid rgba(127, 214, 138, 0.28);
  background: rgba(12, 16, 20, 0.6);
  backdrop-filter: blur(6px);
  font-family: var(--mono);
  font-size: clamp(12px, 0.9vw + 8px, 16px);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  animation: fade-in 0.8s ease-out both;
  animation-delay: 1.1s;
}

.status__label {
  color: var(--muted);
  padding-right: 14px;
  border-right: 1px solid rgba(127, 214, 138, 0.28);
}

.status__text {
  color: var(--ink);
  min-width: 11ch;
  text-align: left;
}

.cursor {
  display: inline-block;
  width: 0.6ch;
  height: 1.1em;
  margin-left: -8px;
  background: var(--accent);
  animation: blink 1s steps(2, start) infinite;
}

.tagline {
  margin: clamp(16px, 3vh, 28px) 0 0;
  max-width: 34ch;
  color: var(--muted);
  font-weight: 500;
  font-size: clamp(14px, 1vw + 9px, 18px);
  letter-spacing: 0.04em;
  animation: fade-in 1s ease-out both;
  animation-delay: 1.4s;
}

/* ---------- keyframes ---------- */

@keyframes reveal {
  to { clip-path: inset(-10% 0 -10% 0); transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes blink {
  to { visibility: hidden; }
}

@keyframes sweep {
  to { transform: rotate(360deg); }
}

@keyframes grid-drift {
  to { background-position: 64px 64px; }
}

@keyframes glow-pulse {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

@keyframes scan-bar {
  to { transform: translateY(140vh); }
}

@keyframes glitch-a {
  0%, 92%, 100% { opacity: 0; transform: none; clip-path: none; }
  93% { opacity: 0.9; transform: translate(-6px, 2px); clip-path: inset(10% 0 55% 0); }
  94% { opacity: 0.9; transform: translate(5px, -1px); clip-path: inset(60% 0 10% 0); }
  95% { opacity: 0; }
  96.5% { opacity: 0.8; transform: translate(-3px, 0); clip-path: inset(30% 0 40% 0); }
  97% { opacity: 0; }
}

@keyframes glitch-b {
  0%, 92%, 100% { opacity: 0; transform: none; clip-path: none; }
  93% { opacity: 0.9; transform: translate(6px, -2px); clip-path: inset(50% 0 20% 0); }
  94% { opacity: 0.9; transform: translate(-5px, 1px); clip-path: inset(0 0 70% 0); }
  95% { opacity: 0; }
  96.5% { opacity: 0.8; transform: translate(4px, 0); clip-path: inset(70% 0 5% 0); }
  97% { opacity: 0; }
}

/* ---------- small screens ---------- */

@media (max-width: 560px) {
  .hud { flex-direction: column; align-items: flex-start; gap: 6px; }
  .hud--bottom { align-items: center; text-align: center; }
  .hud--bottom .hud__item { max-width: 100%; }
  .status { flex-wrap: wrap; justify-content: center; }
  .status__text { min-width: 0; }
  .frame__corner { width: 16px; height: 16px; }
}

/* ---------- motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
  }
  .title__line { clip-path: none; transform: none; }
  .title__line--2::before, .title__line--2::after { display: none; }
  .bg__radar::after { transform: rotate(320deg); }
  .cursor, .dot { visibility: visible; }
}
