:root {
  --font-en: "Source Serif 4", "Source Serif Pro", "Noto Serif", Georgia, "Times New Roman", serif;
  --font-zh: "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", "STSong", SimSun, serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", "Noto Sans Mono", monospace;
  --measure: 42rem;
  --header-h: 3.5rem;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3eee4;
  --bg-elev: #faf7f1;
  --ink: #1c1916;
  --en: #241f1a;
  --zh: #3f3832;
  --muted: #6a635b;
  --faint: #8a8278;
  --rule: #ddd4c6;
  --accent: #8b3e22;
  --accent-hover: #6e2f19;
  --header: rgba(243, 238, 228, 0.88);
  --toggle: #e8e0d2;
  --toggle-active-bg: #1c1916;
  --toggle-active-fg: #f6f1e8;
  --badge-bg: #ebe3d4;
  --badge-fg: #5a5148;
  --caption: #6f675e;
  --shadow: 0 1px 0 rgba(28, 25, 22, 0.08);
  --focus: #8b3e22;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141210;
  --bg-elev: #1c1916;
  --ink: #f0e9dc;
  --en: #f0e9dc;
  --zh: #d8d0c3;
  --muted: #b0a89c;
  --faint: #9a9286;
  --rule: #3a342d;
  --accent: #e2a06d;
  --accent-hover: #f0c094;
  --header: rgba(20, 18, 16, 0.88);
  --toggle: #2a2520;
  --toggle-active-bg: #f0e9dc;
  --toggle-active-fg: #161310;
  --badge-bg: #2a2520;
  --badge-fg: #c9c1b4;
  --caption: #b0a89c;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
  --focus: #e2a06d;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
}

body {
  font-family: var(--font-zh), var(--font-en);
  font-size: 19px;
  line-height: 1.8;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}
a:hover { color: var(--accent-hover); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: var(--header-h);
  padding: 0.55rem 1.15rem;
  background: var(--header);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--rule);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.brand:hover { color: inherit; }
.brand-zh {
  font-family: var(--font-zh);
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: 0.06em;
  line-height: 1.2;
}
.brand-en {
  font-family: var(--font-en);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.2;
}

.theme-toggle {
  display: inline-flex;
  align-items: stretch;
  flex-shrink: 0;
  padding: 0.18rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--toggle);
  box-shadow: var(--shadow);
}
.theme-toggle button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-zh), var(--font-en);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
}
.theme-toggle button svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-toggle button[aria-pressed="true"] {
  background: var(--toggle-active-bg);
  color: var(--toggle-active-fg);
}

main {
  width: min(var(--measure), calc(100% - 2.4rem));
  margin: 0 auto;
  padding: 1.75rem 0 4.5rem;
}

.title-en {
  font-family: var(--font-en);
  font-weight: 700;
  font-size: clamp(1.85rem, 4.2vw, 2.55rem);
  line-height: 1.22;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0;
  text-wrap: balance;
  overflow-wrap: break-word;
}
.title-zh {
  font-family: var(--font-zh);
  font-weight: 700;
  font-size: clamp(1.28rem, 3.1vw, 1.62rem);
  line-height: 1.4;
  letter-spacing: 0.02em;
  color: var(--zh);
  margin: 0.55rem 0 0;
  text-wrap: balance;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.page-zh-only .title-zh {
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  line-height: 1.35;
  color: var(--ink);
  margin: 0;
  letter-spacing: 0.01em;
}

.byline {
  margin: 1.15rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.65;
}
.byline .author {
  color: var(--ink);
  font-style: normal;
  font-weight: 600;
}
.orig {
  margin: 0.2rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}
.orig a { overflow-wrap: anywhere; }

hr.break {
  border: 0;
  height: 1px;
  background: var(--rule);
  margin: 1.6rem 0 1.8rem;
}

article figure {
  margin: 1.35rem 0 0.35rem;
}
article figure + figure {
  margin-top: 0.9rem;
}
article figure img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
}
article figcaption {
  margin: 0.45rem 0 0;
  text-align: center;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--caption);
  font-family: var(--font-zh), var(--font-en);
}

article p { margin: 0; }
article p.en {
  font-family: var(--font-en);
  color: var(--en);
  margin-top: 1.25rem;
}
article p.zh {
  font-family: var(--font-zh);
  color: var(--zh);
  margin-top: 0.35rem;
  margin-bottom: 0.15rem;
  letter-spacing: 0.02em;
}
article figure + p.en,
article figure + p.zh.solo { margin-top: 1.55rem; }

