/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #ffffff;
  --surface: #ffffff;
  --surface-subtle: #f4f4f5;
  --surface-hover: #ececef;
  --border: #e4e4e7;
  --border-subtle: #f0f0f2;
  --text: #09090b;
  --text-muted: #52525b;
  --text-dim: #a1a1aa;
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-soft: rgba(2, 132, 199, 0.08);
  --accent-active: rgba(2, 132, 199, 0.12);
  --code-bg: #0f1117;
  --code-inline-bg: #f4f4f5;
  --header-bg: rgba(255, 255, 255, 0.78);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px -4px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.18);

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;

  --header-h: 60px;
  --sidebar-w: 280px;
  --toc-w: 220px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --bg: #09090b;
  --surface: #0c0c0e;
  --surface-subtle: #18181b;
  --surface-hover: #1f1f23;
  --border: #27272a;
  --border-subtle: #1c1c1f;
  --text: #fafafa;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  --accent: #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-soft: rgba(56, 189, 248, 0.1);
  --accent-active: rgba(56, 189, 248, 0.16);
  --code-bg: #111114;
  --code-inline-bg: #1c1c20;
  --header-bg: rgba(9, 9, 11, 0.72);
  --shadow-md: 0 4px 16px -4px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 20px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
}
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.025em; color: var(--text); line-height: 1.25; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
kbd {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text-muted);
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-active); }
[hidden] { display: none !important; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 300;
  background: var(--accent); color: #fff; padding: 8px 14px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 18px;
  border-radius: var(--radius);
  font-size: 14px; font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, transform .15s;
}
.btn:hover { background: var(--surface-subtle); }
.btn-primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-primary:hover { background: var(--text); opacity: .88; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-subtle); color: var(--text); }

/* ==========================================================================
   Header
   ========================================================================== */
.progress-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 120;
  background: var(--accent);
  transform-origin: 0 50%; transform: scaleX(0);
  pointer-events: none;
}
.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  height: 100%; max-width: 1440px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 24px;
}
.brand-group { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; letter-spacing: -0.02em; color: var(--text); }
.brand-icon {
  min-width: 26px; height: 26px; padding: 0 5px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  color: #fff; font-size: 12px; font-weight: 800; letter-spacing: -0.02em;
  box-shadow: 0 1px 2px rgba(2, 132, 199, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}
.brand-tag {
  font-size: 11px; font-weight: 500;
  padding: 1px 8px; border-radius: 9999px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  user-select: none;
}
.topnav { display: flex; align-items: center; gap: 2px; }
.topnav-link {
  padding: 6px 10px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--text-muted);
  transition: color .15s, background-color .15s;
}
.topnav-link:hover { color: var(--text); }
.topnav-link.active { color: var(--accent); background: var(--accent-soft); }
.topbar-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }

.search-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; width: 240px; padding: 0 6px 0 10px; margin-right: 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text-dim);
  font-size: 13px; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.search-trigger:hover { border-color: var(--text-dim); color: var(--text-muted); }
.search-trigger-text { flex: 1; text-align: left; }
.search-trigger-kbd { background: var(--surface); }

.theme-toggle svg { display: none; }
[data-theme-mode="light"] .theme-toggle .icon-sun,
[data-theme-mode="dark"] .theme-toggle .icon-moon,
[data-theme-mode="system"] .theme-toggle .icon-system { display: block; }

.sidebar-toggle-btn[aria-pressed="true"] { color: var(--accent); }
.menu-btn { display: none; }

/* ==========================================================================
   App frame & sidebar
   ========================================================================== */
.app-frame {
  display: flex; max-width: 1440px; margin: 0 auto;
  min-height: calc(100vh - var(--header-h));
}
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 20px 12px 32px 20px;
  border-right: 1px solid var(--border);
  transition: margin-left .3s var(--ease), opacity .2s ease, visibility .3s;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
html.sidebar-hidden .has-sidebar .sidebar {
  margin-left: calc(-1 * var(--sidebar-w));
  opacity: 0; visibility: hidden;
}
html.sidebar-hidden .has-sidebar .sidebar-resizer { display: none; }

