:root {
  --term-green: #2bff6a;
  --term-green-dim: #1f9f47;
  --term-bg: rgba(0, 8, 2, 0.86);
  --glow: 0 0 6px rgba(43, 255, 106, 0.55);
  --mono: "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  overflow: hidden;
  font-family: var(--mono);
}

/* Layer 1 — the video */
.bg-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
.bg-tint {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.55) 100%);
}

/* Layer 0 — crawlable content (AEO). Real document beneath the fixed video/CLI
   overlays: JS users never see it; crawlers and no-JS visitors do. */
.seo-content {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow-y: auto;
  margin: 0;
  padding: 8vh 7vw;
  background: #02100a;
  color: #bfe9cf;
  font-family: var(--mono);
  line-height: 1.6;
}
.seo-content h1 { color: var(--term-green); font-size: 1.55rem; text-shadow: var(--glow); margin: 0 0 0.6rem; }
.seo-content h2 { color: #aaffc4; font-size: 1.05rem; margin: 1.5rem 0 0.4rem; }
.seo-content a { color: var(--term-green); }

/* Layer 2 — the gate */
.gate {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 9vh;
  color: var(--term-green);
  text-shadow: var(--glow);
  font-size: clamp(0.8rem, 2.2vw, 1.05rem);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.5s ease;
}
.gate-hint { opacity: 0.85; }
.gate-cursor { margin-left: 0.4em; animation: blink 1.1s steps(1) infinite; }
.gate.hide { opacity: 0; pointer-events: none; }

/* Layer 3 — the terminal */
.terminal {
  position: fixed;
  inset: 0;
  z-index: 3;
  background: var(--term-bg);
  color: var(--term-green);
  text-shadow: var(--glow);
  font-size: clamp(0.85rem, 1.7vw, 1rem);
  line-height: 1.5;
  padding: clamp(1rem, 4vw, 2.5rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: powerOn 0.45s ease both;
}
.terminal[hidden] { display: none; }

.term-output {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
  flex: 0 1 auto;
}
.term-output a { color: var(--term-green); text-decoration: underline; }
.term-output .muted { color: var(--term-green-dim); }
.term-output .heading { color: #aaffc4; font-weight: 700; }

.term-line {
  display: flex;
  flex-wrap: wrap;
  white-space: pre-wrap;
  word-break: break-word;
}
.term-prompt { color: var(--term-green); }
.term-cursor {
  display: inline-block;
  margin-left: 1px;
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }
@keyframes powerOn {
  0% { opacity: 0; transform: scale(0.998); filter: brightness(2.2); }
  100% { opacity: 1; transform: none; filter: none; }
}

/* CRT scanlines flourish */
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.08) 3px
  );
  mix-blend-mode: multiply;
  opacity: 0.5;
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .gate-cursor, .term-cursor { animation: none; }
  .terminal { animation: none; }
  .bg-video { display: none; }
  .bg-tint { background: #000; }
}

/* ---- mobile tap-menu + command chips ------------------------------------- */
/* By default (desktop) the typed hint shows and the tap UI is hidden. */
.gate-desktop { display: flex; align-items: center; }
.gate-menu { display: none; }
.term-chips { display: none; }

.gate-menu {
  flex-direction: column;
  gap: 0.7rem;
  width: min(86vw, 360px);
}
.menu-btn {
  font-family: var(--mono);
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--term-green);
  background: rgba(0, 12, 4, 0.55);
  border: 1px solid var(--term-green-dim);
  text-shadow: var(--glow);
  border-radius: 4px;
  padding: 0.9rem 1rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.menu-btn:active { background: rgba(43, 255, 106, 0.18); }
.menu-btn--ghost {
  border-style: dashed;
  color: var(--term-green-dim);
  letter-spacing: 0.06em;
}

.term-chips {
  flex: 0 0 auto;
  gap: 0.5rem;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(43, 255, 106, 0.2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.chip {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--term-green);
  background: rgba(0, 12, 4, 0.6);
  border: 1px solid var(--term-green-dim);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  text-shadow: var(--glow);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.chip:active { background: rgba(43, 255, 106, 0.18); }

/* On touch / small screens: hide the typed hint, show the tap UI. */
@media (max-width: 700px), (hover: none) and (pointer: coarse) {
  .gate { align-items: center; padding-bottom: 0; }
  .gate-desktop { display: none; }
  .gate-menu { display: flex; }
  .term-chips { display: flex; }
  .term-cursor { display: none; }   /* no physical keyboard to drive it */
}
