:root {
  color-scheme: light;
  --paper: #f7f6f2;
  --ink: #20211e;
  --muted: #85857e;
  --line: #deddd6;
  --accent: #536d5c;
  --soft-text: #777871;
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", Consolas, monospace;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #171916;
  --ink: #e5e7df;
  --muted: #a4a89f;
  --line: #383d36;
  --accent: #a4c0aa;
  --soft-text: #c1c5bb;
}
body { background: var(--paper); color: var(--ink); font-family: var(--sans); font-weight: 300; }
.topbar { border-bottom: 0; }
.wordmark, .footer .wordmark { font-family: var(--sans); font-weight: 300; letter-spacing: .08em; }
.topbar .wordmark { font-size: clamp(87px, 7.8vw, 100px); line-height: 1.2; }
.topbar-actions { display: flex; align-items: center; gap: 23px; }
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 74px; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 18px; background: transparent; color: var(--ink); font: 300 11px/1 var(--sans); cursor: pointer; transition: background .18s, border-color .18s; }
.theme-toggle:hover, .theme-toggle:focus-visible { background: var(--paper); border-color: var(--accent); outline: none; }
.theme-glyph { font-size: 15px; }
h1, h2, h3, h4 { color: var(--ink); font-family: var(--sans); font-weight: 300; }
.library { padding: 5px 0 100px; border-top: 0; }
.library-layout { display: grid; grid-template-columns: minmax(0, 1fr) 74px; gap: 25px; align-items: stretch; }
.library-main { min-width: 0; }
.toolbar { display: flex; align-items: center; gap: 20px; margin: 12px 0 0; padding: 0 0 8px; border-bottom: 0; }
.search-box { flex: 1 1 auto; max-width: 450px; min-width: 150px; color: var(--muted); }
.search-box input { color: var(--ink); font-family: var(--sans); font-weight: 300; }
.sort-order { flex: 0 0 auto; border: 0; padding: 8px 0; background: transparent; color: var(--muted); font: 300 11px var(--sans); cursor: pointer; white-space: nowrap; }
.sort-order:hover, .sort-order:focus-visible { color: var(--accent); outline: none; }
.article-flow { min-height: 280px; padding-top: 8px; }
.timeline-year { margin: 0 0 52px; scroll-margin-top: 72px; animation: year-in .32s ease both; }
.timeline-year-heading { margin: 0; padding: 24px 0 11px; color: var(--accent); font: 300 16px/1.5 var(--mono); letter-spacing: .09em; }
.timeline-entry { display: block; padding: 14px 0 19px; border: 0; }
.entry-date { display: block; margin-top: 8px; color: var(--muted); font: 300 11px/1.6 var(--mono); }
.entry-copy { min-width: 0; }
.entry-copy h4 { margin: 0 0 7px; font: 300 26px/1.5 var(--sans); letter-spacing: .015em; transition: color .18s; }
.entry-copy p { display: -webkit-box; margin: 0; overflow: hidden; color: var(--soft-text); font: 300 19px/1.8 var(--sans); overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.entry-copy:hover h4 { color: var(--accent); }
.year-rail { position: sticky; top: 30vh; align-self: start; z-index: 1; padding: 9px 0; }
.year-rail-label { display: block; margin-bottom: 11px; color: var(--muted); font: 300 9px var(--sans); letter-spacing: .1em; text-align: center; }
.year-nav { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; max-height: 42vh; overflow: auto; scrollbar-width: none; }
.year-nav::-webkit-scrollbar { display: none; }
.year-nav::before { position: absolute; top: 9px; bottom: 9px; left: 50%; width: 1px; background: var(--line); content: ""; transform: translateX(-50%); }
.year-link { position: relative; display: flex; min-width: 56px; align-items: center; justify-content: center; gap: 6px; padding: 6px 2px; border: 0; background: transparent; color: var(--muted); font: 300 9px var(--mono); cursor: pointer; transition: color .18s, transform .18s; }
.year-link::before { width: 5px; height: 5px; border: 1px solid var(--muted); border-radius: 50%; background: var(--paper); content: ""; transition: background .18s, border-color .18s, transform .18s; }
.year-link[aria-current="true"] { color: var(--accent); transform: scale(1.12); }
.year-link[aria-current="true"]::before { transform: scale(1.35); border-color: var(--accent); background: var(--accent); }
.empty, .loading-note { padding: 45px 0; color: var(--muted); font: 300 13px var(--sans); }
.article-page { padding-top: 58px; }
.article-page article { font-family: var(--sans); font-weight: 300; }
.article-page .article-title { font: 300 clamp(33.6px, 4.16vw, 50.4px)/1.5 var(--sans); letter-spacing: .01em; }
.article-page .article-byline { margin: -22px 0 16px; color: var(--muted); font: 300 16px/1.6 var(--sans); }
.article-page .article-date { display: flex; align-items: baseline; gap: 8px; margin-bottom: 40px; color: var(--muted); font: 300 15px/1.8 var(--sans); }
.article-content { color: var(--ink); font: 300 21.6px/1.9 var(--sans); }
.article-content p { margin-bottom: 1.25em; }
.article-content h1, .article-content h2, .article-content h3, .article-content h4 { font-family: var(--sans); font-weight: 300; }
.article-content strong, .article-content b { font-weight: 500; }
.article-content img { display: block; width: auto; max-width: 100%; height: auto !important; margin: 20px auto; }
.article-content table { display: block; max-width: 100%; overflow-x: auto; }
.article-content a { color: var(--accent); text-underline-offset: 3px; }
.article-page .topbar-actions { display: flex; }
.article-page .topbar-actions nav { display: flex; }
@keyframes year-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 760px) {
  main { padding: 0 22px; }
  .topbar, .footer { padding: 20px 22px; }
  .topbar-actions { gap: 8px; }
  .topbar .wordmark { font-size: clamp(58.5px, 15vw, 64px); letter-spacing: 0; white-space: nowrap; }
  .reading .topbar-actions nav { display: none; }
  .library { padding: 5px 0 72px; }
  .library-layout { display: flex; flex-direction: column; gap: 8px; }
  .year-rail { order: -1; }
  .toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .search-box { grid-column: 1 / -1; max-width: none; }
  .year-rail { position: sticky; top: 0; align-self: stretch; z-index: 5; margin: 0 -4px; padding: 3px 4px; background: var(--paper); }
  .year-rail-label { display: none; }
  .year-nav { flex-direction: row; justify-content: flex-start; gap: 6px; max-height: none; overflow-x: auto; overflow-y: hidden; padding: 4px 1px 7px; white-space: nowrap; -webkit-overflow-scrolling: touch; touch-action: pan-x; }
  .year-nav::before { display: none; }
  .year-link { flex: 0 0 auto; min-width: 46px; gap: 4px; padding: 8px 2px; font-size: 10px; }
  .timeline-entry { padding: 13px 0 17px; }
  .entry-copy h4 { font-size: 24px; line-height: 1.45; }
  .entry-copy p { font-size: 18px; line-height: 1.7; -webkit-line-clamp: 3; }
  .entry-date { font-size: 12px; }
  .article-page { padding: 40px 22px 70px; }
  .article-page .article-title { font-size: 33.6px; }
  .article-page .article-byline { margin-top: -16px; font-size: 15px; }
  .article-page .article-date { font-size: 18px; }
  .article-content { font-size: 20.16px; line-height: 1.85; }
}
@media (max-width: 360px) {
  .topbar, .footer { padding-right: 16px; padding-left: 16px; }
  .theme-toggle { min-width: 38px; padding: 0 8px; }
  .theme-state { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition: none !important; } }

