:root {
  --bg: #05080f;
  --bg-elevated: #0a101d;
  --surface: rgba(13, 21, 38, 0.78);
  --surface-solid: #0d1526;
  --surface-hover: rgba(20, 33, 58, 0.92);
  --border: rgba(56, 189, 248, 0.16);
  --border-strong: rgba(0, 240, 255, 0.35);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --cyan: #00f0ff;
  --sky: #38bdf8;
  --emerald: #10b981;
  --lr-green: #0a5c36;
  --gold: #c8a951;
  --purple: #c084fc;
  --amber: #f59e0b;
  --red: #f87171;
  --code-bg: #080d18;
  --header-h: 64px;
  --sidebar-w: 296px;
  --toc-w: 248px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-glow: 0 0 32px rgba(0, 240, 255, 0.08);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace;
}

html[data-theme="light"] {
  --bg: #f4f7fb;
  --bg-elevated: #ffffff;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --surface-hover: #eef4fb;
  --border: rgba(15, 23, 42, 0.12);
  --border-strong: rgba(2, 132, 199, 0.45);
  --text: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  --cyan: #0284c7;
  --sky: #0369a1;
  --code-bg: #0d1526;
  --shadow-glow: 0 8px 30px rgba(15, 23, 42, 0.08);
}

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -15%, rgba(0, 240, 255, 0.09), transparent),
    radial-gradient(ellipse 60% 40% at 95% 15%, rgba(10, 92, 54, 0.12), transparent);
}

html[data-theme="light"] body {
  background-image:
    radial-gradient(ellipse 80% 45% at 50% -15%, rgba(2, 132, 199, 0.08), transparent);
}

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

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

img {
  max-width: 100%;
  height: auto;
}

/* Top Navigation */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  background: rgba(5, 8, 15, 0.84);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}

html[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.88);
}

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

.menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand-logo {
  height: 34px;
  width: auto;
  display: block;
}

html[data-theme="light"] .brand-logo {
  filter: drop-shadow(0 1px 2px rgba(5, 8, 15, 0.55));
  background: #05080f;
  padding: 4px 10px;
  border-radius: 8px;
}

.brand-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 240, 255, 0.12);
  color: var(--cyan);
  border: 1px solid rgba(0, 240, 255, 0.28);
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: rgba(56, 189, 248, 0.12);
}

.nav-link.active {
  color: var(--cyan);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  min-width: 210px;
  justify-content: space-between;
  transition: border-color 0.15s ease, color 0.15s ease;
}

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

.search-trigger-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-muted);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--cyan);
  border-color: var(--border-strong);
}

/* 3-Column Documentation Layout */
.docs-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  max-width: 1580px;
  margin: 0 auto;
  min-height: calc(100vh - var(--header-h));
}

.sidebar {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 18px 14px 36px;
  border-right: 1px solid var(--border);
  background: rgba(5, 8, 15, 0.45);
}

html[data-theme="light"] .sidebar {
  background: rgba(255, 255, 255, 0.65);
}

.sidebar::-webkit-scrollbar,
.toc-aside::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-thumb,
.toc-aside::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.22);
  border-radius: 999px;
}

.sidebar-filter {
  width: 100%;
  padding: 8px 11px;
  margin-bottom: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.sidebar-filter:focus {
  border-color: var(--cyan);
}

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

.sidebar-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 4px 8px;
  margin-bottom: 6px;
}

.sidebar-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 2px;
  border-left: 2px solid transparent;
}

.sidebar-link:hover {
  color: var(--text);
  background: rgba(56, 189, 248, 0.08);
}

.sidebar-link.active {
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.1);
  border-left-color: var(--cyan);
  font-weight: 600;
}

.sidebar-link-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-phase {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* Main Documentation Article */
.doc-main {
  min-width: 0;
  padding: 30px 42px 64px;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.doc-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 26px;
}

.meta-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.1);
  color: var(--sky);
  border: 1px solid rgba(56, 189, 248, 0.22);
}

