:root {
  --bg: #0a0e1f;
  --bg-2: #0f1530;
  --ink: #e8ecf8;
  --ink-dim: #9aa3c4;
  --ink-faint: #6b7399;
  --accent: #7aa2ff;       /* Vega blue-white */
  --accent-bright: #a9c4ff;
  --gold: #ffd479;         /* warm star highlight */
  --card: rgba(255, 255, 255, 0.035);
  --card-border: rgba(255, 255, 255, 0.08);
  --radius: 16px;
  --maxw: 1080px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 70% -10%, #1b2350 0%, transparent 55%),
    radial-gradient(900px 600px at 10% 10%, #15193a 0%, transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Subtle starfield: layered tiny dots via background-image, fixed behind all. */
.starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 65% 15%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 80% 60%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 40% 75%, rgba(255,255,255,0.45), transparent),
    radial-gradient(1px 1px at 90% 35%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.2px 1.2px at 12% 85%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 55% 50%, rgba(255,255,255,0.4), transparent);
  background-repeat: repeat;
  background-size: 600px 600px;
  opacity: 0.6;
}

main, .nav, .footer { position: relative; z-index: 1; }

/* ---- Nav ---- */
.nav {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark { width: 26px; height: 30px; overflow: visible; }
.brand-mark line { stroke: var(--accent); stroke-width: 1.2; opacity: 0.55; }
.brand-mark circle { fill: var(--accent-bright); }
.brand-mark .star-vega {
  fill: #fff;
  filter: drop-shadow(0 0 5px var(--accent-bright));
}

.brand-name {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a {
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 15px;
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--ink); }
.nav-cta {
  border: 1px solid var(--card-border);
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--ink) !important;
}
.nav-cta:hover { border-color: var(--accent); }

/* ---- Hero ---- */
.hero {
  max-width: 820px;
  margin: 0 auto;
  padding: 80px 24px 64px;
  text-align: center;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 20px;
}

.hero h1 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: clamp(38px, 6vw, 68px);
  line-height: 1.05;
  letter-spacing: -0.5px;
  margin: 0 0 24px;
  background: linear-gradient(180deg, #ffffff 0%, #c7d2f5 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  font-size: clamp(17px, 2.2vw, 20px);
  color: var(--ink-dim);
  max-width: 640px;
  margin: 0 auto 40px;
}

/* ---- Waitlist form ---- */
.waitlist {
  display: flex;
  gap: 10px;
  max-width: 480px;
  margin: 0 auto;
}

.waitlist input {
  flex: 1;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 14px 20px;
  color: var(--ink);
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.waitlist input::placeholder { color: var(--ink-faint); }
.waitlist input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(122, 162, 255, 0.06);
}

.waitlist button {
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--accent-bright), var(--accent));
  color: #0a0e1f;
  border: none;
  border-radius: 999px;
  padding: 14px 26px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.2s, opacity 0.15s;
  box-shadow: 0 6px 24px rgba(122, 162, 255, 0.25);
}
.waitlist button:hover { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(122, 162, 255, 0.35); }
.waitlist button:disabled { opacity: 0.6; cursor: default; transform: none; }

.form-note {
  margin: 16px auto 0;
  font-size: 14px;
  color: var(--ink-faint);
  min-height: 20px;
  transition: color 0.2s;
}
.form-note.success { color: var(--gold); }
.form-note.error { color: #ff8f8f; }

/* ---- Features ---- */
.features {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px 24px 20px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px;
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
}
.card:hover {
  border-color: rgba(122, 162, 255, 0.4);
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.05);
}

.card-icon {
  font-size: 22px;
  color: var(--accent-bright);
  margin-bottom: 14px;
}

.card h3 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 20px;
  margin: 0 0 10px;
}

.card p {
  margin: 0;
  color: var(--ink-dim);
  font-size: 15.5px;
}

/* ---- Closing ---- */
.closing {
  max-width: 720px;
  margin: 0 auto;
  padding: 80px 24px 60px;
  text-align: center;
}
.closing h2 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: clamp(28px, 4vw, 40px);
  margin: 0 0 14px;
}
.closing p { color: var(--ink-dim); margin: 0 0 28px; }
.closing-cta {
  display: inline-block;
  background: linear-gradient(180deg, var(--accent-bright), var(--accent));
  color: #0a0e1f;
  text-decoration: none;
  border-radius: 999px;
  padding: 13px 30px;
  font-weight: 600;
  box-shadow: 0 6px 24px rgba(122, 162, 255, 0.25);
  transition: transform 0.12s, box-shadow 0.2s;
}
.closing-cta:hover { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(122, 162, 255, 0.35); }

/* ---- Footer ---- */
.footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 32px 24px 48px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  font-size: 14px;
  border-top: 1px solid var(--card-border);
}
.footer-dot { opacity: 0.5; }

@media (max-width: 680px) {
  .features { grid-template-columns: 1fr; }
  .waitlist { flex-direction: column; }
  .waitlist button { width: 100%; }
  .nav-links a:not(.nav-cta) { display: none; }
}

/* ============================================================
   Product demo — looping faux Lyra window (editor → agent → PDF)
   Driven by classes toggled in main.js: .is-typed .is-agent
   .is-compiling .is-rendered (additive). .demo-reset disables
   transitions for an instant loop reset.
   ============================================================ */
.demo {
  max-width: 960px;
  margin: 8px auto 12px;
  padding: 0 24px;
}

.demo-window {
  border: 1px solid var(--card-border);
  border-radius: 14px;
  overflow: hidden;
  background: #0b1024;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(122, 162, 255, 0.06);
}

