/* 版式：单栏笔记本。内容列左侧一条红色页边线，像纸质笔记本的装订边；
   条目之间用虚线分隔，像横格纸。只用系统字体，不引用任何外部资源（国内访问稳定）。 */
:root {
  --paper: #f5f6f8;
  --surface: #ffffff;
  --ink: #1c2230;
  --muted: #5b6475;
  --line: #dfe3ea;
  --accent: #28479a;
  --accent-soft: #e9eef9;
  --margin: #de8074;
  --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --measure: 40rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14171d;
    --surface: #1b1f27;
    --ink: #e3e7ee;
    --muted: #9aa3b5;
    --line: #2b313c;
    --accent: #93aaf0;
    --accent-soft: #1e2840;
    --margin: #a85c54;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #14171d;
  --surface: #1b1f27;
  --ink: #e3e7ee;
  --muted: #9aa3b5;
  --line: #2b313c;
  --accent: #93aaf0;
  --accent-soft: #1e2840;
  --margin: #a85c54;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.85;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
h1, h2, h3 { text-wrap: balance; }
/* 中文标题只在标点处换行，避免把一个词拆到两行；实在放不下时再任意断开 */
h1, .toc-title, .pager-link { word-break: keep-all; overflow-wrap: anywhere; }
time { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.wrap { max-width: 46rem; margin-inline: auto; padding-inline: 20px; }

/* 页头 */
.masthead { background: var(--surface); border-bottom: 1px solid var(--line); }
.masthead-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 20px; padding-block: 14px;
}
.site-name { color: var(--ink); font-weight: 700; font-size: 18px; text-decoration: none; letter-spacing: .02em; }
.masthead nav { display: flex; gap: 20px; }
.masthead nav a { color: var(--muted); text-decoration: none; font-size: 15px; }
.masthead nav a:hover { color: var(--accent); }
.masthead nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }

/* 页边线：内容列 */
.sheet {
  border-left: 2px solid var(--margin);
  padding-left: clamp(14px, 4vw, 34px);
  padding-block: 44px 20px;
  min-width: 0;
}

/* 首页开头 */
.intro { margin-bottom: 44px; }
.eyebrow {
  margin: 0 0 10px; color: var(--muted); font-size: 13px; letter-spacing: .06em;
}
.intro h1 {
  margin: 0 0 16px; font-size: clamp(32px, 7vw, 46px); line-height: 1.2; font-weight: 800;
  letter-spacing: .01em;
}
.lede { margin: 0; color: var(--muted); max-width: var(--measure); }

/* 目录 */
.toc { display: grid; gap: 40px; }
.toc-group h2 {
  display: flex; align-items: baseline; gap: 10px;
  margin: 0 0 6px; font-size: 15px; font-weight: 700; color: var(--accent); letter-spacing: .08em;
}
.toc-group .count { font-size: 12.5px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-list li { border-top: 1px dashed var(--line); }
.toc-list li:last-child { border-bottom: 1px dashed var(--line); }
.toc-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px;
  padding-block: 14px; color: inherit; text-decoration: none;
}
.toc-title { font-weight: 650; font-size: 18px; line-height: 1.5; }
.toc-date { color: var(--muted); font-size: 13px; line-height: 1.5; padding-top: 3px; }
.toc-summary { grid-column: 1 / -1; color: var(--muted); font-size: 15px; line-height: 1.7; }
.toc-item:hover .toc-title { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.toc-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* 笔记正文 */
.crumb { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.crumb a { text-decoration: none; }
.note h1 { margin: 0 0 6px; font-size: clamp(26px, 5.4vw, 36px); line-height: 1.3; font-weight: 800; }
.meta { margin: 0 0 24px; color: var(--muted); font-size: 13px; }
.rule {
  margin: 0 0 30px; padding: 14px 18px; background: var(--accent-soft); border-radius: 8px;
  max-width: var(--measure);
}
.rule-label { display: block; font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: .12em; }
.rule p { margin: 2px 0 0; font-weight: 600; }
.prose { max-width: var(--measure); }
.prose h2 { margin: 2em 0 .5em; font-size: 20px; line-height: 1.5; }
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { margin: 0 0 1em; padding-left: 1.3em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--muted); }
.prose b { font-weight: 650; }

/* 翻页 */
.pager {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 14px;
  margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line);
}
.pager-link {
  display: block; padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); text-decoration: none; line-height: 1.6; min-width: 0;
}
.pager-link:hover { border-color: var(--accent); color: var(--accent); }
.pager-link.next { text-align: right; }
.pager-label { display: block; font-size: 12.5px; color: var(--muted); }

/* 页脚：备案号必须在每页底部可见 */
.site-foot {
  margin-top: 40px; border-top: 1px solid var(--line); background: var(--surface);
  padding-block: 22px 30px; text-align: center; color: var(--muted); font-size: 14px;
}
.site-foot p { margin: 4px 0; }
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--accent); }

@media (max-width: 480px) {
  body { font-size: 16px; }
  .wrap { padding-inline: 16px; }
  .sheet { padding-block: 32px 16px; }
  .toc-item { grid-template-columns: minmax(0, 1fr); }
  .toc-date { grid-row: 2; padding-top: 0; }
  .pager-link.next { text-align: left; }
}
