
:root { --c1: #1a5fb4; --c2: #12407a; --line: #dde3ec; --bg: #f7f9fc; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: "Microsoft YaHei", "微软雅黑", "PingFang SC", "Hiragino Sans GB", "SimSun", sans-serif;
  font-size: 15px; line-height: 1.75; color: #1f2329; background: #fff; }

/* 左侧导航 */
#side { position: fixed; left: 0; top: 0; bottom: 0; width: 290px; overflow-y: auto;
  background: var(--bg); border-right: 1px solid var(--line); padding: 16px 14px 40px; }
#side .brand { display: block; font-size: 15px; font-weight: 700; color: var(--c2); text-decoration: none;
  line-height: 1.4; padding-bottom: 10px; border-bottom: 2px solid var(--c1); margin-bottom: 10px; }
#side summary { cursor: pointer; font-size: 12px; color: #6b7785; letter-spacing: 1px; margin: 14px 0 6px; }
#side ol { list-style: none; margin: 0; padding: 0; }
#side ol.chaps li { margin: 1px 0; }
#side ol.chaps a { display: block; padding: 5px 8px; border-radius: 4px; font-size: 13.5px;
  color: #33445c; text-decoration: none; line-height: 1.45; }
#side ol.chaps a:hover { background: #e8eff9; color: var(--c1); }
#side ol.chaps li.cur a { background: var(--c1); color: #fff; font-weight: 600; }
#side ol.secs { border-left: 2px solid #d9e3f0; margin-left: 6px; }
#side ol.secs a { display: block; padding: 4px 8px 4px 10px; font-size: 12.8px; color: #55606e;
  text-decoration: none; line-height: 1.45; border-left: 2px solid transparent; margin-left: -2px; }
#side ol.secs a:hover { color: var(--c1); background: #eef4fc; }
#side ol.secs a.active { color: var(--c1); font-weight: 600; border-left-color: var(--c1); background: #e8eff9; }
#side ol.secs li.lv3 a { padding-left: 24px; font-size: 12.2px; color: #6b7c90; }
#side ol.secs li.lv3 a.active { color: var(--c1); }

/* 站内搜索（纯前端，索引在 search-index.js） */
#search { margin: 0 0 4px; }
#search input { width: 100%; padding: 7px 10px; font-size: 13px; color: #1f2329; background: #fff;
  border: 1px solid #c9d4e3; border-radius: 4px; outline: none; font-family: inherit; }
#search input:focus { border-color: var(--c1); box-shadow: 0 0 0 2px rgba(26,95,180,.12); }
#search input::-webkit-search-cancel-button { cursor: pointer; }
#side.searching #navbox { display: none; }
#q-info { font-size: 12px; color: #6b7785; margin: 8px 2px 4px; }
#q-info b { color: var(--c2); }
#q-list { list-style: none; margin: 0; padding: 0; }
#q-list li { margin: 2px 0; }
#q-list a { display: block; padding: 7px 9px; border-radius: 4px; text-decoration: none; color: #33445c; line-height: 1.45;
  word-break: break-word; overflow-wrap: anywhere; }
#q-list a:hover { background: #e8eff9; }
#q-list .hit-path { display: block; font-size: 11.5px; color: #8b94a1; }
#q-list .hit-title { display: block; font-size: 13.5px; color: var(--c2); font-weight: 600; margin-top: 1px; }
#q-list .hit-snip { display: block; font-size: 12px; color: #55606e; margin-top: 2px; }
#q-list mark, #q-list .hit-path mark { background: #fff2a8; color: #7a4a00; padding: 0 1px; border-radius: 2px; }

/* 正文 */
main { margin-left: 290px; padding: 22px 40px 60px; max-width: 1220px; }
.toolbar { display: flex; gap: 14px; align-items: center; font-size: 13px; color: #6b7785;
  padding-bottom: 10px; border-bottom: 1px dashed var(--line); margin-bottom: 18px; }
