:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #5b6475;
  --line: #e2e8f0;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --on-accent: #ffffff;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --code-key: #a5b4fc;
  --code-str: #86efac;
  --code-val: #fcd34d;
  --code-comment: #7c869a;
  --diagram-line: #94a3b8;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b;
    --panel: #161c25;
    --text: #e6edf3;
    --muted: #93a1b3;
    --line: #263040;
    --accent: #8b93ff;
    --accent-soft: #1d2340;
    --on-accent: #0f141b;
    --code-bg: #0b0f15;
    --diagram-line: #64748b;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
p code, li code { background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
section { padding: 88px 0; }
section + section { border-top: 1px solid var(--line); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h2 { font-size: 34px; letter-spacing: -.02em; margin-bottom: 14px; }
h3 { font-size: 19px; margin-bottom: 8px; }
.section-lead { color: var(--muted); max-width: 680px; margin: 0 0 36px; }

/* header */
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { font-weight: 700; font-size: 20px; color: var(--text); }
.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; }

/* hero */
.hero { padding: 112px 0 96px; text-align: center; }
.eyebrow { display: inline-block; margin: 0 0 22px; padding: 4px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 600; }
.hero h1 { font-size: clamp(36px, 6vw, 62px); letter-spacing: -.035em; max-width: 880px; margin: 0 auto; }
.hero h1 span { color: var(--accent); }
.lead { font-size: 20px; color: var(--muted); max-width: 720px; margin: 24px auto 36px; }
.cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn { display: inline-block; padding: 12px 22px; border-radius: 10px; font-weight: 600; font-size: 16px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }

/* patterns: one row each, visual and text swapping sides row by row */
.pattern { display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center; margin-top: 72px; }
.pattern:nth-of-type(even) .visual { order: 2; }
.visual { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  box-shadow: 0 20px 50px -30px rgba(15, 23, 42, .35); }
.diagram { display: block; width: 100%; height: auto; padding: 20px 16px 8px; }
.visual .code { border-radius: 0; margin: 0; }
.kicker { margin: 0 0 6px; color: var(--accent); font-weight: 600; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; }
.detail h3 { font-size: 28px; letter-spacing: -.02em; margin-bottom: 12px; }
.detail > p { color: var(--muted); margin: 0 0 14px; }
.detail ul { margin: 0 0 18px; padding-left: 20px; color: var(--muted); }
.detail li { margin-bottom: 6px; }
.detail .use { color: var(--text); background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; margin: 0; }

/* diagrams */
.diagram text { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; text-anchor: middle; fill: var(--text); }
.diagram .io { fill: var(--muted); font-size: 12px; }
.diagram .tag { fill: var(--muted); font-size: 11px; }
.diagram .node rect { fill: var(--panel); stroke: var(--diagram-line); stroke-width: 1.5; }
.diagram .node.root rect, .diagram .node.chosen rect { fill: var(--accent-soft); stroke: var(--accent); }
.diagram .node.pill rect { stroke-dasharray: 4 3; }
.diagram .node.pill text { font-size: 12px; fill: var(--muted); }
.diagram .node.faded rect { stroke-dasharray: 4 3; }
.diagram .node.faded text { fill: var(--muted); }
.diagram .group { fill: none; stroke: var(--diagram-line); stroke-dasharray: 5 4; }
.diagram .edge { fill: none; stroke: var(--diagram-line); stroke-width: 1.5; }
.diagram .edge.strong { stroke: var(--accent); }
.diagram .edge.dashed { stroke-dasharray: 4 3; }
.diagram .ah { fill: var(--diagram-line); }

/* how it works */
.steps { list-style: none; padding: 0; margin: 36px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.steps li { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px; }
.num { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; margin-bottom: 14px; }
.steps p, .grid p { color: var(--muted); margin: 0; font-size: 16px; }

/* code */
.code { margin: 0; background: var(--code-bg); color: var(--code-text); border-radius: 14px; padding: 22px 24px;
  overflow-x: auto; font-size: 14px; line-height: 1.65; }
.code code { font-size: inherit; }
.code .k { color: var(--code-key); }
.code .s { color: var(--code-str); }
.code .v { color: var(--code-val); }
.code .c { color: var(--code-comment); }

/* features */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 36px; }
.grid article { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }

footer { border-top: 1px solid var(--line); padding: 32px 0; color: var(--muted); font-size: 14px; }
footer p { margin: 0; }

@media (max-width: 860px) {
  section { padding: 64px 0; }
  .hero { padding: 72px 0 64px; }
  .steps, .grid, .pattern { grid-template-columns: 1fr; }
  .pattern { gap: 24px; margin-top: 56px; }
  .pattern .visual, .pattern:nth-of-type(even) .visual { order: 2; } /* text first on small screens */
  nav a:not(:first-child) { display: none; }
}
@media (max-width: 480px) {
  .wrap { padding: 0 16px; }
  .lead { font-size: 18px; }
  h2 { font-size: 28px; }
}
