/* 由 tools/knowledge-site/build.mjs 生成，勿手改。token 与 apps/web/src/index.css 对齐。 */
:root{
  color-scheme:only light;
  --background:oklch(1 0 0);
  --foreground:oklch(0.145 0 0);
  --card:oklch(1 0 0);
  --muted:oklch(0.97 0 0);
  --muted-foreground:oklch(0.556 0 0);
  --border:oklch(0.922 0 0);
  --primary:oklch(0.55 0.13 152);
  --sidebar:oklch(0.97 0 0);
  --radius:0.625rem;
  --reading-font-size:16px;
  --reading-line-height:1.6;
  --reading-foreground:oklch(0.28 0 0);
  --font-han:"Geist Variable",system-ui,"Noto Sans CJK SC","Microsoft YaHei","Hiragino Sans",sans-serif;
}
.dark{
  color-scheme:only dark;
  --background:oklch(0.145 0 0);
  --foreground:oklch(0.985 0 0);
  --card:oklch(0.205 0 0);
  --muted:oklch(0.269 0 0);
  --muted-foreground:oklch(0.708 0 0);
  --border:oklch(1 0 0 / 10%);
  --primary:oklch(0.75 0.14 152);
  --sidebar:oklch(0.205 0 0);
  --reading-foreground:oklch(0.9 0 0);
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--background);color:var(--foreground);
  font-family:var(--font-han);font-size:16px;line-height:1.5}
a{color:inherit}
.skip{position:absolute;left:-9999px}
.skip:focus{left:8px;top:8px;z-index:9;background:var(--card);padding:8px 12px;border-radius:8px}

.site-head{display:flex;align-items:baseline;gap:12px;flex-wrap:wrap;
  padding:14px 20px;border-bottom:1px solid var(--border);background:var(--card)}
.brand{font-weight:600;text-decoration:none;font-size:17px}
.tagline{color:var(--muted-foreground);font-size:13px}

/* 搜索框（2026-10-16）：贴在页头右侧。窄屏换行到第二行（.site-head 本来就是 wrap）。 */
.site-search{margin-left:auto;display:flex;gap:6px;align-items:center}
.site-search input{font:inherit;font-size:13.5px;min-width:150px;padding:6px 10px;
  border:1px solid var(--border);border-radius:8px;background:var(--background);color:var(--foreground)}
.site-search button{font:inherit;font-size:13px;padding:6px 12px;border:1px solid var(--border);
  border-radius:8px;background:var(--muted);color:var(--foreground);cursor:pointer}
.search-panel{max-width:900px;margin:0 auto;padding:0 20px}
.search-panel[hidden]{display:none}
.search-panel .sp-note{font-size:13px;color:var(--muted-foreground);margin:14px 0 6px}
.search-panel ul{list-style:none;margin:0;padding:0;border:1px solid var(--border);border-radius:10px;
  overflow:hidden;background:var(--card)}
.search-panel li{border-bottom:1px solid var(--border)}
.search-panel li:last-child{border-bottom:0}
.search-panel a{display:block;padding:10px 14px;text-decoration:none;color:inherit}
.search-panel a:hover{background:var(--muted)}
.search-panel .sp-title{font-weight:600;font-size:14.5px}
.search-panel .sp-series{font-weight:400;font-size:12px;color:var(--muted-foreground);margin-left:8px}
.search-panel .sp-snippet{font-size:13px;line-height:1.55;color:var(--muted-foreground);margin-top:3px}

/* 2026-10-17 用户裁决：侧栏贴屏幕左边缘。此前 .layout 是 1400px 居中，宽屏上左边空出一大块、
   侧栏又紧贴正文，观感既空又挤。去掉宽度上限，侧栏从左边缘起，正文列在剩余空间里居中。 */
.layout{display:flex;align-items:flex-start;gap:0}
.sidebar{flex:0 0 280px;position:sticky;top:0;max-height:100dvh;overflow-y:auto;
  border-right:1px solid var(--border);background:var(--sidebar);padding:16px 12px 40px}
.sidebar a{display:block;text-decoration:none;color:var(--muted-foreground);
  font-size:13.5px;line-height:1.45;padding:4px 8px;border-radius:6px}
.sidebar a:hover{background:var(--muted);color:var(--foreground)}
.sidebar a.on{background:var(--muted);color:var(--foreground);font-weight:600}
.sb-home{font-weight:600;color:var(--foreground)!important;margin-bottom:8px}
/* 系列折叠（2026-10-17）：原生 details/summary，无 JS。summary 自带的小三角去掉，换成
   左侧的箭头，展开时转 90°。 */
.sb-series{margin:16px 0 0}
.sb-series summary{display:flex;align-items:center;gap:8px;cursor:pointer;list-style:none;
  font-size:13px;color:var(--foreground);font-weight:600;padding:2px 8px;border-radius:6px}
