/* ============================================================
   引力波数据分析中的人工智能方法 —— 在线版样式
   仿照简洁学术阅读体验：限宽居中、舒适中文行距、自适应图表。
   ============================================================ */

:root {
  --qing: #1A7F76;
  --qing-light: #26A69A;
  --ink: #222;
  --muted: #666;
  --rule: #e3e6e6;
  --bg: #fcfcfb;
  --maxw: 820px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "PingFang SC", "Songti SC", "Noto Serif CJK SC",
    "Source Han Serif SC", "Microsoft YaHei", serif;
  font-size: 18px;
  line-height: 1.85;
}

/* ---- 顶部站点栏 ---- */
.site-header {
  background: var(--qing);
  color: #fff;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 6px rgba(0,0,0,.12);
}
.site-wrap {
  max-width: var(--maxw); margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: baseline; gap: 12px;
}
.site-title { color: #fff; font-weight: 700; text-decoration: none; font-size: 17px; }
.site-title:hover { text-decoration: underline; }
.site-sub { color: rgba(255,255,255,.8); font-size: 13px; }

/* ---- 正文容器 ---- */
.content {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 22px 80px;
}

/* ---- 标题 ---- */
h1, h2, h3, h4 {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.35; color: #111; margin: 1.6em 0 .7em;
}
h1 { font-size: 1.7em; border-bottom: 3px solid var(--qing); padding-bottom: .3em; }
h2 { font-size: 1.4em; color: var(--qing); }
h3 { font-size: 1.2em; }
h4 { font-size: 1.05em; color: var(--muted); }

/* part / chapter 标题居中（tex4ht 用 h2/h3 表示）*/
.partHead, .chapterHead { text-align: center; }

p { margin: .55em 0; text-align: justify; }

a { color: var(--qing); }
a:hover { color: var(--qing-light); }

/* ---- 图片 ---- */
img, svg, .graphics {
  max-width: 100%; height: auto; display: block; margin: 1em auto;
}
figure { margin: 1.4em 0; text-align: center; }
figcaption, .caption {
  font-size: .85em; color: var(--muted); margin-top: .5em; line-height: 1.6;
}

/* ---- 表格（booktabs 风格）---- */
table { border-collapse: collapse; margin: 1.2em auto; font-size: .9em; max-width: 100%; }
.content table { display: block; overflow-x: auto; }
td, th { padding: .45em .8em; }
thead th { border-top: 2px solid #333; border-bottom: 1.5px solid #333; }
tbody tr:last-child td { border-bottom: 2px solid #333; }
.longtable td, .longtable th { vertical-align: top; }

/* ---- 公式（MathJax）溢出滚动 ---- */
mjx-container { overflow-x: auto; overflow-y: hidden; max-width: 100%; }
mjx-container[display="true"] { margin: 1em 0; }

/* ---- 目录 ---- */
.tableofcontents, .toc { line-height: 1.6; }
.likepartToc { font-weight: 700; color: var(--qing); margin-top: 1em; }

/* ---- 参考文献 ---- */
.thebibliography { font-size: .88em; line-height: 1.55; }
.thebibliography p { margin: .35em 0; }

/* ---- 脚注 / 引用角标 ---- */
sup a, .footnote-mark { font-size: .75em; }

/* ---- 页脚 ---- */
.site-footer {
  max-width: var(--maxw); margin: 40px auto 0; padding: 18px 22px;
  border-top: 1px solid var(--rule); color: var(--muted);
  font-size: .82em; text-align: center;
}

/* ---- 顶/底页面导航（tex4ht crosslinks）---- */
.crosslinks { font-size: .85em; color: var(--muted); margin: 1.5em 0; }
.crosslinks a { margin: 0 .4em; }

/* ---- 响应式 ---- */
@media (max-width: 640px) {
  body { font-size: 16px; line-height: 1.8; }
  .content { padding: 18px 14px 60px; }
  h1 { font-size: 1.45em; }
}

/* ---- 深色模式 ---- */
@media (prefers-color-scheme: dark) {
  :root { --ink: #ddd; --muted: #999; --bg: #1a1c1d; --rule: #333; }
  body { background: var(--bg); color: var(--ink); }
  h1, h2, h3 { color: #e8e8e8; }
  h2 { color: var(--qing-light); }
  thead th, tbody tr:last-child td { border-color: #888; }
  img { opacity: .92; }
}

/* ---- 预渲染 TikZ 示意图 ---- */
.tikz-figure { text-align: center; margin: 1.2em 0; }
.tikz-figure img { max-width: 96%; height: auto; display: inline-block; }

/* ---- 封面区 ---- */
.cover { margin: 0 0 2.4em; text-align: center; }
.cover-banner {
  width: 100%; max-width: 100%; height: auto; display: block;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.28);
  margin: 0 auto .9em;
}
.cover-meta {
  display: flex; align-items: center; justify-content: center;
  gap: .7em; margin: .2em 0 1.1em;
}
.cover-author {
  font-size: 1.15em; font-weight: 700; letter-spacing: .15em;
  color: var(--ink);
}
.cover-badge {
  font-size: .72em; font-weight: 600; letter-spacing: .05em;
  color: #fff; background: var(--qing);
  padding: .12em .7em; border-radius: 999px;
  transform: translateY(-1px);
}
.cover-actions {
  display: flex; flex-wrap: wrap; gap: .7em;
  justify-content: center; margin: 0 0 .9em;
}
.cover-actions .btn {
  display: inline-block; text-decoration: none;
  font-size: .92em; font-weight: 600;
  padding: .5em 1.25em; border-radius: 8px;
  border: 1.5px solid var(--qing);
  color: var(--qing); background: transparent;
  transition: background .15s, color .15s, transform .1s;
}
.cover-actions .btn:hover { background: rgba(26,127,118,.1); transform: translateY(-1px); }
.cover-actions .btn-primary { background: var(--qing); color: #fff; }
.cover-actions .btn-primary:hover { background: var(--qing-light); color: #fff; }
.cover-ver { font-size: .8em; color: var(--muted); }

@media (max-width: 640px) {
  .cover-actions .btn { padding: .45em 1em; font-size: .85em; }
}
@media (prefers-color-scheme: dark) {
  .cover-banner { opacity: 1; box-shadow: 0 6px 24px rgba(0,0,0,.5); }
  .cover-actions .btn:hover { background: rgba(38,166,154,.18); }
}

/* ---- 按钮内小字注释（如 PDF 大小）---- */
.btn-note { font-size: .78em; font-weight: 400; opacity: .8; margin-left: .15em; }

/* ---- 本书简介 ---- */
.intro {
  max-width: 100%; margin: 0 auto 2em; padding: 1.1em 1.4em;
  background: rgba(26,127,118,.05);
  border-left: 4px solid var(--qing); border-radius: 0 8px 8px 0;
}
.intro-h { margin: 0 0 .5em; font-size: 1.15em; color: var(--qing); border: none; }
.intro p { margin: .4em 0; font-size: .95em; line-height: 1.8; }
.intro-aud { color: var(--muted); font-size: .88em; }

/* ---- 页脚多行 ---- */
.foot-main { margin: .2em 0; font-weight: 600; color: var(--ink); }
.foot-sub { margin: .2em 0; font-size: .92em; }

@media (prefers-color-scheme: dark) {
  .intro { background: rgba(38,166,154,.08); }
}

/* ---- 可折叠目录 ---- */
.tableofcontents { line-height: 1.7; }
.toc-part {
  font-weight: 700; font-size: 1.08em; color: var(--qing);
  margin: 1.1em 0 .4em; padding-bottom: .25em;
  border-bottom: 1px solid var(--rule);
}
.toc-other { margin: .35em 0; font-weight: 600; }
details.toc-chap { margin: .25em 0; }
details.toc-chap > summary {
  cursor: pointer; list-style: none; font-weight: 600;
  padding: .2em 0; outline: none;
}
details.toc-chap > summary::-webkit-details-marker { display: none; }
details.toc-chap > summary::before {
  content: "▸"; color: var(--qing); display: inline-block;
  width: 1em; transition: transform .15s;
}
details.toc-chap[open] > summary::before { transform: rotate(90deg); }
.toc-secs { margin: .1em 0 .5em 1.6em; }
.toc-sec { margin: .18em 0; font-size: .92em; }
.toc-sec a { color: var(--ink); }
.toc-sec a:hover { color: var(--qing); }
.toc-orphan { margin-left: 1.6em; }
