/* OmniRead Developer Platform — Design Tokens & Layout */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --topbar-bg: rgba(255, 255, 255, 0.88);
  --surface: #f7f8fa;
  --surface-hover: #eef1f5;
  --ink: #16202a;
  --ink-secondary: #435261;
  --ink-muted: #586776;
  --line: #e3e8ee;
  --line-strong: #cdd6df;
  --accent: #8c5d13;
  --accent-hover: #714a0d;
  --accent-soft: #fbf4e6;
  --accent-border: #ead5ac;
  --code-bg: #f6f8fa;
  --code-header: #edf1f5;
  --shadow-sm: 0 1px 2px rgba(22, 32, 42, 0.05);
  --shadow-md: 0 10px 30px rgba(22, 32, 42, 0.08);
  --shadow-lg: 0 24px 60px rgba(22, 32, 42, 0.22);

  --success: #166534;
  --success-bg: #ecf7f0;
  --success-border: #b7e4c7;
  --warn: #8c5400;
  --warn-bg: #fef7e6;
  --warn-border: #f3d49b;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --danger-border: #f7c4bf;

  --tok-key: #7c4d0f;
  --tok-str: #166534;
  --tok-num: #0369a1;
  --tok-lit: #7e22ce;
  --tok-kw: #9f1239;
  --tok-cmt: #64748b;
  --tok-punc: #64748b;
  --tok-fn: #1d4ed8;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --topbar-h: 64px;

  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  background: var(--bg);
  color: var(--ink);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111820;
    --bg-elevated: #16202a;
    --topbar-bg: rgba(17, 24, 32, 0.86);
    --surface: #16202a;
    --surface-hover: #1f2d3b;
    --ink: #edf2f7;
    --ink-secondary: #c0cedb;
    --ink-muted: #93a5b6;
    --line: #273544;
    --line-strong: #394b5e;
    --accent: #e3b76f;
    --accent-hover: #efd09c;
    --accent-soft: rgba(227, 183, 111, 0.12);
    --accent-border: rgba(227, 183, 111, 0.3);
    --code-bg: #16212c;
    --code-header: #1d2b39;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
    --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.36);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.56);

    --success: #6ee7a0;
    --success-bg: rgba(110, 231, 160, 0.1);
    --success-border: rgba(110, 231, 160, 0.28);
    --warn: #f4b740;
    --warn-bg: rgba(244, 183, 64, 0.12);
    --warn-border: rgba(244, 183, 64, 0.3);
    --danger: #fca5a5;
    --danger-bg: rgba(249, 112, 102, 0.12);
    --danger-border: rgba(249, 112, 102, 0.32);

    --tok-key: #e3b76f;
    --tok-str: #7ee2a8;
    --tok-num: #7dd3fc;
    --tok-lit: #d8b4fe;
    --tok-kw: #fda4af;
    --tok-cmt: #8fa1b3;
    --tok-punc: #94a3b8;
    --tok-fn: #93c5fd;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111820;
  --bg-elevated: #16202a;
  --topbar-bg: rgba(17, 24, 32, 0.86);
  --surface: #16202a;
  --surface-hover: #1f2d3b;
  --ink: #edf2f7;
  --ink-secondary: #c0cedb;
  --ink-muted: #93a5b6;
  --line: #273544;
  --line-strong: #394b5e;
  --accent: #e3b76f;
  --accent-hover: #efd09c;
  --accent-soft: rgba(227, 183, 111, 0.12);
  --accent-border: rgba(227, 183, 111, 0.3);
  --code-bg: #16212c;
  --code-header: #1d2b39;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.36);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.56);

  --success: #6ee7a0;
  --success-bg: rgba(110, 231, 160, 0.1);
  --success-border: rgba(110, 231, 160, 0.28);
  --warn: #f4b740;
  --warn-bg: rgba(244, 183, 64, 0.12);
  --warn-border: rgba(244, 183, 64, 0.3);
  --danger: #fca5a5;
  --danger-bg: rgba(249, 112, 102, 0.12);
  --danger-border: rgba(249, 112, 102, 0.32);

  --tok-key: #e3b76f;
  --tok-str: #7ee2a8;
  --tok-num: #7dd3fc;
  --tok-lit: #d8b4fe;
  --tok-kw: #fda4af;
  --tok-cmt: #8fa1b3;
  --tok-punc: #94a3b8;
  --tok-fn: #93c5fd;
}

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

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

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  overflow-x: clip;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

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

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection {
  background: var(--accent-border);
  color: var(--ink);
}

