:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-soft: rgba(2, 132, 199, 0.1);
  --accent-2: #0d9488;
  --code-bg: #f1f5f9;
  --pre-bg: #0f172a;
  --pre-text: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --radius: 12px;
  --header-h: 64px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-muted: #1e293b;
  --border: #1f2937;
  --text: #f1f5f9;
  --text-muted: #cbd5e1;
  --text-subtle: #94a3b8;
  --accent: #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --accent-2: #2dd4bf;
  --code-bg: #1e293b;
  --pre-bg: #020617;
  --pre-text: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 30px rgba(0, 0, 0, 0.45);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover { color: var(--accent-hover); }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.brand:hover { color: var(--text); }

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-subtle);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.nav-pill:hover {
  color: var(--text);
  background: var(--surface-muted);
}

.nav-pill.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.nav-tag {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.16);
  color: #059669;
}

[data-theme="dark"] .nav-tag {
  background: rgba(45, 212, 191, 0.18);
  color: #2dd4bf;
}

.nav-pill.is-finance-pill {
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-muted);
  color: var(--text-subtle);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.search-trigger:hover {
  border-color: var(--accent);
  color: var(--text);
}

.kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-subtle);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.mobile-menu-btn { display: none; }

[data-theme="dark"] .icon-moon { display: none; }
html:not([data-theme="dark"]) .icon-sun { display: none; }

/* Home Layout */
.home-main {
  max-width: 1160px;
  margin: 0 auto;
  padding: 36px 20px 72px;
}

.hero {
  position: relative;
  padding: 56px 40px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 85% 15%, rgba(14, 165, 233, 0.18), transparent 45%),
    radial-gradient(circle at 15% 85%, rgba(16, 185, 129, 0.14), transparent 45%),
    var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  margin-bottom: 48px;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3.8vw, 2.9rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin: 0 0 16px;
  max-width: 780px;
}

.hero-lead {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 0 28px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14.5px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

.btn-primary:hover { color: #fff; opacity: 0.94; }

.btn-secondary {
  background: var(--surface-muted);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  color: var(--text);
  border-color: var(--accent);
}

.home-section { margin-bottom: 52px; }

.section-header { margin-bottom: 22px; }

.section-header h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.015em;
}

.section-header p {
  margin: 0;
  color: var(--text-subtle);
}

.collections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
}

.collection-card {
  display: flex;
  flex-direction: column;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.collection-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  color: var(--text);
}

.collection-card.is-highlight {
  border-color: rgba(16, 185, 129, 0.45);
  background: linear-gradient(160deg, rgba(16, 185, 129, 0.06), transparent 55%), var(--surface);
}

.badge.is-finance {
  background: rgba(16, 185, 129, 0.16);
  color: #059669;
}

[data-theme="dark"] .badge.is-finance {
  background: rgba(45, 212, 191, 0.18);
  color: #2dd4bf;
}

.collection-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.collection-count {
  font-size: 12px;
  color: var(--text-subtle);
}

.collection-card h3 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0 0 8px;
}

.collection-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 16px;
  flex: 1;
}

.card-cta {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent);
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.featured-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.featured-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  color: var(--text);
}

.featured-thumb {
  aspect-ratio: 16 / 10;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.featured-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.featured-body {
  padding: 18px;
}

.featured-tag {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.featured-body h3 {
  font-family: var(--font-display);
  font-size: 16.5px;
  margin: 6px 0 8px;
  line-height: 1.3;
}

.featured-body p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.55;
}

/* Docs Shell */
.docs-shell {
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr) 230px;
  gap: 28px;
  padding: 24px 20px 64px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  max-height: calc(100vh - var(--header-h) - 36px);
  overflow-y: auto;
  padding-right: 8px;
}

.nav-group { margin-bottom: 18px; }

.nav-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 8px;
  margin-bottom: 4px;
}

.nav-group-title:hover { background: var(--surface-muted); }
.nav-group-title.is-current { color: var(--accent); background: var(--accent-soft); }

.nav-list, .nav-sublist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-sublist {
  margin-left: 12px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
  margin-top: 2px;
  margin-bottom: 6px;
}

