/* 文档页（接入你自己的 agent、安全文章）：沿用 legal 页的页眉、页脚和石墨底，正文更紧凑，多表格和代码块。
   颜色只表达状态；代码块是略抬高的表面，不加光晕。宽 ≥1100px 时左侧目录 sticky，窄屏隐藏。 */

.docs-header { min-height: 64px; }
.docs-header .legal-header-links { align-items: center; gap: 4px 18px; }
.docs-header .legal-header-links a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: 13px; }
.docs-header .legal-header-links a[aria-current] { color: var(--text); }

.docs-main { padding-block: clamp(36px, 5vw, 64px) 96px; }

/* ---------- 开头 ---------- */

.docs-intro { padding-bottom: 32px; border-bottom: 1px solid var(--line); }
.docs-kicker { margin: 0; color: var(--faint); font: 500 12px var(--mono); letter-spacing: .14em; }
.docs-intro h1 { margin: 14px 0 0; font-size: clamp(28px, 3.6vw, 38px); line-height: 1.15; }
.docs-lede { max-width: 640px; margin: 16px 0 0; color: var(--text-soft); font-size: 15px; line-height: 1.85; }
.docs-lede a, .docs-content a { color: var(--accent); text-underline-offset: 3px; text-decoration-color: rgba(245, 185, 66, .4); transition: color .25s ease; }
.docs-lede a:hover, .docs-content a:hover { color: var(--accent-strong); text-decoration-color: currentColor; }

.builtin-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; margin: 20px 0 0; padding: 0; list-style: none; }
.builtin-row .label { color: var(--faint); font: 500 11.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.builtin-row li { display: inline-flex; align-items: center; gap: 8px; color: var(--text-soft); font-size: 13px; font-weight: 600; }
.builtin-row img, .agent-grid img { width: 16px; height: 16px; filter: invert(1); opacity: .78; }

.requires { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 22px 0 0; padding: 8px 12px; border-radius: 10px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); font-size: 13px; line-height: 1.6; }

.audience { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 24px 0 0; padding: 0; list-style: none; max-width: 640px; }
.audience a { display: block; height: 100%; padding: 14px 16px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); text-decoration: none; transition: box-shadow .25s ease, background-color .25s ease; }
.audience a:hover { background: var(--surface-raised); box-shadow: inset 0 0 0 1px var(--line-strong); }
.audience strong { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.audience strong::after { content: '↓'; color: var(--faint); font: 400 13px var(--mono); }
.audience span { display: block; margin-top: 4px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }

/* ---------- 布局与目录 ---------- */

.docs-layout { padding-top: 40px; }
.docs-toc { display: none; }
@media (min-width: 1100px) {
  .docs-layout { display: grid; grid-template-columns: 172px minmax(0, 1fr); gap: 56px; }
  .docs-toc { position: sticky; top: 28px; align-self: start; display: block; max-height: calc(100vh - 56px); overflow-y: auto; scrollbar-width: none; }
  .docs-toc::-webkit-scrollbar { display: none; }
}
.docs-toc p { margin: 18px 0 6px; color: var(--faint); font: 500 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.docs-toc p:first-child { margin-top: 0; }
.docs-toc ol { margin: 0; padding: 0; list-style: none; }
.docs-toc a { display: block; padding: 6px 12px; border-left: 1px solid var(--line-strong); border-radius: 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; text-decoration: none; transition: color .2s ease, border-color .2s ease; }
.docs-toc a:hover, .docs-toc a:focus-visible, .docs-toc a[aria-current] { border-color: var(--text); color: var(--text); }

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

.docs-content { min-width: 0; }
.docs-part { padding-bottom: 8px; }
.docs-part + .docs-part { margin-top: 48px; padding-top: 44px; border-top: 1px solid var(--line); }
.part-kicker { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 10px; color: var(--muted); font: 500 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.part-kicker b { padding: 2px 6px; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--text-soft); font-weight: 500; font-size: 11px; letter-spacing: 0; }
.docs-part > h2 { font-size: clamp(22px, 2.4vw, 28px); }
.part-lede { max-width: 640px; margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.8; }

.docs-content section { scroll-margin-top: 24px; margin-top: 36px; }
.docs-content h3 { margin: 0 0 12px; font-size: 18px; line-height: 1.35; letter-spacing: -.02em; }
.docs-content h4 { margin: 26px 0 10px; color: var(--text); font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.docs-content p, .docs-content li { color: var(--text-soft); font-size: 14.5px; line-height: 1.8; }
.docs-content p { max-width: 68ch; margin: 0 0 12px; }
.docs-content ul, .docs-content ol.steps { max-width: 68ch; margin: 0 0 14px; padding-left: 1.2em; }
.docs-content li { margin: 0 0 6px; padding-left: 2px; }
.docs-content li::marker { color: var(--faint); }
.docs-content strong { color: var(--text); font-weight: 650; }
.docs-content :not(pre) > code { padding: 1px 5px; border-radius: 5px; background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); font-size: .86em; overflow-wrap: anywhere; }
.muted { color: var(--muted) !important; }

.note { max-width: 68ch; margin: 14px 0; padding: 10px 14px; border-left: 2px solid var(--line-strong); background: rgba(255, 255, 255, .025); border-radius: 0 8px 8px 0; }
.note p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.75; }

/* agent 图标格 */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 6px; max-width: 700px; margin: 16px 0 16px; padding: 0 !important; list-style: none; }
.agent-grid li { display: flex; align-items: center; gap: 9px; margin: 0; padding: 9px 12px; border-radius: 9px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--text-soft); font-size: 13px; font-weight: 600; line-height: 1.35; }
.agent-grid li.more { grid-column: span 2; background: transparent; box-shadow: inset 0 0 0 1px var(--line); border: 0; color: var(--muted); font-weight: 500; }
.agent-grid li.more img { opacity: .5; }

