/*
  Self-hosted Hebrew webfonts. This file is the ONE place either Hebrew
  custom property is defined -- a page must not declare `--heb` or
  `--sans-he` itself, or its local declaration wins the cascade over this
  shared one depending on link order (both are asserted absent from every
  other stylesheet by `tests/test_hebrew_webfont.py`).

  ## `--heb` (#752) -- the serif reading stack

  Promoted out of the `--heb:` custom property that was copy-pasted,
  byte-for-byte identical, into every page that reads Hebrew
  (`tutorial.css`, `settings.css`, `welcome.css`, `study.css`,
  `flashcards.css`, `progress.css`, and others since -- the reader, the
  queue, the compare page and the streak page all read it too before #1907,
  #1915 and #1281 removed them in turn). Same shape as
  `phone.css`/`nav.css`/`build_stamp.css` beside it: one definition every
  page loads, not one copy per page to keep in sync by hand.

  ### The bug this fixes

  Every Hebrew surface in this app -- the cue itself, niqqud, lemma cards,
  the queue's row text -- rendered through a *system* font stack:

      "Arial Hebrew","Narkisim","Frank Ruehl CLM","Times New Roman",serif

  Arial Hebrew (macOS/iOS) and Narkisim (Windows, but only if the user has
  installed Windows' optional Hebrew language support -- it does not ship
  with Windows itself) and Frank Ruehl CLM (Linux/Culmus) were never
  something the app shipped; they are gambles on what happens to be
  installed. A Windows machine without Hebrew language support falls all
  the way through to Times New Roman, whose niqqud mark positioning is
  poor at the sizes this app renders (`.line` 1.42rem, `.pop-niqqud`
  2.1rem) -- points collide with letters instead of sitting above/below
  them. Niqqud is on by default (#53, ADR 0019) and #730 just added a
  tutorial card that teaches the learner what the marks mean, so a first
  impression of mangled points on a non-Mac tester's machine undoes that
  card. See #752 for the measured version of this finding.

  ### The fix

  `@font-face` one self-hosted face -- Frank Ruhl Libre, SIL OFL, the
  modern digital descendant of the "Frank Ruehl CLM" face already third in
  the fallback list above -- ahead of the system stack, which survives
  unmodified as the fallback if the webfont somehow fails to load. Real
  GPOS mark-to-base positioning, so niqqud sits correctly regardless of
  what (if anything) is installed on the tester's machine.

  Subsetted to Hebrew + niqqud + Latin digits + space (not the full face --
  see `shared/fonts/README.md` for the exact codepoint ranges and the
  `fonttools` invocation): 5,796 bytes. Any character outside that subset
  (Latin letters, most punctuation) is not a defect -- CSS resolves
  `font-family` per character, so a glyph this subset doesn't cover falls
  through to the next entry in `--heb` exactly as it always has.

  ## `--sans-he` (#775) -- the study-screen sans stack

  #752's own premise -- "every Hebrew surface resolves through one stack"
  -- was wrong: `--sans-he` was a *second*, separate stack, defined only in
  `study.css` and used by the study screen plus 6 of 7 `beats/*.css` cards,
  including the largest Hebrew on any page (`.cue`, `.beat-text`, both
  30px). It never got #752's webfont. Found by rendering `/queue` and
  `/study` on the same build and seeing two different typefaces (#775).

  This is the symmetric fix, not a copy of #752's: the two stacks are a
  deliberate serif-vs-sans design split (reader vs. study screen), so
  pointing `--sans-he` at `--heb`'s face would be a visual regression, not
  a fix. Instead: a self-hosted **sans** Hebrew face, Noto Sans Hebrew (SIL
  OFL, already named as `--sans-he`'s last real fallback before this
  change), ahead of the same system stack `--sans-he` already had, which
  survives unmodified as the fallback.

  Subsetted with the same codepoint ranges, `--layout-features` and
  `fonttools` invocation shape as `--heb`'s face (see
  `shared/fonts/README.md`): 5,440 bytes.

  Provenance, licence text (`OFL-FrankRuhlLibre.txt` and
  `OFL-NotoSansHebrew.txt`, each vendored verbatim -- the two upstream
  projects' OFL.txt bodies differ in their copyright line and are kept as
  separate files rather than assumed interchangeable) and the sha256 of
  each shipped file: `shared/fonts/README.md`.
*/

@font-face {
  font-family: "Frank Ruhl Libre Heb Subset";
  src: url("/static/shared/fonts/FrankRuhlLibre-Hebrew-subset.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0020, U+0030-0039, U+0590-05FF;
}

@font-face {
  font-family: "Noto Sans Hebrew Subset";
  src: url("/static/shared/fonts/NotoSansHebrew-Hebrew-subset.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0020, U+0030-0039, U+0590-05FF;
}

:root {
  --heb: "Frank Ruhl Libre Heb Subset", "Arial Hebrew", "Narkisim",
    "Frank Ruehl CLM", "Times New Roman", serif;
  --sans-he: "Noto Sans Hebrew Subset", "SF Hebrew", -apple-system,
    BlinkMacSystemFont, "Segoe UI", "Arial Hebrew", "Noto Sans Hebrew",
    sans-serif;

  /* #886: the text-size preference. One multiplier, read by every font-size
     declaration that sets Hebrew in EITHER stack -- a factor that moved only
     one would let the study screen (--sans-he) and the reader (--heb) drift
     apart at large sizes, which is the whole reason this lives here beside
     the two stacks it has to keep in sync, rather than in study.css or the
     reader's own (since-removed) stylesheet separately.

     1 is the untouched default. `shared/nav.js` (the one script every page
     that reads Hebrew already loads first, per its own header) sets the live
     value on `documentElement` at boot from `localStorage`, before this
     sheet's own declarations are used -- a custom property set inline on the
     root element outranks this `:root` rule's default in the cascade, so no
     `!important` and no second copy of the number is needed here.

     Scope, stated plainly because it is a judgement call and not the literal
     reading of "both stacks" alone: this multiplies the STUDY SCREEN's
     Hebrew (study.css + beats/*.css, all --sans-he) and THE READER's
     (--heb, on the reader's own since-removed stylesheet) -- the two
     surfaces #886 itself names as the drift risk ("the study screen and the
     reader will drift apart"). It deliberately does NOT reach
     flashcards.css's tools, welcome.css's splash wordmark, or tutorial.css's
     single Hebrew swatch -- plus, when they still existed, the streak page's
     calendar and the compare page -- consumers of these same two tokens
     that are chrome or a different feature, not "these draft cards" the
     owner's report was about. See the PR body for #886 for this scoping
     decision spelled out. */
  --milim-text-scale: 1;
}
