/* ─── Reset & base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f1117;
  --surface:   #161b22;
  --border:    #21262d;
  --text:      #c9d1d9;
  --text-dim:  #8b949e;
  --text-hi:   #f0f6fc;
  --text-med:  #e6edf3;
  --blue:      #58a6ff;
  --green:     #3fb950;
  --orange:    #ffa657;
  --red:       #f85149;
  --yellow:    #d29922;
  --purple:    #d2a8ff;
  --sidebar-w: 220px;
  --top-h:     48px;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}

/* ─── Layout shell ──────────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--top-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 0.75rem;
  z-index: 100;
}

.topbar-logo {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-hi);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.topbar-logo span {
  color: var(--blue);
}

.topbar-sep {
  color: var(--border);
  font-size: 1.1rem;
  user-select: none;
}

.topbar-title {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.topbar-right {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.sidebar {
  position: fixed;
  top: var(--top-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1.25rem 0;
}

.sidebar-group {
  margin-bottom: 1.5rem;
}

.sidebar-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 0 1rem;
  margin-bottom: 0.35rem;
}

.sidebar a {
  display: block;
  padding: 0.3rem 1rem;
  font-size: 0.83rem;
  color: var(--text-dim);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.sidebar a:hover {
  color: var(--text);
  background: #ffffff08;
}

.sidebar a.active {
  color: var(--blue);
  border-left-color: var(--blue);
  background: #58a6ff0d;
}

/* ─── Main content ──────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  margin-top: var(--top-h);
  padding: 2.5rem 2.75rem;
  max-width: calc(var(--sidebar-w) + 860px);
}

.page-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.25rem;
  margin-bottom: 2.25rem;
}

.page-header h1 {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-hi);
  margin-bottom: 0.3rem;
}

.page-header p {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin: 0;
}

/* ─── Sections ──────────────────────────────────────────────────────────── */
section {
  margin-bottom: 2.5rem;
}

section h2 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-hi);
  margin-bottom: 0.9rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: calc(var(--top-h) + 1rem);
}

section h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-med);
  margin: 1.2rem 0 0.45rem;
}

p {
  color: var(--text-dim);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

ul, ol {
  padding-left: 1.25rem;
  margin-bottom: 0.75rem;
}

li {
  color: var(--text-dim);
  font-size: 0.875rem;
  margin-bottom: 0.2rem;
}

/* ─── Inline code ───────────────────────────────────────────────────────── */
:not(pre) > code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.78rem;
  background: var(--border);
  color: #79c0ff;
  padding: 1px 5px;
  border-radius: 4px;
}

/* ─── Code blocks ───────────────────────────────────────────────────────── */
pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

pre code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  color: var(--text-med);
  background: none;
  padding: 0;
  font-size: inherit;
}

/* syntax colours */
.kw  { color: #ff7b72; }
.fn  { color: var(--purple); }
.str { color: #a5d6ff; }
.cm  { color: var(--text-dim); font-style: italic; }
.ty  { color: var(--orange); }
.nu  { color: var(--blue); }

/* ─── Callouts ──────────────────────────────────────────────────────────── */
.callout {
  background: var(--surface);
  border-left: 3px solid var(--blue);
  border-radius: 0 6px 6px 0;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text);
}

.callout.warn    { border-left-color: var(--yellow); }
.callout.success { border-left-color: var(--green);  }
.callout.danger  { border-left-color: var(--red);    }

/* ─── HTTP method pills ─────────────────────────────────────────────────── */
.pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  margin-right: 3px;
  vertical-align: middle;
}
.put  { background: #1f6feb22; color: var(--blue);   border: 1px solid #1f6feb55; }
.post { background: #3fb95022; color: var(--green);  border: 1px solid #3fb95055; }
.del  { background: #da363322; color: var(--red);    border: 1px solid #da363355; }
.get  { background: #d2992222; color: var(--yellow); border: 1px solid #d2992255; }

/* ─── Tables ────────────────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
  margin-bottom: 1rem;
}

th {
  text-align: left;
  padding: 0.45rem 0.75rem;
  background: var(--surface);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}

tr:last-child td { border-bottom: none; }
tr:hover td      { background: #ffffff04; }

/* ─── Workflow steps ────────────────────────────────────────────────────── */
.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.steps li {
  counter-increment: step;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.65rem 0.9rem;
  font-size: 0.85rem;
  color: var(--text);
  margin: 0;
}

.steps li::before {
  content: counter(step);
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: #1f6feb;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Cards (index page) ────────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  text-decoration: none;
  display: block;
  transition: border-color 0.15s, background 0.15s;
}

.card:hover {
  border-color: var(--blue);
  background: #58a6ff08;
}

.card-icon {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  line-height: 1;
}

.card h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-hi);
  margin: 0 0 0.25rem;
}

.card p {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin: 0;
}

/* ─── File reference ────────────────────────────────────────────────────── */
.file-ref {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.75rem;
  color: var(--blue);
}

/* ─── Badge ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  background: #1f6feb22;
  border: 1px solid #1f6feb55;
  color: var(--blue);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 20px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.page-footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: #484f58;
}
