:root {
  color-scheme: light dark;
  --bg: #fbfbf9;
  --panel: #ffffff;
  --ink: #16181a;
  --muted: #5c6366;
  --line: #e2e4df;
  --accent: #0f6b4f;
  --accent-soft: #e8f3ee;
  --code-bg: #f3f4f1;
  --warn-bg: #fff8e6;
  --warn-line: #e8d9a8;
  --radius: 10px;
  --max: 1180px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111413;
    --panel: #171b19;
    --ink: #eef1ee;
    --muted: #a3aca7;
    --line: #2a302d;
    --accent: #6fd3a8;
    --accent-soft: #163027;
    --code-bg: #1d2320;
    --warn-bg: #2a2415;
    --warn-line: #4d4222;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--panel);
  padding: 8px 14px;
  z-index: 100;
}
.skip:focus { left: 12px; top: 12px; }

.topbar {
  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(--line);
}

.topbar-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 24px;
}

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

.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--bg);
  display: grid;
  place-items: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
}

.brand span { font-weight: 500; color: var(--muted); }

.topnav {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.topnav::-webkit-scrollbar { display: none; }

.topnav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  padding: 7px 10px;
  border-radius: 7px;
  white-space: nowrap;
}
.topnav a:hover { color: var(--ink); background: var(--code-bg); }
.topnav a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); font-weight: 600; }

.top-cta {
  font-size: 14px;
  border: 1px solid var(--line);
  padding: 7px 12px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}
.top-cta:hover { border-color: var(--accent); }

.shell {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 48px;
  padding: 36px 24px 80px;
}

.sidebar {
  position: sticky;
  top: 76px;
  align-self: start;
  font-size: 14px;
}

.side-title {
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
  font-weight: 700;
}

.sidebar ul { list-style: none; margin: 0 0 26px; padding: 0; }
.sidebar li { margin: 1px 0; }
.sidebar a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  padding: 5px 9px;
  border-radius: 6px;
  border-left: 2px solid transparent;
}
.sidebar a:hover { color: var(--ink); background: var(--code-bg); }
.sidebar a[aria-current="page"] {
  color: var(--ink);
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 600;
}

.content { min-width: 0; max-width: 760px; }

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

h1 {
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.12;
  letter-spacing: -0.025em;
  margin: 0 0 16px;
  font-weight: 750;
}

h2 {
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 48px 0 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

h3 {
  font-size: 18px;
  line-height: 1.3;
  margin: 30px 0 10px;
  letter-spacing: -0.01em;
}

p { margin: 0 0 16px; }
.lede { font-size: 19px; line-height: 1.6; color: var(--muted); margin-bottom: 28px; }

ul, ol { margin: 0 0 18px; padding-left: 23px; }
li { margin: 0 0 8px; }
li > ul, li > ol { margin-top: 8px; }

strong { font-weight: 650; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
  background: var(--code-bg);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 5px;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
  margin: 0 0 20px;
  line-height: 1.55;
}
pre code { background: none; border: 0; padding: 0; font-size: 13.5px; }

.callout {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: var(--panel);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
  margin: 0 0 22px;
  font-size: 15px;
}
.callout p:last-child { margin-bottom: 0; }
.callout.warn { border-left-color: #b8860b; background: var(--warn-bg); border-color: var(--warn-line); }

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 26px 0 8px;
}

.card {
  display: block;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  color: var(--ink);
}
.card:hover { border-color: var(--accent); }
.card h3 { margin: 0 0 6px; font-size: 16px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 24px 0; }
.steps > li {
  counter-increment: step;
  position: relative;
  padding: 0 0 22px 46px;
  margin: 0;
  border-left: 1px solid var(--line);
  margin-left: 14px;
}
.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: -15px;
  top: -2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
}
.steps h3 { margin: 0 0 8px; font-size: 17px; }
.steps p:last-child, .steps pre:last-child { margin-bottom: 0; }

.table-wrap { overflow-x: auto; margin: 0 0 22px; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; background: var(--panel); }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); background: var(--code-bg); }
tr:last-child td { border-bottom: 0; }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 56px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.pager a { text-decoration: none; }
.pager .next { text-align: right; margin-left: auto; }
.pager small { display: block; color: var(--muted); font-size: 12px; }

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 650;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--code-bg);
  color: var(--ink);
}
.badge.live { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.badge.draft { background: var(--warn-bg); border-color: var(--warn-line); }
.badge.ok { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.badge.soon { background: var(--warn-bg); border-color: var(--warn-line); }

.footer {
  border-top: 1px solid var(--line);
  margin-top: 40px;
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 26px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}
.footer a { color: var(--muted); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; gap: 24px; padding-top: 24px; }
  .sidebar { position: static; border-bottom: 1px solid var(--line); padding-bottom: 18px; }
  .sidebar ul { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 0; }
  .sidebar a { border-left: 0; }
  .side-title { margin-bottom: 8px; }
}

@media (max-width: 640px) {
  .topbar-inner { gap: 14px; padding: 12px 16px; }
  .topnav { display: none; }
  .top-cta { margin-left: auto; }
  .shell { padding: 20px 16px 64px; }
  .cards { grid-template-columns: 1fr; }
  .lede { font-size: 17px; }
  h2 { margin-top: 38px; }
}

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

@media print {
  .topbar, .sidebar, .pager, .footer { display: none; }
  .shell { display: block; max-width: none; padding: 0; }
  .content { max-width: none; }
  a { color: inherit; }
}
