/* ── Variables ──────────────────────────────────────────────── */
:root {
  --bg:           #0a0a0a;
  --card:         #111111;
  --border:       #1e1e1e;
  --text:         #f5f5f5;
  --muted:        #888;
  --accent:       #22c55e;
  --accent-dim:   rgba(34,197,94,.08);
  --accent-border:rgba(34,197,94,.25);
  --sidebar-w:    258px;
  --topbar-h:     56px;
  --content-max:  800px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 24px);
}
body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.02em; }

/* ── Overlay (mobile sidebar backdrop) ─────────────────────── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 99;
}
.overlay.visible { display: block; }

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  z-index: 200;
  background: rgba(10,10,10,.85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 16px;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sidebar-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: background .2s;
}
.sidebar-btn:hover { background: rgba(255,255,255,.06); }

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -.03em;
  flex-shrink: 0;
}

.topbar-sep {
  color: #2e2e2e;
  font-size: 18px;
  font-weight: 300;
  flex-shrink: 0;
}

.topbar-section {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-gh {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: color .2s;
}
.topbar-gh:hover { color: var(--text); }

/* ── Search ─────────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  width: 220px;
}

.search-input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 6px 12px 6px 32px;
  outline: none;
  transition: border-color .2s;
  height: 34px;
}
.search-input:focus { border-color: rgba(245,245,245,.22); }
.search-input::placeholder { color: var(--muted); }

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-drop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  z-index: 300;
  box-shadow: 0 8px 32px rgba(0,0,0,.55);
  min-width: 240px;
}
.search-drop.hidden { display: none; }

.search-result {
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: rgba(255,255,255,.04); }
.search-result-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 2px;
}
.search-result-title { font-size: 13px; color: var(--text); }
.search-empty {
  padding: 14px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  border-right: 1px solid var(--border);
  z-index: 100;
  padding: 20px 0 48px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  background: var(--bg);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-header {
  padding: 0 20px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.sidebar-version { font-size: 11px; color: var(--muted); font-weight: 500; }

.nav-group { margin-bottom: 22px; padding: 0 10px; }

.nav-group-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  padding: 0 8px;
  margin-bottom: 6px;
}

.nav-link {
  display: block;
  padding: 6px 10px;
  font-size: 13.5px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 6px;
  font-weight: 400;
  transition: color .15s, background .15s;
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-link:hover { color: var(--text); background: rgba(255,255,255,.05); }
.nav-link.active {
  color: var(--text);
  background: rgba(255,255,255,.08);
  font-weight: 500;
}

/* ── Main content ────────────────────────────────────────────── */
.content {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-height: 100vh;
}

.content-body {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 52px 44px 96px;
}

/* ── Article typography ──────────────────────────────────────── */
.content-body h1 {
  font-size: 34px;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -.03em;
}

.page-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 36px;
}

.content-body h2 {
  font-size: 21px;
  font-weight: 700;
  margin-top: 52px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.content-body h3 {
  font-size: 16.5px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 10px;
}

.content-body h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-top: 24px;
  margin-bottom: 8px;
}

.content-body p {
  font-size: 15px;
  color: rgba(245,245,245,.8);
  margin-bottom: 14px;
  line-height: 1.72;
}

.content-body ul, .content-body ol {
  margin: 0 0 16px 22px;
}
.content-body li {
  font-size: 15px;
  color: rgba(245,245,245,.8);
  margin-bottom: 6px;
  line-height: 1.65;
}

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

code:not(.hljs) {
  font-family: 'JetBrains Mono', 'Fira Code', 'Menlo', monospace;
  font-size: 12px;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--border);
  padding: 2px 5px;
  border-radius: 4px;
  color: #e2e2e2;
}

/* ── Code block ──────────────────────────────────────────────── */
.cb {
  background: #0c0c0c;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin: 14px 0 22px;
}
.cb-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-r { background: #ff5f57; }
.dot-y { background: #febc2e; }
.dot-g { background: #28c840; }
.cb-file { font-size: 11.5px; color: var(--muted); margin-left: 8px; }
.cb-body { padding: 18px; }
.cb pre { margin: 0; background: transparent !important; padding: 0 !important; }
.cb code {
  font-size: 13px;
  line-height: 1.76;
  font-family: 'JetBrains Mono', 'Fira Code', 'Menlo', monospace;
}
.hljs { background: transparent !important; }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  margin: 14px 0 22px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.content-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 500px;
}
.content-body th {
  padding: 10px 14px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.content-body td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: rgba(245,245,245,.8);
  line-height: 1.55;
}
.content-body tr:last-child td { border-bottom: none; }
.content-body tr:hover td { background: rgba(255,255,255,.02); }

.method {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-block;
  white-space: nowrap;
}
.m-get    { background: rgba(34,197,94,.12);  color: #22c55e; }
.m-post   { background: rgba(59,130,246,.12); color: #60a5fa; }
.m-patch  { background: rgba(251,191,36,.12); color: #fbbf24; }
.m-delete { background: rgba(239,68,68,.12);  color: #f87171; }
.m-put    { background: rgba(168,85,247,.12); color: #c084fc; }

.mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12.5px;
  color: #e2e2e2;
}
.req { color: #f87171; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.opt { color: var(--muted); font-size: 10px; font-weight: 600; text-transform: uppercase; }

/* ── Callouts ────────────────────────────────────────────────── */
.callout {
  padding: 13px 16px;
  border-radius: 8px;
  margin: 14px 0 20px;
  font-size: 14px;
  line-height: 1.65;
  border-left: 3px solid;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.callout-icon { flex-shrink: 0; margin-top: 1px; }
.callout-tip     { background: rgba(34,197,94,.07);  border-color: var(--accent); color: #a7f3c6; }
.callout-note    { background: rgba(59,130,246,.07); border-color: #3b82f6;       color: #93c5fd; }
.callout-warning { background: rgba(251,191,36,.07); border-color: #fbbf24;       color: #fde68a; }
.callout p { color: inherit; margin-bottom: 0; font-size: 14px; }

/* ── Steps ───────────────────────────────────────────────────── */
.step {
  display: flex;
  gap: 18px;
  margin-bottom: 36px;
}
.step-num {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--accent);
  flex-shrink: 0; margin-top: 3px;
}
.step-body { flex: 1; min-width: 0; }
.step-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }

/* ── Page nav (prev/next) ────────────────────────────────────── */
.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 12px;
  margin-top: 72px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.page-nav-link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  flex: 1;
  max-width: 48%;
  transition: border-color .2s, background .2s;
}
.page-nav-link:hover {
  border-color: rgba(245,245,245,.2);
  background: rgba(255,255,255,.03);
}
.page-nav-link.prev { align-items: flex-start; }
.page-nav-link.next { align-items: flex-end; }
.page-nav-dir { font-size: 11px; color: var(--muted); font-weight: 500; margin-bottom: 3px; }
.page-nav-title { font-size: 14px; font-weight: 600; color: var(--text); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .content-body { padding: 40px 28px 80px; }
}
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    background: var(--bg);
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,.6);
  }
  .content { margin-left: 0; }
  .sidebar-btn { display: flex; }
  .topbar-section { display: none; }
  .search-wrap { width: 180px; }
  .content-body { padding: 32px 20px 64px; }
  .content-body h1 { font-size: 26px; }
}
@media (max-width: 480px) {
  .search-wrap { width: 140px; }
  .page-nav { flex-direction: column; }
  .page-nav-link { max-width: 100%; }
}
