/*
 * Self-hosted variable webfonts — replaces the previous Google Fonts
 * dependency (Cairo + Cormorant Garamond) for three reasons:
 *
 * 1. Privacy: every Google Fonts request leaks visitor IP + URL to
 *    fonts.gstatic.com. Self-hosting eliminates that entirely.
 * 2. Performance: one HTTP/2 request to our own origin reuses the
 *    storefront connection (no extra DNS, TLS, or TCP handshake to a
 *    third-party CDN). Combined ≈ 198 KB for both variable axes
 *    (Estedad 128 KB + Geist 70 KB) — smaller than the old Cairo +
 *    Cormorant static-weight set (~280 KB).
 * 3. Security: we can pin the bytes via Subresource Integrity in the
 *    HTML <link> and shrink the CSP `font-src` directive to `self`.
 *
 * Pairing rationale (Arabic-first storefront):
 *
 * - Estedad (Amin Abedi, OFL-1.1) is a humanist sans-serif Arabic
 *   typeface with a paired Latin (a.k.a. "Estedad FD"). Its low
 *   contrast, slightly counter-rounded terminals, and compact optical
 *   size make it read like clean handwritten naskh while remaining
 *   uncompromisingly modern. Critically, it ships a single variable
 *   wght axis (100-900) so we serve one ~128 KB file instead of
 *   eight static cuts. Not available on Google Fonts.
 *
 * - Geist (Vercel + Basement, OFL-1.1) is a precision-engineered
 *   Swiss geometric sans inspired by Inter, Univers, and Suisse
 *   International. We use it strictly for Latin glyphs and digits —
 *   browser glyph fallback automatically substitutes Estedad for any
 *   Arabic codepoint. Variable wght 100-900 in a single ~70 KB file.
 *
 * Loading strategy:
 *
 * - `font-display: swap` paints text immediately with the system
 *   fallback so the first contentful paint is never blocked. The
 *   custom face quietly replaces it within the next few hundred ms
 *   once the WOFF2 lands. This is the 2026 best practice — `optional`
 *   is too aggressive (skips the font on slow networks) and `block`
 *   causes a flash of invisible text.
 *
 * - unicode-range narrows each face to the script it actually serves.
 *   This tells the browser "don't bother downloading Geist if the
 *   page has no Latin chars" — important for our Arabic-only checkout
 *   summary screens where Geist would otherwise be a wasted download.
 *
 * - size-adjust + ascent-override on Geist line up its x-height with
 *   Estedad's so mixed-script lines don't visually jump when the
 *   browser switches glyph sources. Values are derived from each
 *   font's OS/2 metrics; tuned by eye against a paragraph of
 *   alternating "السنابل · Snackly · ٢٠٢٦" runs.
 *
 * - The font files are emitted with the standard `?h=<sha>` cache
 *   buster via the {{asset}} template helper and pinned via SRI in
 *   the <link rel="stylesheet"> tag of every layout, so a tampered
 *   CDN cannot inject a swapped font payload.
 */

/* ── Estedad Variable (Arabic + Latin fallback) ────────────────── */
@font-face {
  font-family: "Estedad";
  src: url("/static/fonts/Estedad-Variable.woff2?v=8.5") format("woff2-variations"),
       url("/static/fonts/Estedad-Variable.woff2?v=8.5") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  /* Arabic + Arabic Supplement + Arabic Presentation Forms-A/B +
     standard punctuation + Persian/Urdu digits. Excludes Latin so
     this file is only fetched when a glyph in these ranges is
     requested, saving ~128 KB on Latin-only admin pages. */
  unicode-range:
    U+0600-06FF,   /* Arabic */
    U+0750-077F,   /* Arabic Supplement */
    U+08A0-08FF,   /* Arabic Extended-A */
    U+FB50-FDFF,   /* Arabic Presentation Forms-A */
    U+FE70-FEFF,   /* Arabic Presentation Forms-B */
    U+200C-200E,   /* ZWNJ, ZWJ, LTR mark */
    U+2010-2011,   /* hyphen, non-breaking hyphen */
    U+2013-2014,   /* en/em dash */
    U+2018-201F,   /* curly quotes */
    U+0020-007E;   /* basic Latin (fallback if Geist not loaded) */
}

/* ── Geist Variable (Latin + digits) ───────────────────────────── */
@font-face {
  font-family: "Geist";
  src: url("/static/fonts/Geist-Variable.woff2?v=1.7.1") format("woff2-variations"),
       url("/static/fonts/Geist-Variable.woff2?v=1.7.1") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  /* Geist's actual coverage: basic + extended Latin, currency, math,
     symbols. We intentionally omit U+0600-06FF so the browser never
     wastes a render on a missing Arabic glyph. */
  unicode-range:
    U+0000-00FF,   /* basic + Latin-1 supplement */
    U+0100-024F,   /* Latin Extended A/B */
    U+0300-036F,   /* combining diacritics */
    U+1E00-1EFF,   /* Latin Extended Additional */
    U+2000-206F,   /* general punctuation */
    U+2070-209F,   /* superscripts/subscripts */
    U+20A0-20CF,   /* currency (€ £ ₪ ₺ ﷼ ج.م د.إ symbols) */
    U+2122,        /* ™ */
    U+2190-21FF,   /* arrows */
    U+2200-22FF,   /* math operators */
    U+25A0-25FF,   /* geometric shapes */
    U+2600-26FF,   /* misc symbols */
    U+FB00-FB04;   /* Latin ligatures (ﬁ ﬂ etc.) */
  /* Metric overrides so Geist x-height matches Estedad. Without
     these, switching between Latin and Arabic on the same line jumps
     the baseline. Values measured from each font's OS/2 / hhea tables
     (Geist OS/2 typoAscender 1024 / unitsPerEm 1000; Estedad 2000 /
     2048 ≈ 0.976). The ratio applied here aligns visual cap-height
     across the two scripts on a 16 px paragraph. */
  size-adjust: 100%;
  ascent-override: 95%;
  descent-override: 24%;
  line-gap-override: 0%;
}
