/* lang.css — bilingual metrics. EN + 中文 (U2).
   LOAD LAST. Several rules here deliberately override primitives.css at equal
   specificity, so source order is what makes them win.

   The reason this file exists at all: the whole hierarchy method in the steering
   docs is "four registers, two sizes" — ALL-CAPS, italic, bold, roman. Two of
   those four do not survive the crossing into Chinese. Neither steering document
   anticipates this. */

/* 1 · Tracking is Latin-only.
      Letter-spacing is designed for Latin sidebearings; applied to Han it forces
      gaps between glyphs that are already drawn on a fixed em square, and the
      word visibly comes apart. */
:lang(zh) { letter-spacing: normal; }

/* 2 · 中文 has no case.
      text-transform:uppercase silently does nothing to Han but WOULD hit any
      Latin or numerals embedded in a Chinese string, producing a mixed register
      by accident. Turn it off explicitly rather than relying on it being inert. */
:lang(zh) { text-transform: none; }

/* 2b · Han has no italic.
      There is no true italic Han typeface in any of these stacks, so font-style:
      italic makes the browser SYNTHESISE an oblique by shearing the glyphs. That
      is a genuine typographic error, not a stylistic one — sheared Han reads as
      broken. .row__title is italic, so this rule is load-bearing.

      Consequence, and it compounds point 4 below: of the four registers the
      steering docs build hierarchy from — ALL-CAPS, italic, bold, roman — TWO do
      not survive the crossing into Chinese. Only bold and roman remain. The
      four-register method is substantially a Latin method, and in 中文 the same
      hierarchy has to be rebuilt from weight and position alone. */
:lang(zh) { font-style: normal; }

/* 3 · Han sits on a different optical baseline and needs more leading.
      Latin body runs 1.55; Han at the same value reads cramped because the
      glyphs fill their em box edge to edge with no ascender/descender relief. */
:lang(zh) { line-height: 1.8; }
.thesis :lang(zh),
:lang(zh).thesis { line-height: 1.75; }

/* 4 · Hierarchy that ALL-CAPS carried in English must be carried by weight.
      With italic also unavailable (2b), weight is doing the work of two lost
      registers here. Affects MK-CAPS, NV-SERIES, NV-SECT and DT-INDEX titles. */
.marker :lang(zh),
.caps   :lang(zh),
.nav--series :lang(zh),
.bilingual__label :lang(zh) {
  font-weight: 700;
}

/* 5 · Han is optically larger than Latin at the same point size.
      Nudge the small registers down slightly so a bilingual line reads as one
      line rather than two competing ones. Never below the 13.5px floor —
      13.5 × .94 ≈ 12.7px would breach it, so the caption register is left alone
      and only the meta register is adjusted. */
.row__title :lang(zh),
.filmstrip__label :lang(zh) {
  font-size: .94em;
}

/* 6 · Secondary-language lines.
      Where 中文 sits beneath an English primary rather than beside it, it drops
      to ink-soft. .alt already does this; here we only fix the leading so the
      pair reads as one unit. */
.alt:lang(zh) { line-height: 1.5; margin-top: 1px; }

/* 7 · Quotation and punctuation.
      Chinese full-width punctuation carries its own spacing; do not add more. */
:lang(zh) { text-align: start; }


/* ═══ Site-wide language switching ══════════════════════════════════════
   The control lives in the rail and its choice is stored, so a reader picks a
   language once rather than on every page. An inline script in <head> applies
   the stored value before first paint, so nothing flashes.

   Switching is done in CSS rather than by hiding nodes in script, which means
   it costs nothing at runtime and survives on any page that has panels.

   The .has-js guard matters: without scripting no attribute is ever set, so
   BOTH languages render. Hiding one behind a control that cannot be operated
   would gate content, which the quality floor forbids. */
.has-js[data-lang="zh"] [data-langpanel="en"] { display: none; }
.has-js[data-lang="en"] [data-langpanel="zh"] { display: none; }

/* The pressed state is weight plus a rule — never colour alone (C5). */
.switch.lang button { letter-spacing: .06em; }
