/* ============================================================
   Talabat activation — type
   ONE file. Every @font-face lives here and nowhere else, so a
   font swap is a one-file change instead of a hunt through eight
   screens. Copy alongside server/, board/ and rig/.

   TT Commons Pro v3.300 — Latin. NO Arabic glyphs in this version.
   Noto Sans Arabic v2.004 — Arabic (the ExtraBold is v2.009: see its
   note). Almost no Latin glyphs.

   The two never collide: unicode-range sends each script to the
   only family that can render it. No fallback guessing.

   Weights: 500 / 600 / 700 / 800 / 900, in BOTH families. 600 and 800
   were Latin only until Session B -- see the DemiBold and ExtraBold notes
   below. TT Commons Pro ships no Regular — Medium is the lightest weight
   available, which is correct for a screen read at distance anyway. So
   NotoSansArabic-Regular.woff2 ships with nothing pointing at it, on
   purpose: nothing asks for 400, and a face in one script only is the
   silent fallback this file exists to prevent.

   A WEIGHT IS DECLARED IN BOTH FAMILIES, AND ONLY A DECLARED WEIGHT IS
   ASKED FOR. server/print/test/fonts.test.js fails otherwise -- and if
   the three copies of this directory differ by a byte.

   THERE IS NO ExtraBlack woff2 IN THIS REPO. Zuhair's frames name it
   for display type; the heaviest face we actually hold is Black, and
   900 is where it is mapped. If ExtraBlack is wanted on screen it has
   to be exported and added here first — declaring a weight whose file
   is absent buys nothing, because the browser just re-uses Black.
   ============================================================ */

/* ---------- Latin ---------- */

