/* 界面只使用黑白灰；层级由排版和留白表达。 */
:root {
  color-scheme: light;
  --bg: #fff; --ink: #202020; --muted: #666; --line: #e5e5e5; --soft: #f6f6f6;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
:root[data-theme="dark"] { color-scheme: dark; --bg: #191919; --ink: #ededed; --muted: #aaa; --line: #363636; --soft: #242424; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.8; -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 4px; }
a:hover { text-decoration: underline; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.4; font-weight: 600; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 5px; }
main:focus { outline: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 30; top: 8px; left: 16px; padding: 8px 16px; background: var(--bg); transform: translateY(-160%); }
.skip-link:focus { transform: none; }
/* 首页是个人简介和入口，没有内容预览或顶部导航。 */
.home-main { width: min(560px, calc(100% - 48px)); margin: clamp(90px, 20vh, 190px) auto 72px; }
.home-main h1 { font-size: 34px; letter-spacing: -.8px; }
.bio { font-size: 18px; line-height: 1.95; margin-top: 24px; max-width: 510px; }
.home-entries { display: flex; gap: 32px; margin-top: 40px; font-size: 18px; }
.home-entries a { text-decoration: underline; }
.home-bottom { margin-top: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; font-size: 14px; color: var(--muted); }
.profile-links { display: flex; gap: 20px; }
.profile-links a { text-decoration: none; }
.reading-controls { display: flex; gap: 18px; align-items: center; flex-shrink: 0; }
.reading-controls button { border: 0; padding: 8px 0; background: none; font-size: 13px; color: var(--muted); min-height: 40px; }
.reading-controls button:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
/* 内页共用稳定的导航，返回首页只需点击名字。 */
.site-header { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); }
.header-inner { width: min(1120px, calc(100% - 64px)); min-height: 76px; margin: auto; display: flex; align-items: center; gap: 48px; }
.logo { font-weight: 600; font-size: 19px; text-decoration: none; letter-spacing: -.5px; }
.nav-links { display: flex; gap: 28px; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: 15px; }
.nav-links a[aria-current="page"] { color: var(--ink); text-decoration: underline; font-weight: 600; }
.header-inner .reading-controls { margin-left: auto; }
.site-main { width: min(1120px, calc(100% - 64px)); margin: 0 auto; flex: 1; padding: 56px 0 88px; }
.archive-main { max-width: 740px; }
.page-heading { margin-bottom: 40px; }
.page-heading h1 { font-size: 32px; letter-spacing: -.5px; overflow-wrap: anywhere; }
.page-heading p { margin-top: 14px; color: var(--muted); white-space: pre-line; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 32px; }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.empty-state { border-top: 1px solid var(--line); padding: 32px 0; }
.empty-state h2 { font-size: 18px; margin-bottom: 8px; }
.empty-state p { font-size: 15px; color: var(--muted); }
.empty-state button { margin-top: 18px; border: 1px solid var(--line); background: var(--bg); padding: 6px 12px; }
.status, .count { color: var(--muted); font-size: 13px; }
.status { padding: 24px 0; }
.archive-toolbar { display: flex; align-items: center; gap: 24px; justify-content: space-between; margin-bottom: 22px; }
.search-field { flex: 1; max-width: 430px; }
.search-field input { width: 100%; background: var(--bg); border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 10px 0; font-size: 15px; }
.search-field input::placeholder { color: var(--muted); }
.count { white-space: nowrap; }
.category-bar { display: flex; flex-wrap: wrap; gap: 22px; margin-bottom: 22px; }
.cat-btn { border: 0; padding: 4px 0; min-height: 40px; background: none; font-size: 13px; color: var(--muted); }
.cat-btn[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-underline-offset: 5px; }
.cat-count { margin-left: 6px; }
.post-item, .series-item { display: block; text-decoration: none; border-top: 1px solid var(--line); padding: 26px 0; }
.post-item:hover, .series-item:hover { text-decoration: none; }
.post-item:hover h2, .series-item:hover h2 { text-decoration: underline; text-underline-offset: 5px; }
.post-item h2, .series-item h2 { font-size: 21px; overflow-wrap: anywhere; }
.post-item p, .series-item p { color: var(--muted); margin-top: 8px; font-size: 15px; }
.post-meta { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.series-item .count { display: inline-block; margin-top: 12px; }
.prerequisites { margin: 0 0 36px; }
.prerequisites h2, .series-outline>h2 { font-size: 17px; margin-bottom: 12px; }
.prerequisites p { color: var(--muted); white-space: pre-line; }
.chapter-list { list-style: none; padding: 0; margin: 0; }
.chapter-list>li>a { display: flex; align-items: baseline; gap: 16px; text-decoration: none; padding: 12px 0; }
.series-outline .chapter-list>li { border-top: 1px solid var(--line); }
.chapter-number { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.chapter-list a:hover span:last-child { text-decoration: underline; }
.start-reading { display: inline-block; margin-top: 30px; font-size: 15px; }
/* 章节目录与正文两栏，不在右侧再挤入一套目录。 */
.reading-layout { display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 740px); gap: 64px; }
.reading-layout.standalone { display: block; max-width: 740px; margin: 0 auto; }
.series-sidebar { position: sticky; top: 112px; align-self: start; max-height: calc(100vh - 140px); overflow-y: auto; padding-right: 24px; border-right: 1px solid var(--line); }
.series-navigation>summary { font-size: 13px; color: var(--muted); cursor: pointer; margin-bottom: 18px; }
.series-name { display: block; font-size: 15px; font-weight: 600; text-decoration: none; margin-bottom: 16px; }
.series-sidebar .chapter-list>li>a { gap: 12px; font-size: 13px; line-height: 1.7; color: var(--muted); padding: 8px 0; }
.series-sidebar .chapter-list>li>a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.series-sidebar .chapter-list>li>a[aria-current="page"] span:last-child { text-decoration: underline; }
.article-header { padding-bottom: 28px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.article-header h1 { font-size: clamp(28px, 3.5vw, 38px); line-height: 1.45; letter-spacing: -.5px; overflow-wrap: anywhere; }
.article-meta { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: 12px; margin-bottom: 16px; }
.article-excerpt { margin-top: 18px; color: var(--muted); font-size: 17px; }
.translation-note { border-left: 2px solid var(--line); padding: 0 0 0 16px; margin: 24px 0; font-size: 14px; color: var(--muted); }
.toc { margin-bottom: 24px; font-size: 13px; color: var(--muted); }
.toc summary { cursor: pointer; }
.toc ol { list-style: none; padding: 10px 0 0 14px; margin: 0; }
.toc li { margin-bottom: 8px; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.toc-sub { padding-left: 12px; }
.series-sidebar .toc { margin: 4px 0 16px 26px; font-size: 12px; }
.article-body { font-size: 18px; line-height: 1.95; overflow-wrap: anywhere; }
.article-body p, .article-body ul, .article-body ol, .article-body blockquote, .article-body pre, .article-body table { margin: 0 0 1.4em; }
.article-body h1, .article-body h2, .article-body h3 { margin: 1.8em 0 .7em; scroll-margin-top: 108px; }
.article-body h1, .article-body h2 { font-size: 26px; }
.article-body h3 { font-size: 21px; }
.article-body img { display: block; max-width: 100%; height: auto; margin: 28px auto; }
.article-body blockquote { border-left: 2px solid var(--line); padding: 0 20px; color: var(--muted); }
.article-body blockquote p:last-child { margin-bottom: 0; }
.article-body pre { overflow: auto; padding: 18px; background: var(--soft); font-size: 14px; line-height: 1.7; white-space: pre; }
.article-body code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .88em; }
.article-body :not(pre)>code { background: var(--soft); padding: 2px 4px; }
.article-body table { display: block; overflow: auto; border-collapse: collapse; font-size: 15px; }
.article-body th, .article-body td { text-align: left; border: 1px solid var(--line); padding: 10px 14px; }
.article-body th { background: var(--soft); }
.article-body hr { border: 0; border-top: 1px solid var(--line); margin: 36px 0; }
.article-body mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; padding: 8px 0; }
.article-nav { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 24px; border-top: 1px solid var(--line); padding-top: 24px; margin-top: 48px; }
.next-card { text-decoration: none; }
.next-card span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.next-card strong { font-size: 15px; font-weight: 500; }
.next-card:last-child { text-align: right; }
.back-link { display: inline-block; margin-top: 32px; font-size: 14px; }
.site-footer { width: min(1120px, calc(100% - 64px)); margin: 0 auto; padding: 24px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.site-footer a { text-decoration: none; }
.noscript { text-align: center; padding: 20px; }
@media(min-width:801px) {
  .series-navigation>summary { display: none; }
}
@media(max-width:1000px) { .reading-layout { grid-template-columns: minmax(0, 195px) minmax(0, 1fr); gap: 36px; } }
@media(max-width:800px) {
  .reading-layout { display: block; }
  .series-sidebar { position: static; max-height: none; padding: 0; border-right: 0; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
  .series-navigation>summary { padding: 0 0 14px; margin: 0; color: var(--ink); }
  .series-sidebar .chapter-list { max-height: 45vh; overflow: auto; padding-bottom: 12px; }
  .article-body { font-size: 17px; }
}
@media(max-width:560px) {
  .home-main { margin-top: 100px; }
  .home-main h1 { font-size: 30px; }
  .bio { font-size: 17px; }
  .home-bottom { gap: 16px; flex-wrap: wrap; }
  .header-inner { width: calc(100% - 40px); min-height: 68px; gap: 24px; }
  .logo { font-size: 17px; }
  .nav-links { gap: 18px; }
  .nav-links a { font-size: 14px; }
  .reading-controls { gap: 12px; }
  .site-main { width: calc(100% - 40px); padding: 36px 0 64px; }
  .page-heading h1 { font-size: 28px; }
  .site-footer { width: calc(100% - 40px); }
  .archive-toolbar { gap: 16px; }
  .count { font-size: 12px; }
}
@media(max-width:380px) { .header-inner { gap: 18px; } .nav-links { gap: 14px; } .reading-controls { gap: 10px; } }
@media(prefers-reduced-motion:reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