.demo-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--card-border);
}
.demo-dot { width: 11px; height: 11px; border-radius: 50%; background: #2a3357; }
.demo-dot:nth-child(1) { background: #ff5f56; opacity: 0.7; }
.demo-dot:nth-child(2) { background: #ffbd2e; opacity: 0.7; }
.demo-dot:nth-child(3) { background: #27c93f; opacity: 0.7; }
.demo-title {
  margin-left: 8px;
  font-size: 12.5px;
  color: var(--ink-faint);
  font-family: 'Inter', sans-serif;
}

.demo-body {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  min-height: 300px;
}

/* ---- Editor pane ---- */
.demo-editor {
  position: relative;
  padding: 18px 18px 46px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.85;
  color: #c7d0ee;
  background:
    linear-gradient(90deg, rgba(122,162,255,0.03), transparent 40%);
  overflow: hidden;
}
.code-line { white-space: nowrap; }
.ln {
  display: inline-block;
  width: 18px;
  margin-right: 16px;
  text-align: right;
  color: #44507e;
  user-select: none;
}
.tok-cmd { color: #7aa2ff; }
.tok-pun { color: #c792ea; }

/* Typed line 2: width animates 0 → full on .is-typed */
.demo-type {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: bottom;
  width: 0;
}
.is-typed .demo-type {
  width: 30ch;
  transition: width 1.7s steps(38, end);
}
.demo-caret {
  display: inline-block;
  width: 7px;
  height: 1.05em;
  vertical-align: text-bottom;
  background: #7aa2ff;
  margin-left: 1px;
  animation: caret-blink 1s steps(1) infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }

/* Agent-inserted figure block: collapses in on .is-agent */
.code-insert {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  border-left: 2px solid transparent;
  margin-left: -10px;
  padding-left: 8px;
}
.is-agent .code-insert {
  max-height: 140px;
  opacity: 1;
  border-left-color: rgba(122, 162, 255, 0.5);
  background: linear-gradient(90deg, rgba(122,162,255,0.07), transparent 70%);
  transition: max-height 0.6s ease, opacity 0.5s ease 0.1s, border-color 0.4s;
}

/* Agent toast pill */
.agent-toast {
  position: absolute;
  left: 16px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: #d7e0ff;
  background: rgba(122, 162, 255, 0.14);
  border: 1px solid rgba(122, 162, 255, 0.35);
  padding: 5px 11px;
  border-radius: 999px;
  opacity: 0;
  transform: translateY(6px);
}
.is-agent .agent-toast { opacity: 1; transform: none; transition: opacity 0.35s, transform 0.35s; }
.is-rendered .agent-toast { opacity: 0; transition: opacity 0.4s; }
.agent-spinner { display: inline-block; color: var(--accent-bright); animation: agent-spin 1.4s linear infinite; }
@keyframes agent-spin { to { transform: rotate(360deg); } }

/* ---- PDF pane ---- */
.demo-pdf {
  position: relative;
  background: #eef0f7;
  padding: 22px 22px 24px;
  border-left: 1px solid var(--card-border);
}
.pdf-status {
  position: absolute;
  top: 10px;
  right: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
}
.compile-running, .compile-done {
  padding: 3px 9px;
  border-radius: 999px;
  opacity: 0;
}
.compile-running { color: #8a6d00; background: #ffe9a8; }
.compile-done { color: #1f7a3d; background: #c8f0d4; position: absolute; right: 0; top: 0; white-space: nowrap; }
.is-compiling .compile-running { opacity: 1; transition: opacity 0.25s; }
.is-rendered .compile-running { opacity: 0; }
.is-rendered .compile-done { opacity: 1; transition: opacity 0.3s; }

.pdf-page {
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 6px 22px rgba(20, 24, 50, 0.16);
  padding: 22px 24px;
  color: #1a1f3d;
  font-family: 'Fraunces', Georgia, serif;
  min-height: 240px;
}
.pdf-h { font-weight: 600; font-size: 17px; margin-bottom: 10px; }
.pdf-p { font-size: 13px; line-height: 1.7; color: #2c3357; margin: 0 0 14px; }

.pdf-figure {
  margin: 0;
  opacity: 0;
  transform: scale(0.97) translateY(6px);
}
.is-rendered .pdf-figure { opacity: 1; transform: none; transition: opacity 0.55s ease, transform 0.55s ease; }
.pdf-figbox {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  height: 92px;
  padding: 12px;
  background: linear-gradient(180deg, #f7f8fe, #eef1fb);
  border: 1px solid #e0e4f2;
  border-radius: 4px;
}
.pdf-bar { width: 22px; border-radius: 3px 3px 0 0; background: linear-gradient(180deg, var(--accent-bright), var(--accent)); }
.pdf-bar.b1 { height: 34%; }
.pdf-bar.b2 { height: 58%; }
.pdf-bar.b3 { height: 76%; }
.pdf-bar.b4 { height: 96%; }
.pdf-cap { text-align: center; font-size: 11.5px; color: #5a627f; margin-top: 8px; font-style: italic; }

/* Instant reset between loops */
.demo-reset * { transition: none !important; }

@media (prefers-reduced-motion: reduce) {
  .demo-type { width: 30ch; }
  .code-insert { max-height: 140px; opacity: 1; }
  .pdf-figure { opacity: 1; transform: none; }
  .compile-done { opacity: 1; }
  .agent-toast, .demo-caret, .agent-spinner { display: none; }
}

@media (max-width: 680px) {
  .demo-body { grid-template-columns: 1fr; }
  .demo-pdf { border-left: none; border-top: 1px solid var(--card-border); }
}
