/* One screen: the pitch and feature list on the left, a live powerhouse on the right.
   Tokens are the app's own (src/client/styles/global.css), so the site and the app match. */
:root {
  --bg: #f4f1ec;
  --surface: #fbfaf7;
  --fg: #1e1c1a;
  --muted: #6b655e;
  --line: rgb(30 28 26 / 0.1);
  --line-strong: rgb(30 28 26 / 0.22);
  --accent: #5b54e8;
  --warn: #e8930c;
  --warn-text: #9a5b00;
  --on-warn: #1e1c1a;
  --ok: #2e7a50;
  --shadow: 0 1px 2px rgb(30 28 26 / 0.06), 0 30px 70px -20px rgb(30 28 26 / 0.25);
  --shadow-sm: 0 1px 2px rgb(30 28 26 / 0.06);
  --shimmer-a: #807a72;
  --shimmer-b: #1e1c1a;
  --font: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Fragment Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171513;
    --surface: #221f1c;
    --fg: #ece7e0;
    --muted: #a39c92;
    --line: rgb(236 231 224 / 0.1);
    --line-strong: rgb(236 231 224 / 0.22);
    --accent: #8f89ff;
    --warn: #f0a43a;
    --warn-text: #f0a43a;
    --on-warn: #1e1c1a;
    --ok: #5cc48e;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 30px 70px -20px rgb(0 0 0 / 0.7);
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.35);
    --shimmer-a: #8a837a;
    --shimmer-b: #ece7e0;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #171513;
  --surface: #221f1c;
  --fg: #ece7e0;
  --muted: #a39c92;
  --line: rgb(236 231 224 / 0.1);
  --line-strong: rgb(236 231 224 / 0.22);
  --accent: #8f89ff;
  --warn: #f0a43a;
  --warn-text: #f0a43a;
  --on-warn: #1e1c1a;
  --ok: #5cc48e;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 30px 70px -20px rgb(0 0 0 / 0.7);
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.35);
  --shimmer-a: #8a837a;
  --shimmer-b: #ece7e0;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.page {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  box-sizing: border-box;
}
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; }