.pill-green {
  background: rgba(16, 185, 129, 0.12);
  color: var(--emerald);
  border-color: rgba(16, 185, 129, 0.28);
}

.pill-gold {
  background: rgba(200, 169, 81, 0.14);
  color: var(--gold);
  border-color: rgba(200, 169, 81, 0.3);
}

.pill-muted {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
  border-color: var(--border);
}

.source-link {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.source-link:hover {
  color: var(--cyan);
}

/* Rendered Markdown Content */
.doc-content {
  font-size: 15.5px;
  line-height: 1.72;
}

.doc-content a[id] {
  display: block;
  position: relative;
  top: -82px;
  visibility: hidden;
}

.doc-content h1,
.doc-content h2,
.doc-content h3,
.doc-content h4 {
  font-family: var(--font-display);
  color: var(--text);
  letter-spacing: -0.02em;
  scroll-margin-top: 84px;
}

.doc-content h1 {
  font-size: clamp(1.75rem, 2.8vw, 2.35rem);
  line-height: 1.2;
  margin: 0 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.doc-content h2 {
  font-size: 1.48rem;
  margin: 38px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.doc-content h3 {
  font-size: 1.18rem;
  margin: 26px 0 10px;
  color: var(--sky);
}

.doc-content h4 {
  font-size: 1.02rem;
  margin: 20px 0 8px;
}

.doc-content p {
  margin: 0 0 15px;
}

.doc-content p[align="center"],
.doc-content div[align="center"] {
  text-align: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 14px 0;
}

.doc-content img[src*="shields.io"] {
  height: 22px;
  width: auto;
  border-radius: 4px;
  margin: 0;
}

.doc-content img:not([src*="shields.io"]) {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-glow);
  cursor: zoom-in;
  margin: 8px auto;
  display: block;
}

.doc-content hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

.doc-content ul, .doc-content ol {
  margin: 0 0 16px;
  padding-left: 24px;
}

.doc-content li {
  margin-bottom: 6px;
}

.doc-content code:not(pre code) {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.16);
  color: var(--cyan);
  word-break: break-word;
}

html[data-theme="light"] .doc-content code:not(pre code) {
  background: rgba(2, 132, 199, 0.08);
  color: #0369a1;
}

/* Code Blocks */
.code-block {
  margin: 18px 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--code-bg);
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #94a3b8;
}

.copy-btn {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  cursor: pointer;
}

.copy-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.code-block pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  color: #e2e8f0;
}

