:root {
  --bg: #0a0a0b;
  --surface: #111113;
  --surface-elevated: #18181b;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --border: #27272a;
  --accent: #ef4444;
  --accent-hover: #f87171;
  --accent-muted: rgba(239, 68, 68, 0.15);
  --sidebar-width: 280px;
  --header-h: 56px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: var(--accent-hover);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
  color: var(--text);
}

.brand img {
  height: 32px;
  width: auto;
  display: block;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
}

.header-links a {
  color: var(--muted);
}

.header-links a:hover {
  color: var(--accent-hover);
  text-decoration: none;
}

.menu-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  border-radius: 6px;
  padding: 0.4rem 0.65rem;
  font: inherit;
  cursor: pointer;
  color: var(--text);
}

.layout {
  display: flex;
  min-height: calc(100vh - var(--header-h));
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0;
}

.sidebar-inner {
  position: sticky;
  top: var(--header-h);
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 0 1rem 2rem;
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.25rem 0 0.5rem 0.5rem;
}

.nav-section-title:first-child {
  margin-top: 0;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list a {
  display: block;
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.92rem;
  text-decoration: none;
}

.nav-list a:hover {
  background: var(--surface-elevated);
  text-decoration: none;
}

.nav-list a.active {
  background: var(--accent-muted);
  color: var(--accent-hover);
  font-weight: 600;
  border-left: 3px solid var(--accent);
  padding-left: calc(0.5rem - 3px);
}

main {
  flex: 1;
  min-width: 0;
  padding: 2rem 2.5rem 3rem;
  max-width: 900px;
}

main h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 1.25rem;
  line-height: 1.25;
}

main strong {
  font-weight: 700;
}

main h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

main h2:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 1.25rem;
}

main h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.75rem 0 0.65rem;
  color: var(--text);
  line-height: 1.35;
}

main p {
  margin: 0 0 1rem;
  color: var(--text);
}

main ul,
main ol {
  margin: 0 0 1rem;
  padding-left: 1.35rem;
  color: var(--text);
  list-style-position: outside;
}

main ol {
  list-style-type: decimal;
}

main li {
  margin-bottom: 0.35rem;
}

main hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

.doc-screenshot {
  margin: 0 0 1.25rem;
}

.doc-screenshot img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

main code {
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--surface-elevated);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: #e4e4e7;
}

main pre {
  background: #09090b;
  color: #e8eaed;
  padding: 1rem 1.1rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0 0 1rem;
  border: 1px solid var(--border);
}

main pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.callout {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  background: var(--surface-elevated);
  padding: 0.85rem 1rem;
  border-radius: 0 8px 8px 0;
  margin: 0 0 1rem;
  font-size: 0.95rem;
}

.callout strong {
  font-weight: 700;
}

.callout-warning {
  border-left-color: #f59e0b;
}

.callout-info {
  border-left-color: #3b82f6;
}

.callout-danger {
  border-left-color: #dc2626;
}

.callout-success {
  border-left-color: #22c55e;
}

main table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1rem;
  font-size: 0.95rem;
}

main th,
main td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.65rem;
  text-align: left;
}

main th {
  background: var(--surface-elevated);
  color: var(--text);
}

/* Hub landing: card grid (GitBook-style) */
.hub-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 0 0 2rem;
}

@media (max-width: 640px) {
  .hub-cards {
    grid-template-columns: 1fr;
  }
}

.hub-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.hub-card:hover {
  border-color: var(--muted);
  background: var(--surface-elevated);
  text-decoration: none;
}

.hub-card-label {
  flex: 1;
}

.hub-card-chevron {
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
}

/* Previous / Next footer */
.docs-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 560px) {
  .docs-pager {
    grid-template-columns: 1fr;
  }
}

.docs-pager-link {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.docs-pager-next {
  flex-direction: row;
  justify-content: flex-start;
}

.docs-pager-next .docs-pager-body {
  flex: 1;
  text-align: right;
  align-items: flex-end;
}

.docs-pager-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}

.docs-pager-link:hover {
  border-color: var(--muted);
  background: var(--surface-elevated);
  text-decoration: none;
}

.docs-pager-kicker {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.docs-pager-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.docs-pager-chevron {
  font-size: 1.5rem;
  color: var(--muted);
  line-height: 1;
  flex-shrink: 0;
}

.loading {
  color: var(--muted);
}

.error-box {
  border: 1px solid #7f1d1d;
  background: #1c0a0a;
  color: #fecaca;
  padding: 1rem;
  border-radius: 8px;
}

.error-box code {
  background: rgba(0, 0, 0, 0.35);
}

@media (max-width: 880px) {
  .menu-toggle {
    display: block;
  }

  .header-links {
    display: flex;
    font-size: 0.85rem;
  }

  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    display: none;
  }

  .sidebar.is-open {
    display: block;
  }

  .sidebar-inner {
    position: static;
    max-height: none;
  }

  main {
    padding: 1.25rem 1rem 2rem;
  }
}
