/* zh-Hans typography: family, line height, tracking, measure.
   Loaded for every locale; every rule here is scoped to html[lang="zh-Hans"],
   so the English edition is untouched. tokens.css swaps the three font stacks
   and the measures for Chinese; this file sets the metrics that go with them.

   Why Chinese needs its own file (researched 2026-11-06, sources below):
   - A Han glyph is a full em square with no ascender/descender slack, so the
     same line-height that reads well in Latin looks cramped in Chinese. W3C
     CLReq describes a common line gap of 50-100% of the em, i.e. line-height
     1.5-2.0 for body text; we use 1.8 for body and 1.7 for decks.
     https://www.w3.org/TR/clreq
   - `word-break: break-word` is a deprecated legacy value. The specified
     combination is `word-break: normal` + `overflow-wrap: anywhere`, and
     `anywhere` (unlike `break-word`) is counted when the browser computes
     min-content, which is what keeps a long Latin token or URL from forcing a
     horizontal scroll on a phone.
     https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap
   - `line-break` was never declared, so every break rode on each engine's
     `line-break: auto` default. `strict` states the CLReq rule explicitly — no
     break before a closing mark (。，、؛：！？）》」』】), none after an opening
     mark — so the zh edition breaks the same way in Blink, WebKit and Gecko and
     an engine default can no longer move a 。to the top of a line. It is the
     strictest correct value for Chinese: it only ever removes a break, never
     adds overflow.
     https://www.w3.org/TR/clreq/#line_breaking
     https://developer.mozilla.org/en-US/docs/Web/CSS/line-break
   - Negative tracking is a Latin optical correction. Han characters are
     already on a fixed grid, so letter-spacing stays 0 everywhere in Chinese.
     https://github.com/sofish/typo.css/blob/master/docs/modern-chinese-typography */

/* ---- display sizes: no tracking, tighter than Latin but never below 1.3 --
   The floor moved to 1.5 after measurement: a Han glyph fills its em box and
   Songti's ink box measures 1.43-1.46x the font size, so 1.36 packed lines'
   ink together on the story title, the digest headline and the 28px lead.
   tools/n3_zhlead.mjs, 2026-11-09. cards.css carries the matching card and
   lead values and the arithmetic. */
html[lang="zh-Hans"] .article__title,
html[lang="zh-Hans"] .detail__title,
html[lang="zh-Hans"] .digest__headline,
html[lang="zh-Hans"] .state__title,
/* The 404 document's headline is display type like these four. It was missing from this
   list, so the page carried a hand-copied pair of declarations instead — measured by N3
   2026-11-12: the zh 404 alone kept base.css's Latin optical correction. Adding it here
   is what lets frontend/404.html link this sheet and delete its copy. */
html[lang="zh-Hans"] .nf__title {
  letter-spacing: 0;
  line-height: 1.5;
  word-break: normal;
  overflow-wrap: anywhere;
  line-break: strict;
  font-family: var(--font-display);
  font-weight: 700;
}

html[lang="zh-Hans"] .card__title,
html[lang="zh-Hans"] .digest-item__title {
  letter-spacing: 0;
  line-height: 1.5;
  word-break: normal;
  overflow-wrap: anywhere;
  line-break: strict;
}

/* ---- body and decks: Chinese body copy needs the extra leading ---------- */
html[lang="zh-Hans"] .detail__body p,
html[lang="zh-Hans"] .prose p,
html[lang="zh-Hans"] .claim__text,
/* The 404 document's body paragraph. It carried its own `line-height: 1.8` while the
   page had no access to this sheet; with the sheet linked, the rule belongs here with
   every other Chinese body paragraph. Measured 2026-11-12: dropping the page's copy
   without adding it here took the zh body from 30.6px to 25.5px leading. */
html[lang="zh-Hans"] .nf__body {
  line-height: 1.8;
  word-break: normal;
  overflow-wrap: anywhere;
  line-break: strict;
}
html[lang="zh-Hans"] .article__deck,
html[lang="zh-Hans"] .detail__deck,
html[lang="zh-Hans"] .article__bullets li {
  line-height: 1.75;
  word-break: normal;
  overflow-wrap: anywhere;
  line-break: strict;
}
html[lang="zh-Hans"] .card__deck { line-height: 1.7; }

/* ---- labels: no tracking, and never uppercase (Chinese has no case) ----- */
html[lang="zh-Hans"] .section-label,
html[lang="zh-Hans"] .panel__label,
html[lang="zh-Hans"] .mono-label,
html[lang="zh-Hans"] .card__cat,
html[lang="zh-Hans"] .article__cat,
html[lang="zh-Hans"] .card__format,
html[lang="zh-Hans"] .article__format,
html[lang="zh-Hans"] .section-head,
html[lang="zh-Hans"] .feed-note,
html[lang="zh-Hans"] .chip,
html[lang="zh-Hans"] .toolbar__link,
html[lang="zh-Hans"] .masthead__kicker {
  letter-spacing: 0;
  text-transform: none;
}

/* A CJK quote mark is already a full-width glyph; the Latin side-bearing
   correction on the claim marker would detach it from the text. */
html[lang="zh-Hans"] .claim__span { border-left-width: 2px; }

/* ---- inter-script spacing, native first ---------------------------------
   A Han glyph fills its em box with no side bearing, so a Latin word or a
   figure beside it has no optical gap: `美联储FOMC` reads as one solid block.
   W3C's guidance is the browser's automatic spacing, NOT typed spaces in the
   copy — and it is `backend/app/i18n.py`'s own `text_autospace` setting for
   the edition-preview pages. The stored copy is deliberately spaceless
   (`pipeline/zh_quality.py`, measured on three live Chinese wires), so the gap
   can only be a render-time property.

   `text-autospace: normal` is Baseline (Chrome 123+, Safari 18.2+, Firefox
   139+) and is a no-op in an engine without it, so it costs nothing where it
   is unsupported. `js/typography.js` carries the fallback for those engines and
   checks the exact same support query this declaration relies on:
   `CSS.supports('text-autospace','normal')`.
   https://www.w3.org/International/articles/styling/inline-space */
@supports (text-autospace: normal) {
  html[lang="zh-Hans"] body,
  html[lang="zh-Hant"] body,
  html[lang="ja"] body {
    text-autospace: normal;
  }
}

/* Mixed CJK + Latin + digits: the Latin numerals in a Chinese line must not
   drift in width, so tabular figures stay on wherever a time or a number is
   set, and the face falls back through the CJK stack tokens.css defines. */
html[lang="zh-Hans"] .article__time,
html[lang="zh-Hans"] .rail__clock,
html[lang="zh-Hans"] .filters__count,
html[lang="zh-Hans"] .ticker {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