/* 排查清单 */
.checks { max-width: 68ch; margin: 14px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.checks li { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin: 0; padding: 12px 0; border-bottom: 1px solid var(--line); }
.checks b { color: var(--text); font-size: 14px; font-weight: 650; }
.checks span { color: var(--muted); font-size: 13.5px; line-height: 1.75; }

/* 表格：窄屏在自己的容器里横向滚动，页面不横滚 */
.table-wrap { max-width: 100%; margin: 14px 0 18px; overflow-x: auto; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line); -webkit-overflow-scrolling: touch; }
.table-wrap:focus-visible { outline-offset: 2px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.65; }
th, td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
tr:last-child > td, tr:last-child > th[scope="row"] { border-bottom: 0; }
thead th { color: var(--faint); font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; background: rgba(255, 255, 255, .02); }
td { color: var(--text-soft); }
th[scope="row"] { color: var(--text); font-weight: 600; white-space: nowrap; }
td code, th code { white-space: nowrap; }
.table-compare { min-width: 640px; }
.table-compare td { width: 29%; }
.table-map { min-width: 600px; }
.yes { color: var(--text); }
.no { color: var(--faint); }

/* 代码块：略抬高的表面，Geist Mono，溢出时横向滚动 */
.code { max-width: 100%; margin: 14px 0 18px; border-radius: 10px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.code figcaption { display: flex; justify-content: space-between; gap: 12px; padding: 7px 14px; border-bottom: 1px solid var(--line); color: var(--faint); font: 500 11.5px var(--mono); letter-spacing: .02em; }
.code pre { margin: 0; padding: 12px 14px 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.code pre:focus-visible { outline-offset: -2px; border-radius: 0 0 10px 10px; }
.code code { display: block; width: max-content; min-width: 100%; color: var(--text-soft); font-size: 12.5px; line-height: 1.7; white-space: pre; tab-size: 4; }
.code .p { color: var(--faint); user-select: none; }
.code .d { color: var(--faint); }

.docs-meta { margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--faint); font: 12px var(--mono); }

@media (max-width: 720px) {
  .docs-header { position: relative; }
  .audience { grid-template-columns: 1fr; }
  .agent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .docs-content section { margin-top: 30px; }
}
@media (max-width: 480px) {
  .shell { width: calc(100% - 32px); }
  .docs-lede { font-size: 14.5px; }
  .docs-content p, .docs-content li { font-size: 14px; }
  .agent-grid li { padding: 9px 10px; font-size: 12.5px; }
}

/* 修正：列表类组件覆盖正文 ul 的缩进；比较表的行标题可以换行；页尾说明不受正文段落规则影响 */
.docs-content .checks, .docs-content .agent-grid { padding-left: 0; max-width: 700px; }
.docs-content .checks li { padding-left: 0; }
.table-compare th[scope="row"] { width: 150px; min-width: 130px; white-space: normal; }
thead th { letter-spacing: .02em; }
.docs-content .docs-meta { max-width: none; margin: 44px 0 0; color: var(--faint); font: 12px var(--mono); }
.code-tsv code { tab-size: 12; }
.docs-header { flex-wrap: wrap; gap: 0 16px; }
@media (max-width: 480px) { .docs-header .legal-header-links a[aria-current] { display: none; } }
.docs-header .brand { align-self: center; }

/* ---------- 安全文章（/docs/security.html）：摘要三栏、手机 → 服务器 → 电脑示意、步骤、对照清单 ---------- */

.sec-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 24px 0 0; padding: 0; list-style: none; }
.sec-summary li { padding: 14px 16px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.sec-summary b { display: block; font-size: 14px; font-weight: 650; }
.sec-summary span { display: block; margin-top: 4px; color: var(--muted); font-size: 12.5px; line-height: 1.65; }

.sec-diagram { display: grid; grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr) 64px minmax(0, 1fr); align-items: stretch; margin: 28px 0 0; }
.sec-node { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 14px 16px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.sec-node-relay { background: transparent; box-shadow: none; border: 1px dashed var(--line-strong); }
.sec-node p { margin: 0; }
.sec-node-label { display: flex; align-items: center; gap: 7px; color: var(--faint); font: 500 11.5px var(--mono); letter-spacing: .04em; }
.sec-node-label svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.sec-node-body { flex: 1; color: var(--text); font-size: 14px; font-weight: 600; line-height: 1.55; }
.sec-node-body.sec-cipher { color: var(--muted); font: 400 12px/1.6 var(--mono); overflow-wrap: anywhere; }
.sec-node-key { color: var(--muted); font-size: 12px; }
.sec-node:not(.sec-node-relay) .sec-node-key::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: var(--ok); vertical-align: 1px; }
.sec-link { position: relative; display: grid; place-items: center; }
.sec-link::before { content: ''; position: absolute; left: 6px; right: 10px; top: 50%; border-top: 1px solid var(--line-strong); }
.sec-link::after { content: ''; position: absolute; right: 7px; top: calc(50% - 3.5px); width: 7px; height: 7px; border-top: 1px solid var(--faint); border-right: 1px solid var(--faint); transform: rotate(45deg); }
.sec-link span { position: relative; padding: 1px 6px; background: var(--bg); color: var(--faint); font: 500 10.5px var(--mono); letter-spacing: .04em; }