.skip {
  position: fixed;
  top: -120px;
  left: 16px;
  z-index: 60;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
}

.skip:focus {
  top: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.anchor-alias {
  display: block;
  position: relative;
  top: -88px;
  visibility: hidden;
}

/* Header / Topbar */
.topbar {
  height: var(--topbar-h);
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  gap: 16px;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  min-height: 44px;
}

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

.brand-icon-wrap {
  display: inline-flex;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.brand-mark {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: contain;
}

.brand-mark-dark {
  display: none;
}

:root[data-theme="dark"] .brand-mark-light {
  display: none;
}

:root[data-theme="dark"] .brand-mark-dark {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-mark-light {
    display: none;
  }

  :root:not([data-theme="light"]) .brand-mark-dark {
    display: block;
  }
}

.brand-text {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand strong {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-divider {
  width: 1px;
  height: 18px;
  background: var(--line-strong);
}

.brand-caption {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-muted);
}

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

/* Search Trigger */
.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink-muted);
  font-size: 14px;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.search-trigger:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  background: var(--surface-hover);
}

.search-trigger-label {
  padding-right: 14px;
}

.search-kbd,
kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--ink-muted);
}

/* Theme Switcher */
.theme-switcher {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  gap: 2px;
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.theme-btn:hover {
  color: var(--ink);
}

.theme-btn[aria-pressed="true"] {
  background: var(--bg-elevated);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.menu-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

/* 3-Column Documentation Layout */
.layout {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr) 232px;
  max-width: 1440px;
  margin: 0 auto;
  min-height: calc(100dvh - var(--topbar-h));
}

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100dvh - var(--topbar-h));
  overflow-y: auto;
  padding: 24px 16px 32px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.sidebar-backdrop {
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  background: rgba(15, 23, 32, 0.45);
  z-index: 24;
}

.nav-group + .nav-group {
  margin-top: 20px;
}

.nav-group-label {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 0 12px 6px;
}

.nav-group-links {
  display: grid;
  gap: 2px;
}

.nav-group-links a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--ink-secondary);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 450;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.nav-group-links a:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.nav-group-links a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-card {
  margin: 26px 4px 0;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  font-size: 13.5px;
}

.sidebar-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.sidebar-card p {
  margin: 0 0 12px;
  color: var(--ink-muted);
  line-height: 1.65;
}

.sidebar-card-links {
  display: grid;
  gap: 6px;
}

.sidebar-card-links a {
  text-decoration: none;
  font-weight: 550;
  font-size: 13px;
}

/* Main Content Area */
main {
  min-width: 0;
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
  padding: 36px 44px 20px;
}

.page-heading {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.page-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.group-pill,
.hero-pill {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  padding: 3px 10px;
  border-radius: 999px;
}

.reading-meta {
  font-size: 13px;
  color: var(--ink-muted);
}

h1 {
  font-size: clamp(1.85rem, 3vw, 2.35rem);
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin: 0 0 12px;
  font-weight: 750;
}

.description {
  margin: 0;
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--ink-secondary);
}

/* Landing Hero (index.html) */
.hero {
  margin-bottom: 40px;
  padding: 32px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at top right, var(--accent-soft), transparent 58%),
    var(--surface);
}

.hero-top h1 {
  margin-top: 14px;
  font-size: clamp(2rem, 3.6vw, 2.65rem);
}