article.zh-only p,
article p.zh.solo {
  font-family: var(--font-zh);
  color: var(--ink);
  margin-top: 1.15rem;
  margin-bottom: 0;
  letter-spacing: 0.02em;
}

article h2 {
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.35;
  font-weight: 700;
}
article h2.en {
  font-family: var(--font-en);
  color: var(--ink);
  margin-top: 2.35rem;
  letter-spacing: -0.01em;
}
article h2.zh {
  font-family: var(--font-zh);
  color: var(--zh);
  font-size: 1.12rem;
  margin-top: 0.35rem;
  margin-bottom: 0.35rem;
  letter-spacing: 0.04em;
}
article.zh-only h2,
article h2.zh.solo {
  font-family: var(--font-zh);
  color: var(--ink);
  font-size: 1.22rem;
  margin-top: 2.35rem;
  margin-bottom: 0.2rem;
  letter-spacing: 0.03em;
}

article h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.4;
  font-weight: 700;
}
article h3.en {
  font-family: var(--font-en);
  color: var(--ink);
  margin-top: 1.7rem;
}
article h3.zh {
  font-family: var(--font-zh);
  color: var(--zh);
  margin-top: 0.3rem;
  margin-bottom: 0.2rem;
  letter-spacing: 0.03em;
}
article.zh-only h3,
article h3.zh.solo {
  font-family: var(--font-zh);
  color: var(--ink);
  margin-top: 1.7rem;
  margin-bottom: 0.15rem;
}

article hr {
  border: 0;
  height: 1px;
  background: var(--rule);
  margin: 2rem 0;
}

article ul, article ol {
  margin: 0.9rem 0 0.35rem;
  padding-left: 1.4rem;
}
article li {
  margin: 0.65rem 0;
  padding-left: 0.15rem;
}
article li .en {
  font-family: var(--font-en);
  color: var(--en);
  display: block;
}
article li .zh {
  font-family: var(--font-zh);
  color: var(--zh);
  display: block;
  margin-top: 0.15rem;
  letter-spacing: 0.02em;
}
article.zh-only li,
article li.solo {
  font-family: var(--font-zh);
  color: var(--ink);
}

article blockquote {
  margin: 1.15rem 0 0.3rem;
  padding: 0.1rem 0 0.1rem 1rem;
  border-left: 3px solid var(--rule);
}
article blockquote.en {
  font-family: var(--font-en);
  color: var(--en);
}
article blockquote.zh {
  font-family: var(--font-zh);
  color: var(--zh);
  margin-top: 0.4rem;
  letter-spacing: 0.02em;
}
article.zh-only blockquote,
article blockquote.solo {
  font-family: var(--font-zh);
  color: var(--ink);
  margin-top: 1.15rem;
}

article pre {
  margin: 1.15rem 0 0.35rem;
  padding: 1rem 1.1rem;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}
article pre.zh { margin-top: 0.45rem; }
article.zh-only pre { margin-top: 1.15rem; }

.home-kicker {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-fg);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.5;
}
.home-lead {
  margin: 1.15rem 0 0;
  color: var(--zh);
  font-size: 1.02rem;
}
.home-lead .en {
  font-family: var(--font-en);
  color: var(--muted);
  display: block;
  margin-top: 0.2rem;
  font-size: 0.95rem;
}

.article-list {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
}
.article-list > li {
  margin: 0;
  padding: 1.25rem 0;
  border-top: 1px solid var(--rule);
}
.article-list > li:last-child {
  border-bottom: 1px solid var(--rule);
}
.article-list a.item {
  display: block;
  text-decoration: none;
  color: inherit;
}
.article-list a.item:hover .t-en,
.article-list a.item:hover .t-zh {
  color: var(--accent);
}
.article-list .t-en {
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 1.18rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.article-list .t-zh {
  font-family: var(--font-zh);
  font-size: 1rem;
  line-height: 1.45;
  color: var(--zh);
  margin-top: 0.28rem;
  letter-spacing: 0.02em;
}
.article-list .t-zh.solo {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--ink);
  margin-top: 0;
}
.article-list .meta {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.88rem;
}

footer.site-foot {
  width: min(var(--measure), calc(100% - 2.4rem));
  margin: 0 auto;
  padding: 0 0 2.8rem;
  color: var(--faint);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

@media (max-width: 520px) {
  body { font-size: 17.5px; }
  .site-header { padding: 0.5rem 0.85rem; }
  main { width: min(var(--measure), calc(100% - 1.7rem)); padding-top: 1.35rem; }
  .theme-toggle button { padding: 0.42rem 0.55rem; font-size: 0.74rem; }
  .article-list .t-en { font-size: 1.08rem; }
}