.sb-series summary::-webkit-details-marker{display:none}
.sb-series summary::marker{content:""}
.sb-series summary:hover{background:var(--muted)}
.sb-series summary::before{content:"";flex:none;width:0;height:0;border-left:5px solid currentColor;
  border-top:4px solid transparent;border-bottom:4px solid transparent;
  transition:transform .15s;transform-origin:40% 50%}
.sb-series[open] summary::before{transform:rotate(90deg)}
.sb-series .sb-t{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sb-series .n{color:var(--muted-foreground);font-weight:400}
.sb-group{font-size:12px;color:var(--muted-foreground);margin:10px 8px 2px}
.sidebar ul{list-style:none;margin:0;padding:0}

main{flex:1 1 auto;min-width:0;padding:32px 24px 80px}
article{max-width:44rem;margin:0 auto}
.a-head{margin-bottom:24px}
.a-series{font-size:13px;margin:0 0 6px}
.a-series a{color:var(--primary);text-decoration:none}
.a-lead{color:var(--muted-foreground);font-size:14px;margin:8px 0 0}
.n{color:var(--muted-foreground);font-weight:400;font-size:14px}

/* 标题：主题色 + 加粗（与应用里「题目」的观感一致） */
.a-title,.a-body h1,.a-body h2,.a-body h3{color:var(--primary);font-weight:600;line-height:1.35}
/* 作者手写的中文序号标题行（「一、」「（一）」）：与真正的 h2/h3 同观感——主题色 + 加粗。
   2026-10-16 用户报「段落标题没有颜色标记」时一并核出来的：文章页此前**完全没处理**这一类，
   而电子书那条链早就认它（boldChnNumbered）。同一份正文在站点/书/对话里应当长得一样。 */
.a-body .chn-h{color:var(--primary);font-weight:600}
.a-title{font-size:26px;margin:0}
.a-body h1{font-size:22px;margin:34px 0 12px}
.a-body h2{font-size:19px;margin:30px 0 10px}
.a-body h3{font-size:17px;margin:24px 0 8px}

/* 正文：字号/行距/字色全部走 --reading-*，与应用同一套 */
.reading-text{font-size:var(--reading-font-size);line-height:var(--reading-line-height);
  color:var(--reading-foreground)}
.a-body p{margin:0 0 16px}
.a-body ol{margin:0 0 16px;padding-left:1.6em}
.a-body li{margin:0 0 6px}
.a-body hr{border:0;border-top:1px solid var(--border);margin:28px 0}
/* 句内强调不加粗、只深一档——与 index.css 的 .reading-text strong 同义 */
.a-body strong{font-weight:400;color:var(--foreground)}

/* ── 首页 / 系列页 / 目录页（2026-10-15：照搬老站 ma-zhuang 的骨架，配色换成本项目 token）──
   .wrap 是这三页的容器：文章页那层 article{max-width:44rem} 是给正文的行宽用的，
   卡片网格在 44rem 里只能排两列，太挤。 */
.wrap{max-width:54rem;margin:0 auto}
.hero{text-align:center;padding:30px 10px 4px}
.hero h1{font-size:34px;letter-spacing:.12em;margin:0;color:var(--primary)}
.hero p{color:var(--muted-foreground);margin:10px 0 0;font-size:14px}
.page-title{font-size:26px;margin:0;color:var(--primary);font-weight:600;display:flex;align-items:baseline;gap:10px}
.page-desc{color:var(--muted-foreground);font-size:14px;margin:6px 0 0}
.count{color:var(--muted-foreground);font-weight:400;font-size:13px}
.intro{margin-top:26px;background:var(--card);border:1px solid var(--border);border-radius:12px;padding:22px}
.intro p{margin:0;font-size:15.5px;line-height:2;text-align:justify}
.intro .ov{text-decoration:none;color:var(--primary)}
.intro .agent-line{margin-top:10px;font-size:14.5px;color:var(--muted-foreground);text-align:left}
.intro .agent-line a{color:var(--primary);text-decoration:none}
.socials{display:flex;flex-wrap:wrap;gap:10px 18px;margin-top:16px;padding-top:16px;border-top:1px solid var(--border)}
.socials a{font-size:13.5px;text-decoration:none;color:var(--muted-foreground)}
.socials a:hover{color:var(--primary)}
.series{margin-top:32px}
.series > h2{display:flex;align-items:baseline;gap:10px;font-size:20px;margin:0;
  font-weight:600;color:var(--primary)}
.series > p.desc{color:var(--muted-foreground);margin:4px 0 10px;font-size:14px}
.series-more{margin:10px 0 0}
.series-more a{color:var(--primary);text-decoration:none;font-size:13px}
.g-name{font-size:16px;margin:20px 0 10px;color:var(--foreground);font-weight:600}
.cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:10px}
.cards a{display:block;background:var(--card);border:1px solid var(--border);border-radius:10px;
  padding:10px 12px;text-decoration:none}