.nav-link, .nav-sublink {
  display: block;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--text-muted);
}

.nav-link:hover, .nav-sublink:hover {
  color: var(--text);
  background: var(--surface-muted);
}

.nav-link.is-current, .nav-sublink.is-current {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.sidebar-backdrop { display: none; }

/* Main Doc Column */
.docs-main {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 40px 40px;
  box-shadow: var(--shadow-sm);
}

.doc-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-subtle);
}

.code-all-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.code-all-toggle[hidden] { display: none; }
.code-all-toggle:hover { border-color: var(--accent); color: var(--accent); }

.breadcrumbs a { color: var(--text-subtle); }
.breadcrumbs a:hover { color: var(--accent); }
.crumb-current { color: var(--text); font-weight: 500; }

/* Markdown Typography */
.markdown-body > *:first-child { margin-top: 0; }

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -0.015em;
  margin-top: 2em;
  margin-bottom: 0.7em;
  color: var(--text);
}

.markdown-body h1 {
  font-size: clamp(1.65rem, 2.6vw, 2.15rem);
  margin-top: 0;
  padding-bottom: 0.45em;
  border-bottom: 1px solid var(--border);
}

.markdown-body h2 {
  font-size: 1.45rem;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border);
}

.markdown-body h3 { font-size: 1.18rem; }
.markdown-body h4 { font-size: 1.02rem; }

.markdown-body p, .markdown-body ul, .markdown-body ol {
  margin-top: 0;
  margin-bottom: 1.1em;
}

.markdown-body li + li { margin-top: 0.35em; }

.markdown-body blockquote {
  margin: 1.4em 0;
  padding: 12px 18px;
  border-left: 4px solid var(--accent);
  background: var(--surface-muted);
  border-radius: 0 10px 10px 0;
  color: var(--text-muted);
}

.markdown-body blockquote > :last-child { margin-bottom: 0; }

.markdown-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.25em auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  padding: 4px;
  cursor: zoom-in;
}

.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-bg);
  padding: 0.16em 0.42em;
  border-radius: 6px;
}

.markdown-body pre {
  position: relative;
  background: var(--pre-bg);
  color: var(--pre-text);
  padding: 16px 18px;
  border-radius: 12px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.55;
  margin: 1.25em 0;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.markdown-body pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

.code-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-family: var(--font-sans);
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.8);
  color: #e2e8f0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.markdown-body pre:hover .code-copy-btn,
.code-copy-btn:focus { opacity: 1; }
.code-copy-btn:hover { background: var(--accent); border-color: var(--accent); }

/* Collapsible Code Blocks & Details */
.code-toggle-wrap {
  margin: 1.25em 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--pre-bg);
}

.code-toggle-wrap pre,
.code-toggle-wrap .highlighter-rouge {
  margin: 0;
  border: none;
  border-radius: 0;
}

.code-toggle-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}

.code-toggle-wrap.is-collapsed .code-toggle-bar {
  border-bottom: none;
}

.code-toggle-wrap.is-collapsed .code-toggle-body {
  display: none;
}

.code-toggle-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-subtle);
  font-family: var(--font-mono);
  font-size: 12px;
}

.code-lang-pill {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.03em;
}

.code-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.code-toggle-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.markdown-body details {
  margin: 1.25em 0;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-muted);
}

.markdown-body details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
  font-size: 14.5px;
}

.markdown-body details[open] summary {
  margin-bottom: 12px;
}

/* Tables (Markdown & Pandas DataFrames) */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  margin: 1.4em 0;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  margin: 0;
}

.markdown-body th, .markdown-body td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.markdown-body th:last-child, .markdown-body td:last-child { border-right: none; }
.markdown-body tr:last-child td { border-bottom: none; }

.markdown-body thead th {
  background: var(--surface-muted);
  font-weight: 600;
  color: var(--text);
}

.markdown-body tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--surface-muted) 45%, transparent);
}

/* Section cards inside README pages */
.section-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.section-card {
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.section-card-title {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15.5px;
  margin-bottom: 6px;
}

.section-card-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  margin: 0 0 8px !important;
}

.section-sublinks {
  margin: 8px 0 0 !important;
  padding-left: 18px;
  font-size: 13px;
}

