/* ============================================================
   OX Recorder — design tokens & shared components
   Canonical source for every page: marketing site, /doc and the
   plugin docs (oxrecorder-webservice public/plugin/docs-theme.css
   mirrors the token values below — keep them in sync).

   Cursor-inspired: warm cream canvas, warm ink, a single cyan-300
   accent used scarcely, hairline-only depth, display weight 400.
   Light is the default; dark follows the OS unless the visitor
   picks a theme (js/theme.js sets <html data-theme>).
   ============================================================ */

/* ---------- Fonts (self-hosted; Google Fonts is unreliable in CN) ---------- */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("../assets/fonts/inter-400.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("../assets/fonts/inter-500.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("../assets/fonts/inter-600.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../assets/fonts/jetbrains-mono-400.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../assets/fonts/jetbrains-mono-500.woff2") format("woff2"); }

/* ---------- Tokens: light ---------- */
:root {
  color-scheme: light;

  --primary: #67e8f9;          /* cyan-300: fills & indicators */
  --primary-active: #22d3ee;
  --on-primary: #083344;       /* dark ink on cyan fill */
  --primary-soft: rgba(103, 232, 249, 0.16);
  --primary-text: #0e7490;     /* brand-coloured text / meaningful icons */
  --focus: #0891b2;

  --ink: #26251e;
  --body: #5a5852;
  --muted: #6f6c62;          /* spec #807d72 darkened for 4.5:1 on canvas */
  --muted-soft: #a09c92;

  --canvas: #f7f7f4;
  --canvas-soft: #fafaf7;
  --surface-card: #ffffff;
  --surface-strong: #e6e5e0;
  --surface-hover: #efeee8;

  --hairline: #e6e5e0;
  --hairline-soft: #efeee8;
  --hairline-strong: #cfcdc4;

  --success: #1f8a65;
  --error: #cf2d56;
  --warning: #a8650a;
  --info: #2f6db3;

  /* Syntax highlighting */
  --code-bg: #ffffff;
  --code-text: #26251e;
  --code-comment: #8a877c;
  --code-keyword: #6d5bd0;
  --code-string: #1f7a57;
  --code-number: #8a4fc2;
  --code-title: #2f6db3;
  --code-attr: #a8650a;

  --logo-filter: brightness(0.5) contrast(1.25);

  /* Type */
  --font-sans: "Inter", system-ui, -apple-system, "Helvetica Neue", Helvetica, Arial,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, "Fira Code", monospace;

  /* Radius */
  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-pill: 9999px;

  /* Spacing */
  --s-xxs: 4px; --s-xs: 8px; --s-sm: 12px; --s-base: 16px; --s-md: 20px;
  --s-lg: 24px; --s-xl: 32px; --s-xxl: 48px; --s-section: 80px;

  /* Layout */
  --maxw: 1200px;
  --gutter: clamp(16px, 4vw, 32px);
  --topbar-h: 64px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

/* ---------- Tokens: dark (warm, never blue-black) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --primary: #67e8f9; --primary-active: #a5f3fc; --on-primary: #083344; --primary-soft: rgba(103, 232, 249, 0.14); --primary-text: #67e8f9; --focus: #67e8f9;
    --ink: #f2f1ec; --body: #bdbab0; --muted: #96928a; --muted-soft: #6f6b62;
    --canvas: #14130f; --canvas-soft: #1a1915; --surface-card: #1f1e1a; --surface-strong: #2b2a25; --surface-hover: #26251f;
    --hairline: #2e2c27; --hairline-soft: #24231f; --hairline-strong: #403d36;
    --success: #4cc495; --error: #f2668b; --warning: #e0a84a; --info: #7fb0ea;
    --code-bg: #1a1915; --code-text: #e8e6df; --code-comment: #8a867b; --code-keyword: #a99cf0;
    --code-string: #8fd1a6; --code-number: #c7a6ee; --code-title: #8fbcef; --code-attr: #e9bd6c;
    --logo-filter: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #67e8f9; --primary-active: #a5f3fc; --on-primary: #083344; --primary-soft: rgba(103, 232, 249, 0.14); --primary-text: #67e8f9; --focus: #67e8f9;
  --ink: #f2f1ec; --body: #bdbab0; --muted: #96928a; --muted-soft: #6f6b62;
  --canvas: #14130f; --canvas-soft: #1a1915; --surface-card: #1f1e1a; --surface-strong: #2b2a25; --surface-hover: #26251f;
  --hairline: #2e2c27; --hairline-soft: #24231f; --hairline-strong: #403d36;
  --success: #4cc495; --error: #f2668b; --warning: #e0a84a; --info: #7fb0ea;
  --code-bg: #1a1915; --code-text: #e8e6df; --code-comment: #8a867b; --code-keyword: #a99cf0;
  --code-string: #8fd1a6; --code-number: #c7a6ee; --code-title: #8fbcef; --code-attr: #e9bd6c;
  --logo-filter: none;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--body);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--primary-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-xs); }

h1, h2, h3, h4, h5, h6 { color: var(--ink); margin: 0; }
.display-mega { font-size: clamp(36px, 7vw, 72px); font-weight: 400; line-height: 1.1; letter-spacing: -0.03em; color: var(--ink); }
.display-lg   { font-size: clamp(28px, 4vw, 36px); font-weight: 400; line-height: 1.2; letter-spacing: -0.02em; color: var(--ink); }
.display-md   { font-size: 26px; font-weight: 400; line-height: 1.25; letter-spacing: -0.0125em; color: var(--ink); }
.display-sm   { font-size: 22px; font-weight: 400; line-height: 1.3; letter-spacing: -0.005em; color: var(--ink); }
.eyebrow {
  display: inline-block;
  font-size: 11px; font-weight: 600; line-height: 1.4; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
}

code, kbd, samp, pre { font-family: var(--font-mono); }

/* ---------- Logo ---------- */
.ox-logo { display: block; height: 28px; width: auto; filter: var(--logo-filter); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px;
  border: 1px solid transparent; border-radius: var(--r-md);
  font-size: 14px; font-weight: 500; line-height: 1; white-space: nowrap;
  text-decoration: none; cursor: pointer;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.btn--primary { background: var(--primary); color: var(--on-primary); }
.btn--primary:hover { background: var(--primary-active); }
.btn--secondary { background: var(--surface-card); color: var(--ink); border-color: var(--hairline-strong); }
.btn--secondary:hover { background: var(--surface-hover); }
.btn--ink { background: var(--ink); color: var(--canvas); height: 44px; padding: 0 20px; }
.btn--ink:hover { opacity: .88; }
.btn--text { background: transparent; color: var(--ink); padding: 0 4px; }

/* ---------- Downloads (one system: .dl-btn / .dl-card / .dl-link) ----------
   .dl-btn   the file a visitor came for (build, installer, package, archive). Compact, identical everywhere.
             .dl-btn--primary only for a single recommended download standing alone; .dl-btn--ext = external store link.
   .dl-card  inside .dl-grid: a download that needs context (title, description, .dl-meta, button pinned to bottom).
   .dl-link  supporting files and mentions in prose (checksums, notes, README, csv, source). Never a button.
   Navigation to a downloads page uses plain .btn (no icon). */
:root {
  --dl-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12m-5-5 5 5 5-5M4 16v5h16v-5'/%3E%3C/svg%3E");
  --dl-icon-ext: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5'/%3E%3C/svg%3E");
}
.dl-btn::before, .dl-link::before {
  content: ""; flex: none; background-color: currentColor;
  -webkit-mask: var(--dl-icon) center / contain no-repeat; mask: var(--dl-icon) center / contain no-repeat;
}
.dl-btn--ext::before { -webkit-mask-image: var(--dl-icon-ext); mask-image: var(--dl-icon-ext); }
.dl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-sizing: border-box;
  min-height: 36px; padding: 8px 14px; max-width: 100%;
  border: 1px solid var(--hairline-strong); border-radius: 8px; background: var(--surface-card);
  color: var(--ink) !important; font-size: 14px; font-weight: 500; line-height: 1.286; text-align: left;
  text-decoration: none !important; cursor: pointer;
  transition: background-color .15s var(--ease), border-color .15s var(--ease);
}
.dl-btn::before { width: 16px; height: 16px; }
.dl-btn:hover { border-color: var(--ink); background: var(--surface-hover); color: var(--ink) !important; }
.dl-btn:focus-visible, .dl-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.dl-btn--primary { background: var(--primary); border-color: transparent; color: var(--on-primary) !important; }
.dl-btn--primary:hover { background: var(--primary-active); border-color: transparent; color: var(--on-primary) !important; }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 16px; margin: 20px 0; }
.dl-grid--wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr)); } /* cards whose button label is long */
.dl-card {
  display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 20px;
  border: 1px solid var(--hairline); border-radius: var(--r-lg); background: var(--surface-card);
}
.dl-grid > .dl-card > :is(h3, p) { margin: 0; padding: 0; }
.dl-grid > .dl-card > h3 { font-size: 17px; font-weight: 600; line-height: 1.35; color: var(--ink); }
.dl-grid > .dl-card > p { font-size: 14px; line-height: 1.5; color: var(--muted); }
.dl-grid > .dl-card > p code { font-size: 13px; }
.dl-meta { font-size: 13px; line-height: 1.5; color: var(--muted); }
.dl-grid > .dl-card > .dl-meta { font-size: 13px; }
.dl-card > .dl-btn, .dl-card > .dl-actions { margin-top: auto; align-self: flex-start; }
.dl-actions { display: flex; flex-wrap: wrap; gap: 8px; max-width: 100%; }
.dl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.dl-head h3 { margin: 0 !important; font-size: 17px; font-weight: 600; line-height: 1.35; color: var(--ink); }
.dl-head svg { width: 28px; height: 28px; flex: none; color: var(--ink); }
.dl-head .android-icon { color: var(--success); }
.dl-badge { padding: 2px 10px; border-radius: var(--r-pill); background: var(--primary-soft); color: var(--ink); font-size: 12px; font-weight: 600; }
.dl-card > details { margin: 0; }
.dl-link { display: inline; }
.dl-link::before { display: inline-block; width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; text-decoration: none; }
.dl-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 16px; padding: 0; list-style: none; }
@media (pointer: coarse) { .dl-btn { min-height: 44px; } }
.btn--text:hover { color: var(--primary-text); }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* ---------- Badge ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--surface-strong); color: var(--ink);
  font-size: 11px; font-weight: 600; line-height: 1.4; letter-spacing: 0.08em; text-transform: uppercase;
}
.badge--accent { background: var(--primary-soft); color: var(--primary-text); }

