/* EastStory - Jingguan-ink style: off-white bg, ink text, vermilion accent only */
:root {
  --bg: #FCFCFA;
  --ink: #333330;
  --accent: #9E2A22;
  --line: #DDD8CE;
  --muted: #7A766C;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  font-size: 18px;
  line-height: 1.9;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
main, .masthead, footer, .site-head {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
}
.masthead { padding-top: 56px; text-align: center; }
.masthead h1 { font-size: 34px; letter-spacing: 2px; margin: 0 0 8px; font-weight: 700; }
.tagline { color: var(--muted); margin: 0 0 20px; font-size: 17px; }
.cat-nav {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  font-size: 16px;
  margin-bottom: 12px;
}
.site-head {
  padding-top: 22px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  letter-spacing: 1px;
  /* brand link left, header clock right; wraps on narrow screens */
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 2px 16px;
}
section h2 {
  font-size: 22px;
  margin: 38px 0 6px;
  padding-left: 10px;
  border-left: 4px solid var(--accent);
  line-height: 1.4;
}
.card {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px 18px 14px;
  margin: 14px 0;
  background: #FFFFFF;
}
.card-meta { margin: 0 0 6px; font-size: 14px; color: var(--muted); line-height: 1.6; }
.tag {
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0 6px;
  font-size: 13px;
  margin-right: 6px;
}
.card h3 { margin: 0 0 6px; font-size: 20px; line-height: 1.55; }
.card h3 a { color: var(--ink); }
.card h3 a:hover { color: var(--accent); text-decoration: none; }
.hook { margin: 0; font-size: 16px; color: #55524A; line-height: 1.8; }
article h1 { font-size: 27px; line-height: 1.5; margin: 26px 0 8px; }
article .meta { color: var(--muted); font-size: 15px; margin: 0 0 22px; }
article h2 {
  font-size: 21px;
  margin: 34px 0 10px;
  padding-left: 10px;
  border-left: 4px solid var(--accent);
  line-height: 1.5;
}
article p { margin: 0 0 1.1em; text-align: justify; }
.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  margin-top: 36px;
  padding-top: 16px;
  font-size: 15px;
  line-height: 1.6;
}
.back { font-size: 15px; margin-top: 18px; }
footer {
  border-top: 1px solid var(--line);
  margin-top: 48px;
  padding-top: 20px;
  padding-bottom: 40px;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.8;
}
footer p { margin: 0 0 6px; }
footer .fine { font-size: 13px; letter-spacing: 1px; }
/* ---- header clock (all pages; markup from clock_html() in
   build_site.py, values filled in by the inline script it appends).
   Small muted text so it never competes with the page title. ---- */
.head-clock { font-size: 13px; color: var(--muted); white-space: nowrap; }
.head-clock .hc-time { font-variant-numeric: tabular-nums; }
.head-clock .hc-sep { margin: 0 7px; }
.mast-clock { margin: 0 0 8px; text-align: right; }
/* Language-switch link in page headers: same small muted register as
   the clock, grouped with it on the right of the header. */
.lang-link { color: var(--muted); font-size: 13px; margin-left: 10px; white-space: nowrap; }
/* ---- story pages: two-column layout with sticky sidebar ----
   Only story pages contain .story-layout, so these rules cannot leak
   into the index or about pages; the English build reuses the same
   classes. The text column keeps its original 720px measure (~68% of
   the 1096px container) and the sidebar is a fixed 300px column that
   sticks to the viewport top and scrolls internally when taller. */
.story-layout {
  max-width: 1096px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 36px;
  align-items: flex-start;
}
.story-layout .story-main {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 720px;
  margin: 0;
  padding: 0;
}
.story-side {
  flex: 0 0 300px;
  width: 300px;
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  margin-top: 26px;
}
.side-nav {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #FFFFFF;
  padding: 14px 16px 6px;
  font-size: 15px;
  line-height: 1.6;
}
.side-title { margin: 0 0 4px; font-size: 16px; font-weight: 700; letter-spacing: 1px; }
.side-group h3 { margin: 16px 0 6px; font-size: 14px; color: var(--accent); letter-spacing: 1px; }
.side-group ul { list-style: none; margin: 0; padding: 0; }
.side-group li { margin: 0 0 9px; padding: 2px 6px 2px 8px; border-left: 2px solid var(--line); }
.side-group li a { display: block; color: var(--ink); font-weight: 700; font-size: 15px; line-height: 1.5; }
.side-group li a:hover { color: var(--accent); text-decoration: none; }
.side-hook { display: block; color: var(--muted); font-size: 13px; line-height: 1.55; }
.side-group li.current { border-left-color: var(--accent); background: #FBF1EF; }
.side-group li.current a { color: var(--accent); }
/* Story pages: widen header/footer to the two-column container width
   (progressive enhancement - without :has() they keep the 720px rule). */
body:has(.story-layout) .site-head,
body:has(.story-layout) footer { max-width: 1096px; }
@media (max-width: 900px) {
  /* Single column: article first, the full sidebar below it. */
  .story-layout { flex-direction: column; }
  .story-layout .story-main { align-self: center; width: 100%; }
  .story-side {
    position: static;
    flex: none;
    width: auto;
    align-self: stretch;
    max-height: none;
    overflow-y: visible;
    margin-top: 4px;
  }
}
@media (max-width: 600px) {
  body { font-size: 18px; }
  .masthead { padding-top: 40px; }
  .masthead h1 { font-size: 28px; }
  article h1 { font-size: 24px; }
  .pager { flex-direction: column; gap: 8px; }
  .head-clock { white-space: normal; }
}