/* Songhe article body: shared typography and theme-safe text. */
:root { --article-title-green: #6b8f72; }
html[data-theme="dark"] { --article-title-green: #a4c0aa; }
.entry-copy h4, .entry-copy:hover h4 { color: var(--article-title-green); }
.article-content {
  color: var(--ink);
  font: 300 16px/1.9 var(--sans);
  letter-spacing: 2px;
  overflow-wrap: anywhere;
}
.article-content, .article-content * {
  font-family: var(--sans) !important;
  font-size: 16px !important;
  letter-spacing: 2px !important;
}
.article-content a { color: var(--accent); text-underline-offset: 3px; }
.article-content img { display: block; width: auto; max-width: 100%; height: auto !important; margin: 20px auto; }
.article-content picture.responsive-media { display: block; max-width: 100%; }
.article-content picture.responsive-media > img { display: block; max-width: 100%; }
.article-content table { display: block; max-width: 100%; overflow-x: auto; }
.article-content blockquote { margin: 1.25em 0; padding: .15em 0 .15em 1em; border-left: 2px solid var(--line); color: var(--soft-text); }
.article-content mark { background: transparent; color: inherit; }
.article-content p { display: block; margin: 0 0 1.25em !important; line-height: 1.9 !important; }
.article-content p:last-child { margin-bottom: 0 !important; }
.article-content li { margin-block-end: .65em; }