.sec-steps { max-width: 68ch; margin: 6px 0 16px; padding: 0; list-style: none; counter-reset: sec-step; }
.docs-content .sec-steps li { position: relative; display: grid; gap: 2px; margin: 0; padding: 0 0 16px 40px; counter-increment: sec-step; }
.sec-steps li::before { content: counter(sec-step); position: absolute; left: 0; top: 1px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--text-soft); font: 500 11.5px var(--mono); }
.sec-steps li:not(:last-child)::after { content: ''; position: absolute; left: 12px; top: 30px; bottom: 4px; border-left: 1px solid var(--line); }
.sec-steps b { color: var(--text); font-size: 14px; font-weight: 650; }
.sec-steps span { color: var(--muted); font-size: 13.5px; line-height: 1.75; }

.sec-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 760px; margin: 14px 0 18px; }
.sec-compare > div { padding: 14px 16px 6px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.sec-compare > div:last-child { background: transparent; }
.docs-content .sec-compare-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: var(--text); font-size: 13.5px; font-weight: 650; }
.sec-compare-title svg { width: 15px; height: 15px; fill: none; stroke: var(--ok); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.sec-compare-plain svg { stroke: var(--faint); }
.docs-content .sec-compare ul { margin: 0 0 8px; padding-left: 1.1em; }
.docs-content .sec-compare li { margin: 0 0 5px; font-size: 13px; line-height: 1.65; }
.docs-content .sec-compare > div:last-child li { color: var(--muted); }

.sec-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 760px; }
.sec-pair .code { margin: 0 0 18px; }