.toolbar a { color: var(--c1); text-decoration: none; }
.toolbar a:hover { text-decoration: underline; }
article h1 { font-size: 26px; color: var(--c2); margin: 4px 0 16px; padding-bottom: 12px; border-bottom: 3px solid #2d8cf0; line-height: 1.35; }
article h2 { font-size: 20px; color: var(--c2); margin: 30px 0 10px; padding-left: 10px; border-left: 4px solid #2d8cf0; scroll-margin-top: 12px; }
article h3 { font-size: 16.5px; color: #1c3d6b; margin: 22px 0 8px; scroll-margin-top: 12px; }
article h4 { font-size: 15px; color: #1c3d6b; margin: 16px 0 6px; }
article p { margin: 9px 0; }
article ul, article ol { margin: 9px 0; padding-left: 24px; }
article li { margin: 4px 0; }
article table { width: 100%; border-collapse: collapse; margin: 12px 0 16px; font-size: 13.5px; }
article th, article td { border: 1px solid #c9d4e3; padding: 6px 9px; vertical-align: top; word-break: break-word; }
article th { background: #eef4fc; color: var(--c2); font-weight: 600; text-align: left; }
article tbody tr:nth-child(even) td { background: #fafcff; }
article blockquote { margin: 12px 0; padding: 10px 14px; background: var(--bg); border-left: 3px solid #a8c4ea; }
article blockquote p { margin: 3px 0; }
article code { background: #eef1f6; padding: 1px 4px; border-radius: 3px; font-size: 13px; font-family: Consolas, "Courier New", monospace; }
article pre { background: #f5f7fa; border: 1px solid #e3e8ef; border-radius: 4px; padding: 10px 12px;
  overflow: auto; font-size: 13px; line-height: 1.5; }
article pre code { background: none; padding: 0; }
article strong { color: #0d2f5c; }
article a { color: var(--c1); text-decoration: none; border-bottom: 1px solid #a9c4e6; }
article a:hover { background: #eef4fc; }
article a.shot { display: block; border: none; margin: 12px 0; }
article a.shot img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 4px; cursor: zoom-in; }
article a.shot:hover img { border-color: var(--c1); box-shadow: 0 2px 10px rgba(26,95,180,.18); }
article hr { border: none; border-top: 1px dashed var(--line); margin: 22px 0; }

/* 上一篇 / 下一篇 */
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; }
.pager a { color: var(--c1); text-decoration: none; }
.pager a:hover { text-decoration: underline; }
.pager .ph { color: #b8c0cc; }
footer.site { margin-left: 290px; padding: 10px 40px 26px; font-size: 12px; color: #8b94a1; }

/* 窄屏：导航改为顶部可折叠 */
@media (max-width: 920px) {
  #side { position: static; width: auto; bottom: auto; border-right: none; border-bottom: 1px solid var(--line); padding: 12px 14px; overflow-x: hidden; }
  /* 窄屏下结果列表限高，不然正文被顶到屏幕外 */
  #side.searching #q-list { max-height: 62vh; overflow-y: auto; }
  #side #navbox > summary { display: block; }
  #side #navbox:not([open]) ol, #side #navbox:not([open]) .secs-title { display: none; }
  main, footer.site { margin-left: 0; padding-left: 16px; padding-right: 16px; }
  main { padding-top: 14px; }
  article h1 { font-size: 21px; }
  article h2 { font-size: 18px; }
  article table { display: block; overflow-x: auto; }
}
@media (min-width: 921px) {
  #side #navbox > summary { display: none; }
  #side #navbox:not([open]) ol { display: block; }
}

/* 打印：去掉导航，只留正文 */
@media print {
  #side, .toolbar, .pager, footer.site { display: none !important; }
  main { margin: 0; padding: 0; max-width: none; }
  article a.shot img { max-width: 100%; page-break-inside: avoid; }
  article h2, article h3 { page-break-after: avoid; }
}