/* ---------- Card ---------- */
.card {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: var(--s-lg);
}
a.card { display: block; text-decoration: none; color: inherit; transition: border-color .15s var(--ease); }
a.card:hover { border-color: var(--hairline-strong); }

/* ---------- Inputs ---------- */
.input, input[type="text"], input[type="email"], input[type="search"], input[type="tel"], input[type="number"], select, textarea {
  background: var(--surface-card);
  color: var(--ink);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  padding: 10px 14px;
  min-height: 44px;
  font-size: 15px;
}
textarea { min-height: 120px; resize: vertical; }
:is(.input, input, select, textarea)::placeholder { color: var(--muted-soft); }
:is(.input, input, select, textarea):focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--primary-soft); }

/* ---------- Code ---------- */
:not(pre) > code {
  font-size: 0.875em;
  padding: 0.12em 0.4em;
  border-radius: var(--r-xs);
  background: var(--surface-strong);
  color: var(--ink);
  overflow-wrap: anywhere;
}
pre {
  position: relative;
  margin: 0 0 var(--s-lg);
  padding: 18px 20px;
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  tab-size: 2;
}
pre code { background: none; padding: 0; font-size: inherit; color: inherit; }

/* highlight.js token colours (theme-aware) */
.hljs { background: transparent !important; color: var(--code-text); }
.hljs-comment, .hljs-quote, .hljs-meta { color: var(--code-comment); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-literal, .hljs-type { color: var(--code-keyword); }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-template-tag { color: var(--code-string); }
.hljs-number, .hljs-symbol, .hljs-bullet { color: var(--code-number); }
.hljs-title, .hljs-section, .hljs-function .hljs-title, .hljs-title.function_ { color: var(--code-title); }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-property, .hljs-params { color: var(--code-attr); }
.hljs-deletion { color: var(--error); }

.copy-btn {
  position: absolute; top: 8px; right: 8px;
  height: 28px; padding: 0 10px;
  border: 1px solid var(--hairline); border-radius: var(--r-sm);
  background: var(--surface-card); color: var(--muted);
  font: 500 12px/1 var(--font-sans);
  cursor: pointer; opacity: 0; transition: opacity .15s var(--ease);
}
pre:hover .copy-btn, .copy-btn:focus-visible, .copy-btn.is-copied { opacity: 1; }
.copy-btn:hover { color: var(--ink); }
.copy-btn.is-copied { color: var(--success); }
@media (hover: none) { .copy-btn { opacity: 1; } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 0 var(--s-lg); border: 1px solid var(--hairline); border-radius: var(--r-lg); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--hairline); }
th { color: var(--ink); font-weight: 600; background: var(--canvas-soft); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

/* ---------- Callouts ---------- */
.callout {
  margin: 0 0 var(--s-lg);
  padding: 14px 16px 14px 18px;
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--muted-soft);
  border-radius: var(--r-md);
  background: var(--surface-card);
  font-size: 15px;
}
.callout--info    { border-left-color: var(--info); }
.callout--warn    { border-left-color: var(--warning); }
.callout--success { border-left-color: var(--success); }
.callout--error   { border-left-color: var(--error); }
.callout > :last-child { margin-bottom: 0; }

