/* ==================================================================
   docs.bingbingbing.top — 文档站样式
   ------------------------------------------------------------------
   设计令牌与主站 home/assets/style.css、对话页 ai-call/pages/css/theme.css
   保持一致，但是**独立的一份文件**：两站分开部署，谁都不引用谁。
   令牌改了记得同步另外两处，这是「同一个产品」的唯一保障。
   ================================================================== */

:root {
  /* 表面 */
  --bg: #ffffff;
  --bg-tint: #fbfbfe;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #f2f4f9;
  --overlay: rgba(255, 255, 255, 0.72);

  /* 墨色 */
  --text: #0d1117;
  --text-2: #4a5163;
  --text-3: #8b91a3;
  --text-inverse: #ffffff;

  /* 线条 */
  --border: #e9ebf2;
  --border-strong: #dcdfea;
  --border-focus: #9ca3af;

  /* 强调色：近黑，全站唯一一支冷色 */
  --accent: #111827;
  --accent-hover: #000000;
  --accent-2: #6b7280;
  --accent-soft: #f3f4f6;
  --accent-ring: rgba(17, 24, 39, 0.16);
  --gradient: linear-gradient(135deg, #111827 0%, #374151 45%, #6b7280 100%);

  /* 状态 */
  --ok: #10b981;
  --ok-soft: #ecfdf5;
  --warn: #f59e0b;
  --warn-soft: #fffbeb;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --info-soft: #eff6ff;

  /* 形状 */
  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 13px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-full: 999px;

  /* 投影 */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.03);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.06), 0 2px 4px rgba(16, 24, 40, 0.03);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.08), 0 4px 8px rgba(16, 24, 40, 0.03);
  --shadow-xl: 0 24px 56px rgba(16, 24, 40, 0.1), 0 8px 16px rgba(16, 24, 40, 0.04);
  --shadow-accent: 0 8px 24px rgba(17, 24, 39, 0.22);

  /* 字体 */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Cascadia Code", Menlo, Consolas,
    "Liberation Mono", monospace;

  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: 2.25rem;

  /* 动效 */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 140ms;
  --dur-base: 220ms;
  --dur-slow: 380ms;

  /* 布局 */
  --topbar-h: 58px;
  --sidebar-w: 248px;
  --shell-max: 1240px;
  --content-max: 780px;
}

/* ------------------------------------------------------------------ */
/* reset                                                                */
/* ------------------------------------------------------------------ */

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

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* 锚点跳转后标题不能藏在吸顶栏底下；多留 18px 呼吸位 */
  scroll-padding-top: calc(var(--topbar-h) + 18px);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

ul,
ol {
  list-style: none;
}

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

hr {
  border: none;
  border-top: 1px solid var(--border);
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

::selection {
  background: rgba(55, 65, 81, 0.18);
  color: var(--text);
}

* {
  scrollbar-width: thin;
  scrollbar-color: #d5d9e4 transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #dcdfea;
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: var(--r-full);
}

::-webkit-scrollbar-thumb:hover {
  background: #c3c8d8;
  background-clip: content-box;
}

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

.skip-link {
  position: fixed;
  top: 10px;
  left: 50%;
  z-index: 999;
  padding: 10px 18px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-inverse);
  background: var(--accent);
  border-radius: var(--r-full);
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, -160%);
  transition: transform var(--dur-base) var(--ease-back);
}

.skip-link:focus-visible {
  transform: translate(-50%, 0);
  text-decoration: none;
}

/* ------------------------------------------------------------------ */
/* 按钮 / 徽章                                                         */
/* ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: var(--fs-sm);
  font-weight: 600;
  border-radius: var(--r-md);
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  color: var(--text-inverse);
  background: var(--gradient);
  box-shadow: var(--shadow-accent);
}

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

.btn-ghost {
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
}

.badge-accent {
  color: var(--text-inverse);
  background: var(--accent);
  border-color: var(--accent);
}

.badge-ok {
  color: #047857;
  background: var(--ok-soft);
  border-color: #a7f3d0;
}

.badge-warn {
  color: #b45309;
  background: var(--warn-soft);
  border-color: #fde68a;
}

.badge-danger {
  color: #b91c1c;
  background: var(--danger-soft);
  border-color: #fecaca;
}

/* ------------------------------------------------------------------ */
/* 顶栏                                                                */
/* ------------------------------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--overlay);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: var(--shell-max);
  min-height: var(--topbar-h);
  margin: 0 auto;
  padding: 8px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  font-size: var(--fs-md);
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  color: #fff;
  background: var(--gradient);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(17, 24, 39, 0.26);
}

.brand-mark svg {
  width: 18px;
  height: 18px;
}

.brand-suffix {
  font-size: var(--fs-sm);
  font-weight: 550;
  color: var(--text-3);
}

.topbar-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

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

.top-search {
  display: none; /* 没有构建步骤就没有真正的搜索索引，宁可不放 */
}