.sidebar-resizer {
  width: 9px; margin-left: -5px; margin-right: -4px;
  cursor: col-resize; position: relative; z-index: 30; flex-shrink: 0;
  touch-action: none;
}
.sidebar-resizer::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: 4px; width: 1px;
  background: transparent; transition: background-color .15s;
}
.sidebar-resizer:hover::after, .sidebar-resizer.is-active::after { background: var(--accent); width: 2px; }
body.is-resizing { cursor: col-resize; user-select: none; }
body.is-resizing .sidebar { transition: none; }
.sidebar-backdrop { display: none; }

.tree-controls-bar { margin-bottom: 16px; }
.sidebar-classes { display: none; flex-wrap: wrap; gap: 4px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.sidebar-class-link {
  padding: 5px 10px; border-radius: 9999px;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  border: 1px solid var(--border);
  transition: color .15s, border-color .15s, background-color .15s;
}
.sidebar-class-link:hover { color: var(--text); }
.sidebar-class-link.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.sidebar-section-title {
  margin: 0 0 10px 6px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-dim);
}
.tree-filter-box {
  display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.tree-filter-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tree-filter-box .search-icon { width: 14px; height: 14px; color: var(--text-dim); flex-shrink: 0; }
.tree-filter-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; }
.tree-filter-input::placeholder { color: var(--text-dim); }
.tree-clear-btn { border: 0; background: transparent; color: var(--text-dim); cursor: pointer; font-size: 11px; padding: 2px 4px; }
.tree-action-buttons { display: flex; gap: 2px; margin-top: 8px; }
.tree-action-btn {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  font-size: 11.5px; font-weight: 500; color: var(--text-dim);
  padding: 4px 6px; border-radius: var(--radius-sm);
  transition: color .15s, background-color .15s;
}
.tree-action-btn:hover { color: var(--text); background: var(--surface-subtle); }

.tree-category { margin-bottom: 14px; }
.tree-category-header, .tree-subcategory-header {
  width: 100%; display: flex; align-items: center; gap: 6px;
  border: 0; background: transparent; cursor: pointer; text-align: left;
  border-radius: var(--radius-sm);
}
.tree-category-header {
  padding: 4px 6px;
  font-size: 12.5px; font-weight: 600; color: var(--text);
}
.tree-category-header:hover .category-title { color: var(--accent); }
.chevron-icon { width: 14px; height: 14px; color: var(--text-dim); flex-shrink: 0; transition: transform .2s var(--ease); }
.is-expanded > .tree-category-header .chevron-icon,
.is-expanded > .tree-subcategory-header .chevron-icon { transform: rotate(90deg); }
.category-title, .subcategory-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color .15s; }
.category-count { font-size: 11px; font-weight: 500; color: var(--text-dim); font-variant-numeric: tabular-nums; }

.tree-category-items, .tree-subcategory-items { list-style: none; margin: 0; padding: 0; display: none; }
.tree-category.is-expanded > .tree-category-items { display: block; margin: 4px 0 0 13px; }
.tree-subcategory.is-expanded > .tree-subcategory-items { display: block; margin: 2px 0 6px 6px; border-left: 1px solid var(--border); }
.tree-subcategory-header { padding: 5px 6px; font-size: 13px; font-weight: 500; color: var(--text-muted); }
.tree-subcategory-header:hover { color: var(--text); }
.tree-subcategory.is-active-sub > .tree-subcategory-header { color: var(--text); }
.sub-chevron { width: 12px; height: 12px; }