.hero-lead {
  font-size: 16.5px;
  line-height: 1.75;
  color: var(--ink-secondary);
  margin: 0 0 22px;
  max-width: 68ch;
}

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

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0 0 26px;
}

.hero-chips li {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
}

.hero-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.track-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

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

.track-badge {
  font-size: 12px;
  font-weight: 650;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.track-card strong {
  font-size: 16px;
  line-height: 1.4;
}

.track-card p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink-secondary);
  flex: 1;
}

.track-link {
  margin-top: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-md);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-sm {
  min-height: 38px;
  padding: 0 14px;
  font-size: 13.5px;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

:root[data-theme="dark"] .btn-primary {
  color: #16120b;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-primary {
    color: #16120b;
  }
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #ffffff;
}

:root[data-theme="dark"] .btn-primary:hover {
  color: #16120b;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-primary:hover {
    color: #16120b;
  }
}

.btn-secondary {
  background: var(--bg-elevated);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
}

.btn-ghost:hover {
  background: var(--accent-soft);
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg-elevated);
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.pill-btn:hover {
  border-color: var(--accent);
  color: var(--ink);
}

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

/* Article Typography */
.doc-article {
  overflow-wrap: anywhere;
}

.doc-article > :first-child {
  margin-top: 0;
}

.doc-article p {
  margin: 16px 0;
}

.doc-article h2 {
  font-size: 1.42rem;
  line-height: 1.4;
  letter-spacing: -0.015em;
  margin: 44px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: calc(var(--topbar-h) + 24px);
}

.doc-article h3 {
  font-size: 1.12rem;
  line-height: 1.45;
  margin: 30px 0 12px;
  scroll-margin-top: calc(var(--topbar-h) + 24px);
}

.doc-article h4 {
  font-size: 1rem;
  margin: 22px 0 8px;
}

.anchor {
  font-size: 0.85em;
  margin-left: 8px;
  text-decoration: none;
  opacity: 0;
  color: var(--ink-muted);
  transition: opacity 0.15s ease;
}

h2:hover .anchor,
h3:hover .anchor,
.anchor:focus {
  opacity: 1;
}

.doc-article ul,
.doc-article ol {
  padding-left: 22px;
  margin: 14px 0;
}

.doc-article li {
  margin: 7px 0;
}

.doc-article hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 36px 0;
}

code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--code-bg);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 5px;
  overflow-wrap: anywhere;
}

/* Enhanced Code Blocks */
.code-block {
  margin: 22px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--code-bg);
  overflow: hidden;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px 6px 16px;
  background: var(--code-header);
  border-bottom: 1px solid var(--line);
  gap: 12px;
}

.code-lang,
.code-size {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
}

.code-copy-btn {
  min-height: 32px;
  min-width: 56px;
  padding: 2px 10px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: var(--bg-elevated);
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 500;
  transition: color 0.15s ease, border-color 0.15s ease;
}

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

.code-block pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  line-height: 1.7;
  tab-size: 2;
}

.code-block pre code {
  display: block;
  border: 0;
  padding: 0;
  background: none;
  font-size: 13px;
  white-space: pre;
  overflow-wrap: normal;
  width: max-content;
  min-width: 100%;
}

/* Syntax Token Colors */
.tok-key { color: var(--tok-key); }
.tok-str { color: var(--tok-str); }
.tok-num { color: var(--tok-num); }
.tok-lit { color: var(--tok-lit); font-weight: 600; }
.tok-kw { color: var(--tok-kw); font-weight: 600; }
.tok-cmt { color: var(--tok-cmt); font-style: italic; }
.tok-punc { color: var(--tok-punc); }
.tok-fn { color: var(--tok-fn); }

/* First-Class AI Prompt Cards */
.prompt-card {
  margin: 26px 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--accent-border);
  border-top: 3px solid var(--accent);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.prompt-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--accent-border);
}

.prompt-card-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.prompt-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