/* ---------- Segmented controls: language + theme ---------- */
.seg {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px; border: 1px solid var(--hairline); border-radius: var(--r-md);
  background: var(--surface-card);
}
.seg__btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 28px; padding: 0 8px;
  border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 500; line-height: 1; cursor: pointer;
}
.seg__btn:hover { color: var(--ink); }
.seg__btn[aria-pressed="true"] { background: var(--surface-strong); color: var(--ink); }
.seg__btn svg { width: 15px; height: 15px; display: block; }

/* ---------- Visually hidden ---------- */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

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

/* ============================================================
   Shared topbar (marketing, /doc and plugin docs use identical markup)

   <header class="topbar"><div class="topbar__inner">
     <a class="topbar__brand" href="/home.html">
       <img class="ox-logo" src="/assets/logo.png" alt="OXRecorder" width="448" height="260">
       <span class="topbar__section">Docs</span>          (optional)
     </a>
     <nav class="topbar__nav" aria-label="…"> <a href aria-current="page">…</a> … </nav>
     <div class="topbar__tools">
       <div class="seg" role="group" data-lang-seg> <button class="seg__btn" data-lang="en" aria-pressed>EN</button> <button …data-lang="zh">中文</button> </div>
       <span data-theme-slot></span>   (OXTheme.mountToggle fills it)
       <a class="btn btn--primary btn--sm">…</a>   (optional CTA)
       <button class="topbar__menu" aria-label aria-expanded>…</button>   (mobile)
     </div>
   </div></header>
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.topbar__inner { display: flex; align-items: center; gap: 24px; height: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.topbar__brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.topbar__brand .ox-logo { height: 30px; }
.topbar__section { padding-left: 12px; border-left: 1px solid var(--hairline-strong); font-size: 14px; font-weight: 500; color: var(--muted); }
.topbar__nav { display: flex; align-items: center; gap: 4px; }
.topbar__nav a { padding: 6px 10px; border-radius: var(--r-md); font-size: 14px; font-weight: 500; line-height: 1.4; color: var(--body); text-decoration: none; }
.topbar__nav a:hover { color: var(--ink); background: var(--surface-hover); }
.topbar__nav a[aria-current="page"] { color: var(--ink); }
.topbar__tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topbar__menu { display: none; width: 36px; height: 36px; align-items: center; justify-content: center; border: 1px solid var(--hairline); border-radius: var(--r-md); background: var(--surface-card); color: var(--ink); cursor: pointer; }
.topbar__menu svg { width: 18px; height: 18px; }
@media (max-width: 767px) {
  .topbar__inner { gap: 12px; }
  .topbar__menu { display: inline-flex; }
  .topbar__nav {
    display: none; position: absolute; top: var(--topbar-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0; padding: 8px var(--gutter) 16px;
    background: var(--canvas); border-bottom: 1px solid var(--hairline);
  }
  .topbar__nav.is-open { display: flex; }
  .topbar__nav a { padding: 12px 8px; font-size: 16px; }
  .topbar__tools .btn--primary { display: none; }
}

/* ============================================================
   Shared documentation layout (/doc and plugin docs)
   <div class="doc-shell">
     <aside class="doc-sidebar" id="docSidebar">…</aside>
     <main class="doc-main"><article class="doc-content">…</article></main>
     <aside class="doc-outline"><p class="doc-outline__title">On this page</p><nav>…</nav></aside>
   </div>
   ============================================================ */
