:root {
  color-scheme: dark;
  /* Dark brand — character glows like a small calm being in deep space */
  --bg: #0A0E1A;
  --bg-soft: rgba(255, 255, 255, 0.05);
  --ink: #FFFFFF;
  --ink-2: rgba(255, 255, 255, 0.65);
  --ink-3: rgba(255, 255, 255, 0.42);
  --divider: rgba(255, 255, 255, 0.10);
  --field-bg: rgba(255, 255, 255, 0.07);
  --field-bg-focus: rgba(255, 255, 255, 0.12);
  --green: #4ADE80;
  --green-soft: rgba(74, 222, 128, 0.14);
  --amber: #FBBF24;
  --link: #60A5FA;
  --error: #F87171;

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', SF-Mono, Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Page-wide cursor-aware glow + center spotlight behind character. */
html { background-color: var(--bg); }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg);
  background-image:
    radial-gradient(
      720px circle at var(--cursor-x, 50%) var(--cursor-y, 50%),
      rgba(100, 150, 220, 0.10),
      rgba(10, 14, 26, 0) 55%
    ),
    radial-gradient(
      ellipse 900px 700px at 50% 48%,
      rgba(60, 100, 170, 0.18),
      rgba(10, 14, 26, 0) 65%
    );
}

/* The hero now wraps top + bottom groups with the 3D scene fully
   behind it. Top/bottom layout — character occupies the middle. */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: clamp(28px, 5vh, 64px) 24px clamp(28px, 5vh, 64px);
  text-align: center;
  gap: 24px;
}

.hero-top, .hero-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(12px, 2vh, 22px);
  width: 100%;
}

/* ─── Brand wordmark ────────────────────────────────────────────── */
.brand { opacity: 0; animation: fadeUp 1.1s 0.2s var(--ease) forwards; }

.wordmark {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(48px, 8vw, 84px);
  letter-spacing: -0.025em;
  color: var(--ink);
  line-height: 1;
}

/* ─── Pitch sentence ────────────────────────────────────────────── */
.pitch { opacity: 0; animation: fadeUp 1.1s 0.5s var(--ease) forwards; }

.pitch p {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(20px, 2.6vw, 26px);
  color: var(--ink);
  line-height: 1.45;
  max-width: 540px;
  letter-spacing: -0.005em;
}

.pitch em {
  font-style: italic;
  color: var(--ink);
}

/* ─── Character stage — full-viewport, behind everything ────────── */
.character-stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  margin: 0;
  background: transparent;
}

.character-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  background: transparent;
  /* Fade in once the scene starts rendering, so the GLB doesn't
     pop visibly at the moment Three.js takes over. */
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}

.character-stage.scene-ready .character-canvas {
  opacity: 1;
}

/* ─── Waitlist form ─────────────────────────────────────────────── */
.waitlist {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  animation: fadeUp 1.1s 1.0s var(--ease) forwards;
}

.field {
  display: flex;
  gap: 6px;
  width: min(480px, 100%);
  background: var(--field-bg);
  border-radius: 14px;
  padding: 6px;
  border: 1px solid var(--divider);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.field:focus-within {
  border-color: rgba(255, 255, 255, 0.4);
  background: var(--field-bg-focus);
}

.field.error {
  border-color: var(--error);
}

.field input[type="email"] {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--ink);
  padding: 12px 14px;
}

.field input[type="email"]::placeholder {
  color: var(--ink-3);
}

.submit-btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  color: var(--bg);
  background: var(--ink);
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  cursor: pointer;
  transition: background 0.2s var(--ease), transform 0.1s var(--ease);
  white-space: nowrap;
}

.submit-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.85); }
.submit-btn:active:not(:disabled) { transform: scale(0.98); }
.submit-btn:disabled {
  /* Visually "off" but still readable — no hover, no click affordance. */
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.5);
  cursor: not-allowed;
  transform: none;
}

