:root {
  --bg: #0f1419;
  --bg-elevated: #1a2332;
  --bg-card: #151d2a;
  --border: #2a3548;
  --text: #e8eef7;
  --text-muted: #8b9bb4;
  --accent: #3d9cf0;
  --accent-2: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --code-bg: #0a0e14;
  --link: #7dd3fc;
  --radius: 12px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Fira Code", "SF Mono", Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f7fb;
    --bg-elevated: #ffffff;
    --bg-card: #ffffff;
    --border: #d5deea;
    --text: #0f172a;
    --text-muted: #64748b;
    --code-bg: #0f172a;
    --link: #0369a1;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
}

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

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

/* Header / nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}
.logo span { color: var(--accent); }

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  font-size: 0.82rem;
}
.nav a { color: var(--text-muted); text-decoration: none; }
.nav a:hover { color: var(--accent); }

/* Hero */
.hero {
  padding: 2.75rem 0 1.5rem;
}
.hero .badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}
.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 0.85rem;
}
.hero .lede {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 62ch;
  margin-bottom: 1.25rem;
}
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.meta-row strong { color: var(--text); font-weight: 600; }

.callout {
  margin: 1.5rem 0;
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 0.92rem;
}
.callout.warn {
  border-color: color-mix(in srgb, var(--warn) 45%, var(--border));
  background: color-mix(in srgb, var(--warn) 8%, var(--bg-card));
}
.callout.danger {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
  background: color-mix(in srgb, var(--danger) 8%, var(--bg-card));
}
.callout.info {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-card));
}
.callout strong { display: block; margin-bottom: 0.35rem; }

/* Sections */
section {
  padding: 2.25rem 0 0.5rem;
  border-top: 1px solid var(--border);
  margin-top: 1.5rem;
}
section h2 {
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}
section h3 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--text);
}
section p, section li { color: var(--text-muted); }
section p { margin-bottom: 0.85rem; }
section ul, section ol {
  margin: 0.5rem 0 1rem 1.25rem;
}
section li { margin-bottom: 0.4rem; }
section li strong { color: var(--text); }

/* Flow diagram */
.flow {
  margin: 1.5rem 0;
  padding: 1.5rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}
.flow svg { display: block; width: 100%; min-width: 640px; height: auto; }

/* Cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
  margin: 1rem 0 1.5rem;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.card h4 {
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
}
.card p { font-size: 0.88rem; margin: 0; }

/* Checklist */
.checklist {
  list-style: none;
  margin-left: 0 !important;
  counter-reset: step;
}
.checklist li {
  counter-increment: step;
  position: relative;
  padding: 0.85rem 1rem 0.85rem 3.25rem;
  margin-bottom: 0.55rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.checklist li::before {
  content: counter(step);
  position: absolute;
  left: 0.85rem;
  top: 0.85rem;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.checklist li strong { display: block; margin-bottom: 0.2rem; color: var(--text); }

/* Code */
pre {
  background: var(--code-bg);
  color: #e2e8f0;
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.55;
  margin: 0.75rem 0 1.25rem;
  border: 1px solid #1e293b;
}
code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
pre code { background: none; padding: 0; font-size: inherit; color: inherit; }

.example-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

/* Tables */
.table-wrap { overflow-x: auto; margin: 1rem 0; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
th, td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  color: var(--text);
  font-weight: 600;
  background: var(--bg-elevated);
}
td { color: var(--text-muted); }

/* Sources */
.sources li { margin-bottom: 0.55rem; word-break: break-word; }

.footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 600px) {
  .nav { font-size: 0.75rem; gap: 0.3rem 0.65rem; }
  .checklist li { padding-left: 3rem; }
}
