/* Opacus Docs — GitBook-style shared CSS */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w: 268px;
  --brand: #00d4ff;
  --brand-dim: rgba(0,212,255,0.12);
  --bg: #0d1117;
  --bg-panel: #161b22;
  --bg-code: #0d1117;
  --bg-note: #1c2333;
  --border: rgba(255,255,255,0.08);
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-heading: #f0f6fc;
  --success: #3fb950;
  --warn-bg: #261f00;
  --warn-border: #d29922;
  --note-bg: #0c1d2e;
  --note-border: #1f6feb;
  --tip-bg: #0d1f15;
  --tip-border: #2ea043;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 15px;
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────── */
.gb-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 0 0 32px;
  z-index: 50;
}

.gb-sidebar::-webkit-scrollbar { width: 4px; }
.gb-sidebar::-webkit-scrollbar-track { background: transparent; }
.gb-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.gb-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text-heading);
  font-weight: 700; font-size: 15px;
}
.gb-logo img { width: 28px; height: 28px; border-radius: 6px; }
.gb-logo span { color: var(--brand); font-size: 11px; font-weight: 500; display: block; margin-top: 1px; }

.gb-nav { padding: 16px 12px; }

.gb-section {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 14px 8px 6px;
  -webkit-user-select: none;
  user-select: none;
}

.gb-nav a {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  border-radius: 6px;
  transition: all 0.15s;
  margin-bottom: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gb-nav a:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.gb-nav a.active {
  background: var(--brand-dim);
  color: var(--brand);
  font-weight: 500;
}
.gb-nav a svg { width: 14px; height: 14px; flex-shrink: 0; opacity: 0.7; }
.gb-nav a.active svg { opacity: 1; }

/* ── Main content ──────────────────────────────────────── */
.gb-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  max-width: 860px;
  padding: 48px 56px 80px;
}

@media (max-width: 900px) {
  .gb-main { padding: 32px 24px 80px; }
}

/* ── Typography ────────────────────────────────────────── */
.gb-main h1 {
  font-size: 32px; font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  line-height: 1.25;
}
.gb-main h2 {
  font-size: 22px; font-weight: 700;
  color: var(--text-heading);
  margin-top: 44px; margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.gb-main h3 {
  font-size: 17px; font-weight: 600;
  color: var(--text-heading);
  margin-top: 28px; margin-bottom: 8px;
}
.gb-main h4 {
  font-size: 14px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-top: 24px; margin-bottom: 8px;
}
.gb-main p { margin-bottom: 14px; }
.gb-main ul, .gb-main ol { padding-left: 22px; margin-bottom: 14px; }
.gb-main li { margin-bottom: 6px; }
.gb-main strong { color: var(--text-heading); font-weight: 600; }
.gb-main a { color: var(--brand); text-decoration: none; }
.gb-main a:hover { text-decoration: underline; }

/* Page header */
.gb-page-header {
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.gb-page-header .badge {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--brand-dim);
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}
.gb-page-header .lead {
  font-size: 17px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 6px;
}

/* ── Code blocks ───────────────────────────────────────── */
pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  margin: 16px 0;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  color: #e6edf3;
}
code {
  font-family: var(--mono);
  background: rgba(110,118,129,0.15);
  color: var(--brand);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.875em;
}
pre code {
  background: none; color: inherit; padding: 0; font-size: inherit;
}
.code-label {
  font-size: 11px; color: var(--text-muted);
  font-family: var(--mono);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 4px;
}

/* ── Callout boxes ─────────────────────────────────────── */
.callout {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius);
  margin: 20px 0;
  font-size: 14px;
  line-height: 1.55;
}
.callout-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.callout.note { background: var(--note-bg); border: 1px solid var(--note-border); }
.callout.warn { background: var(--warn-bg); border: 1px solid var(--warn-border); }
.callout.tip  { background: var(--tip-bg);  border: 1px solid var(--tip-border); }
.callout strong { color: var(--text-heading); }

