:root {
  --bg: #f6f5f0;
  --surface: #ffffff;
  --text: #1f1e1a;
  --muted: #66635a;
  --border: #d9d6cc;
  --accent: #2f5fd0;
  --accent-soft: #e6ecfb;
  --accent-text: #ffffff;
  --code-bg: #efede6;
  --comment: #7c7869;
  --shadow: 0 10px 30px rgba(31, 30, 26, .08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141412;
    --surface: #1d1d1a;
    --text: #e9e7e0;
    --muted: #a19e93;
    --border: #36352f;
    --accent: #7aa2ff;
    --accent-soft: #1d2740;
    --accent-text: #0f1420;
    --code-bg: #1a1a17;
    --comment: #8a877b;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
code, pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
code { font-size: .88em; background: var(--code-bg); padding: .1em .35em; border-radius: 4px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
section { padding: 56px 0 8px; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.3rem, 6vw, 4rem); margin: .2em 0 .35em; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin: 0 0 .6em; }
h3 { font-size: 1.15rem; margin: 0 0 .4em; }

/* ---- header ---- */
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.top nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 56px; }
.brand { font-weight: 800; letter-spacing: -0.02em; color: var(--text); text-decoration: none; font-size: 1.1rem; }
.links { display: flex; gap: 20px; flex-wrap: wrap; justify-content: flex-end; }
.links a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.links a:hover { color: var(--text); }
@media (max-width: 760px) { .links a:not(:last-child) { display: none; } }

/* ---- hero ---- */
.hero { padding-top: 72px; }
.eyebrow { color: var(--accent); font-weight: 600; font-size: .9rem; text-transform: uppercase; letter-spacing: .08em; margin: 0; }
.lede { font-size: 1.2rem; max-width: 46em; color: var(--muted); }
.lede em { color: var(--text); font-style: normal; font-weight: 600; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.button {
  display: inline-block; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--border);
  color: var(--text); text-decoration: none; font-weight: 600; background: var(--surface);
}
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* ---- demo ---- */
#demo { padding-top: 40px; }
.demo-frame { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); background: var(--surface); }
.demo-frame iframe { display: block; width: 100%; height: 520px; border: 0; }
@media (max-width: 700px) { .demo-frame iframe { height: 600px; } }
.caption { color: var(--muted); font-size: .95rem; max-width: 52em; }

/* ---- how ---- */
.cols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 36px; align-items: start; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } }
pre {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 18px; overflow-x: auto; font-size: .82rem; line-height: 1.55; margin: 0 0 1em;
}
pre code { background: none; padding: 0; font-size: inherit; }
pre .c { color: var(--comment); }
.ideas dt { font-weight: 700; margin-top: 12px; }
.ideas dd { margin: 2px 0 0; color: var(--muted); }

.diagram { margin: 40px 0 0; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.diagram svg { width: 100%; height: auto; display: block; }
.diagram .box rect { fill: var(--bg); stroke: var(--border); stroke-width: 1.5; }
.diagram .box.accent rect { fill: var(--accent-soft); stroke: var(--accent); }
.diagram text { fill: var(--text); font: 600 14px system-ui, sans-serif; text-anchor: middle; }
.diagram text.small { font-weight: 400; font-size: 12px; fill: var(--muted); }
.diagram text.label { text-anchor: middle; }
.diagram .line path { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.diagram .line path.back { stroke-dasharray: 5 4; }
.diagram .fill-line { fill: var(--muted); }

/* ---- cards and tables ---- */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 18px 0; }
@media (max-width: 760px) { .cards { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px 22px; }
.card p { margin: 0; color: var(--muted); }
.card p.more { margin-top: 12px; }
.card h3 a { color: var(--text); }
.tag { font-size: .75rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 99px; vertical-align: middle; margin-left: 6px; }

.map { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: .95rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.map caption { text-align: left; font-weight: 700; padding-bottom: 8px; }
.map th, .map td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.map tr:last-child td { border-bottom: 0; }
.map th { background: var(--code-bg); font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.map td:first-child { white-space: nowrap; }
@media (max-width: 600px) { .map td:first-child { white-space: normal; } }
.small-print { color: var(--muted); font-size: .9rem; }

/* ---- footer ---- */
.bottom { margin-top: 64px; border-top: 1px solid var(--border); padding: 24px 0 40px; color: var(--muted); font-size: .9rem; }
.bottom .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
