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

:root {
  --accent: #6c3aed;
  --accent-light: #f3f0ff;
  --accent-mid: #ede9fe;
  --ink: #111827;
  --ink-2: #374151;
  --ink-3: #6b7280;
  --ink-4: #9ca3af;
  --bg: #ffffff;
  --bg-sub: #f9fafb;
  --panel: #f3f4f6;
  --line: #e5e7eb;
  --line-2: #d1d5db;
  --amber: #f59e0b;
  --green: #10b981;
  --red: #ef4444;
  --code-bg: #f8f7ff;
  --nav-w: 260px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
  --mono: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
  --radius: 8px;
}

html { font-size: 16px; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* ---- Layout ---- */

.layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Nav ---- */

.nav {
  width: var(--nav-w);
  flex-shrink: 0;
  background: var(--bg-sub);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.nav__brand:hover { text-decoration: none; }

.nav__brand-mark {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 7px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.nav__scroll { flex: 1; padding: 16px 12px; }

.nav__section { margin-bottom: 24px; }

.nav__section-title {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-4);
  padding: 0 8px 8px;
}

.nav__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--ink-2);
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 1px;
  transition: background 120ms;
}

.nav__item:hover { background: var(--panel); color: var(--ink); text-decoration: none; }
.nav__item.active { background: var(--accent-mid); color: var(--accent); }

.nav__item svg { flex-shrink: 0; opacity: 0.7; }
.nav__item.active svg { opacity: 1; }

.nav__footer {
  padding: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-4);
}

/* ---- Main ---- */

.main {
  flex: 1;
  min-width: 0;
  max-width: 820px;
  padding: 48px 64px 80px;
}

@media (max-width: 1024px) {
  .main { padding: 40px 40px 80px; }
}

/* ---- Page header ---- */

.page-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 14px;
}

h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 12px;
}

.page-lead {
  font-size: 17px;
  color: var(--ink-3);
  line-height: 1.6;
  margin-bottom: 40px;
  max-width: 600px;
}

.divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 40px 0;
}

/* ---- Content ---- */

h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 40px 0 12px;
}

h3 {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink);
  margin: 28px 0 8px;
}

p { color: var(--ink-2); margin-bottom: 16px; line-height: 1.7; font-size: 14.5px; }
p:last-child { margin-bottom: 0; }

ul, ol { padding-left: 20px; margin-bottom: 16px; }
li { color: var(--ink-2); font-size: 14.5px; line-height: 1.7; margin-bottom: 4px; }

strong { color: var(--ink); font-weight: 600; }

/* ---- Callouts ---- */

.callout {
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 24px 0;
  border: 1px solid;
  font-size: 13.5px;
  line-height: 1.6;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.callout--info { background: var(--accent-light); border-color: #c4b5fd; color: #4c1d95; }
.callout--tip { background: #f0fdf4; border-color: #86efac; color: #14532d; }
.callout--warn { background: #fffbeb; border-color: #fcd34d; color: #78350f; }

.callout__icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }

/* ---- Code ---- */

code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--code-bg);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--accent-mid);
}

pre {
  background: #1e1b4b;
  border-radius: var(--radius);
  padding: 20px 22px;
  overflow-x: auto;
  margin: 16px 0 24px;
}

pre code {
  font-family: var(--mono);
  font-size: 13px;
  background: none;
  color: #e2e8f0;
  padding: 0;
  border: none;
  line-height: 1.7;
}

.token-key { color: #a78bfa; }
.token-str { color: #86efac; }
.token-num { color: #fb923c; }
.token-comment { color: #6b7280; }
.token-method { color: #f472b6; }
.token-url { color: #67e8f9; }

/* ---- Tables ---- */

.table-wrap { overflow-x: auto; margin: 16px 0 24px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead { border-bottom: 2px solid var(--line-2); }
th { text-align: left; padding: 10px 14px; font-weight: 600; color: var(--ink-3); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: top; }
tr:last-child td { border-bottom: none; }

td code { font-size: 12.5px; }

/* ---- Method badges ---- */

.method {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

.method--get  { background: #dcfce7; color: #166534; }
.method--post { background: #dbeafe; color: #1e40af; }
.method--patch { background: #fef9c3; color: #713f12; }
.method--delete { background: #fee2e2; color: #991b1b; }

/* ---- Endpoint block ---- */

.endpoint {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 24px 0;
  overflow: hidden;
}

.endpoint__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-sub);
  border-bottom: 1px solid var(--line);
}

.endpoint__path {
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--ink);
  font-weight: 500;
}

.endpoint__body { padding: 16px 18px; }
.endpoint__body p { font-size: 13.5px; }

/* ---- Event card ---- */

.event-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.event-card__name {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 6px;
}

.event-card__desc { font-size: 13.5px; color: var(--ink-2); margin-bottom: 14px; }

/* ---- Steps ---- */

.steps { counter-reset: step; padding-left: 0; list-style: none; }

.steps li {
  counter-increment: step;
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
  align-items: flex-start;
}

.steps li::before {
  content: counter(step);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.steps li p { margin-bottom: 0; }

/* ---- Warmup table ---- */

.warmup-row td:nth-child(3) { color: var(--green); font-weight: 600; }

/* ---- Tag chips ---- */

.tag {
  display: inline-block;
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
}

.tag--required { background: #fee2e2; color: #991b1b; }
.tag--optional { background: var(--panel); color: var(--ink-3); }
.tag--string  { background: #dcfce7; color: #166534; }
.tag--number  { background: #dbeafe; color: #1e40af; }
.tag--boolean { background: #fef9c3; color: #713f12; }
.tag--object  { background: var(--accent-light); color: #4c1d95; }
.tag--array   { background: #fce7f3; color: #831843; }

/* ---- Home cards ---- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.doc-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  transition: border-color 150ms, box-shadow 150ms;
  display: block;
}

.doc-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
  text-decoration: none;
}

.doc-card__icon {
  width: 36px;
  height: 36px;
  background: var(--accent-light);
  border-radius: 8px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  color: var(--accent);
}

.doc-card__title { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.doc-card__desc { font-size: 13px; color: var(--ink-3); line-height: 1.5; }

/* ---- Responsive ---- */

@media (max-width: 768px) {
  .nav { display: none; }
  .main { padding: 32px 20px 60px; }
  h1 { font-size: 26px; }
}
