:root, [data-theme="dark"] {
  --bg: #0f1115;
  --surface: #171a21;
  --border: #2a2f3a;
  --text: #e8eaed;
  --muted: #9aa3b2;
  --accent: #6ee7b7;
  --accent-dim: #34d399;
  --code-bg: #0a0c10;
  --code-text: #d1d5db;
  --warn: #fbbf24;
  --btn-bg: #1c212b;
  --btn-hover: #252b38;
  --radius: 10px;
  --max: 720px;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --border: #ddd9d0;
  --text: #1a1c1f;
  --muted: #5c6570;
  --accent: #0d7a55;
  --accent-dim: #0a6b4a;
  --code-bg: #efece4;
  --code-text: #1a1c1f;
  --warn: #a16207;
  --btn-bg: #efece4;
  --btn-hover: #e4e0d6;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

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

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem 1.25rem 4rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.logo {
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font);
  font-size: 0.85rem;
  color: var(--text);
  background: var(--btn-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.theme-btn:hover { background: var(--btn-hover); }

.theme-icon::before {
  content: "◐";
  font-size: 0.95rem;
  line-height: 1;
}

[data-theme="light"] .theme-icon::before { content: "◑"; }

.theme-label { color: var(--muted); }

header {
  padding: 0 0 1.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.25rem;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--accent-dim);
  margin: 0 0 0.65rem;
}

h1 {
  font-size: clamp(1.7rem, 4.8vw, 2.3rem);
  font-weight: 650;
  line-height: 1.2;
  margin: 0 0 0.85rem;
  letter-spacing: -0.025em;
}

.lede {
  color: var(--muted);
  font-size: 1.08rem;
  margin: 0;
  max-width: 40ch;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.15rem;
  margin-top: 1.6rem;
  font-size: 0.95rem;
}

nav a { color: var(--text); }
nav a:hover { color: var(--accent); }

section { margin: 2.75rem 0; }

h2 {
  font-size: 1.22rem;
  font-weight: 650;
  margin: 0 0 0.85rem;
  letter-spacing: -0.015em;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
  color: var(--muted);
}

p { margin: 0 0 1rem; }

.footnote {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 1.25rem;
}

ul.plain {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

ul.plain li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.75rem;
}

ul.plain li:last-child { border-bottom: none; }

ul.plain strong {
  color: var(--accent-dim);
  font-weight: 600;
  font-size: 0.9rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  margin: 1rem 0;
}

.card h3 { margin-top: 0; color: var(--text); }

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 0.65rem 0 0.65rem 2.5rem;
  border-bottom: 1px solid var(--border);
}

.steps li:last-child { border-bottom: none; }

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.7rem;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--code-bg);
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

pre, code {
  font-family: var(--mono);
  font-size: 0.82rem;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 0.75rem 0 1.25rem;
  line-height: 1.5;
  color: var(--code-text);
}

code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

.kv {
  display: grid;
  gap: 0.65rem;
  margin: 1rem 0 0;
}

.kv dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0;
}

.kv dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  word-break: break-all;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  color: var(--accent);
}

.note {
  font-size: 0.9rem;
  color: var(--muted);
  border-left: 3px solid var(--border);
  padding-left: 0.85rem;
  margin: 1rem 0;
}

.note.warn { border-left-color: var(--warn); }

footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 520px) {
  ul.plain li {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
  body { font-size: 16px; }
  .wrap { padding: 1rem 1rem 3rem; }
  .theme-label { display: none; }
}
