/**
 * print-grammar/hj.css — layer 2: hyphenation & justification.
 *
 * One H&J spec for every flowing print document. Formerly the body of
 * public/print-type.css (which now just imports this file); tuned on the
 * Aims of Education edition, where it cut hyphenated line ends from 22%
 * of lines to 7%, capped ladders at 2, and eliminated 2-letter stubs.
 *
 * Usage: give flowing body copy .pt-flow, then .pt-book (justified,
 * ligatures) or .pt-ragged (letters).
 */

.pt-flow p {
  /* H&J discipline, per Argetsinger (pp. 194–196): close, even word
     spacing beats avoided hyphens — "breaking words is less harmful to
     the appearance of the page than too much space between words"
     (Tschichold). Chrome can't flex word spaces like a paragraph
     composer, so hyphenation is the only justification valve we have —
     but a letter-size measure at ~68 characters gives the breaker room,
     so the valve can run tight: min word 8, leave 4 before the break,
     carry 4 over (kills three-letter turnovers like "succeed-ing"),
     ladder capped at 2 consecutive hyphens. text-wrap: pretty lets the
     line breaker look ahead instead of filling greedily. */
  hyphens: auto;
  -webkit-hyphens: auto;
  hyphenate-limit-chars: 8 4 4;
  -webkit-hyphenate-limit-before: 4;
  -webkit-hyphenate-limit-after: 4;
  -webkit-hyphenate-limit-lines: 2;
  text-wrap: pretty;
  /* Classical page make-up (pp. 256, 299–301): a widow — the
     paragraph's last line alone atop a page — is "not allowed under any
     circumstance". Argetsinger allows orphans (first line alone at the
     foot) as a matter of course; house style diverges and forbids them
     too — a lone opening line at the foot, often ending in a hyphen,
     reads worse than a page running a line short. */
  orphans: 2;
  widows: 2;
}

.pt-flow {
  font-kerning: normal;
}

/* Book setting: justified with ligatures on. Screen/ATS documents that
   need clean text extraction should NOT take .pt-book (ligatures break
   ATS copy-paste: "refine" reads as "rene"). */
.pt-book {
  font-variant-ligatures: common-ligatures;
  /* Old-style figures with an old-style face — "do not mix old style
     text composition with modern face figures" (p. 211). */
  font-variant-numeric: oldstyle-nums;
}
.pt-book p {
  text-align: justify;
}

/* Letterspaced small caps — the classical dress for capitalized words,
   acronyms, running heads, and small-cap lead-ins (p. 193). */
.pt-sc {
  font-variant-caps: small-caps;
  font-variant-numeric: oldstyle-nums;
  letter-spacing: var(--pg-sc-tracking, 0.06em);
}

/* Tabular figures on an en-set for columns and tables (pp. 212–213). */
.pt-tab-figures {
  font-variant-numeric: oldstyle-nums tabular-nums;
}

/* Hyphenation-review pin: compounds break only at their own hyphen,
   proper nouns and misleading divisions not at all (pp. 196, 315).
   Wrap the word in the source when the review catches a bad break. */
.pt-nobreak {
  hyphens: none;
  -webkit-hyphens: none;
}

/* Ragged setting for letters and correspondence: no justification, but
   the same hyphenation limits keep the rag tidy (pp. 200–201). */
.pt-ragged p {
  text-align: left;
}
