:root {
  --bg: #05060f;
  --fg: #e8ecff;
  --muted: #8a92b8;
  --cyan: #00e5ff;
  --violet: #a855f7;
  --pink: #ff3d9a;
  --glass: rgba(18, 22, 44, 0.55);
  --border: rgba(140, 160, 255, 0.16);
}

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

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Space Grotesk", system-ui, sans-serif;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Background layers ---------- */

.aurora {
  position: fixed;
  inset: 0;
  overflow: hidden;
  filter: blur(80px);
  opacity: 0.55;
  z-index: 0;
}
.blob {
  position: absolute;
  width: 45vmax;
  height: 45vmax;
  border-radius: 50%;
  mix-blend-mode: screen;
}
.b1 { background: radial-gradient(circle, var(--cyan), transparent 65%); top: -15%; left: -10%; animation: drift1 22s ease-in-out infinite alternate; }
.b2 { background: radial-gradient(circle, var(--violet), transparent 65%); bottom: -20%; right: -10%; animation: drift2 26s ease-in-out infinite alternate; }
.b3 { background: radial-gradient(circle, var(--pink), transparent 65%); top: 40%; left: 40%; width: 30vmax; height: 30vmax; opacity: 0.6; animation: drift3 30s ease-in-out infinite alternate; }

@keyframes drift1 { to { transform: translate(25vw, 20vh) scale(1.2); } }
@keyframes drift2 { to { transform: translate(-30vw, -15vh) scale(1.1); } }
@keyframes drift3 { to { transform: translate(-25vw, -30vh) scale(1.4); } }

.grid-floor {
  position: fixed;
  left: -50%;
  right: -50%;
  bottom: -10vh;
  height: 55vh;
  background-image:
    linear-gradient(rgba(0, 229, 255, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(168, 85, 247, 0.22) 1px, transparent 1px);
  background-size: 60px 60px;
  transform: perspective(500px) rotateX(70deg);
  transform-origin: center top;
  mask-image: linear-gradient(to bottom, transparent, #000 35%, #000 70%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 35%, #000 70%, transparent);
  animation: grid-move 3s linear infinite;
  z-index: 0;
}
@keyframes grid-move { to { background-position: 0 60px, 0 60px; } }

#network {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.noise {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Stage ---------- */

.stage {
  position: relative;
  z-index: 3;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 16px 24px;
  gap: 22px;
}

.stage > * {
  opacity: 0;
  animation: rise 0.9s cubic-bezier(.2, .8, .2, 1) forwards;
}
.status-pill { animation-delay: 0.1s; }
.logo-mark   { animation-delay: 0.25s; }
.brand       { animation-delay: 0.4s; }
.tagline     { animation-delay: 0.9s; }
.terminal    { animation-delay: 1.2s; }
.subtext     { animation-delay: 1.5s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(24px); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: none; }
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(12px);
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ffd166;
}
.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffd166;
  box-shadow: 0 0 0 0 rgba(255, 209, 102, 0.7);
  animation: ping 1.6s ease-out infinite;
}
@keyframes ping {
  70%  { box-shadow: 0 0 0 10px rgba(255, 209, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 209, 102, 0); }
}

/* ---------- Logo mark ---------- */