/* Highlight.js Cockpit Theme */
.hljs-comment, .hljs-quote { color: #64748b; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-subst { color: #c084fc; font-weight: 600; }
.hljs-string, .hljs-doctag, .hljs-regexp { color: #34d399; }
.hljs-number, .hljs-literal, .hljs-variable, .hljs-template-variable { color: #fbbf24; }
.hljs-title, .hljs-section, .hljs-selector-id { color: #38bdf8; font-weight: 600; }
.hljs-type, .hljs-class .hljs-title, .hljs-built_in { color: #00f0ff; }
.hljs-attr, .hljs-attribute, .hljs-name, .hljs-property { color: #7dd3fc; }
.hljs-meta, .hljs-symbol, .hljs-bullet { color: #fb923c; }

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 18px 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
}

.doc-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.8px;
}

.doc-content th {
  text-align: left;
  padding: 11px 14px;
  font-weight: 600;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.06);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.doc-content td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  vertical-align: top;
}

.doc-content tr:last-child td {
  border-bottom: 0;
}

.doc-content tbody tr:hover {
  background: rgba(56, 189, 248, 0.05);
}

/* HTML 2-col table inside README.md */
.doc-content table[width], .doc-content td[width="50%"] {
  white-space: normal;
}

/* Callouts */
.callout {
  margin: 18px 0;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  border-left-width: 4px;
  background: var(--surface);
}

.callout-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout-note { border-left-color: #38bdf8; }
.callout-note .callout-title { color: #38bdf8; }

.callout-tip { border-left-color: #10b981; }
.callout-tip .callout-title { color: #10b981; }

.callout-important { border-left-color: #c084fc; }
.callout-important .callout-title { color: #c084fc; }

.callout-warning { border-left-color: #f59e0b; background: rgba(245, 158, 11, 0.07); }
.callout-warning .callout-title { color: #f59e0b; }

.callout-caution { border-left-color: #ef4444; background: rgba(239, 68, 68, 0.08); }
.callout-caution .callout-title { color: #ef4444; }

.doc-content blockquote:not(.callout) {
  margin: 18px 0;
  padding: 12px 18px;
  border-left: 3px solid var(--sky);
  background: rgba(56, 189, 248, 0.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
}

.doc-content blockquote p:last-child {
  margin-bottom: 0;
}

/* Details Accordions */
.doc-content details {
  margin: 16px 0;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
}

.doc-content summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}

.doc-content details[open] summary {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* Mermaid Cards */
.mermaid-card {
  margin: 20px 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #070c17;
  overflow: hidden;
}

.mermaid-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.14);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--sky);
  background: rgba(56, 189, 248, 0.05);
}

.mermaid-zoom-btn {
  font-family: var(--font-sans);
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: rgba(0, 240, 255, 0.08);
  color: var(--cyan);
  cursor: pointer;
}

.mermaid-zoom-btn:hover {
  background: rgba(0, 240, 255, 0.18);
}

.mermaid-card pre.mermaid {
  margin: 0;
  padding: 18px;
  display: flex;
  justify-content: center;
  overflow-x: auto;
  background: transparent;
}

.katex-block {
  margin: 16px 0;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow-x: auto;
  text-align: center;
}

/* Prev / Next Pagination */
.doc-pager {
  margin-top: 42px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.pager-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.pager-card:hover {
  border-color: var(--cyan);
  transform: translateY(-2px);
}

.pager-card.next {
  text-align: right;
}

.pager-label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pager-title {
  font-weight: 600;
  color: var(--text);
  font-size: 14.5px;
}

/* Right-hand TOC */
.toc-aside {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 26px 18px 36px 8px;
  border-left: 1px solid var(--border);
}

.toc-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 10px;
  padding-left: 10px;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-link {
  display: block;
  padding: 4px 10px;
  font-size: 12.5px;
  color: var(--text-muted);
  border-left: 2px solid var(--border);
  line-height: 1.4;
}

.toc-link.depth-3 {
  padding-left: 20px;
  font-size: 12px;
}

.toc-link:hover, .toc-link.active {
  color: var(--cyan);
  border-left-color: var(--cyan);
}

/* Home / Landing Portal */
.portal-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 36px 24px 72px;
}

.hero-banner {
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: linear-gradient(135deg, rgba(10, 18, 34, 0.94), rgba(6, 22, 24, 0.92));
  padding: 40px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 32px;
  align-items: center;
  box-shadow: var(--shadow-glow);
  margin-bottom: 36px;
}

html[data-theme="light"] .hero-banner {
  background: linear-gradient(135deg, #071120, #0b2421);
  color: #e2e8f0;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: #00f0ff;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(0, 240, 255, 0.12);
  border: 1px solid rgba(0, 240, 255, 0.28);
  margin-bottom: 16px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.6vw, 3.1rem);
  line-height: 1.1;
  margin: 0 0 14px;
  color: #f8fafc;
}

.hero-subtitle {
  font-size: 16px;
  color: #cbd5e1;
  margin: 0 0 24px;
  max-width: 620px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #00d8ff, #0284c7);
  color: #04101d;
}

.btn-primary:hover {
  color: #04101d;
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.3);
}

.btn-secondary:hover {
  color: #00f0ff;
  border-color: #00f0ff;
}

.hero-visual img {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 240, 255, 0.28);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  cursor: zoom-in;
}

/* KPI Strip */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 14px;
  margin-bottom: 42px;
}

.stat-card {
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(12px);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--cyan);
  line-height: 1.2;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Section Headers */
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 42px 0 18px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin: 0;
}

.section-sub {
  color: var(--text-muted);
  font-size: 14.5px;
  margin: 4px 0 0;
}

/* Reading Tracks */
.tracks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.track-card {
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.track-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.06rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.track-audience {
  font-size: 13px;
  color: var(--text-muted);
}

.track-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.track-step {
  font-size: 13px;
  padding: 5px 9px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.14);
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.track-step:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

/* Filter Chips */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
}

.chip {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.chip:hover, .chip.active {
  color: var(--cyan);
  border-color: var(--cyan);
  background: rgba(0, 240, 255, 0.1);
}

.inline-input {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  min-width: 240px;
  outline: none;
}

.inline-input:focus {
  border-color: var(--cyan);
}

/* Doc Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}

.doc-card {
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.doc-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.doc-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.doc-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(0, 240, 255, 0.12);
  color: var(--cyan);
}

.doc-card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.3;
}

.doc-card-summary {
  font-size: 13.5px;
  color: var(--text-muted);
  flex: 1;
}

.doc-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
}

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 18px;
}

.gallery-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.gallery-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  cursor: zoom-in;
  border-bottom: 1px solid var(--border);
}

.gallery-body {
  padding: 14px 16px;
}

.gallery-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
}

.gallery-desc {
  font-size: 13px;
  color: var(--text-muted);
}

/* Search Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(2, 6, 14, 0.78);
  backdrop-filter: blur(8px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 72px 16px 24px;
}

.modal-backdrop.open {
  display: flex;
}

.search-modal {
  width: 100%;
  max-width: 720px;
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
  overflow: hidden;
}

.search-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.search-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font-size: 16px;
}

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

.search-result-item {
  display: block;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  border: 1px solid transparent;
}

.search-result-item:hover, .search-result-item.selected {
  background: rgba(0, 240, 255, 0.1);
  border-color: rgba(0, 240, 255, 0.25);
}

.search-result-title {
  font-weight: 600;
  color: var(--text);
  font-size: 14.5px;
}

.search-result-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--sky);
  margin-top: 2px;
}

.search-result-snippet {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Lightbox */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(2, 5, 12, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox-backdrop.open {
  display: flex;
}

.lightbox-inner {
  position: relative;
  max-width: 94vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.lightbox-inner img,
.lightbox-inner .mermaid-zoom-target {
  max-width: 92vw;
  max-height: 82vh;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: #070c17;
  overflow: auto;
}

.lightbox-inner .mermaid-zoom-target svg {
  min-width: min(86vw, 1100px);
  height: auto;
  padding: 20px;
}

.lightbox-caption {
  color: #cbd5e1;
  font-size: 13.5px;
  text-align: center;
}

.lightbox-close {
  position: fixed;
  top: 18px;
  right: 22px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

/* References Accordion */
.ref-card {
  margin-bottom: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
}

.ref-head {
  padding: 14px 18px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.ref-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
}

.ref-desc {
  padding: 10px 18px 0;
  font-size: 13.5px;
  color: var(--text-muted);
}

.ref-card .code-block {
  margin: 12px 18px 18px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 26px 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

/* Responsive Breakpoints */
@media (max-width: 1260px) {
  .docs-shell {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }
  .toc-aside {
    display: none;
  }
}

@media (max-width: 960px) {
  .menu-btn {
    display: inline-flex;
  }
  .topbar-nav {
    display: none;
  }
  .docs-shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: var(--header-h);
    width: min(310px, 86vw);
    z-index: 70;
    background: var(--bg-elevated);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.55);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .doc-main {
    padding: 22px 18px 48px;
  }
  .hero-banner {
    grid-template-columns: 1fr;
    padding: 26px 22px;
  }
  .doc-pager {
    grid-template-columns: 1fr;
  }
  .search-trigger {
    min-width: auto;
  }
  .search-trigger span.search-label,
  .search-trigger .kbd {
    display: none;
  }
}
