:root {
  --bg: #fbfbf9;
  --surface: #ffffff;
  --text: #1c1c1a;
  --muted: #5d5d58;
  --line: #e2e1dc;
  --accent: #2b6fd6;
  --accent-soft: rgba(43, 111, 214, 0.09);
  --ok: #217a45;
  --term-bg: #17181b;
  --term-text: #e6e6e3;
  --term-dim: #9a9a95;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121315;
    --surface: #1a1b1e;
    --text: #ececea;
    --muted: #a4a49f;
    --line: #2c2d31;
    --accent: #6ea4ff;
    --accent-soft: rgba(110, 164, 255, 0.12);
    --ok: #63c58b;
    --term-bg: #0b0c0d;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code { font-family: var(--mono); font-size: 0.88em; }
p code, li code, figcaption code {
  background: var(--accent-soft);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }

/* nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 19px; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
nav { display: flex; gap: 22px; font-size: 15px; }
nav a { color: var(--muted); }
nav a:hover { color: var(--text); text-decoration: none; }
nav .gh { color: var(--text); font-weight: 600; }

/* hero */
.hero { padding: 88px 24px 40px; }
.preview {
  display: inline-block;
  margin: 0 0 22px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13.5px;
}
h1 {
  margin: 0;
  max-width: 15ch;
  font-size: clamp(38px, 6.4vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.lead { max-width: 58ch; margin: 22px 0 30px; color: var(--muted); font-size: 20px; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 44px; }
.btn {
  display: inline-block;
  padding: 11px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
}
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }

.term {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  border-radius: 10px;
  background: var(--term-bg);
  color: var(--term-text);
  font: 14px/1.65 var(--mono);
}
.term code { font-size: inherit; }
.term .p { color: var(--term-dim); user-select: none; }
.term .dim { color: var(--term-dim); }
.term .ok { color: #7fd6a0; }

/* split */
.split {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding-top: 32px;
  padding-bottom: 32px;
}
.split > div { padding: 20px 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.split h2 { margin: 0 0 6px; font-size: 18px; }
.split p { margin: 0; color: var(--muted); font-size: 15.5px; }
.split .accent { border-color: var(--accent); background: var(--accent-soft); }

/* sections */
section { padding-top: 40px; padding-bottom: 40px; }
.section { margin: 0 0 22px; font-size: 30px; letter-spacing: -0.02em; line-height: 1.2; }
.wide { max-width: 68ch; color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid.two { grid-template-columns: repeat(2, 1fr); margin-top: 28px; }
.grid article { padding: 20px 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.grid h3 { margin: 0 0 6px; font-size: 17px; }
.grid p { margin: 0; color: var(--muted); font-size: 15.5px; }

/* diagram */
.diagram { margin: 0; padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.diagram svg { display: block; width: 100%; height: auto; }
.diagram figcaption { margin-top: 14px; color: var(--muted); font-size: 15.5px; }
.diagram .edges path { stroke: var(--muted); stroke-width: 1.25; }
.diagram .mk { fill: var(--muted); }
.diagram rect { fill: none; stroke: var(--line); stroke-width: 1.5; }
.diagram .main rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.diagram text { fill: var(--muted); font: 11.5px var(--sans); text-anchor: middle; }
.diagram text.name { fill: var(--text); font-size: 13px; font-weight: 600; }
.diagram .main text { fill: var(--text); }
.diagram .label text.start { text-anchor: start; }

/* steps */
.steps { margin: 0 0 18px; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 18px; }
.steps li { counter-increment: step; }
.steps h3 { margin: 0 0 8px; font-size: 17px; }
.steps h3::before { content: counter(step) ". "; color: var(--muted); }

/* table */
.table { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 15.5px; }
th, td { padding: 12px 18px; text-align: left; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 600; font-size: 14px; }
td:not(:first-child), th:not(:first-child) { white-space: nowrap; font-variant-numeric: tabular-nums; }

.note p {
  margin: 0;
  padding: 18px 22px;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--accent-soft);
  font-size: 15.5px;
}

.foot { padding-top: 32px; padding-bottom: 48px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14.5px; }
.foot p { margin: 6px 0; }

@media (max-width: 820px) {
  .split, .grid, .grid.two { grid-template-columns: 1fr; }
  nav a:not(.gh) { display: none; }
  .hero { padding-top: 56px; }
  .lead { font-size: 18px; }
  .diagram { padding: 12px; }
}