.logo-mark {
  width: clamp(120px, 22vw, 170px);
  aspect-ratio: 1;
  filter: drop-shadow(0 0 24px rgba(0, 229, 255, 0.35));
}
.logo-mark svg { width: 100%; height: 100%; overflow: visible; }
.ring {
  fill: none;
  stroke: url(#lg);
  stroke-linecap: round;
  transform-origin: 100px 100px;
}
.r1 { stroke-width: 1.5; stroke-dasharray: 120 40 20 40; animation: spin 18s linear infinite; opacity: 0.8; }
.r2 { stroke-width: 2;   stroke-dasharray: 60 30;        animation: spin 12s linear infinite reverse; opacity: 0.6; }
.r3 { stroke-width: 1;   stroke-dasharray: 4 8;          animation: spin 30s linear infinite; opacity: 0.7; }
.hex {
  fill: rgba(0, 229, 255, 0.06);
  stroke: url(#lg);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
  animation: draw 2s 0.4s ease forwards, breathe 4s 2.4s ease-in-out infinite;
  transform-origin: 100px 100px;
}
.core { fill: url(#lg); animation: pulse 2s ease-in-out infinite; transform-origin: 100px 100px; }
.orbit { transform-origin: 100px 100px; }
.orbit circle { fill: var(--cyan); filter: drop-shadow(0 0 6px var(--cyan)); }
.o1 { animation: spin 6s linear infinite; }
.o2 { animation: spin 9s linear infinite reverse; }
.o2 circle { fill: var(--violet); filter: drop-shadow(0 0 6px var(--violet)); }
.o3 { animation: spin 4s linear infinite; }
.o3 circle { fill: var(--pink); filter: drop-shadow(0 0 6px var(--pink)); }

@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes draw    { to { stroke-dashoffset: 0; } }
@keyframes breathe { 50% { transform: scale(1.06); } }
@keyframes pulse   { 50% { transform: scale(1.35); opacity: 0.75; } }

/* ---------- Brand ---------- */

.brand {
  position: relative;
  font-size: clamp(44px, 11vw, 128px);
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
  padding-left: 0.12em; /* balance trailing letter-spacing */
  background: linear-gradient(90deg, var(--cyan), #fff 30%, var(--violet) 60%, var(--pink) 80%, var(--cyan));
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rise 0.9s 0.4s cubic-bezier(.2, .8, .2, 1) forwards, shimmer 8s linear infinite;
  text-shadow: 0 0 40px rgba(0, 229, 255, 0.15);
  white-space: nowrap;
}
@keyframes shimmer { to { background-position: 300% 0; } }

/* Glitch slices, toggled by JS */
.brand::before,
.brand::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  padding-left: 0.12em;
  background: inherit;
  -webkit-background-clip: text;
  background-clip: text;
  opacity: 0;
  pointer-events: none;
}
.brand.glitch::before {
  opacity: 0.9;
  transform: translate(-4px, 0);
  clip-path: inset(10% 0 55% 0);
  filter: hue-rotate(90deg);
  animation: glitch-a 0.35s steps(2) both;
}
.brand.glitch::after {
  opacity: 0.9;
  transform: translate(4px, 0);
  clip-path: inset(60% 0 8% 0);
  filter: hue-rotate(-90deg);
  animation: glitch-b 0.35s steps(2) both;
}
@keyframes glitch-a { 50% { clip-path: inset(40% 0 30% 0); transform: translate(6px, -2px); } }
@keyframes glitch-b { 50% { clip-path: inset(20% 0 65% 0); transform: translate(-6px, 2px); } }

.tagline {
  font-size: clamp(16px, 2.4vw, 22px);
  color: var(--muted);
  letter-spacing: 0.04em;
}
.tagline .hl {
  color: var(--fg);
  position: relative;
}
.tagline .hl::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  transform: scaleX(0);
  transform-origin: left;
  animation: underline 0.8s 1.8s ease forwards;
}
.tagline .hl:last-child::after { animation-delay: 2.2s; }
@keyframes underline { to { transform: scaleX(1); } }

/* ---------- Terminal ---------- */

.terminal {
  width: min(560px, 100%);
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  text-align: left;
  overflow: hidden;
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}
.tl { width: 11px; height: 11px; border-radius: 50%; }
.tl.red   { background: #ff5f57; }
.tl.amber { background: #febc2e; }
.tl.green { background: #28c840; }
.term-title {
  margin-left: auto;
  margin-right: auto;
  transform: translateX(-24px);
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--muted);
}
.term-body {
  padding: 14px 16px 16px;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  line-height: 1.7;
}
.log {
  height: calc(1.7em * 5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.log .line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: line-in 0.25s ease; }
.log .prompt { color: var(--cyan); }
.log .ok   { color: #28c840; }
.log .info { color: var(--violet); }
.log .warn { color: #febc2e; }
.log .dim  { color: var(--muted); }
.cursor {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  vertical-align: -2px;
  background: var(--cyan);
  margin-left: 2px;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@keyframes line-in { from { opacity: 0; transform: translateX(-6px); } }

.progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}
.progress-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--pink));
  background-size: 200% 100%;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.6);
  transition: width 0.6s cubic-bezier(.2, .8, .2, 1);
  animation: flow 2s linear infinite;
}
@keyframes flow { to { background-position: -200% 0; } }
.progress-pct { color: var(--fg); min-width: 3.5ch; text-align: right; font-size: 12px; }

.subtext {
  max-width: 460px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

/* ---------- Footer ---------- */

.footer {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 20px 16px 28px;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.05em;
}
.footer .sep { opacity: 0.5; }

/* ---------- Small screens ---------- */

@media (max-width: 480px) {
  .stage { gap: 18px; padding-top: 32px; }
  .term-body { font-size: 11.5px; }
  .term-title { display: none; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition: none !important;
  }
  .hex { stroke-dashoffset: 0; }
}
