:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --text: #16202c;
  --muted: #566273;
  --border: #dde2e8;
  --accent: #0f6b5c;
  --accent-strong: #0a5145;
  --accent-soft: #e3f2ef;
  --accent-text: #ffffff;
  --code-bg: #10161f;
  --code-text: #e6edf3;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 16px rgba(16, 24, 40, 0.06);
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #151b23;
    --surface-2: #1c2430;
    --text: #e6edf3;
    --muted: #9aa7b6;
    --border: #2a3441;
    --accent: #3fc1a5;
    --accent-strong: #6fd6bf;
    --accent-soft: #12302b;
    --accent-text: #06231d;
    --code-bg: #0a0e14;
    --code-text: #e6edf3;
    --shadow: none;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
}

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

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}

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

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
}

.brand {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand svg {
  width: 28px;
  height: 28px;
  flex: none;
}

.brand .shield {
  fill: var(--accent);
}

.brand .keyhole {
  fill: var(--accent-text);
}

.site-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.93rem;
  padding: 6px 10px;
  border-radius: 8px;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

/* Hero */
.hero {
  padding: 72px 0 48px;
}

.eyebrow {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.eyebrow li {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 4px 12px;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
  margin: 0 0 20px;
  max-width: 20ch;
}

.hero .lead {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 62ch;
  margin: 0 0 32px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
}

.button:hover {
  color: var(--text);
  border-color: var(--muted);
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.button.primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--accent-text);
}

/* Sections */
section {
  padding: 56px 0;
}

section + section {
  border-top: 1px solid var(--border);
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 12px;
}

.section-lead {
  color: var(--muted);
  max-width: 68ch;
  margin: 0 0 32px;
}

h3 {
  font-size: 1.05rem;
  margin: 0 0 8px;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

.card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.card p {
  margin: 0;
  color: var(--muted);
}

.card .icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-strong);
  margin-bottom: 14px;
}

.card .icon svg {
  width: 20px;
  height: 20px;
}

/* Diagram */
.diagram {
  margin: 0 0 32px;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 32px;
}

.diagram svg {
  display: block;
  width: 100%;
  min-width: 640px;
  height: auto;
}

.diagram-hint {
  display: none;
  margin: -24px 0 24px;
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 680px) {
  .diagram-hint {
    display: block;
  }
}

.diagram .node rect {
  fill: var(--surface-2);
  stroke: var(--border);
  stroke-width: 1.5;
}

.diagram .node.main rect {
  fill: var(--accent-soft);
  stroke: var(--accent);
  stroke-width: 2;
}

.diagram .node text {
  fill: var(--text);
  font: 600 15px system-ui, sans-serif;
}

.diagram .node .sub {
  fill: var(--muted);
  font: 400 12px system-ui, sans-serif;
}

.diagram .edge {
  stroke: var(--muted);
  stroke-width: 1.75;
  fill: none;
}

.diagram .edge-label {
  fill: var(--muted);
  font: 500 12px system-ui, sans-serif;
}

.diagram .arrowhead {
  fill: var(--muted);
}

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 14px 16px 14px 56px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 16px;
  top: 14px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--accent);
  color: var(--accent-text);
}

/* Code */
code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--surface-2);
  border-radius: 5px;
  padding: 1px 5px;
}

pre {
  margin: 12px 0 0;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 10px;
  padding: 16px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.55;
}

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

.quickstart {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.card code {
  overflow-wrap: anywhere;
}

.quickstart .card p + pre {
  margin-top: 12px;
}

.quickstart h3 .num {
  color: var(--accent);
  margin-right: 6px;
}

/* Compatibility */
.specs {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}

.specs ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.specs li + li {
  margin-top: 4px;
}

.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.checklist li {
  position: relative;
  padding-left: 30px;
}

.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-soft)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%230f6b5c' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 10.5l3.2 3L15 7'/%3E%3C/svg%3E")
    center / 12px no-repeat;
}

.note {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 20px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0 48px;
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--text);
}

@media (max-width: 640px) {
  .hero {
    padding: 48px 0 32px;
  }

  section {
    padding: 40px 0;
  }

  .site-nav .optional {
    display: none;
  }

  .site-nav a {
    padding: 6px 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

@media (prefers-color-scheme: dark) {
  .checklist li::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%233fc1a5' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 10.5l3.2 3L15 7'/%3E%3C/svg%3E");
  }
}