.prompt-meta {
  font-size: 12px;
  color: var(--ink-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 999px;
}

.prompt-copy-btn {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  border: 0;
  background: var(--accent);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  transition: background-color 0.15s ease;
}

:root[data-theme="dark"] .prompt-copy-btn {
  color: #16120b;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .prompt-copy-btn {
    color: #16120b;
  }
}

.prompt-copy-btn:hover {
  background: var(--accent-hover);
}

.prompt-pre {
  margin: 0;
  padding: 18px 20px;
  max-height: 520px;
  overflow-y: auto;
  background: var(--bg-elevated);
  line-height: 1.75;
}

.prompt-pre code {
  display: block;
  border: 0;
  padding: 0;
  background: none;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", sans-serif;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
}

/* Tables & Callouts */
.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  margin: 22px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.7;
}

th {
  text-align: left;
  background: var(--surface);
  font-weight: 650;
  color: var(--ink);
}

td,
th {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  min-width: 100px;
}

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

table code {
  font-size: 12.5px;
}

blockquote,
.note {
  margin: 22px 0;
  padding: 14px 18px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  color: var(--ink-secondary);
  font-size: 14.5px;
}

blockquote p:first-child {
  margin-top: 0;
}

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

/* Right-Hand TOC */
.toc {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100dvh - var(--topbar-h));
  overflow-y: auto;
  padding: 32px 20px 32px 8px;
  font-size: 13px;
}

.toc-label {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin: 0 0 12px 12px;
}

.toc-nav {
  display: grid;
}

.toc-link {
  display: block;
  color: var(--ink-muted);
  text-decoration: none;
  border-left: 2px solid var(--line);
  padding: 6px 12px;
  line-height: 1.5;
  transition: color 0.14s ease, border-color 0.14s ease;
}

.toc-link.toc-h3 {
  padding-left: 24px;
  font-size: 12.5px;
}

.toc-link:hover {
  color: var(--ink);
  border-left-color: var(--line-strong);
}

.toc-link.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.toc-empty {
  color: var(--ink-muted);
  padding-left: 12px;
}

/* Pagination & Footer */
.page-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  border-top: 1px solid var(--line);
  margin-top: 52px;
  padding-top: 24px;
}

.page-nav-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.page-nav-link:hover {
  border-color: var(--accent);
  background: var(--surface);
  color: var(--ink);
}

.page-nav-link small {
  font-size: 12px;
  color: var(--ink-muted);
}

.page-nav-link span {
  font-size: 15px;
  font-weight: 600;
}

.page-nav-link.next {
  text-align: right;
}

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 32px;
  padding: 22px 0 36px;
  font-size: 12.5px;
  color: var(--ink-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.site-footer strong {
  color: var(--ink-secondary);
  font-weight: 600;
}

/* Downloads Page: Cards, Inspector & Browser Quick Linter */
.example-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0 28px;
}

.example {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.example:hover {
  color: var(--ink);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.example-number {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 12px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.example strong {
  font-size: 16px;
}

.example-desc {
  font-size: 13.5px;
  color: var(--ink-secondary);
  line-height: 1.55;
}

.example code {
  width: fit-content;
  font-size: 12px;
  color: var(--ink-muted);
  background: var(--surface);
}

.download-label {
  margin-top: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent);
}

.linter-card,
.inspector-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 18px;
  margin: 18px 0 32px;
}

.linter-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.linter-samples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.linter-textarea {
  width: 100%;
  min-height: 200px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--bg-elevated);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
}

.linter-output {
  margin-top: 14px;
}

.linter-placeholder {
  margin: 0;
  font-size: 14px;
  color: var(--ink-muted);
}

.linter-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  margin-bottom: 12px;
  font-size: 14px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 650;
}