@media (max-width: 860px) {
  .sec-summary, .sec-compare, .sec-pair { grid-template-columns: 1fr; }
  .sec-diagram { grid-template-columns: 1fr; }
  .sec-link { height: 40px; }
  .sec-link::before { left: 50%; right: auto; top: 4px; bottom: 8px; border-top: 0; border-left: 1px solid var(--line-strong); }
  .sec-link::after { left: calc(50% - 3.5px); right: auto; top: auto; bottom: 9px; transform: rotate(135deg); }
}

/* ---------- 博客（scripts/blog.mjs 生成的列表页与文章页） ---------- */

.docs-kicker a { color: inherit; text-decoration: none; }
.docs-kicker a:hover { color: var(--text); }
.blog-meta { margin: 14px 0 0; color: var(--faint); font: 500 12px var(--mono); letter-spacing: .04em; }
.blog-body { max-width: 720px; padding-top: 36px; }
.blog-body h2 { margin: 40px 0 14px; font-size: clamp(20px, 2.2vw, 24px); line-height: 1.3; letter-spacing: -.02em; }
.blog-body h2:first-child { margin-top: 0; }
.blog-body h3 { margin-top: 28px; }
.blog-body ol { max-width: 68ch; margin: 0 0 14px; padding-left: 1.4em; }
.blog-body blockquote { max-width: 68ch; margin: 14px 0; padding: 10px 14px; border-left: 2px solid var(--line-strong); border-radius: 0 8px 8px 0; background: rgba(255, 255, 255, .025); }
.blog-body blockquote p { margin: 0; color: var(--muted); }
.blog-body img { max-width: 100%; height: auto; border-radius: 12px; }
.blog-cta { max-width: 720px; margin: 48px 0 0; padding: 18px 20px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.blog-cta p { margin: 0 0 8px; color: var(--text-soft); font-size: 15px; line-height: 1.7; }
.blog-cta a { color: var(--accent); font-weight: 600; text-underline-offset: 3px; }
.blog-back { margin: 28px 0 0; font-size: 13px; }
.blog-back a { color: var(--muted); text-decoration: none; }
.blog-back a:hover { color: var(--text); }
.blog-list { max-width: 720px; margin: 0; padding: 0; list-style: none; }
.blog-list li { padding: 28px 0; border-bottom: 1px solid var(--line); }
.blog-list .blog-meta { margin: 0; }
.blog-list h2 { margin: 8px 0; font-size: 20px; line-height: 1.35; }
.blog-list h2 a { color: var(--text); text-decoration: none; }
.blog-list h2 a:hover { text-decoration: underline; text-underline-offset: 3px; }
.blog-list p:last-child { margin: 0; color: var(--text-soft); font-size: 14.5px; line-height: 1.8; }
.blog-empty { padding-top: 28px; color: var(--muted); }

/* Linux 安装说明（docs/install-linux）：安装步骤列表、开头的一行命令、表格里的 SHA-256；
   [data-copy] 的复制按钮由 motion.js 加在代码块标题栏里，没有脚本时不出现。 */
.docs-content ol.install-steps { max-width: 68ch; margin: 0 0 14px; padding-left: 1.4em; }
.docs-intro .code { max-width: 640px; margin: 22px 0 0; }
.code figcaption { align-items: center; }
.code .copy-button { min-height: 0; margin: -4px -8px -4px auto; padding: 3px 9px; border-radius: 6px; font: 500 11.5px var(--mono); }
td code.hash { white-space: normal; overflow-wrap: anywhere; font-size: 11.5px; }
td[data-linux-field$=".size"] { white-space: nowrap; }
