/* ─────────────────────────────────────────────────────────────────────────
   The Blackscreen Project — landing page

   The page is monochrome: white on true black, no accent hue. The one place
   colour appears is INSIDE the terminal, where it uses the product's real
   palette — because that is genuinely what it looks like. Keep the two in
   step: these values mirror the terminal's own dark theme.

   Committed to a single dark theme: the product is named for a black screen,
   so there is no prefers-color-scheme branch here.

   Everything is external — no inline <style>, no style="" attributes — because
   public/_headers sets style-src 'self' with no 'unsafe-inline'. Staggered
   animation delays therefore live in classes (.w1….w5) rather than on nodes.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  --bg:           #000000;
  --text:         #e8e8e8;
  --muted:        #aaaaaa;
  --dim:          #888888;
  --dimmer:       #555555;
  --line:         rgba(255, 255, 255, 0.06);
  --line-bright:  rgba(255, 255, 255, 0.18);
  --err:          #ff8fa3;

  /* The terminal's own palette — DARK in branding-palette.ts. */
  --t-brand:      #00ffff;
  --t-body:       #e5e5e5;
  --t-sep:        #5a5a5a;
  --t-try:        #ffd866;
  --t-tryText:    #8be9fd;
  --t-ok:         #50fa7b;

  --mono: "JetBrains Mono", "Fira Code", ui-monospace, "SF Mono", SFMono-Regular,
          Menlo, Consolas, "Liberation Mono", monospace;
  /* Special Elite is not self-hosted, so this resolves to Courier on most
     machines — which is the typewriter read we want anyway. Drop a woff2 into
     public/ and add it here to make it guaranteed; font-src 'self' already
     allows it. */
  --display: "Special Elite", "Courier New", var(--mono);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}

::selection { background: rgba(255, 255, 255, 0.2); color: #fff; }

a { color: inherit; text-decoration: none; }

:focus-visible { outline: 1px solid #fff; outline-offset: 3px; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  background: #fff;
  color: #000;
  padding: 0.5rem 0.85rem;
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

/* ── cursor ────────────────────────────────────────────────────────────── */

.cursor-dot, .cursor-halo {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 9999;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.cursor-dot { width: 6px; height: 6px; background: #fff; }
.cursor-halo {
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(255,255,255,0.10) 0%, transparent 70%);
}

/* The native cursor is only hidden once JS is actually driving the custom one.
   Hiding it unconditionally in CSS would leave anyone with scripting blocked
   navigating a page with no cursor at all. */
body.has-cursor,
body.has-cursor a,
body.has-cursor button,
body.has-cursor input { cursor: none; }

@media (pointer: coarse) {
  .cursor-dot, .cursor-halo { display: none; }
  body.has-cursor, body.has-cursor a, body.has-cursor button { cursor: auto; }
}

#particles { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

main { position: relative; z-index: 1; }

/* ── banner ────────────────────────────────────────────────────────────── */

.banner {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding: 32px 24px 24px;
  transition: padding 0.3s ease;
}

/* An empty mirror of the nav on the left keeps the wordmark optically centred
   however wide the nav gets. */
.banner-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 16px;
  max-width: 1440px;
  margin: 0 auto;
}

.banner-center { text-align: center; }

.brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(20px, 3.5vw, 38px);
  letter-spacing: 0.25em;
  line-height: 1.2;
  color: #fff;
  text-shadow:
    0 0 8px rgba(255,255,255,0.6),
    0 0 24px rgba(255,255,255,0.35),
    0 0 48px rgba(255,255,255,0.15);
}

.divider {
  width: 220px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
  margin: 14px auto;
  transition: width 0.3s ease, margin 0.3s ease;
}

.sublinks { color: var(--dim); font-size: 12px; letter-spacing: 0.15em; }

.banner-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 22px;
  padding-top: 6px;
}