.status-pass {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.status-warn {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid var(--warn-border);
}

.status-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.linter-list {
  display: grid;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.linter-item {
  padding: 11px 14px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  line-height: 1.6;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
}

.linter-item-error {
  border-color: var(--danger-border);
  background: var(--danger-bg);
}

.linter-item-warn {
  border-color: var(--warn-border);
  background: var(--warn-bg);
}

.linter-item-pass {
  border-color: var(--success-border);
  background: var(--success-bg);
}

.linter-item strong {
  display: inline-block;
  margin-right: 6px;
}

.linter-next-steps {
  margin-top: 12px;
  font-size: 13.5px;
  color: var(--ink-secondary);
}

/* Interactive JSON Inspector */
.inspector-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.inspector-tab {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 14px;
  font-weight: 550;
}

.inspector-tab:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.inspector-tab.is-active {
  background: var(--bg-elevated);
  border-color: var(--line-strong);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.inspector-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.inspector-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.inspector-meta strong {
  font-size: 15.5px;
  margin-right: 8px;
}

.inspector-meta p {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--ink-secondary);
}

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

.inspector-code {
  margin: 0;
}

.inspector-code pre {
  max-height: 440px;
  overflow: auto;
}

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

.search-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 16px 24px;
}

.search-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 32, 0.56);
  backdrop-filter: blur(4px);
}

.search-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-strong);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 76dvh;
}

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

.search-icon {
  color: var(--ink-muted);
  flex-shrink: 0;
}

#search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 15.5px;
  outline: none;
}

.search-close-btn {
  min-height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 600;
}

.search-results {
  overflow-y: auto;
  padding: 8px;
  display: grid;
  gap: 4px;
}

.search-result-item {
  display: block;
  padding: 10px 12px;
  border-radius: 9px;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid transparent;
}

.search-result-item:hover,
.search-result-item.is-selected {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--ink);
}

.search-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}

.search-result-title {
  font-size: 14.5px;
  font-weight: 600;
}

.search-result-meta {
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
}

.search-result-snippet {
  font-size: 13px;
  color: var(--ink-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-result-item mark {
  background: var(--accent-border);
  color: var(--ink);
  padding: 0 2px;
  border-radius: 3px;
}

.search-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 14px;
}

.search-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  font-size: 12px;
  color: var(--ink-muted);
}

/* 404 Page */
.page-404 {
  min-height: 100dvh;
  display: grid;
  place-items: center;
}

.not-found {
  max-width: 560px;
  padding: 40px 24px;
  text-align: center;
}

.not-found h1 {
  margin-top: 14px;
}

.not-found p {
  color: var(--ink-secondary);
  margin: 0 0 24px;
}

.not-found .hero-actions {
  justify-content: center;
}

/* Responsive Breakpoints */
@media (min-width: 1441px) {
  .layout {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 244px minmax(0, 1fr);
  }

  .toc {
    display: none;
  }

  main {
    padding: 32px 32px 20px;
  }
}

@media (max-width: 960px) {
  .hero-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  :root {
    --topbar-h: 60px;
  }

  .topbar {
    padding: 0 14px;
    gap: 8px;
  }

  .search-trigger {
    min-width: 44px;
    min-height: 44px;
    padding: 0 10px;
  }

  .search-trigger-label,
  .search-kbd {
    display: none;
  }

  .theme-btn {
    min-height: 36px;
    padding: 0 8px;
  }

  .theme-btn span {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .layout {
    display: block;
  }

  .sidebar {
    display: none;
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: min(304px, 86vw);
    z-index: 25;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.is-open {
    display: block;
  }

  main {
    padding: 24px 18px 20px;
  }

  .hero {
    padding: 22px 18px;
  }

  .example-grid,
  .page-nav {
    grid-template-columns: 1fr;
  }

  .page-nav-link.next {
    text-align: left;
  }
}

@media (max-width: 420px) {
  .brand-divider,
  .brand-caption {
    display: none;
  }

  .menu-toggle span {
    display: none;
  }

  .menu-toggle {
    min-width: 44px;
    padding: 0 12px;
    justify-content: center;
  }

  .linter-card,
  .inspector-card {
    padding: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