@font-face {
  font-family: 'Talabat';
  src: url('./TTCommonsPro-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: block;          /* kiosk is local disk — block avoids FOUT */
  unicode-range: U+0000-05FF, U+2000-206F, U+20A0-20CF, U+2190-2BFF;
}
@font-face {
  font-family: 'Talabat';
  src: url('./TTCommonsPro-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: block;
  unicode-range: U+0000-05FF, U+2000-206F, U+20A0-20CF, U+2190-2BFF;
}
/* DemiBold, 600. Declared in S14 for the same reason ExtraBold was declared in
   S8c: TTCommonsPro-DemiBold.woff2 had been shipping in every public/fonts/
   since S1b with no @font-face pointing at it, so every request for it
   resolved silently to Bold. Zuhair's gameplay HUD sets the TIME LEFT sticker
   -- the label and the clock, the biggest number on the screen -- in DemiBold.

   Latin only until Session B, "on the ExtraBold precedent: Noto Sans Arabic
   ships no DemiBold here" -- which was never so. NotoSansArabic-SemiBold.woff2
   had shipped in every public/fonts/ since S1b with nothing pointing at it, the
   very defect this note is about, and Arabic at 600 drew in Bold. It is
   declared in the Arabic section now. */
@font-face {
  font-family: 'Talabat';
  src: url('./TTCommonsPro-DemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: block;
  unicode-range: U+0000-05FF, U+2000-206F, U+20A0-20CF, U+2190-2BFF;
}
/* ExtraBold, 800. Declared in S8 because Zuhair's frames set money and data
   in it (the board's scores, the kiosk's field labels) and the file had been
   shipping in every public/fonts/ since S1b with no @font-face pointing at
   it — so every request for it silently resolved to Bold.

   LATIN ONLY FROM S8c TO SESSION B, deliberately. Noto Sans Arabic had no
   ExtraBold file here, and CSS weight matching for a target above 500
   searches upward, so Arabic at 800 drew in Noto Black -- "one step heavier
   rather than one step lighter, the right pairing beside TT ExtraBold".
   That was right while 800 set scores and labels. REVERSED IN SESSION B, by
   the owner: 800 sets NAMES now -- the rig's post-run board rows, PC 2's
   ranks 4-10, the ops console -- and a weight that silently falls back is
   S8c's own defect, whichever way it falls. What it costs: an Arabic name at
   800 draws lighter and narrower than the Black it drew in, so every width
   measured at 800 before was Black's. The face is declared in the Arabic
   section, from a file added for it. */
@font-face {
  font-family: 'Talabat';
  src: url('./TTCommonsPro-ExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: block;
  unicode-range: U+0000-05FF, U+2000-206F, U+20A0-20CF, U+2190-2BFF;
}
@font-face {
  font-family: 'Talabat';
  src: url('./TTCommonsPro-Black.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: block;
  unicode-range: U+0000-05FF, U+2000-206F, U+20A0-20CF, U+2190-2BFF;
}

/* ---------- Arabic ----------
   Noto Sans Arabic draws much smaller than TT Commons Pro at the
   same font-size. Measured from the actual files:

     cap height   TT 0.700em   Noto 0.416em
     x-height     TT 0.503em   Noto 0.374em
     line span    TT 1.250em   Noto 2.112em

   Untreated, an Arabic name sits ~40% smaller than a Latin one in
   the same leaderboard row — it reads as a bug, not a script.

   size-adjust scales the outlines up to match. The ascent/descent
   overrides then pin the line box to TT's, so mixed rows keep one
   baseline and one row height.

   THESE ARE STARTING VALUES. Verify on the real 1080x1920 board
   with a long Arabic name and a long Latin name in adjacent rows —
   that is the case that breaks. If tall Arabic clips inside an
   overflow:hidden row, raise ascent-override before lowering
   size-adjust.                                                   */

@font-face {
  font-family: 'Talabat';
  src: url('./NotoSansArabic-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: block;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF,
                 U+FB50-FDFF, U+FE70-FEFF;
  size-adjust: 132%;
  ascent-override: 105%;
  descent-override: 32%;
  line-gap-override: 0%;
}
/* SemiBold, 600 (Session B). The file had shipped since S1b; see the Latin
   DemiBold note. */
@font-face {
  font-family: 'Talabat';
  src: url('./NotoSansArabic-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: block;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF,
                 U+FB50-FDFF, U+FE70-FEFF;
  size-adjust: 132%;
  ascent-override: 105%;
  descent-override: 32%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Talabat';
  src: url('./NotoSansArabic-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: block;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF,
                 U+FB50-FDFF, U+FE70-FEFF;
  size-adjust: 132%;
  ascent-override: 105%;
  descent-override: 32%;
  line-gap-override: 0%;
}
/* ExtraBold, 800 (Session B); the Latin ExtraBold note says why. NO v2.004
   ExtraBold was to be had -- Noto's releases start at v2.010 -- so this is
   v2.009's, from the archived notofonts/noto-fonts repo, unhinted like the
   rest. Against the v2.004 Bold and Black either side of it, v2.009 changes
   the advance of exactly two Arabic-block characters, U+0608 ARABIC RAY and
   U+0691 RREH, and the kiosk's keyboard offers neither; v2.013 changes 35 and
   45. */
@font-face {
  font-family: 'Talabat';
  src: url('./NotoSansArabic-ExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: block;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF,
                 U+FB50-FDFF, U+FE70-FEFF;
  size-adjust: 132%;
  ascent-override: 105%;
  descent-override: 32%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Talabat';
  src: url('./NotoSansArabic-Black.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: block;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF,
                 U+FB50-FDFF, U+FE70-FEFF;
  size-adjust: 132%;
  ascent-override: 105%;
  descent-override: 32%;
  line-gap-override: 0%;
}

/* ---------- use ---------- */

:root {
  --font: 'Talabat', system-ui, sans-serif;

  --orange: #FF5900;
  --maroon: #451215;
  --cream:  #F4EDE3;
  --brown:  #6E3E24;
}

html { font-family: var(--font); }

/* Any element that can contain a player name.
   dir="auto" on the ELEMENT, never on a container — set it on a
   row and the rank and score flip sides too. */
.name {
  font-weight: 900;
  line-height: 1.35;            /* Arabic needs the descender room */
}

/* Mixed-script rows: keep rank and score in fixed LTR columns and
   isolate only the name.
     <div class="row"><span>3</span><bdi class="name">فاطمة</bdi><span>2,510</span></div>
   <bdi> is what stops an RTL name reordering the rest of the line. */
