/* ─────────────────────────────────────────
   Polari API — Shared Shell Styles
   ───────────────────────────────────────── */

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

:root {
  --bg:           #080b0f;
  --surface:      #0e1318;
  --surface-2:    #121820;
  --border:       rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.12);
  --text:         #e8eaed;
  --muted:        #5a6370;
  --dim:          #2a3038;
  --accent:       #ff41c3;
  --accent-green: #00e5a0;
  --accent-dim:   rgba(255,65,195,0.07);
  --accent-border:rgba(255,65,195,0.2);
  --sidebar-w:    260px;
  --topbar-h:     52px;
  --font-mono:    'Space Mono', monospace;
  --font-sans:    'Syne', sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Topbar ──────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: rgba(8,11,15,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  line-height: 0;
}

.logo {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
  text-decoration: none;
}
.logo span { color: var(--accent); }

.topbar-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
}

.topbar-section {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

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

.topbar-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent-green);
  border: 1px solid rgba(0,229,160,0.25);
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.1em;
}

.topbar-link {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.06em;
  transition: color 0.2s;
}
.topbar-link:hover { color: var(--text); }

/* ── Layout shell ────────────────────────── */
.shell {
  display: flex;
  padding-top: var(--topbar-h);
  min-height: 100vh;
}

/* ── 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);
  padding: 24px 0 48px;
  scrollbar-width: none;
  background: var(--bg);
  transition: transform 0.25s ease;
  z-index: 90;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-group {
  margin-bottom: 28px;
}

.sidebar-group-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0 20px;
  margin-bottom: 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 20px;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  border-left: 2px solid transparent;
  margin-left: -1px; /* aligns with sidebar border */
}
.sidebar-link:hover {
  color: var(--text);
  background: rgba(255,255,255,0.03);
}
.sidebar-link.active {
  color: var(--text);
  border-left-color: var(--accent);
  background: var(--accent-dim);
}

.sidebar-link-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--dim);
  flex-shrink: 0;
  transition: background 0.15s;
}
.sidebar-link.active .sidebar-link-dot,
.sidebar-link:hover .sidebar-link-dot {
  background: var(--accent);
}

.sidebar-link-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.04em;
}

/* ── Main content ────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}

.content {
  max-width: 760px;
  padding: 52px 56px 100px;
}

/* ── Page header ─────────────────────────── */
.page-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.page-title {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 16px;
}

.page-lead {
  font-size: 16px;
  font-weight: 300;
  color: #8a9099;
  line-height: 1.7;
  max-width: 560px;
  margin-bottom: 40px;
}

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

/* ── Typography ──────────────────────────── */
h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
  margin-top: 48px;
  color: var(--text);
}
h2:first-child { margin-top: 0; }

h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  margin-top: 32px;
  color: var(--text);
}

p {
  color: #8a9099;
  margin-bottom: 16px;
  font-weight: 300;
  line-height: 1.75;
}

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

/* ── Callout / alert ─────────────────────── */
.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-green);
  background: rgba(0,229,160,0.04);
  border-radius: 4px;
  padding: 14px 18px;
  margin: 24px 0;
  font-size: 13px;
  color: #8a9099;
  line-height: 1.65;
}
.callout strong { color: var(--accent-green); font-weight: 600; }

.callout.warn {
  border-left-color: #f5a623;
  background: rgba(245,166,35,0.04);
}
.callout.warn strong { color: #f5a623; }

/* ── Code blocks ─────────────────────────── */
.code-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin: 24px 0;
  font-family: var(--font-mono);
  font-size: 12px;
}

.code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.code-dots { display: flex; gap: 5px; }
.code-dots span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--dim);
}

.code-lang {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.code-copy {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: color 0.2s, border-color 0.2s;
}
.code-copy:hover { color: var(--text); border-color: var(--border-hover); }
.code-copy.copied { color: var(--accent-green); border-color: rgba(0,229,160,0.3); }

.code-body {
  padding: 18px;
  line-height: 1.85;
  color: #8a9099;
  overflow-x: auto;
}

/* Syntax tokens */
.t-key   { color: #7eb8f7; }
.t-str   { color: var(--accent); }
.t-val   { color: #f0c674; }
.t-cmt   { color: var(--muted); font-style: italic; }
.t-grn   { color: var(--accent-green); }
.t-url   { color: #c5a5f5; }

/* Inline code */
code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--accent);
}

/* ── Endpoint pill ───────────────────────── */
.endpoint {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 24px 0 16px;
}

.method {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 3px;
}
.method.get  { background: rgba(0,229,160,0.12); color: var(--accent-green); border: 1px solid rgba(0,229,160,0.2); }
.method.post { background: rgba(127,127,255,0.12); color: #9b9bff; border: 1px solid rgba(127,127,255,0.2); }
.method.del  { background: rgba(255,100,100,0.1); color: #ff8080; border: 1px solid rgba(255,100,100,0.2); }

.endpoint-path {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  letter-spacing: 0.02em;
}

/* ── Params table ────────────────────────── */
.params-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 28px;
  font-size: 13px;
}

.params-table th {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.params-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: #8a9099;
  vertical-align: top;
  line-height: 1.5;
}

.params-table td:first-child {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
}

.params-table td:nth-child(2) {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent-green);
}

.param-req {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  padding: 1px 5px;
  border-radius: 2px;
  margin-left: 6px;
  letter-spacing: 0.06em;
  vertical-align: middle;
}

/* ── Layer badge ─────────────────────────── */
.layer-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 24px;
}
.layer-badge-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* ── Step list ───────────────────────────── */
.steps { counter-reset: step; list-style: none; }
.steps li {
  counter-increment: step;
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  color: #8a9099;
  font-weight: 300;
}
.steps li::before {
  content: counter(step);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

/* ── Cards ───────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin: 24px 0;
}

.card {
  background: var(--surface);
  padding: 20px;
  text-decoration: none;
  transition: background 0.2s;
  display: block;
}
.card:hover {
  background: rgba(255,65,195,0.05);
  text-decoration: none;
}

.card-eyebrow {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--accent);
  letter-spacing: 0.14em;
  margin-bottom: 8px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.card-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  font-weight: 300;
}

/* ── On-page nav (next/prev) ─────────────── */
.page-nav {
  display: flex;
  gap: 12px;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.page-nav-link {
  flex: 1;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
  background: var(--surface);
}
.page-nav-link:hover {
  border-color: var(--border-hover);
  background: var(--surface-2);
  text-decoration: none;
}
.page-nav-link.next { text-align: right; }

.page-nav-dir {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.12em;
  margin-bottom: 4px;
}
.page-nav-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

/* ── Sidebar overlay (mobile) ────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 89;
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 768px) {
  .sidebar-toggle { display: block; }

  .sidebar {
    transform: translateX(-100%);
    z-index: 95;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 12px 0 40px rgba(0,0,0,0.6);
  }
  .sidebar-overlay.visible { display: block; }

  .main { margin-left: 0; }
  .content { padding: 32px 24px 80px; }
  .page-nav { flex-direction: column; }
}