/* ------------------------------------------------------------------ */
/* 外壳：左侧目录 + 右侧正文                                            */
/* ------------------------------------------------------------------ */

.shell {
  display: grid;
  /* 目录列写死，正文列用 minmax(0,1fr)：0 的下界是防止代码块/表格把栅格撑破 */
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 40px;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 26px 24px 72px;
  align-items: start;
}

/* ------------------------------------------------------------------ */
/* 目录                                                                */
/* ------------------------------------------------------------------ */

.toc {
  position: sticky;
  top: calc(var(--topbar-h) + 26px);
  /* 视口减去顶栏与上下留白，超出部分目录自己滚，不跟着正文飘走 */
  max-height: calc(100vh - var(--topbar-h) - 52px);
  max-height: calc(100dvh - var(--topbar-h) - 52px);
  overflow-y: auto;
  padding-right: 6px;
}

/*
 * 目录的开关行。**所有断点都显示**，因为 <details> 需要在每个尺寸下都能开关；
 * 唯一的区别是桌面端不显示当前章节标签（空间太窄，显示出来会挤掉列表宽度）。
 */
.toc-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: var(--fs-sm);
  font-weight: 620;
  color: var(--text-2);
  cursor: pointer;
  list-style: none;
}

.toc-head::-webkit-details-marker {
  display: none;
}

.toc-head .caret {
  width: 13px;
  height: 13px;
  flex: none;
  transition: transform var(--dur-base) cubic-bezier(0.34, 1.18, 0.64, 1);
}

details.toc[open] .toc-head .caret {
  transform: rotate(180deg);
}