/* Mermaid */
.mermaid {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin: 1.5em 0;
  overflow-x: auto;
  text-align: center;
}

[data-theme="dark"] .mermaid {
  background: #0f172a;
}

/* Pager */
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.pager-link {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
}

.pager-link:hover { border-color: var(--accent); color: var(--text); }
.pager-next { text-align: right; grid-column: 2; }
.pager-label { font-size: 12px; color: var(--text-subtle); margin-bottom: 2px; }
.pager-title { font-weight: 600; font-size: 14px; color: var(--accent); }

/* Right TOC Rail */
.toc-rail {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  max-height: calc(100vh - var(--header-h) - 36px);
  overflow-y: auto;
}

.toc-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  margin: 0 0 10px;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--border);
}

.toc-list a {
  display: block;
  padding: 4px 12px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-subtle);
  border-left: 2px solid transparent;
  margin-left: -1px;
}

.toc-list a:hover { color: var(--text); }
.toc-list a.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.toc-list .toc-h3 a { padding-left: 22px; }

/* Rouge Syntax Highlighting (GitHub Dark inspired) */
.highlight .c, .highlight .cm, .highlight .cp, .highlight .c1, .highlight .cs { color: #8b949e; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kt, .highlight .ow { color: #ff7b72; }
.highlight .s, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .s2, .highlight .sh, .highlight .sx, .highlight .s1 { color: #a5d6ff; }
.highlight .m, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .mo, .highlight .il { color: #79c0ff; }
.highlight .na, .highlight .nb, .highlight .nc, .highlight .no, .highlight .nf { color: #d2a8ff; }
.highlight .o, .highlight .p { color: #e2e8f0; }

/* Search Modal */
.search-modal[hidden], .lightbox[hidden] { display: none; }

.search-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(2, 6, 23, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 72px 16px 24px;
}

.search-dialog {
  width: 100%;
  max-width: 620px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-subtle);
}

.search-input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 15.5px;
}

.search-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 10px;
}

.search-hint {
  margin: 14px;
  font-size: 14px;
  color: var(--text-subtle);
}

.search-item {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
}

.search-item:hover { background: var(--surface-muted); color: var(--text); }
.search-item-title { font-weight: 600; font-size: 14.5px; color: var(--accent); }
.search-item-excerpt { font-size: 12.5px; color: var(--text-subtle); margin-top: 2px; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(2, 6, 23, 0.86);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox img {
  max-width: min(94vw, 1200px);
  max-height: 82vh;
  border-radius: 10px;
  background: #fff;
  padding: 6px;
}

.lightbox-close {
  position: fixed;
  top: 18px;
  right: 22px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(15, 23, 42, 0.8);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}

.lightbox-caption { color: #e2e8f0; font-size: 14px; margin-top: 12px; text-align: center; }

/* 404 */
.not-found {
  max-width: 640px;
  margin: 72px auto;
  padding: 0 20px;
}

.not-found-card {
  padding: 40px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
  color: var(--text-subtle);
}

.footer-copy { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-links a { color: var(--text-subtle); }
.footer-links a:hover { color: var(--accent); }

/* Responsive */
@media (max-width: 1140px) {
  .docs-shell { grid-template-columns: 256px minmax(0, 1fr); }
  .toc-rail { display: none; }
}

@media (max-width: 900px) {
  .header-nav { display: none; }
  .mobile-menu-btn { display: grid; }
  .search-trigger-label, .kbd { display: none; }
  .docs-shell { grid-template-columns: minmax(0, 1fr); padding: 16px 14px 48px; }
  .docs-main { padding: 22px 18px 28px; }
  .hero { padding: 34px 22px; }

  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: 290px;
    max-height: none;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 18px 14px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .sidebar.is-open { transform: translateX(0); }

  .sidebar-backdrop.is-open {
    display: block;
    position: fixed;
    inset: var(--header-h) 0 0 0;
    background: rgba(2, 6, 23, 0.5);
    z-index: 45;
  }

  .pager { grid-template-columns: 1fr; }
  .pager-next { grid-column: auto; text-align: left; }
}