.tree-doc-link {
  position: relative; display: block;
  margin-left: -1px; padding: 5px 10px 5px 14px;
  font-size: 13.5px; color: var(--text-muted);
  border-left: 1px solid transparent;
  transition: color .15s, border-color .15s;
}
.tree-category-items > .tree-item > .tree-doc-link { margin-left: 0; border-radius: var(--radius-sm); padding-left: 10px; }
.tree-doc-link:hover { color: var(--text); border-left-color: var(--text-dim); }
.tree-doc-link.active { color: var(--accent); font-weight: 500; border-left-color: var(--accent); }
.tree-doc-text { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar.density-compact .tree-doc-link { padding-top: 2px; padding-bottom: 2px; font-size: 12.5px; }
.sidebar.density-compact .tree-subcategory-header { padding-top: 2px; padding-bottom: 2px; font-size: 12.5px; }
.sidebar.density-compact .tree-category { margin-bottom: 8px; }

.tree-empty-state { padding: 24px 8px; text-align: center; font-size: 13px; color: var(--text-muted); }

/* ==========================================================================
   Content
   ========================================================================== */
.content-container { flex: 1; min-width: 0; padding: 40px 56px 64px; }
.article { max-width: 760px; margin: 0 auto; }
html.sidebar-hidden .has-sidebar .article { max-width: 820px; }
.page-main { flex: 1; min-width: 0; }

.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 0; font-size: 13px; color: var(--text-muted); }
.breadcrumbs li { display: inline-flex; align-items: center; gap: 6px; }
.breadcrumbs li + li::before { content: '/'; color: var(--text-dim); }
.breadcrumbs li:last-child { color: var(--accent); font-weight: 500; }
.breadcrumbs a:hover { color: var(--text); }

.article-header { padding-bottom: 28px; margin-bottom: 32px; border-bottom: 1px solid var(--border); }
.article-header h1 { font-size: clamp(28px, 4vw, 36px); font-weight: 800; letter-spacing: -0.035em; margin: 0 0 12px; }
.article-lead { font-size: 17px; line-height: 1.6; color: var(--text-muted); margin: 0 0 16px; }
.article-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center;
  height: 24px; padding: 0 10px; border-radius: 9999px;
  font-size: 12px; font-weight: 500;
  background: var(--accent-soft); color: var(--accent);
}
.chip-muted { background: var(--surface-subtle); color: var(--text-muted); }

/* Prose */
.prose { font-size: 15.5px; line-height: 1.75; color: var(--text); }
.prose > h1:first-child { display: none; }
.prose h2 { font-size: 23px; margin: 48px 0 14px; padding-top: 4px; }
.prose h3 { font-size: 18px; margin: 32px 0 10px; }
.prose h4 { font-size: 15.5px; margin: 24px 0 8px; }
.prose h2:first-child, .prose > h1:first-child + h2, .prose > h1:first-child + p { margin-top: 0; }
.prose p { margin: 0 0 18px; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px; transition: text-decoration-color .15s; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose ul, .prose ol { margin: 0 0 18px; padding-left: 22px; }
.prose li { margin: 6px 0; }
.prose li::marker { color: var(--text-dim); }
.prose strong { font-weight: 600; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 40px 0; }
.prose img { max-width: 100%; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.prose blockquote {
  margin: 24px 0; padding: 12px 18px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-muted);
}
.prose blockquote p:last-child { margin-bottom: 0; }
/* Kramdown tags inline code with language-plaintext, which the Prism theme colors #ccc. */
.prose :not(pre) > code,
.prose :not(pre) > code[class*="language-"] {
  font-family: var(--font-mono); font-size: 0.86em;
  padding: 2px 6px; border-radius: 5px;
  color: var(--text);
  background: var(--code-inline-bg);
  border: 1px solid var(--border);
  text-shadow: none;
  white-space: normal; overflow-wrap: anywhere;
}
.prose .heading-anchor { margin-left: 8px; color: var(--text-dim); text-decoration: none; opacity: 0; transition: opacity .15s; font-weight: 500; }
.prose h2:hover .heading-anchor, .prose h3:hover .heading-anchor, .prose .heading-anchor:focus { opacity: 1; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 24px 0; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; }
.prose th, .prose td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.prose th { font-weight: 600; font-size: 13px; color: var(--text-muted); background: var(--surface-subtle); }
.prose tr:last-child td { border-bottom: 0; }

/* Code blocks */
.code-wrapper {
  position: relative; margin: 24px 0;
  border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--border);
  background: var(--code-bg);
}
[data-theme="light"] .code-wrapper { border-color: #1f2330; }
.code-header {
  display: flex; align-items: center; justify-content: space-between;
  height: 38px; padding: 0 8px 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-family: var(--font-mono); font-size: 11.5px; color: #8b8b95;
  text-transform: lowercase;
}
.copy-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: transparent; color: #a1a1aa; cursor: pointer;
  font-family: var(--font-sans); font-size: 12px; padding: 4px 8px; border-radius: var(--radius-sm);
  transition: color .15s, background-color .15s;
}
.copy-btn:hover { color: #fafafa; background: rgba(255, 255, 255, 0.08); }
.copy-btn.copied { color: #4ade80; }
.prose div.highlighter-rouge, .prose div.highlight, .prose figure.highlight { margin: 0; background: transparent; }
pre, pre[class*="language-"] {
  margin: 0 !important; padding: 16px 18px !important;
  background: transparent !important; overflow-x: auto;
  font-family: var(--font-mono) !important; font-size: 13px !important; line-height: 1.7 !important;
  color: #e4e4e7; text-shadow: none !important;
}
pre code { font-family: inherit !important; background: transparent; padding: 0; border: 0; }

/* Pager */
.guide-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 64px; padding-top: 32px; border-top: 1px solid var(--border); }
.pager-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 20px; border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  transition: border-color .15s, box-shadow .15s;
}
.pager-card:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pager-next { grid-column: 2; text-align: right; align-items: flex-end; }
.pager-direction { font-size: 12.5px; color: var(--text-muted); }
.pager-title { font-size: 15px; font-weight: 600; color: var(--text); }
.pager-card:hover .pager-title { color: var(--accent); }
.pager-context { font-size: 12px; color: var(--text-dim); }