/* 「当前章节」只在窄屏出现，宽屏靠左侧列表本身表达位置 */
.toc-head .toc-current {
  display: none;
  margin-left: auto;
  max-width: 45%;
  overflow: hidden;
  font-size: var(--fs-xs);
  font-weight: 550;
  color: var(--text-3);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* <details> 收起时必须真的把目录藏起来。
   标准行为是靠 content-visibility 隐藏，但这里的内容是 flex 项，
   在某些引擎上会漏出来，所以用一条显式规则兜住 —— 收起却仍看得见列表，
   是这一块最容易出现的「看起来能用其实坏了」。 */
details.toc:not([open]) > .toc-nav {
  display: none;
}

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

.toc-group > p {
  margin-bottom: 6px;
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.toc a {
  display: block;
  padding: 6px 10px;
  font-size: var(--fs-sm);
  color: var(--text-2);
  border-left: 2px solid transparent;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}

.toc a:hover {
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
}

/* :target 只能标记「当前跳转到的那个」，所以要标成激活态得靠脚本。
   prefers-reduced-motion 时这些过渡本来就被压掉，不会闪。 */
.toc a.is-active {
  color: var(--accent);
  font-weight: 620;
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.toc .toc-sub a {
  padding-left: 22px;
  font-size: var(--fs-xs);
}

.toc-toggle {
  display: none;
}

/* ------------------------------------------------------------------ */
/* 正文                                                                */
/* ------------------------------------------------------------------ */

.doc {
  min-width: 0;
  max-width: var(--content-max);
}

.doc-header {
  padding-bottom: 22px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--border);
}

.doc-header h1 {
  font-size: clamp(1.6rem, 3.4vw, 2.125rem);
  font-weight: 680;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.doc-header .lede {
  margin-top: 12px;
  font-size: var(--fs-md);
  line-height: 1.75;
  color: var(--text-2);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.doc-section {
  /* 目测的锚点偏移由 html 的 scroll-padding-top 负责，这里只留段落间距 */
  padding-bottom: 34px;
  margin-bottom: 34px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

.doc-section:last-of-type {
  border-bottom: none;
}

.doc h2 {
  font-size: var(--fs-2xl);
  font-weight: 660;
  letter-spacing: -0.025em;
  line-height: 1.25;
  margin-bottom: 6px;
}

.doc h3 {
  font-size: var(--fs-lg);
  font-weight: 640;
  letter-spacing: -0.015em;
  margin: 26px 0 10px;
}

.doc h4 {
  font-size: var(--fs-base);
  font-weight: 640;
  margin: 20px 0 8px;
}

.doc p {
  margin: 10px 0;
  color: var(--text-2);
}

.doc p strong,
.doc li strong {
  color: var(--text);
  font-weight: 620;
}

.doc .anchor-hint {
  margin-top: 4px;
  font-size: var(--fs-sm);
  color: var(--text-3);
}

.doc ul,
.doc ol {
  margin: 10px 0;
  padding-left: 2px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/*
 * 嵌套列表的样式必须写得足够精确。
 *
 * 踩过的坑：只写 `.doc ul li::before { content: '' }`（画圆点）时，
 * `.doc ol li::before`（写 content: counter(item) 的编号徽章）会把嵌套在
 * ol → li 里的 ul 子项也一起命中 —— 后者特异性更高，于是「第 3 步」里的
 * 子项被画成了编号 4、5、6、7。这里把所有「列表项套列表项」的组合都显式
 * 列出来，谁赢不靠猜。
 */
.doc ul li::before,
.doc ol ul li::before,
.doc ul ul li::before,
.doc ul ol ul li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 9px;
  width: 5px;
  height: 5px;
  background: var(--border-strong);
  border-radius: 50%;
}

.doc ol li {
  position: relative;
  padding-left: 24px;
  counter-increment: item;
  font-size: var(--fs-base);
  line-height: 1.7;
  color: var(--text-2);
}

.doc ol li::before {
  content: counter(item);
  position: absolute;
  left: 0;
  top: 4px;
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-2);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
}

/* 嵌套在列表项里的子列表：缩进 + 小一号字，但不要再画编号徽章 */
.doc li > ul,
.doc li > ol {
  margin-top: 8px;
}

.doc ol ol li,
.doc ul ol li {
  padding-left: 22px;
  font-size: var(--fs-sm);
}

.doc ol ol li::before {
  top: 3px;
  width: 15px;
  height: 15px;
  font-size: 10px;
}

.doc ul ul li,
.doc ol ul li {
  font-size: var(--fs-sm);
  padding-left: 16px;
}

.doc code {
  padding: 1px 5px;
  font-size: 0.88em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--r-xs);
  overflow-wrap: anywhere;
}

.doc a code {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 提示条 */
.note {
  display: flex;
  gap: 11px;
  margin: 16px 0;
  padding: 13px 15px;
  font-size: var(--fs-sm);
  line-height: 1.7;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.note-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  margin-top: 1px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--r-sm);
}

.note-body {
  min-width: 0;
  overflow-wrap: anywhere;
}

.note-body > :first-child {
  margin-top: 0;
}

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

.note-info .note-icon {
  color: var(--accent);
  background: var(--accent-soft);
}

.note-warn {
  background: var(--warn-soft);
  border-color: #fde68a;
}

.note-warn .note-icon {
  color: #b45309;
  background: #fff;
}

.note-danger {
  background: var(--danger-soft);
  border-color: #fecaca;
}

.note-danger .note-icon {
  color: var(--danger);
  background: #fff;
}

/* ------------------------------------------------------------------ */
/* 表格                                                                */
/* ------------------------------------------------------------------ */

.table-wrap {
  /* 手机上的关键：表格自己横滚，而不是把整页撑宽 */
  margin: 14px 0;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
}

table {
  width: 100%;
  min-width: 460px;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

th,
td {
  padding: 9px 13px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 620;
  color: var(--text);
  background: var(--surface-2);
  white-space: nowrap;
}

td {
  color: var(--text-2);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--bg-tint);
}

td code {
  white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* 代码块（与对话页 .md-code / .code-bar 对齐）                        */
/* ------------------------------------------------------------------ */

.code {
  min-width: 0;
  margin: 14px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  /* clip 而不是 hidden：不建立滚动容器，与对话页保持同一处理方式 */
  overflow: clip;
  box-shadow: var(--shadow-xs);
}

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

.code-lang {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
}

.code-copy {
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out);
}

.code-copy:hover {
  color: var(--accent);
  border-color: var(--border-focus);
  background: var(--accent-soft);
}

.code-copy.is-copied {
  color: #047857;
  background: var(--ok-soft);
  border-color: #a7f3d0;
}

.code pre {
  margin: 0;
  padding: 14px 16px;
  /* 两个轴都显式写：只写一个轴时另一个会变成 auto，把滚轮吞掉 */
  overflow-x: auto;
  overflow-y: hidden;
}

.code code {
  display: block;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 12.6px;
  line-height: 1.72;
  color: var(--text);
  background: none;
  border-radius: 0;
  tab-size: 2;
  white-space: pre;
}

/* 与对话页同一套手写高亮配色 */
.tok-k { color: #7c3aed; font-weight: 600; }
.tok-b { color: #0891b2; font-weight: 500; }
.tok-s { color: #0f766e; }
.tok-n { color: #c2410c; }
.tok-c { color: #94a3b8; font-style: italic; }
.tok-f { color: #2563eb; }
.tok-t { color: #db2777; }
.tok-a { color: #ca8a04; }
.tok-p { color: #64748b; }

/* ------------------------------------------------------------------ */
/* 端点卡片                                                            */
/* ------------------------------------------------------------------ */

.endpoint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  margin: 14px 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.method {
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-inverse);
  background: var(--accent);
  border-radius: var(--r-xs);
}

.method-post {
  background: #374151;
}

.endpoint-path {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.endpoint-note {
  margin-left: auto;
  font-size: var(--fs-xs);
  color: var(--text-3);
}

/* ------------------------------------------------------------------ */
/* details 折叠（ToolCall 往返示例）                                   */
/* ------------------------------------------------------------------ */

details.disclosure {
  margin: 14px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: clip;
}

details.disclosure > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  list-style: none;
  transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}

details.disclosure > summary::-webkit-details-marker {
  display: none;
}

details.disclosure > summary:hover {
  color: var(--text);
  background: var(--surface-2);
}

details.disclosure > summary .caret {
  width: 13px;
  height: 13px;
  flex: none;
  transition: transform var(--dur-base) cubic-bezier(0.34, 1.18, 0.64, 1);
}

details.disclosure[open] > summary .caret {
  transform: rotate(180deg);
}

details.disclosure > summary .caret path {
  /* summary 里的图标用 currentColor 描边，跟随文字色 */
  stroke: currentColor;
}

details.disclosure .disclosure-body {
  padding: 4px 14px 14px;
  border-top: 1px solid var(--border);
}

details.disclosure .disclosure-body > :first-child {
  margin-top: 12px;
}

/* ------------------------------------------------------------------ */
/* 页脚 / 上一节下一节                                                 */
/* ------------------------------------------------------------------ */

.doc-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  max-width: var(--content-max);
  padding-top: 22px;
  margin-top: 6px;
  font-size: var(--fs-sm);
  border-top: 1px solid var(--border);
}

.doc-footer p {
  color: var(--text-3);
}

.scrim {
  display: none;
}

/* ------------------------------------------------------------------ */
/* 响应式                                                              */
/* ------------------------------------------------------------------ */

/* 1080px 以下：目录列收窄，正文仍然并排 */
@media (max-width: 1080px) {
  :root {
    --sidebar-w: 216px;
  }

  .shell {
    gap: 28px;
    padding: 22px 20px 64px;
  }
}

/* 860px 以下：单页 + 目录抽屉。
   这里不用 position: fixed 的侧滑抽屉，而是把 <details> 展开成文档流里的一块，
   因为纯 CSS 的 details 在没有 JS 的情况下也能开关，键盘与读屏都原生可用。 */
@media (max-width: 860px) {
  .shell {
    display: block;
    padding: 18px 18px 56px;
  }

  .doc {
    max-width: none;
  }

  .toc {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 0;
    margin-bottom: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
  }

  /* 抽屉形态：开关行更宽裕，并显示当前章节（窄屏下正文与目录不同屏，
     没有这个标签用户就不知道自己读到哪了） */
  .toc-head {
    gap: 9px;
    padding: 12px 14px;
  }

  .toc-head .toc-current {
    display: block;
  }

  .toc-nav {
    padding: 4px 10px 12px;
    border-top: 1px solid var(--border);
  }
}

/* 620px */
@media (max-width: 620px) {
  .topbar-inner {
    padding: 8px 16px;
  }

  .shell {
    padding: 16px 16px 48px;
  }

  .brand-suffix {
    display: none;
  }

  .topbar-actions .btn-primary {
    padding: 8px 13px;
    font-size: var(--fs-xs);
  }

  .doc-header h1 {
    font-size: 1.5rem;
  }
}

/* ≤400px：需求点名要保证可用的尺寸 */
@media (max-width: 400px) {
  body {
    font-size: 0.90625rem;
  }

  .topbar-inner {
    padding: 8px 13px;
    gap: 8px;
  }

  .shell {
    padding: 14px 13px 42px;
  }

  .doc h2 {
    font-size: 1.375rem;
  }

  .table-wrap {
    /* 13px 的单元格内边距在 360px 宽屏上会让表格显得更挤 */
    margin-left: -2px;
    margin-right: -2px;
  }

  th,
  td {
    padding: 8px 10px;
  }

  .code pre {
    padding: 11px 12px;
  }

  .code code {
    font-size: 12px;
  }

  .note {
    padding: 11px 12px;
  }

  .topbar-actions .btn-ghost {
    display: none; /* 手机上先把「对话」按钮留出来，文档站自己的首页链接可以从目录进 */
  }
}

/* ------------------------------------------------------------------ */
/* 减少动效                                                            */
/* ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
