/* Article pages: the version B palette, a single reading column of about 66 characters,
   pinyin after Chinese in running text and above it in display sizes. */
:root {
  --paper: #EEF2EF;
  --surface: #F7F9F7;
  --ink: #1F2321;
  --muted: #5E6762;
  --line: #CCD5D0;
  --cinnabar: #B8372D;
  --jade: #3F7A64;
  --gold: #A9822F;
  --season: #5F7D8C;
  --season-soft: color-mix(in srgb, var(--season) 14%, var(--paper));
  --f-display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --f-body: "Figtree", "Segoe UI", system-ui, sans-serif;
  --f-han: "Noto Serif SC", "Songti SC", "SimSun", serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131715; --surface: #1A1F1C; --ink: #E3E7E1; --muted: #9AA39C; --line: #2D3530;
    --cinnabar: #DE5A4C; --jade: #84BBA3; --gold: #D4AE5C; --season: #8FB0C0; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #131715; --surface: #1A1F1C; --ink: #E3E7E1; --muted: #9AA39C; --line: #2D3530;
  --cinnabar: #DE5A4C; --jade: #84BBA3; --gold: #D4AE5C; --season: #8FB0C0; color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 17.5px/1.7 var(--f-body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--jade); outline-offset: 3px; }
.han { font-family: var(--f-han); }
.wrap { max-width: 1120px; margin: 0 auto; }

/* Header (same markup as the home page) */
.mast { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-block: 20px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.seal-sm { width: 40px; height: 40px; background: #B8372D; color: #FFF6F2; border-radius: 4px; display: grid; grid-template-columns: 1fr 1fr; place-items: center; font-family: var(--f-han); font-weight: 700; font-size: 15px; line-height: 1; padding: 4px; }
.brand-name { font-family: var(--f-display); font-size: 22px; }
.nav { display: flex; gap: 6px 20px; flex-wrap: wrap; font-size: 14.5px; }
.nav a { text-decoration: none; color: var(--muted); }
.nav a:hover, .nav a[aria-current] { color: var(--ink); }

/* Pinyin */
ruby { ruby-position: over; }
rt { font-family: var(--f-mono); font-weight: 400; font-style: normal; letter-spacing: 0; color: var(--muted); text-transform: none; }
p rt, li rt, td rt, figcaption rt, blockquote rt, h2 rt, h3 rt { display: inline; font-size: .74em; margin-left: .3em; }
.hero-han rt { font-size: .26em; }

/* Article */
.article { max-width: 720px; margin: 0 auto; padding-block: 48px 64px; }
.kicker { font-family: var(--f-mono); font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--jade); display: flex; gap: 10px; flex-wrap: wrap; }
.kicker a { text-decoration: none; }
.article h1 { font-family: var(--f-display); font-weight: 400; font-size: clamp(36px, 6vw, 58px); line-height: 1.08; margin: 16px 0 0; text-wrap: balance; letter-spacing: -.01em; }
.dek { font-size: 20px; color: var(--muted); margin: 18px 0 0; max-width: 60ch; text-wrap: pretty; }
.byline { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin-top: 24px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.hero-han { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin: 32px 0 8px; padding: 28px 32px; border-radius: 6px; background: var(--season-soft); }
.hero-han .big { font-family: var(--f-han); font-size: clamp(64px, 12vw, 112px); line-height: 1.1; color: var(--season); }
.hero-han p { font-size: 15px; color: var(--muted); max-width: 30ch; margin: 0; }

.body { margin-top: 32px; }
.body > * + * { margin-top: 1.1em; }
/* Paragraphs keep the 1.1em gap from `.body > * + *`; only the bottom margin is reset */
.body p { margin-bottom: 0; text-wrap: pretty; }
.body > p:first-child { margin-top: 0; }
.body h2 { font-family: var(--f-display); font-weight: 400; font-size: 30px; line-height: 1.2; margin: 2em 0 0; text-wrap: balance; }
.body h3 { font-family: var(--f-body); font-weight: 600; font-size: 18px; line-height: 1.4; margin: 1.6em 0 0; }
.body ul, .body ol { padding-left: 1.2em; margin-bottom: 0; }
.body li + li { margin-top: .5em; }
.body blockquote { margin: 1.8em 0; padding: 4px 0 4px 24px; border-left: 2px solid var(--cinnabar); }
.body blockquote .zh { font-family: var(--f-han); font-size: 26px; line-height: 1.5; display: block; }
.body blockquote .py { font-family: var(--f-mono); font-size: 13px; color: var(--jade); display: block; margin-top: 6px; }
.body blockquote .en { font-family: var(--f-display); font-style: italic; font-size: 21px; display: block; margin-top: 8px; }

.terms { width: 100%; border-collapse: collapse; font-size: 15.5px; }
.table-wrap { overflow-x: auto; }
.terms th, .terms td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.terms th { font-family: var(--f-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
.terms td:first-child { font-family: var(--f-han); font-size: 20px; white-space: nowrap; }
.terms td .py { display: block; font-family: var(--f-mono); font-size: 12px; color: var(--jade); }

.taboo { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 16px; padding-block: 20px; border-bottom: 1px solid var(--line); }
.body .taboo { margin-top: 0; }
.taboo .glyph { font-family: var(--f-han); font-size: 40px; line-height: 1.1; color: var(--cinnabar); text-align: center; }
.taboo .glyph small { display: block; font-family: var(--f-mono); font-size: 12px; color: var(--muted); margin-top: 4px; }
.taboo h3 { margin: 0; }
.taboo p { margin: 6px 0 0; color: var(--muted); font-size: 16px; }

.ask { margin-top: 2.4em; padding: 24px 28px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); }
.ask h2 { margin: 0; font-size: 24px; }
.ask p { color: var(--muted); font-size: 15.5px; margin-top: 6px; }
.ask ol { margin-top: 12px; }

.related { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); }
.related h2 { font-family: var(--f-mono); font-weight: 400; font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.related ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.related a { font-family: var(--f-display); font-size: 21px; text-decoration: none; }
.related a:hover { text-decoration: underline; text-underline-offset: 4px; }
.sources { margin-top: 32px; font-size: 14px; color: var(--muted); }
.sources p { margin: 4px 0 0; }

/* Article index */
.list { max-width: 820px; margin: 0 auto; padding-block: 48px 64px; }
.list h1 { font-family: var(--f-display); font-weight: 400; font-size: clamp(36px, 5.6vw, 54px); margin: 12px 0 0; }
.list > p { color: var(--muted); margin: 12px 0 0; max-width: 56ch; }
.cards { list-style: none; padding: 0; margin: 32px 0 0; }
.cards li { padding-block: 24px; border-top: 1px solid var(--line); }
.cards a { text-decoration: none; display: grid; gap: 6px; }
.cards h2 { font-family: var(--f-display); font-weight: 400; font-size: 28px; line-height: 1.2; margin: 0; }
.cards a:hover h2 { text-decoration: underline; text-underline-offset: 4px; }
.cards p { margin: 0; color: var(--muted); font-size: 16px; }

footer { max-width: 1120px; margin: 0 auto; border-top: 1px solid var(--line); padding-block: 32px 48px; display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
footer p { max-width: 60ch; margin: 0; }

@media (max-width: 640px) {
  body { font-size: 17px; }
  /* Three-column tables stack on phones: term on the left, the other two cells stacked on the right */
  .terms.stack thead { display: none; }
  .terms.stack, .terms.stack tbody { display: block; }
  .terms.stack tr { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 2px 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .terms.stack td { border: 0; padding: 0; }
  .terms.stack td:first-child { grid-row: span 2; white-space: normal; }
  .terms.stack td:nth-child(2) { font-weight: 600; color: var(--ink); }
  .hero-han { flex-direction: column; align-items: flex-start; padding: 22px; }
  .taboo { grid-template-columns: 48px minmax(0, 1fr); }
  .taboo .glyph { font-size: 32px; }
}
