/* ALMARAI, SELF-HOSTED, FOR ARABIC AND PERSIAN.
 *
 * WHAT THESE PAGES USED BEFORE: nothing. option5.css declares only Plus Jakarta
 * Sans, which has no Arabic glyphs, so every Arabic and Persian page fell
 * through to the generic sans-serif and was set in whatever the device
 * happened to supply -- SF Arabic on a Mac, Segoe UI on Windows, Noto Naskh on
 * Android. Three different typefaces for the same page. (Tajawal is loaded in
 * this codebase, but only by the promoter panel's own layouts.)
 *
 * SELF-HOSTED, NOT FROM GOOGLE. A webfont request is a third-party request
 * carrying the visitor's address and the page they are on, and the cookie
 * inventory lists fonts.googleapis.com among the hosts contacted BEFORE any
 * consent. Serving the files ourselves removes that, and it is the same
 * argument as the Maps embed. OFL.txt sits beside the files because the
 * licence requires it to travel with them.
 *
 * UNICODE-RANGE, so a Latin page never downloads 48 KB it cannot use. The
 * browser fetches a face only when the page actually contains a codepoint in
 * its range, so an English page costs nothing at all.
 *
 * U+200C IS IN THE RANGE AND ALMARAI HAS NO GLYPH FOR IT, deliberately.
 * Persian half-spaces were the one real doubt about this font: its cmap
 * carries every Persian letter and digit but neither ZWNJ nor ZWJ. Measured in
 * Chrome rather than argued about -- "می‌رود" renders 121.58px with the
 * half-space and 104.73px without, with the yeh correctly in its final form --
 * because ZWNJ is a default-ignorable format control resolved by the shaper,
 * not a character the font has to carry. The absence from the cmap is a red
 * herring; the join breaks exactly as it should.
 *
 * font-display: swap, so text is readable in the device face while 48 KB
 * arrives, rather than invisible.
 */
@font-face {
  font-family: 'Almarai';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('/fonts/almarai/Almarai-Light.woff2') format('woff2'),
       url('/fonts/almarai/Almarai-Light.ttf') format('truetype');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1,
                 U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41,
                 U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: 'Almarai';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/almarai/Almarai-Regular.woff2') format('woff2'),
       url('/fonts/almarai/Almarai-Regular.ttf') format('truetype');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1,
                 U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41,
                 U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: 'Almarai';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/almarai/Almarai-Bold.woff2') format('woff2'),
       url('/fonts/almarai/Almarai-Bold.ttf') format('truetype');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1,
                 U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41,
                 U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: 'Almarai';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('/fonts/almarai/Almarai-ExtraBold.woff2') format('woff2'),
       url('/fonts/almarai/Almarai-ExtraBold.ttf') format('truetype');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1,
                 U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41,
                 U+FB50-FDFF, U+FE70-FEFF;
}

/* ALMARAI FIRST, PLUS JAKARTA SANS AFTER IT, FOR EVERY PAGE.
 *
 * The order is what makes unicode-range do the work: Arabic codepoints match
 * Almarai's ranges and Latin ones fall past it to Plus Jakarta Sans, so a
 * mixed line -- "Desert Festival" inside an Arabic sentence, a Latin venue
 * name, a price -- is set in both without anyone tagging the spans. It costs a
 * Latin-only page nothing, because a face whose range the page never touches
 * is never fetched.
 *
 * Applied through the variables rather than to a selector, so every rule that
 * already uses them picks it up and nothing has to be restated.
 *
 * :root:root, NOT :root, AND THE REASON IS MEASURED. option5.css is loaded
 * TWICE on these pages -- once from master.html's head and again from the
 * page's own head, which the layout dialect merges in AFTERWARDS. The
 * stylesheet order on the events page really is
 *
 *     ... option5.css ... almarai.css -> option5.css -> oh-overrides.css ...
 *
 * so option5.css's own :root block is the last definition of --o5-display and
 * won: the heading computed to Plus Jakarta Sans and not one byte of Almarai
 * was ever fetched, on an Arabic page. Repeating the selector raises the
 * specificity from 0,1,0 to 0,2,0, which beats :root wherever it appears, so
 * this does not depend on load order at all.
 *
 * The duplicate stylesheet is a separate defect -- it costs every visitor a
 * second download of the same file and silently defeats any override placed
 * in master -- and is reported rather than fixed here, because the fix is in
 * seventeen page templates. */
:root:root {
  --o5-display: 'Almarai', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, sans-serif;
  --o5-body: 'Almarai', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, sans-serif;
}