.nav-tab {
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--dim);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.nav-tab:hover { color: #fff; border-bottom-color: rgba(255,255,255,0.4); }

.nav-login {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: #fff;
  background: transparent;
  border: 1px solid var(--line-bright);
  padding: 8px 18px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}
.nav-login:hover {
  background: #fff;
  color: #000;
  box-shadow: 0 0 28px rgba(255,255,255,0.35);
}

/* Scrolled — the banner compresses into a bar. */
.banner.scrolled { padding: 14px 24px 10px; }
.banner.scrolled .brand { font-size: 17px; letter-spacing: 0.2em; }
.banner.scrolled .divider { width: 120px; margin: 8px auto; }
.banner.scrolled .sublinks { font-size: 10px; }
.banner.scrolled .banner-nav { padding-top: 0; }

@media (max-width: 820px) {
  .banner-grid { grid-template-columns: 1fr auto; }
  .banner-side { display: none; }
  .banner-center { text-align: left; }
  .divider { margin-left: 0; }
  .banner-nav { gap: 14px; }
  .nav-tab { display: none; }
}

/* ── hero ──────────────────────────────────────────────────────────────── */

.hero {
  min-height: 88vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 80px 24px 120px;
  position: relative;
  text-align: center;
}

.eyebrow {
  color: var(--dimmer);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 28px;
  opacity: 0;
  animation: fade-in 0.8s 0.1s forwards;
}

.headline {
  font-size: clamp(40px, 6.5vw, 84px);
  font-weight: 700;
  line-height: 1.05;
  max-width: 1100px;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.word {
  display: inline-block;
  opacity: 0;
  transform: translateY(20px);
  animation: word-in 0.7s forwards;
}
.word.glow { text-shadow: 0 0 28px rgba(255,255,255,0.45); }

/* Per-word delays as classes, not style="" — see the CSP note at the top. */
.w1 { animation-delay: 0.30s; }
.w2 { animation-delay: 0.40s; }
.w3 { animation-delay: 0.55s; }
.w4 { animation-delay: 0.65s; }
.w5 { animation-delay: 0.75s; }

.hero-sub {
  color: var(--muted);
  font-size: clamp(15px, 1.5vw, 18px);
  max-width: 660px;
  margin: 36px auto 0;
  opacity: 0;
  animation: fade-in 0.8s 1.4s forwards;
  text-wrap: pretty;
}

.ctas {
  margin-top: 48px;
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.hero .ctas { opacity: 0; animation: fade-in 0.8s 1.8s forwards; }

.cta {
  font-family: var(--mono);
  font-size: 14px;
  padding: 14px 26px;
  border: 1px solid #fff;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}
.cta-primary { background: #fff; color: #000; }
.cta-primary:hover { box-shadow: 0 0 36px rgba(255,255,255,0.45); transform: translateY(-1px); }
.cta-secondary { background: transparent; color: #fff; }
.cta-secondary:hover { background: rgba(255,255,255,0.06); box-shadow: 0 0 24px rgba(255,255,255,0.15); }

.wireframe {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: -1;
  opacity: 0.5;
  pointer-events: none;
}
.wireframe svg {
  width: 720px; height: 720px;
  max-width: 90vw; max-height: 90vw;
  animation: rotate 60s linear infinite;
}
.wireframe svg circle { fill: #fff; }
.wireframe svg line { stroke: rgba(255,255,255,0.35); stroke-width: 0.5; }

/* ── section shell ─────────────────────────────────────────────────────── */

.content-section {
  padding: 100px 24px;
  max-width: 1080px;
  margin: 0 auto;
}

.section-header { text-align: center; margin-bottom: 48px; }
.section-header .kicker {
  color: var(--dimmer);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.section-header h3 {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 700;
  letter-spacing: -0.01em;
  max-width: 800px;
  margin: 0 auto;
  text-wrap: balance;
}

/* ── what it does ──────────────────────────────────────────────────────── */

/* The dividers are the 1px grid gap showing the --line background through,
   rather than four borders that would double up where cards meet. The cards
   therefore have to paint --bg themselves. */
.value-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.value {
  background: var(--bg);
  padding: 42px 34px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.value-index {
  color: var(--dimmer);
  font-size: 11px;
  letter-spacing: 0.3em;
}

.value h4 {
  font-size: clamp(17px, 2vw, 21px);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.value p {
  color: var(--muted);
  font-size: 14px;
  text-wrap: pretty;
}

@media (max-width: 720px) {
  .value-grid { grid-template-columns: minmax(0, 1fr); }
  .value { padding: 32px 24px; }
}

/* ── demo terminal ─────────────────────────────────────────────────────── */

.demo-wrapper {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.015);
  overflow: hidden;
}
.demo-titlebar {
  background: rgba(255,255,255,0.04);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--dim);
}
.demo-titlebar .dot,
.modal-bar .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  flex: none;
}
.demo-session { margin-left: 8px; }

.demo-body {
  padding: 24px;
  /* The header block is fixed-width ASCII art; it must scroll inside its own
     box rather than reflow, and the page body must never scroll sideways. */
  overflow-x: auto;
  font-size: clamp(11px, 1.05vw, 13.5px);
  line-height: 1.75;
  color: var(--t-body);
}

.demo-header {
  font: inherit;
  white-space: pre;
  margin-bottom: 4px;
}

.demo-line { white-space: pre; }
.demo-you  { color: var(--t-try); }
.demo-text { color: var(--t-body); }
.demo-out  { color: var(--dim); }
.demo-ok   { color: var(--t-ok); }

/* Terminal palette, applied only inside the demo. */
.c-brand   { color: var(--t-brand); font-weight: 700; }
.c-sep     { color: var(--t-sep); }
.c-try     { color: var(--t-try); font-weight: 700; }
.c-tryText { color: var(--t-tryText); }
.c-pipe    { color: var(--dimmer); }
.c-src     { color: var(--t-tryText); }
.c-err     { color: var(--err); }

/* app.js reveals the lines in sequence; without scripting they stay visible,
   which is why the default here is shown rather than hidden. */
.demo-body.playing .demo-line { visibility: hidden; }
.demo-body.playing .demo-line.shown { visibility: visible; }

.demo-cursor::after {
  content: '▮';
  color: #fff;
  animation: blink 1s steps(2) infinite;
}

/* ── contact ───────────────────────────────────────────────────────────── */

.contact {
  text-align: center;
  padding: 140px 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: radial-gradient(800px circle at center, rgba(255,255,255,0.04), transparent);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.contact h3 {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.contact p { color: var(--muted); }
.contact .cta { margin-top: 14px; }

/* ── footer ────────────────────────────────────────────────────────────── */

footer { padding: 40px 24px; color: var(--dim); }

.footer-bottom {
  max-width: 1080px;
  margin: 0 auto;
  font-size: 12px;
  color: var(--dimmer);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* ── sign-in modal ─────────────────────────────────────────────────────── */

.modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in 0.2s both;
}

.modal-panel {
  position: relative;
  width: min(520px, 100%);
  border: 1px solid var(--line-bright);
  background: #050505;
  box-shadow: 0 0 80px -20px rgba(255,255,255,0.25);
  animation: modal-in 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.modal-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--dim);
}
.modal-title { margin-left: 8px; letter-spacing: 0.12em; }
.modal-x {
  margin-left: auto;
  background: transparent;
  border: 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 6px;
}
.modal-x:hover { color: #fff; }

.modal-body { padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.modal-lede { color: var(--dim); font-size: 13px; }

.prompt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.prompt-row:focus-within {
  border-color: var(--line-bright);
  box-shadow: 0 0 30px -12px rgba(255,255,255,0.6);
}

.prompt-label { flex: none; color: var(--dim); user-select: none; }

.prompt-input {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  caret-color: #fff;
  outline: none;               /* focus is shown on .prompt-row instead */
}
.prompt-input::placeholder { color: var(--dimmer); }

.prompt-go {
  flex: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  font: inherit;
  padding: 4px 12px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.prompt-go:hover:not(:disabled) { background: #fff; color: #000; border-color: #fff; }
.prompt-go:disabled { opacity: 0.4; cursor: default; }

/* Holds its line so a message appearing never shifts the dialog. */
.status { min-height: 1.6em; font-size: 13px; color: var(--dim); }
.status[data-kind="error"] { color: var(--err); }
.status[data-kind="ok"]    { color: var(--t-ok); }
.status[data-kind="busy"]  { color: var(--muted); }

.hint { font-size: 12px; color: var(--dimmer); line-height: 1.7; }
.hint code { color: var(--dim); }
.hint a { color: var(--dim); border-bottom: 1px solid var(--line); }
.hint a:hover { color: #fff; }

/* ── reveal on scroll ──────────────────────────────────────────────────── */

/* .js is set by app.js, so with scripting blocked nothing is left invisible. */
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.js .reveal.visible { opacity: 1; transform: none; }

/* Stagger for the value cards. Delays are classes, not style="" — same reason
   as .w1….w5 above. Reduced motion kills the transition outright, so these
   become inert rather than needing their own override. */
.js .reveal.r1 { transition-delay: 0s; }
.js .reveal.r2 { transition-delay: 0.09s; }
.js .reveal.r3 { transition-delay: 0.18s; }
.js .reveal.r4 { transition-delay: 0.27s; }

/* ── keyframes ─────────────────────────────────────────────────────────── */

@keyframes fade-in  { to { opacity: 1; } }
@keyframes word-in  { to { opacity: 1; transform: translateY(0); } }
@keyframes rotate  { to { transform: rotate(360deg); } }
@keyframes blink   { 50% { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(0.98); }
                     to   { opacity: 1; transform: none; } }

/* ── reduced motion ────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  /* Anything whose visible state is the END of an animation must be forced
     visible here, or turning motion off leaves the page blank. */
  .word, .eyebrow, .hero-sub, .hero .ctas { opacity: 1; transform: none; }
  .js .reveal { opacity: 1; transform: none; }
  .demo-body.playing .demo-line { visibility: visible; }
}
