:root {
  color-scheme: light;
  --bg: #f5ede3; --ink: #39271f; --muted: #705345; --quiet: #795c4c;
  --line: #ddcbb8; --hover: #eaddce; --panel: #efe2d5; --accent: #865137;
  --serif: "Newsreader", "Noto Serif SC", "Songti SC", Georgia, serif;
  --sans: "Inter", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --measure: 760px; --photo: 920px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #251b17; --ink: #f4e9de; --muted: #c7ac98; --quiet: #bc9c86;
  --line: #4d392e; --hover: #3a2921; --panel: #31231d; --accent: #d6aa88;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #251b17; --ink: #f4e9de; --muted: #c7ac98; --quiet: #bc9c86;
    --line: #4d392e; --hover: #3a2921; --panel: #31231d; --accent: #d6aa88;
  }
}
::selection { background: var(--hover); color: var(--ink); }
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 24px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.65 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1,h2,h3,p,figure { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
a:focus-visible,button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }
img,video { max-width: 100%; height: auto; }
.site-header,main,.site-footer { width: min(var(--measure), calc(100% - 64px)); margin-inline: auto; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 78px; padding-block: 21px; border-bottom: 1px solid var(--line); }
.brand { font: 500 23px/1.1 var(--serif); white-space: nowrap; }
.header-nav { display: flex; align-items: center; gap: 22px; color: var(--muted); font-size: 13px; }
.header-nav a,.site-footer a { transition: color .16s; }
.header-nav a:hover,.site-footer a:hover { color: var(--ink); }
.academic,.site-footer a { display: inline-flex; align-items: center; gap: 2px; }
.external { width: 12px; height: 12px; }
.theme-toggle { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); transition: color .16s,background .16s; }
.theme-toggle:hover { color: var(--ink); background: var(--hover); }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .sun { display: block; }
  :root:not([data-theme]) .theme-toggle .moon { display: none; }
}
.hero { padding: 48px 0 33px; }
h1 { font: 400 clamp(28px,3.8vw,40px)/1.22 var(--serif); letter-spacing: -.015em; overflow-wrap: anywhere; text-wrap: pretty; }
.hero h1 { max-width: 650px; }
.zh-intro { margin-top: 11px; color: var(--muted); font: 400 15px/1.8 "Noto Serif SC","Songti SC",serif; }
.intro { margin-top: 5px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.section-title { color: var(--ink); font: 500 17px/1.4 var(--sans); letter-spacing: -.018em; }
.index-section .section-title,.category-notes .section-title { margin-bottom: 12px; }
.collection-list,.post-list { list-style: none; margin: 0; padding: 0; }
.collection-list > li,.post-item { border-top: 1px solid var(--line); }
.collection-list > li:last-child,.post-item:last-child { border-bottom: 1px solid var(--line); }
.index-row { display: grid; grid-template-columns: 29px minmax(0,1fr) 30px 18px; align-items: start; gap: 12px; margin-inline: -8px; padding: 11px 8px; border-radius: 8px; transition: background .18s ease; }
.index-row:hover,.index-row:focus-visible,.post-row:hover,.post-row:focus-visible { background: var(--hover); }
.row-number,.row-count { font: 400 11px/22px var(--mono); font-variant-numeric: tabular-nums; color: var(--quiet); }
.row-count { text-align: right; }
.index-copy { min-width: 0; }
.index-copy h3 { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 10px; row-gap: 0; font-size: 15px; font-weight: 500; line-height: 1.48; letter-spacing: -.012em; }
.index-copy h3 span { font: 400 12px/1.7 var(--sans); color: var(--quiet); letter-spacing: 0; }
.index-copy p { color: var(--muted); font-size: 12.5px; line-height: 1.55; margin-top: 3px; }
.row-arrow { align-self: start; margin-top: 2px; color: var(--accent); opacity: 0; transform: translateX(-3px); transition: opacity .18s,transform .18s; }
.index-row:hover .row-arrow,.index-row:focus-visible .row-arrow { opacity: 1; transform: translateX(0); }
.recent-section { margin-top: 34px; margin-bottom: 52px; }
.filters { display: flex; flex-wrap: wrap; gap: 4px; margin-block: 12px 16px; }
.filter { font: 400 11px/1.5 var(--mono); padding: 5px 9px; border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--muted); transition: color .16s,background .16s; }
.filter:hover { background: var(--hover); color: var(--ink); }
.filter[aria-pressed="true"] { background: var(--hover); border-color: var(--line); color: var(--accent); }
.post-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; column-gap: 18px; margin-inline: -8px; padding: 14px 8px; border-radius: 8px; transition: background .18s; }
.post-row.has-cover { grid-template-columns: minmax(0,1fr) auto 76px; }
.post-copy { min-width: 0; }
.post-copy h3 { font: 500 15px/1.5 var(--sans); letter-spacing: -.012em; overflow-wrap: anywhere; }
.post-copy p { color: var(--muted); font-size: 12.5px; line-height: 1.5; margin-top: 3px; }
.post-meta { display: grid; gap: 4px; justify-items: end; color: var(--quiet); font: 400 11px/1.5 var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.post-category { color: var(--accent); font-size: 10px; }
.thumbnail { width: 76px; height: 54px; object-fit: cover; border-radius: 5px; display: block; background: var(--panel); }
.empty-state { padding: 19px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.empty-state p { color: var(--ink); font: 400 20px/1.35 var(--serif); }
.empty-state span { display: block; margin-top: 4px; color: var(--muted); font-size: 12.5px; }
.collection-intro,.article { padding-top: 42px; }
.collection-intro { margin-bottom: 40px; }
.back { display: inline-block; color: var(--muted); font-size: 12px; margin-bottom: 22px; }
.back:hover,.article-end a:hover { color: var(--accent); }
.category-notes { margin-bottom: 80px; }
.article-header { margin-bottom: 33px; }
.article-header h1 { font-size: clamp(30px,4.2vw,43px); line-height: 1.22; }
.article-deck { color: var(--muted); font-size: 16px; line-height: 1.65; margin-top: 12px; }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; color: var(--quiet); font: 400 11px/1.7 var(--mono); margin-top: 17px; font-variant-numeric: tabular-nums; }
.article-meta a:hover { color: var(--accent); }
.article-page .prose { font-size: 16px; line-height: 1.85; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose :where(p,ul,ol,blockquote,pre,figure,table,.table-scroll) { margin-block: 1.15em; }
.prose :where(ul,ol) { padding-inline-start: 1.5em; }
.prose li + li { margin-top: .3em; }
.prose :where(h2,h3,h4) { line-height: 1.4; font-weight: 600; margin: 1.8em 0 .65em; letter-spacing: -.015em; }
.prose h2 { font: 500 27px/1.35 var(--serif); }
.prose h3 { font-size: 19px; }
.prose h4 { font-size: 16px; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose blockquote { margin-inline: 0; padding: .1em 0 .1em 18px; border-left: 2px solid var(--line); color: var(--muted); }
.prose blockquote > :first-child { margin-top: 0; }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose pre { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; overflow-x: auto; font: 400 12.5px/1.7 var(--mono); tab-size: 2; }
.prose code { font: .86em var(--mono); background: var(--panel); border-radius: 4px; padding: .14em .32em; }
.prose pre code { background: transparent; padding: 0; font: inherit; white-space: pre; overflow-wrap: normal; }
.prose table { width: 100%; border-collapse: collapse; font: 400 13px/1.6 var(--sans); }
.prose .table-scroll { overflow-x: auto; max-width: 100%; }
.prose .table-scroll table { margin: 0; }
.prose th,.prose td { border-bottom: 1px solid var(--line); padding: 9px 12px; text-align: start; vertical-align: top; }
.prose thead th { background: var(--panel); font-weight: 600; }
.prose .katex-display { max-width: 100%; overflow-x: auto; overflow-y: hidden; padding: 5px 0; margin: 1.2em 0; }
.prose hr { height: 1px; border: 0; background: var(--line); margin: 2em 0; }
.prose img,.prose video,.hero-photo img { display: block; max-width: 100%; height: auto; border-radius: 4px; }
.hero-photo { margin-bottom: 32px; }
.hero-photo img { width: 100%; }
.prose figcaption,.hero-photo figcaption { margin-top: 8px; font: 400 12px/1.65 var(--sans); color: var(--muted); }
.essay.article-page .prose { font: 400 18px/1.85 var(--serif); }
.photo.article-page main { width: min(var(--photo),calc(100% - 64px)); }
.photo.article-page .article-header,.photo.article-page .article-end { max-width: var(--measure); margin-inline: auto; }
.photo.article-page .prose > :not(figure):not(.wide):not(.table-scroll) { max-width: var(--measure); margin-inline: auto; }
.photo.article-page .prose > p:has(> img:only-child) { max-width: var(--photo); }
.photo.article-page .prose figure img,.photo.article-page .prose p:has(> img:only-child) img { width: 100%; }
.article-end { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 20px; margin: 44px 0 60px; }
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 17px 0 32px; border-top: 1px solid var(--line); color: var(--quiet); font-size: 11px; }
.site-footer > div { display: flex; gap: 18px; }
.sr-only,.skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip:focus { position: absolute; top: 8px; left: 8px; padding: 8px 12px; background: var(--bg); z-index: 2; }
@media(max-width: 600px) {
  .site-header,main,.site-footer,.photo.article-page main { width: calc(100% - 40px); }
  .site-header { min-height: 68px; padding-block: 15px; gap: 10px; }
  .brand { font-size: 21px; }
  .header-nav { gap: 12px; font-size: 12px; }
  .theme-toggle { width: 30px; height: 30px; }
  .hero { padding: 35px 0 28px; }
  .zh-intro { font-size: 14px; }
  .index-row { grid-template-columns: 23px minmax(0,1fr) 18px; gap: 9px; padding-block: 11px; }
  .index-row .row-arrow { display: none; }
  .index-copy h3 { font-size: 14.5px; column-gap: 7px; }
  .index-copy h3 span { font-size: 11.5px; }
  .index-copy p { font-size: 12px; }
  .recent-section { margin-top: 29px; }
  .filters { gap: 2px; }
  .filter { padding: 5px 7px; }
  .post-row { gap: 9px 12px; }
  .post-row.has-cover { grid-template-columns: minmax(0,1fr) auto 58px; }
  .thumbnail { width: 58px; height: 45px; }
  .post-meta { font-size: 10px; }
  .collection-intro,.article { padding-top: 30px; }
  .article-page .prose { font-size: 15px; }
  .essay.article-page .prose { font-size: 17px; }
}
@media(max-width: 350px) {
  .site-header,main,.site-footer,.photo.article-page main { width: calc(100% - 32px); }
  .brand { font-size: 19px; }
  .header-nav { gap: 8px; font-size: 11px; }
  .post-row,.post-row.has-cover { grid-template-columns: minmax(0,1fr) auto; }
  .post-meta { grid-column: 1; grid-row: 2; justify-items: start; display: flex; flex-wrap: wrap; gap: 7px; }
  .thumbnail { grid-column: 2; grid-row: 1 / 3; }
}
@media(prefers-reduced-motion: reduce) {
  *,*::before,*::after { transition: none !important; }
}