/* Header */
.top { display: flex; align-items: center; gap: 20px; padding-block: 16px; }
.word { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }
/* Theme switch: three icons, fixed in the bottom-right corner. */
.theme { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 4; display: flex; gap: 2px; padding: 2px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.theme button { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.theme button:hover { color: var(--fg); }
.theme button[aria-checked="true"] { background: var(--bg); color: var(--fg); }

/* Main */
.main { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 40px 64px; padding-block: 8px 28px; }
.pitch { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.stage { flex: 1 1 480px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; position: relative; }

h1 { margin: 0; font-size: clamp(36px, 4.4vw, 58px); line-height: 1.02; letter-spacing: -0.035em; font-weight: 650; text-wrap: balance; }
.lede { margin: 0; font-size: 17px; line-height: 1.55; color: var(--muted); max-width: 34em; }
.ctas { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 12px; text-decoration: none; font-weight: 600; font-size: 15px; }
.btn-primary { background: var(--fg); color: var(--bg); }
/* Cloudflare's own Deploy to Cloudflare button, as it appears in READMEs. */
.deploy { display: inline-flex; align-items: center; min-height: 46px; border-radius: 8px; }
.deploy img { display: block; height: 40px; width: auto; }
.btn-secondary { border: 1px solid var(--line-strong); }
.btn-secondary:hover { background: var(--surface); }
.oss { margin: -10px 0 0; font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* Feature list: also the demo's chapter control */
.features { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.feature { border-bottom: 1px solid var(--line); }
.feature button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 2px; border: 0; background: none; text-align: left; cursor: pointer; font-size: 15px; color: var(--muted); }
.feature button:hover { color: var(--fg); }
.feature .dot { width: 8px; height: 8px; border-radius: 2px; flex: none; background: var(--line-strong); transition: background 0.3s; }
.feature[data-active] button { color: var(--fg); font-weight: 600; }
.feature[data-active] .dot { background: var(--hue); }
.feature .bar { flex: none; width: 48px; height: 2px; border-radius: 1px; background: var(--line); overflow: hidden; visibility: hidden; }
.feature[data-active] .bar { visibility: visible; }
.feature .bar i { display: block; height: 100%; width: 0; background: var(--fg); }
.feature p { margin: 0; padding: 0 2px 12px 22px; font-size: 14px; line-height: 1.5; color: var(--muted); max-width: 36em; }
.demo-controls { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.demo-controls button { white-space: nowrap; border: 1px solid var(--line-strong); background: transparent; border-radius: 9px; min-height: 32px; padding: 0 12px; cursor: pointer; font-size: 13px; }

/* Stage: a live powerhouse */
.orb { width: min(420px, 100%); aspect-ratio: 1.25; position: relative; margin-block: -20px -12px; }
.orb canvas { width: 100%; height: 100%; display: block; }
.orb .fallback { position: absolute; inset: 10% 30%; border-radius: 50%; background: radial-gradient(circle at 36% 30%, #fff 0, #efebe4 20%, #c4bcb1 60%, #6f675e 100%); }
.status { margin: 0; font-size: 21px; font-weight: 450; letter-spacing: -0.02em; text-align: center; min-height: 1.4em; }
.app { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 6px; }
.composer { background: var(--surface); border-radius: 22px; box-shadow: var(--shadow); padding: 14px 14px 12px 18px; display: flex; gap: 12px; align-items: flex-end; margin-bottom: 8px; }
.composer .text { flex: 1; min-width: 0; font-size: 16px; line-height: 1.45; min-height: 2.9em; }
.composer .text[data-empty] { color: var(--muted); }
.composer .caret { display: inline-block; width: 1.5px; height: 1.1em; background: var(--fg); vertical-align: -0.2em; margin-left: 1px; animation: blink 1s steps(1) infinite; }
.send { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--fg); color: var(--bg); }
@keyframes blink { 50% { opacity: 0; } }

.pills { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; min-height: 160px; }
.pill { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 11px 14px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-sm); font-size: 14px; animation: rise 0.45s both cubic-bezier(0.16, 1, 0.3, 1); border: 1px solid transparent; }
.pill[data-alert] { border-color: color-mix(in oklab, var(--warn) 55%, transparent); }
.pill .d { width: 8px; height: 8px; border-radius: 2px; flex: none; background: var(--hue); }
.pill b { font-weight: 600; }
.pill .act { flex: 1 1 160px; min-width: 0; color: var(--muted); }
.pill[data-alert] .act { color: var(--warn-text); }
.pill .meta { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.pill .actions { flex-basis: 100%; display: flex; gap: 8px; padding: 6px 0 2px 18px; }
.pill .actions button { min-height: 34px; padding: 0 14px; border-radius: 9px; cursor: pointer; font-size: 13px; }
.approve { border: 0; background: var(--warn); color: var(--on-warn) !important; font-weight: 600; }
.decline { border: 1px solid var(--line-strong); background: transparent; }
.shimmer { background: linear-gradient(90deg, var(--shimmer-a) 0, var(--shimmer-b) 40%, var(--shimmer-a) 80%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent !important; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.toast { position: fixed; top: calc(16px + env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); width: min(320px, calc(100% - 32px)); display: flex; gap: 12px; padding: 12px 14px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); font-size: 13px; line-height: 1.4; animation: drop 0.5s both cubic-bezier(0.16, 1, 0.3, 1); z-index: 2; }
/* The app's own notification icon: the light orb. */
.toast-orb { flex: none; width: 34px; height: 34px; padding: 3px; box-sizing: border-box; border-radius: 9px; background: var(--bg); }
.toast b { display: block; font-size: 13px; }
.toast span { color: var(--muted); }
.toast small { font-family: var(--mono); font-size: 10px; color: var(--muted); display: block; margin-bottom: 2px; }
@keyframes drop { from { opacity: 0; transform: translateY(-10px); } }


/* Phones: the pitch, then the demo, then the feature list. */
@media (max-width: 720px) {
  .top { flex-wrap: wrap; }
  .main { flex-direction: column; align-items: stretch; }
  .pitch { display: contents; }
  .pitch > h1, .pitch > .lede, .pitch > .ctas, .pitch > .oss { order: 1; }
  .stage { order: 2; }
  .features, .demo-controls { order: 3; }
  .features { margin-top: -24px; }
}
@media (prefers-reduced-motion: reduce) {
  .shimmer, .pill, .toast, .caret { animation: none; }
}