.doc-shell {
  --rail-w: 264px;
  display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr) 208px; gap: 0 40px;
  max-width: calc(var(--maxw) + 80px); margin: 0 auto; padding: 0 var(--gutter);
  /* sidebar divider: drawn on the grid so it stays full height */
  background: linear-gradient(var(--hairline), var(--hairline)) calc(var(--rail-w) - 1px) 0 / 1px 100% no-repeat;
  background-origin: content-box;
}
/* Side rails never get their own scrollbar. They stay pinned while they fit in
   the viewport; layout.js adds .is-static when one is taller, so it simply
   scrolls with the page instead. */
.doc-sidebar {
  position: sticky; top: var(--topbar-h); align-self: start;
  padding: 28px 20px 40px 0;
}
.doc-main { min-width: 0; padding: 40px 0 96px; }
.doc-content { max-width: 760px; }
.doc-outline { position: sticky; top: var(--topbar-h); align-self: start; padding: 40px 0; }
.doc-sidebar.is-static, .doc-outline.is-static { position: static; }
.doc-outline__title { margin: 0 0 12px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.doc-outline nav { display: flex; flex-direction: column; border-left: 1px solid var(--hairline); }
.doc-outline a { margin-left: -1px; padding: 4px 0 4px 14px; border-left: 2px solid transparent; font-size: 13px; line-height: 1.45; color: var(--muted); text-decoration: none; }
.doc-outline a[data-depth="3"] { padding-left: 26px; }
.doc-outline a:hover { color: var(--ink); }
.doc-outline a.is-active { color: var(--ink); border-left-color: var(--focus); }

.doc-outline a[hidden] { display: none; }

.nav-group + .nav-group { margin-top: 24px; }
.nav-group > h4 { margin: 0 0 8px; padding: 0 10px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nav-group ul { list-style: none; margin: 0; padding: 0; }
.nav-item { display: block; padding: 6px 10px; border-radius: var(--r-md); border-left: 2px solid transparent; font-size: 14px; line-height: 1.4; color: var(--body); text-decoration: none; }
.nav-item:hover { background: var(--surface-hover); color: var(--ink); }
.nav-item.active, .nav-item[aria-current="page"] { color: var(--ink); font-weight: 500; background: var(--surface-hover); border-left-color: var(--focus); border-radius: 0 var(--r-md) var(--r-md) 0; }

/* Doc typography (applies inside .doc-content) */
.doc-content h1 { font-size: clamp(30px, 4.5vw, 40px); font-weight: 400; line-height: 1.15; letter-spacing: -0.025em; margin: 0 0 12px; }
.doc-content h2 { font-size: 26px; font-weight: 400; line-height: 1.25; letter-spacing: -0.0125em; margin: 56px 0 16px; padding-top: 8px; }
.doc-content h3 { font-size: 18px; font-weight: 600; line-height: 1.4; margin: 32px 0 8px; }
.doc-content h4 { font-size: 16px; font-weight: 600; margin: 24px 0 8px; }
.doc-content p, .doc-content li { line-height: 1.7; }
.doc-content p { margin: 0 0 16px; }
.doc-content ul, .doc-content ol { margin: 0 0 16px; padding-left: 22px; }
.doc-content a:not(.btn) { color: var(--ink); text-decoration: underline; text-decoration-color: var(--hairline-strong); text-underline-offset: 3px; }
.doc-content a:not(.btn):hover { text-decoration-color: var(--primary); color: var(--primary-text); }
.doc-content hr { border: 0; border-top: 1px solid var(--hairline); margin: 40px 0; }
.doc-content img { border-radius: var(--r-lg); border: 1px solid var(--hairline); }

.doc-footer { margin-top: 64px; padding: 24px 0; border-top: 1px solid var(--hairline); font-size: 13px; color: var(--muted); }
.doc-footer a { color: var(--muted); }

.doc-menu-btn { display: none; }
.doc-backtop {
  position: fixed; right: 20px; bottom: 20px; z-index: 40; width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--hairline-strong); border-radius: var(--r-pill);
  background: var(--surface-card); color: var(--ink); cursor: pointer;
}
.doc-backtop[hidden] { display: none; }

@media (max-width: 1279px) {
  .doc-shell { --rail-w: 248px; grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .doc-outline { display: none; }
}
@media (max-width: 919px) {
  .doc-shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .doc-menu-btn { display: inline-flex; align-items: center; gap: 8px; margin: 16px 0 0; }
  .doc-sidebar {
    position: fixed; z-index: 60; top: var(--topbar-h); left: 0; bottom: 0; width: min(320px, 86vw); height: auto;
    padding: 20px; background: var(--canvas); border-right: 1px solid var(--hairline-strong);
    overflow-y: auto; overscroll-behavior: contain;
    transform: translateX(-100%); transition: transform .2s var(--ease);
  }
  .doc-sidebar.is-open { transform: none; }
  .doc-scrim { position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 55; background: rgba(0,0,0,.4); }
  .doc-scrim[hidden] { display: none; }
}
