:root {
  --bg: #fbfaf7;
  --surface: #f3f1ec;
  --text: #1c2024;
  --muted: #565d64;
  --rule: #dedad1;
  --accent: #0d5c58;
  --accent-ink: #ffffff;
  --code-bg: #efece5;
  --get: #0d5c58;
  --post: #8a4b08;
  --focus: #0d5c58;
  --font: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121517;
    --surface: #1a1e21;
    --text: #e7e5e0;
    --muted: #a5abb0;
    --rule: #2c3236;
    --accent: #72c7bf;
    --accent-ink: #0b1213;
    --code-bg: #1d2225;
    --get: #72c7bf;
    --post: #e4a35a;
    --focus: #72c7bf;
    color-scheme: dark;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  overflow-wrap: break-word;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

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

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--accent-ink);
  z-index: 10;
}
.skip:focus { top: 8px; }

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

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.site-header { border-bottom: 1px solid var(--rule); }
.site-header .bar { min-height: 60px; }

.brand {
  color: var(--text);
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
  font-size: 1.05rem;
}

.menu { display: flex; gap: 4px 20px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.menu a { color: var(--muted); text-decoration: none; padding: 4px 0; }
.menu a:hover, .menu a[aria-current="page"] { color: var(--text); }
.menu a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }

.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 72px;
  color: var(--muted);
  font-size: 0.875rem;
}
.site-footer .bar { min-height: 64px; padding-top: 12px; padding-bottom: 12px; }
.site-footer a { color: var(--muted); }

h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -0.01em; scroll-margin-top: 16px; }
h1 { font-size: 2rem; margin: 0 0 16px; font-weight: 650; }
h2 { font-size: 1.35rem; margin: 48px 0 12px; font-weight: 620; }
h3 { font-size: 1.08rem; margin: 32px 0 8px; font-weight: 620; }
h4 { font-size: 0.95rem; margin: 20px 0 6px; font-weight: 620; color: var(--muted); }

p, ul, ol { margin: 0 0 16px; }
li { margin: 4px 0; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 40px 0; }

code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 4px;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 20px;
  line-height: 1.5;
}
pre code { background: none; padding: 0; font-size: 0.84rem; }

.table { overflow-x: auto; margin: 0 0 20px; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; vertical-align: top; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--rule); }
th { font-weight: 600; color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }
td code { white-space: nowrap; }

.note {
  border-left: 3px solid var(--accent);
  background: var(--surface);
  padding: 12px 16px;
  margin: 0 0 20px;
}
.note p:last-child { margin-bottom: 0; }

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

/* home */

.hero { padding: 72px 0 40px; max-width: 760px; }
.hero h1 { font-size: clamp(2rem, 5vw, 2.9rem); letter-spacing: -0.02em; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 62ch; }

.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.button {
  display: inline-block;
  padding: 10px 18px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  text-decoration: none;
  font-weight: 560;
}
.button.primary { background: var(--accent); color: var(--accent-ink); }
.button:hover { text-decoration: underline; }

.section { padding: 32px 0; border-top: 1px solid var(--rule); }
.section > h2 { margin-top: 8px; }
.kicker { color: var(--muted); max-width: 64ch; }

.rows { list-style: none; padding: 0; margin: 24px 0 0; }
.rows li {
  display: grid;
  grid-template-columns: minmax(180px, 280px) 1fr;
  gap: 8px 32px;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
  margin: 0;
}
.rows li:last-child { border-bottom: 1px solid var(--rule); }
.rows h3 { margin: 0; font-size: 1rem; }
.rows p { margin: 0; color: var(--muted); }

.steps { list-style: none; counter-reset: step; padding: 0; margin: 24px 0 0; max-width: 760px; }
.steps li { counter-increment: step; position: relative; padding: 0 0 18px 44px; margin: 0; }
.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1px;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
}

/* docs */

.docs {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 48px;
  padding-top: 40px;
}

.sidenav { font-size: 0.92rem; position: sticky; top: 16px; align-self: start; max-height: calc(100vh - 32px); overflow-y: auto; }
.sidenav ul { list-style: none; padding: 0; margin: 0 0 16px; }
.sidenav li { margin: 0; }
.sidenav a { display: block; color: var(--muted); text-decoration: none; padding: 4px 0; }
.sidenav a:hover, .sidenav a[aria-current="page"] { color: var(--text); }
.sidenav a[aria-current="page"] { font-weight: 600; }
.sidenav-title { margin: 0 0 4px; font-weight: 600; }
.sidenav-title a { color: var(--text); }

.prose { max-width: 76ch; min-width: 0; }
.reference { max-width: 92ch; }

.onpage { border-left: 1px solid var(--rule); padding-left: 16px; margin: 0 0 32px; font-size: 0.92rem; }
.onpage p { margin: 0 0 4px; color: var(--muted); }
.onpage ul { list-style: none; padding: 0; margin: 0; }
.onpage li { margin: 2px 0; }

.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--rule); }
.pager .next { margin-left: auto; text-align: right; }

.m { font-family: var(--mono); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; }
.m-get { color: var(--get); }
.m-post { color: var(--post); }
.sidenav .m { display: inline-block; min-width: 3.4em; }

.op { border-top: 1px solid var(--rule); padding-top: 4px; }
.op h3 code { background: none; padding: 0; font-size: 0.95rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0 0 12px; font-size: 0.92rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.schema h3 { font-family: var(--mono); font-size: 0.95rem; }

@media (max-width: 860px) {
  .docs { grid-template-columns: 1fr; gap: 24px; padding-top: 24px; }
  .sidenav { position: static; max-height: none; border-bottom: 1px solid var(--rule); padding-bottom: 8px; }
  .sidenav ul { display: flex; flex-wrap: wrap; gap: 0 16px; }
  .sidenav.ref ul { display: none; }
  .sidenav.ref { display: flex; flex-wrap: wrap; gap: 4px 16px; }
  .rows li { grid-template-columns: 1fr; }
  .hero { padding-top: 40px; }
  h1 { font-size: 1.7rem; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