.cards a:hover{border-color:var(--primary)}
.cards a .t{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
  font-size:14.5px;font-weight:600;line-height:1.5;color:var(--foreground)}
.cards a .excerpt{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
  margin-top:4px;color:var(--muted-foreground);font-size:13px;line-height:1.6}
.home-all{margin:36px 0 0;text-align:center}
.home-all a{color:var(--primary);text-decoration:none;font-size:15px}
.toc-h{font-size:20px;margin:28px 0 4px;padding-bottom:6px;border-bottom:1px solid var(--border);
  color:var(--primary);font-weight:600}
.toc-list{list-style:none;margin:0 0 10px;padding:0;columns:2;column-gap:30px}
.toc-list li{break-inside:avoid}
.toc-list a{display:block;padding:3px 0;text-decoration:none;color:var(--foreground);
  font-size:14px;line-height:1.6}
.toc-list a:hover{color:var(--primary)}

.site-foot{margin:48px auto 0;max-width:44rem;padding-top:16px;
  border-top:1px solid var(--border);font-size:14px}
.site-foot a{color:var(--primary);text-decoration:none}
/* 页脚折叠（2026-10-19 用户裁决）：只露法务链接，支持邮箱点箭头展开；纯 <details>，不依赖脚本。 */
.site-foot .foot-more{display:inline-block;margin-inline-start:8px;vertical-align:middle}
.site-foot .foot-more summary{display:inline-block;cursor:pointer;list-style:none;
  border:1px solid var(--border);border-radius:999px;padding:0 7px;line-height:20px;
  font-size:12px;color:var(--foreground);opacity:.7}
.site-foot .foot-more summary::-webkit-details-marker{display:none}
.site-foot .foot-more summary::after{content:"⌄"}
.site-foot .foot-more[open] summary::after{content:"⌃"}
.site-foot .foot-more>a{display:block;margin-top:8px}

/* 留言板（2026-10-16）：与正文同一条阅读宽度，样式跟站点的 token 走，不另起一套。 */
.comments{margin:48px 0 8px;padding-top:24px;border-top:1px solid var(--border)}
.cm-title{font-size:17px;font-weight:700;margin:0 0 14px}
.cm-form{margin:0 0 18px}
.cm-input{width:100%;box-sizing:border-box;padding:10px 12px;border:1px solid var(--border);
  border-radius:10px;background:var(--background);color:var(--foreground);font:inherit;
  font-size:14px;line-height:1.6;resize:vertical}
.cm-input:focus{outline:none;border-color:var(--primary)}
.cm-actions{display:flex;align-items:center;gap:12px;margin-top:8px}
.cm-send{padding:7px 18px;border:0;border-radius:10px;background:var(--primary);color:#fff;
  font-size:14px;cursor:pointer}
.cm-send:disabled{opacity:.5;cursor:default}
.cm-msg{margin:0;font-size:13px;color:#a33}
.cm-tip{font-size:14px;color:var(--muted-foreground);margin:0 0 14px}
.cm-tip a{color:var(--primary)}
.cm-empty{font-size:14px;color:var(--muted-foreground)}
.cm-list{list-style:none;margin:0;padding:0}
.cm-item{padding:12px 0;border-top:1px solid var(--border)}
.cm-meta{display:flex;align-items:center;gap:10px;font-size:13px;color:var(--muted-foreground);margin-bottom:4px}
.cm-author{font-weight:600;color:var(--foreground)}
.cm-del{margin-left:auto;border:0;background:none;color:#a33;font-size:13px;cursor:pointer;padding:2px 4px}
.cm-body{margin:2px 0;font-size:15px;line-height:1.75;white-space:pre-wrap;overflow-wrap:break-word}

/* 窄屏（<860px）：**正文在前、目录在后**。
   最初写成 display:block 让侧栏自然堆在正文上面，实测结果是正文被压到 7800px 之下——
   读者要滑过 230 多条目录链接才看得到第一个字（2026-10-15 浏览器实测发现）。
   目录是导航不是正文，窄屏上它的位置应当在读完之后。同时给目录一个高度上限，
   免得它在页面尾部又铺开七八屏。 */
@media (max-width:860px){
  .layout{display:flex;flex-direction:column}
  main{order:1;padding:24px 18px 64px}
  .sidebar{order:2;position:static;flex:none;max-height:60dvh;overflow-y:auto;
    border-right:0;border-top:1px solid var(--border)}
  .a-title{font-size:22px}
}
