:root {
  --bg: #efe9e1;
  --ink: #1b1a19;
  --muted: #6d6760;
  --line: rgba(27, 26, 25, 0.12);
  --card: rgba(255, 255, 255, 0.55);
  --accent: #ff5a36;
  --btn: rgba(255, 255, 255, 0.72);
  --btn-hover: #ffffff;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111114;
    --ink: #f2efe9;
    --muted: #9a958e;
    --line: rgba(242, 239, 233, 0.12);
    --card: rgba(255, 255, 255, 0.04);
    --btn: rgba(30, 30, 34, 0.72);
    --btn-hover: #2a2a30;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

em { font-style: italic; color: var(--accent); }

/* ---------- top bar ---------- */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px clamp(16px, 4vw, 40px);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.brand .dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
}
.topbar nav { display: flex; gap: 20px; font-size: 14px; }
.topbar nav a { text-decoration: none; color: var(--muted); }
.topbar nav a:hover { color: var(--ink); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 520px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#scene.grabbing { cursor: grabbing; }

.loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
  transition: opacity 0.6s ease;
}
.loader span {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent);
  animation: bounce 0.7s cubic-bezier(.3,.0,.7,1) infinite alternate;
}
.loader.done { opacity: 0; pointer-events: none; }
@keyframes bounce { from { transform: translateY(-24px); } to { transform: translateY(0) scale(1.15, 0.85); } }

.hero-copy {
  position: absolute;
  left: clamp(16px, 4vw, 40px);
  top: clamp(72px, 12vh, 120px);
  max-width: 520px;
  pointer-events: none;
}
.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
h1, h2 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 0.95;
  margin: 0;
}
h1 { font-size: clamp(44px, 7vw, 88px); }
.lede {
  margin: 16px 0 0;
  max-width: 380px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--muted);
}

.hud {
  position: absolute;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--btn);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  max-width: calc(100vw - 32px);
  overflow-x: auto;
  scrollbar-width: none;
}
.hud button {
  font: 500 13px/1 var(--sans);
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}
.hud button:hover { background: var(--btn-hover); }
.hud button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.hud kbd {
  font: 500 10px/1 var(--sans);
  padding: 3px 5px;
  border-radius: 4px;
  border: 1px solid var(--line);
  opacity: 0.7;
}
@media (hover: none), (max-width: 640px) {
  .hud kbd { display: none; }
  .hud button { padding: 10px 12px; }
}

.stats {
  position: absolute;
  right: clamp(16px, 4vw, 40px);
  top: 64px;
  font: 500 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
  text-align: right;
  pointer-events: none;
}

.scroll-hint {
  position: absolute;
  right: clamp(16px, 4vw, 40px);
  bottom: max(28px, env(safe-area-inset-bottom));
  text-decoration: none;
  color: var(--muted);
  font-size: 18px;
}
@media (max-width: 640px) { .scroll-hint { display: none; } }

/* ---------- content ---------- */
main { padding: 0 clamp(16px, 4vw, 40px); }

.how, .deploy {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(72px, 12vw, 140px) 0 0;
}
h2 { font-size: clamp(36px, 5vw, 64px); max-width: 760px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 48px;
}
.cards article {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
}
.num { font: 500 12px/1 ui-monospace, monospace; color: var(--accent); }
.cards h3 { margin: 18px 0 8px; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.cards p { margin: 0; color: var(--muted); line-height: 1.6; font-size: 15px; }

.deploy pre {
  margin: 32px 0 16px;
  padding: 18px 20px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--bg);
  overflow-x: auto;
  font-size: 14px;
}
.deploy p { color: var(--muted); line-height: 1.6; }
.deploy p code {
  font-size: 0.9em;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
}

footer {
  max-width: 1100px;
  margin: clamp(72px, 12vw, 140px) auto 0;
  padding: 24px clamp(16px, 4vw, 40px) 40px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.noscript { text-align: center; padding: 40px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .loader span { animation: none; }
}
