:root {
  color-scheme: light;
  --text: #1f2328;
  --muted: #59636e;
  --background: #ffffff;
  --surface: #f6f8fa;
  --border: #d1d9e0;
  --accent: #0969da;
  --accent-dark: #0550ae;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--background);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

header,
main,
footer {
  width: min(1080px, calc(100% - 40px));
  margin-inline: auto;
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
}

header > a:first-child,
header > strong {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 650;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

nav a {
  padding: 8px 10px;
  color: var(--muted);
  border-radius: 6px;
  font-size: 0.9rem;
}

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

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

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

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

main {
  min-height: calc(100vh - 180px);
  padding: 64px 0;
}

.hero {
  padding-top: 72px;
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  align-items: center;
  gap: 56px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  max-width: 820px;
  margin: 0 0 18px;
  color: var(--text);
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

main:not(.hero) h1 {
  font-size: clamp(2.3rem, 5vw, 3.5rem);
}

h2 {
  margin: 56px 0 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-size: clamp(1.45rem, 3vw, 1.9rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

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

p,
li {
  color: var(--text);
}

.lede {
  max-width: 720px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 1.15rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  color: #ffffff;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  font-weight: 600;
}

.button:hover {
  color: #ffffff;
  background: var(--accent-dark);
  text-decoration: none;
}

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

.button.secondary:hover {
  color: var(--text);
  background: var(--surface);
}

.terminal {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.terminal::before {
  display: block;
  padding: 9px 14px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  content: "Quick start";
  font-size: 0.8rem;
  font-weight: 600;
}

.terminal pre {
  margin: 0;
  border: 0;
  border-radius: 0;
}

.prompt {
  color: #1a7f37;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 48px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.stat {
  padding: 18px;
  text-align: center;
}

.stat + .stat {
  border-left: 1px solid var(--border);
}

.stat strong {
  display: block;
  font-size: 1rem;
}

.stat span {
  color: var(--muted);
  font-size: 0.85rem;
}

.grid,
.flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.flow {
  grid-template-columns: repeat(4, 1fr);
  counter-reset: flow;
}

.card {
  padding: 20px;
  color: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--background);
}

a.card:hover {
  color: inherit;
  border-color: #8c959f;
  background: var(--surface);
  text-decoration: none;
}

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

.card .number {
  display: block;
  margin-bottom: 18px;
  color: var(--muted);
  font: 600 0.72rem/1 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.06em;
}

.flow .card {
  counter-increment: flow;
}

.flow .card::before {
  display: block;
  margin-bottom: 14px;
  color: var(--muted);
  content: counter(flow);
  font: 600 0.8rem/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

code {
  padding: 2px 5px;
  color: #6639ba;
  background: var(--surface);
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.88em;
}

pre {
  overflow-x: auto;
  padding: 18px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

pre code {
  padding: 0;
  color: inherit;
  background: transparent;
}

table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  border-spacing: 0;
}

tbody {
  display: table;
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

tr:last-child th,
tr:last-child td {
  border-bottom: 0;
}

th {
  background: var(--surface);
  font-weight: 600;
}

.note {
  padding: 14px 16px;
  border: 1px solid #b6d4fe;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: #f0f6ff;
}

.api-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  align-items: start;
  gap: 40px;
  margin-top: 40px;
}

.api-index {
  position: sticky;
  top: 88px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.api-index strong {
  display: block;
  margin-bottom: 10px;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.api-index a {
  display: block;
  padding: 5px 8px;
  color: var(--muted);
  border-radius: 5px;
  font-size: 0.9rem;
}

.api-index a:hover {
  color: var(--accent);
  background: var(--background);
  text-decoration: none;
}

.api-content {
  min-width: 0;
}

.api-section {
  scroll-margin-top: 80px;
}

.api-content > .api-section:first-child h2 {
  margin-top: 0;
}

.signature {
  border-left: 4px solid var(--accent);
}

.badge {
  display: inline-block;
  margin: 0 5px 5px 0;
  padding: 2px 8px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.78rem;
}

.source-link {
  display: inline-block;
  margin-right: 14px;
  font-size: 0.9rem;
  font-weight: 600;
}

.diagram {
  overflow-x: auto;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--background);
}

.diagram .mermaid {
  display: flex;
  justify-content: center;
  min-width: 720px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.diagram svg {
  max-width: 100%;
  height: auto;
}

.diagram-caption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

footer {
  margin-top: 40px;
  padding: 24px 0 36px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

@media (max-width: 800px) {
  header {
    position: static;
    align-items: flex-start;
  }

  .hero-layout {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .flow {
    grid-template-columns: 1fr 1fr;
  }

  .api-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .api-index {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .api-index strong {
    grid-column: 1 / -1;
  }
}

.demo-shot {
  display: block;
  width: min(100%, 820px);
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

@media (max-width: 560px) {
  header {
    display: block;
  }

  nav {
    margin-top: 8px;
  }

  nav a {
    padding-left: 0;
    margin-right: 10px;
    background: transparent;
  }

  main {
    padding-top: 44px;
  }

  .stats,
  .flow {
    grid-template-columns: 1fr;
  }

  .stat + .stat {
    border-top: 1px solid var(--border);
    border-left: 0;
  }
}
