:root {
  --brand: #E55020;
  --brand-deep: #A53D0F;
  --brand-tint: #FCE4D6;
  --brand-wash: #FFF8F4;
  --ink: #0A0A0A;
  --muted: #525252;
  --line: #EAE7E3;
  --surface: #F7F7F7;
  --side: #221F1C;
  --side-2: #322F2C;
  --side-line: #42403D;
  --side-text: #FAFAF8;
  --side-muted: #A8A4A0;
  --code-bg: #221F1C;
  --code-text: #FAFAF8;
  --get: #1F7836;
  --post: #A53D0F;
  --put: #1F4F8A;
  --delete: #C42718;
  --warn-bg: #FEF3C7;
  --warn-ink: #92400E;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --side-w: 272px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; font: 16px/1.6 var(--sans); color: var(--ink); background: #fff; -webkit-text-size-adjust: 100%; }

a { color: var(--brand-deep); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.skip { position: absolute; left: -9999px; top: 8px; background: #fff; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

/* Sidebar */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); overflow-y: auto;
  background: var(--side); color: var(--side-text); padding: 20px 0 32px; z-index: 20;
}
.sidebar a.brand { display: flex; align-items: center; gap: 10px; padding: 0 20px 18px; border-left: 0; background: none; border-bottom: 1px solid var(--side-line); margin-bottom: 12px; text-decoration: none; color: var(--side-text); }
.brand img { width: 28px; height: 28px; border-radius: 7px; background: var(--brand); }
.brand b { font-size: 16px; letter-spacing: .01em; }
.brand span { display: block; font-size: 12px; color: var(--side-muted); font-weight: 400; }
.sidebar h2 { border: 0; padding: 0; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); margin: 18px 20px 6px; font-weight: 600; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a { display: block; padding: 5px 20px 5px 17px; color: var(--side-text); text-decoration: none; font-size: 14px; border-left: 3px solid transparent; }
.sidebar ul ul a { padding-left: 32px; font-size: 13px; color: var(--side-muted); }
.sidebar a:hover { background: var(--side-2); color: #fff; }
.sidebar a.active { border-left-color: var(--brand); background: var(--side-2); color: #fff; }
.side-foot { margin: 20px 20px 0; font-size: 12px; color: var(--side-muted); }
.side-foot a { display: inline; padding: 0; border: 0; color: var(--side-text); text-decoration: underline; font-size: 12px; }

/* Top bar (mobile only) */
.topbar { display: none; }

/* Main */
main { margin-left: var(--side-w); padding: 40px 48px 96px; max-width: calc(var(--side-w) + 920px); }
section { padding-top: 8px; }
h1 { font-size: 36px; line-height: 1.15; margin: 0 0 12px; letter-spacing: -.01em; }
h2 { font-size: 26px; line-height: 1.25; margin: 56px 0 12px; padding-top: 24px; border-top: 1px solid var(--line); letter-spacing: -.005em; }
h3 { font-size: 19px; margin: 36px 0 8px; }
h4 { font-size: 15px; margin: 22px 0 6px; }
p, ul, ol { margin: 0 0 14px; }
li { margin: 4px 0; }
.lead { font-size: 18px; color: var(--muted); max-width: 720px; }
.muted { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }

code { font-family: var(--mono); font-size: .88em; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; overflow-wrap: anywhere; }
pre { position: relative; margin: 0 0 18px; background: var(--code-bg); color: var(--code-text); border-radius: 10px; padding: 16px 18px; overflow-x: auto; font: 13px/1.55 var(--mono); }
pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; overflow-wrap: normal; }
.code-label { display: block; font: 600 12px/1 var(--sans); color: var(--muted); margin: 0 0 6px; text-transform: uppercase; letter-spacing: .06em; }
.copy {
  position: absolute; top: 8px; right: 8px; font: 600 12px/1 var(--sans); padding: 6px 9px; border-radius: 6px;
  border: 1px solid var(--side-line); background: var(--side-2); color: var(--side-text); cursor: pointer;
}
.copy:hover { border-color: var(--brand); }

table { width: 100%; border-collapse: collapse; margin: 0 0 18px; font-size: 14px; display: block; overflow-x: auto; }
th, td { text-align: left; vertical-align: top; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; white-space: nowrap; }
td:first-child { white-space: nowrap; }
td code { white-space: nowrap; }

.endpoint { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0 10px; font: 600 15px/1.4 var(--mono); }
.endpoint .path { overflow-wrap: anywhere; }
.method { display: inline-block; font: 700 12px/1 var(--sans); letter-spacing: .04em; color: #fff; padding: 5px 8px; border-radius: 5px; }
.m-get { background: var(--get); }
.m-post { background: var(--post); }
.m-put { background: var(--put); }
.m-delete { background: var(--delete); }
.scope { font: 500 13px/1 var(--sans); color: var(--muted); }
.scope code { font-size: 12px; }

.note { border-left: 4px solid var(--brand); background: var(--brand-wash); padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 0 0 18px; }
.note.warn { border-left-color: var(--warn-ink); background: var(--warn-bg); }
.note p:last-child, .note ul:last-child { margin-bottom: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 0 0 18px; }
.card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: #fff; }
.card b { display: block; margin-bottom: 4px; }
.card p { margin: 0; font-size: 14px; color: var(--muted); }

.steps { counter-reset: step; list-style: none; padding: 0; }
.steps > li { counter-increment: step; position: relative; padding-left: 40px; margin: 0 0 18px; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-tint); color: var(--brand-deep); font: 700 13px/26px var(--sans); text-align: center; }

@media (max-width: 900px) {
  .topbar {
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 30;
    background: var(--side); color: var(--side-text); padding: 10px 16px;
  }
  .topbar b { font-size: 15px; }
  .menu-btn { font: 600 14px/1 var(--sans); background: var(--side-2); color: var(--side-text); border: 1px solid var(--side-line); border-radius: 6px; padding: 8px 12px; cursor: pointer; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; width: min(86vw, 300px); top: 0; z-index: 40; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); }
  main { margin-left: 0; padding: 24px 16px 72px; }
  h1 { font-size: 28px; }
  h2 { font-size: 22px; }
  html { scroll-padding-top: 64px; }
}

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