/* ── Tables ────────────────────────────────────────────── */
.gb-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 13.5px; }
.gb-table th {
  text-align: left;
  padding: 9px 12px;
  color: var(--text-muted);
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
.gb-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text);
}
.gb-table tr:last-child td { border-bottom: none; }
.gb-table tr:hover td { background: rgba(255,255,255,0.025); }

/* ── Method badges ─────────────────────────────────────── */
.method {
  display: inline-block;
  padding: 1px 7px; border-radius: 4px;
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  text-transform: uppercase;
}
.method-get  { background: rgba(56,139,253,0.15); color: #58a6ff; }
.method-post { background: rgba(63,185,80,0.15);  color: #3fb950; }
.method-del  { background: rgba(248,81,73,0.15);  color: #f85149; }
.method-put  { background: rgba(210,153,34,0.15); color: #d29922; }

/* ── Breadcrumb ────────────────────────────────────────── */
.gb-breadcrumb {
  font-size: 12px; color: var(--text-muted);
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 6px;
}
.gb-breadcrumb a { color: var(--text-muted); text-decoration: none; }
.gb-breadcrumb a:hover { color: var(--brand); }
.gb-breadcrumb span { opacity: 0.4; }

/* ── Grid layout helpers ───────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 16px 0; }
@media (max-width: 700px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ── Card tiles ────────────────────────────────────────── */
.tile {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  display: block;
  transition: border-color 0.15s, transform 0.15s;
}
.tile:hover { border-color: var(--brand); transform: translateY(-2px); }
.tile h3, .tile h4 { font-size: 14px; color: var(--text-heading); margin: 0 0 6px; }
.tile p  { font-size: 13px; color: var(--text-muted); margin: 0; line-height: 1.5; }
.tile a  { font-size: 12px; color: var(--brand); text-decoration: none; display: inline-block; margin-top: 8px; }
.tile a:hover { text-decoration: underline; }
.tile .tile-icon { font-size: 22px; margin-bottom: 10px; display: block; }

/* ── Steps ─────────────────────────────────────────────── */
.steps { counter-reset: step; margin: 20px 0; }
.step {
  display: flex; gap: 16px; align-items: flex-start;
  margin-bottom: 28px;
}
.step-num {
  flex-shrink: 0;
  width: 28px; height: 28px;
  background: var(--brand-dim);
  border: 1px solid var(--brand);
  color: var(--brand);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.step-body h4 { margin-top: 2px; margin-bottom: 6px; font-size: 14px; color: var(--text-heading); }
.step-body p  { font-size: 13.5px; margin: 0; color: var(--text-muted); }

/* ── Layer diagram ─────────────────────────────────────── */
.layer-stack { margin: 20px 0; }
.layer {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 4px;
  background: var(--bg-panel);
  font-size: 13.5px;
}
.layer-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 7px; border-radius: 10px;
  flex-shrink: 0;
}
.layer-arrow { text-align: center; color: var(--text-muted); font-size: 14px; margin: -2px 0; padding-left: 24px; }

/* ── Flow arrow connector ──────────────────────────────── */
.flow { display: flex; flex-direction: column; gap: 2px; margin: 16px 0; }
.flow-node {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; font-size: 13px;
}
.flow-arrow { padding: 2px 14px; color: var(--brand); font-size: 18px; -webkit-user-select: none; user-select: none; }

/* ── Prev / Next nav ───────────────────────────────────── */
.gb-pagination {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  gap: 16px;
}
.gb-pagination a {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 13.5px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s, color 0.15s;
  max-width: 45%;
}
.gb-pagination a:hover { border-color: var(--brand); color: var(--brand); }
.gb-pagination .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
.gb-pagination .title { font-weight: 500; color: var(--text-heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gb-pagination .next { margin-left: auto; text-align: right; }
