/* spaSHial site styles, shared by index.html, sandbox.html and docs/index.html.
   One accent, one corner radius (8px), system fonts (the site works offline).
   Dark by default; follows prefers-color-scheme. The 3D stage is always dark. */
:root {
  --bg: #14151c;
  --surface: #1c1d27;
  --raised: #262836;
  --border: #383b4f;
  --text: #f1f1ec;
  --muted: #a7b0d4;
  --accent: #ffb86c;
  --on-accent: #1d1306;
  --code-bg: #101117;
  --ok: #5af08a;
  --warn: #f3e68a;
  --err: #ff8585;
  --stage: #1e1f29;
  --radius: 8px;
  --shadow: 0 1px 0 rgb(0 0 0 / .25), 0 12px 32px -16px rgb(0 0 0 / .6);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f5f9;
    --surface: #ffffff;
    --raised: #ebebf3;
    --border: #cfd2e2;
    --text: #1b1c26;
    --muted: #4f5578;
    --accent: #a85200;
    --on-accent: #ffffff;
    --code-bg: #f0f0f6;
    --ok: #137a3a;
    --warn: #8a6a00;
    --err: #b3261e;
    --shadow: 0 1px 0 rgb(0 0 0 / .04), 0 12px 32px -18px rgb(30 30 60 / .35);
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
code, pre, kbd, textarea { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* buttons: primary is the accent, everything else is quiet */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--raised); color: var(--text); font: 600 14px/1.2 var(--font);
  text-decoration: none; cursor: pointer; white-space: nowrap; transition: transform .12s ease, background .12s ease; }
.btn:hover { background: color-mix(in srgb, var(--raised) 80%, var(--text) 8%); }
.btn:active { transform: translateY(1px) scale(.985); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, white 12%); }
.btn.small { padding: 6px 12px; font-size: 13px; }
select.btn { appearance: auto; padding-right: 10px; }

/* the top bar */
.bar { display: flex; align-items: center; gap: 18px; height: 60px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.bar .brand { font: 700 18px/1 var(--font); color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.bar .brand b { color: var(--accent); }
.bar nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.bar nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: var(--radius); font-size: 14px; }
.bar nav a:hover, .bar nav a[aria-current] { color: var(--text); background: var(--raised); }

/* a live sketch: the stage and its console line */
.stage { position: relative; background: var(--stage); border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; border: 1px solid var(--border); }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--stage); }
.stage .idle { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, #1e1f29 88%, transparent); }
.stage .idle[hidden] { display: none; }
.console { font: 12.5px/1.5 var(--mono); color: var(--muted); min-height: 1.5em; white-space: pre-wrap; }
.console .error { color: var(--err); }
.console .warn { color: var(--warn); }
.console .ok { color: var(--ok); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