.error {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--error);
  margin-top: 10px;
  min-height: 18px;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}

.error.show { opacity: 1; }

/* ─── Success state ─────────────────────────────────────────────── */
.success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}

.success.show { opacity: 1; }

.confidence-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--green-soft);
  border-radius: 11px;
  height: 22px;
}

.confidence-chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.confidence-chip .label {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
  color: var(--green);
  line-height: 1;
}

.success-text {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.success-sub {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink-2);
  max-width: 360px;
  line-height: 1.5;
}

/* ─── Citation field (orbital cards) ────────────────────────────── */
.citation-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
}

.citation-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 240px;
  padding: 12px 14px;
  background: rgba(20, 28, 50, 0.55);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
  text-align: left;
  font-family: var(--font-body);
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity 0.8s var(--ease);
  will-change: transform, opacity;
}

.citation-field.revealed .citation-card {
  animation: orbit var(--orbit-speed, 40s) linear infinite;
  animation-delay: calc(var(--orbit-phase, 0) * var(--orbit-speed, 40s) * -1);
  opacity: 0.92;
}

/* Each card travels an elliptical orbit around viewport center.
   The transform happens INSIDE the card; the card itself sits at
   left:50%, top:50% with translate(-50%,-50%) baseline. */
@keyframes orbit {
  from {
    transform:
      translate(-50%, -50%)
      translate(
        calc(cos(0turn) * var(--orbit-radius-x)),
        calc(sin(0turn) * var(--orbit-radius-y))
      );
  }
  to {
    transform:
      translate(-50%, -50%)
      translate(
        calc(cos(1turn) * var(--orbit-radius-x)),
        calc(sin(1turn) * var(--orbit-radius-y))
      );
  }
}

/* Cards stagger their fade-in after reveal */
.citation-field.revealed .citation-card:nth-child(1) { transition-delay: 0.0s; }
.citation-field.revealed .citation-card:nth-child(2) { transition-delay: 0.3s; }
.citation-field.revealed .citation-card:nth-child(3) { transition-delay: 0.6s; }
.citation-field.revealed .citation-card:nth-child(4) { transition-delay: 0.9s; }

.citation-card .citation-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 10px;
  line-height: 1;
}

.citation-card .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 6px;
}
.citation-card .dot.ship      { background: var(--green); }
.citation-card .dot.downgrade { background: var(--amber); }
.citation-card .dot.replace   { background: var(--ink-2); }

.citation-card .pct.ship      { color: var(--green); }
.citation-card .pct.downgrade { color: var(--amber); }
.citation-card .pct.replace   { color: var(--ink-2); }

.citation-card .citation-text {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.35;
  color: var(--ink);
  margin: 0;
}

.citation-card .citation-source {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--ink-3);
  margin: 4px 0 0 0;
}

/* On small screens, hide the orbital cards — they'd crowd the hero. */
@media (max-width: 768px) {
  .citation-field { display: none; }
}

/* ─── Footer ────────────────────────────────────────────────────── */
.footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  opacity: 0;
  animation: fadeUp 1.1s 1.4s var(--ease) forwards;
}

.footer .link {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

.footer .link:hover { color: var(--ink); }

.footer .dot-sep {
  color: var(--ink-3);
  font-size: 13px;
}

/* ─── Animations ────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Responsive: small screens ─────────────────────────────────── */
@media (max-width: 480px) {
  .hero { padding: 28px 18px; gap: 18px; }
  .field {
    flex-direction: column;
    gap: 8px;
    padding: 8px;
  }
  .submit-btn { width: 100%; padding: 14px; }
}

/* ─── Reduced motion ────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  /* Static fallback when motion is reduced — keep the dark page,
     show character as a still image instead of running the WebGL scene. */
  .character-stage::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('assets/hero-fallback.png') center/contain no-repeat;
    opacity: 0.85;
    filter: brightness(0.92) saturate(0.85);
  }
}