/* TOC */
.toc-pane {
  width: var(--toc-w); flex-shrink: 0;
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto; padding: 40px 20px 32px 8px;
  font-size: 13px;
}
.toc-title { font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 10px; }
.toc-list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc-link {
  display: block; margin-left: -1px; padding: 4px 0 4px 12px;
  border-left: 1px solid transparent;
  color: var(--text-muted); line-height: 1.45;
  transition: color .15s, border-color .15s;
}
.toc-link.depth-3 { padding-left: 24px; font-size: 12.5px; }
.toc-link:hover { color: var(--text); }
.toc-link.active { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }

/* ==========================================================================
   Homepage
   ========================================================================== */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  padding: 96px 24px 72px; text-align: center;
  border-bottom: 1px solid var(--border);
}
.hero::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(600px 280px at 50% -40px, var(--accent-active), transparent 70%),
    linear-gradient(var(--border-subtle) 1px, transparent 1px) 0 0 / 100% 48px,
    linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px) 0 0 / 48px 100%;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 75%);
}
.hero-search {
  display: flex; align-items: center; gap: 12px;
  width: 100%; max-width: 640px; height: 56px; margin: 0 auto; padding: 0 12px 0 18px;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow-md);
  color: var(--text-dim); font-size: 16px; cursor: text;
  transition: border-color .15s, box-shadow .15s;
}
.hero-search:hover, .hero-search:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-md); outline: none; }
.hero-search-text { flex: 1; text-align: left; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.home-section { max-width: 1200px; margin: 0 auto; padding: 64px 24px 32px; }
.home-class + .home-class { margin-top: 56px; }
.home-section-title { font-size: 24px; margin: 0 0 6px; }
.home-section-desc { color: var(--text-muted); margin: 0 0 28px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.cat-card {
  display: flex; flex-direction: column;
  padding: 20px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--surface);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.cat-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); box-shadow: var(--shadow-md); }
.cat-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cat-card-title { font-size: 16px; margin: 0; }
.cat-card-count { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.cat-card-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cat-card-list a {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 6px 8px; margin: 0 -8px; border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-muted);
  transition: color .15s, background-color .15s;
}
.cat-card-list a:hover { color: var(--accent); background: var(--accent-soft); }
.cat-card-meta { font-size: 12px; color: var(--text-dim); white-space: nowrap; }

/* 404 */
.not-found { max-width: 480px; margin: 0 auto; padding: 120px 24px; text-align: center; }
.not-found-code { font-size: 72px; font-weight: 800; letter-spacing: -0.05em; margin: 0; background: linear-gradient(135deg, #38bdf8, #0284c7); -webkit-background-clip: text; background-clip: text; color: transparent; }
.not-found h1 { font-size: 24px; margin: 8px 0 12px; }
.not-found p { color: var(--text-muted); margin: 0 0 28px; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); }
.footer-container { max-width: 1440px; margin: 0 auto; padding: 48px 24px 28px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.footer-brand-col { display: flex; flex-direction: column; gap: 14px; }
.footer-desc { margin: 0; max-width: 360px; font-size: 13.5px; line-height: 1.6; color: var(--text-muted); }
.footer-col-title { margin: 0 0 14px; font-size: 13px; font-weight: 600; letter-spacing: 0; }
.footer-link-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-link-list a { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; color: var(--text-muted); transition: color .15s; }
.footer-link-list a:hover { color: var(--text); }
.footer-link-list a.footer-more-link { color: var(--accent); font-weight: 500; }
.footer-col { min-width: 0; }
.footer-bottom-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-top: 24px; border-top: 1px solid var(--border-subtle);
  font-size: 13px; color: var(--text-dim);
}
.footer-top-link:hover { color: var(--text); }

/* ==========================================================================
   Search modal
   ========================================================================== */
.search-modal { position: fixed; inset: 0; z-index: 200; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.search-backdrop { position: absolute; inset: 0; background: rgba(9, 9, 11, 0.5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade-in .15s ease; }
.search-panel {
  position: relative; width: 100%; max-width: 620px;
  display: flex; flex-direction: column; max-height: 70vh;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  overflow: hidden; animation: pop-in .18s var(--ease);
}
.search-input-row { display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 54px; border-bottom: 1px solid var(--border); color: var(--text-dim); }
.search-input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 15px; }
.search-input::-webkit-search-cancel-button { display: none; }
.search-results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.search-group-label { padding: 10px 10px 6px; font-size: 11.5px; font-weight: 600; color: var(--text-dim); }
.search-result {
  display: block; padding: 10px 12px; border-radius: var(--radius);
  cursor: pointer;
}
.search-result-title { display: block; font-size: 14px; font-weight: 500; color: var(--text); }
.search-result-desc { display: block; font-size: 12.5px; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result.is-selected { background: var(--accent-soft); }
.search-result.is-selected .search-result-title { color: var(--accent); }
.search-empty { padding: 32px 12px; text-align: center; font-size: 14px; color: var(--text-muted); }
.search-footer { display: flex; gap: 16px; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-dim); }
.search-footer kbd { margin-right: 3px; }
body.modal-open { overflow: hidden; }

@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-8px) scale(0.98); } }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1200px) {
  .toc-pane { display: none; }
}
@media (max-width: 1024px) {
  .topnav { display: none; }
  .sidebar-classes { display: flex; }
  .search-trigger { width: auto; }
  .search-trigger-text, .search-trigger-kbd { display: none; }
  .search-trigger { width: 34px; padding: 0; justify-content: center; margin-right: 0; border-color: transparent; background: transparent; }
}
@media (max-width: 900px) {
  .menu-btn { display: inline-flex; margin-left: -6px; }
  .sidebar-toggle-btn, .sidebar-resizer { display: none !important; }
  .sidebar,
  html.sidebar-hidden .has-sidebar .sidebar {
    position: fixed; z-index: 150; top: 0; left: 0; bottom: 0; height: 100%;
    width: min(320px, 85vw); margin-left: 0;
    opacity: 1; visibility: visible;
    background: var(--surface); border-right: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    transition: transform .3s var(--ease);
    padding-top: 20px;
  }
  .sidebar.open, html.sidebar-hidden .has-sidebar .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 140; background: rgba(9, 9, 11, 0.5); animation: fade-in .2s ease; }
  .content-container { padding: 28px 20px 48px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand-col { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .brand-tag { display: none; }
  .topbar-inner { padding: 0 12px; gap: 12px; }
  .hero { padding: 56px 16px 40px; }
  .hero-search { height: 50px; font-size: 15px; }
  .guide-pager { grid-template-columns: 1fr; }
  .pager-next { grid-column: 1; }
  .footer-bottom-bar { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
