/* ==========================================================================
   HORIZON STUDIO — Arabic typeface (خط ثمانية)

   Why this file exists: the site's whole stack was "Alliance No.2", Helvetica,
   Arial — all Latin-only faces. Arabic matched none of them, so every browser
   fell through to whatever system Arabic font it had, and the Arabic side of
   the site was set in a typeface nobody chose.

   Ported from bishernp-website/public/css/thmanyah.css, with the same fifteen
   woff2 files, byte for byte. One house typeface across the three sites.

   ── How it works ─────────────────────────────────────────────────────────
   Every face carries the same `unicode-range`, and that is the whole
   mechanism: Thmanyah claims Arabic and nothing else, so on a mixed line the
   Arabic renders in Thmanyah and the English words, Western numerals and ASCII
   punctuation render in Alliance No.2 — per character, no JavaScript, no
   wrapper spans, no page needing to declare which script it is in.

   Thmanyah does ship Latin, but its Latin is a display companion to the Arabic
   rather than a text face, and «Colossus 2» or «GB300» set in it beside the
   rest of the site looks wrong. The range simply does not claim those
   codepoints. It keeps exactly three things: every Arabic block including both
   presentation-forms blocks, the Arabic-Indic numerals ٠-٩ and Arabic
   punctuation ، ؛ ؟ ۔ which Alliance has no glyph for at all, and « » which is
   what Arabic copy actually sets its quotations in.

   ── Which family ─────────────────────────────────────────────────────────
   Horizon uses SANS. bishernp.com uses Serif Text and Serif Display, which
   suit a consultancy's editorial voice; Horizon's Latin face is Alliance No.2,
   a geometric grotesque, and the site reads as an instrument panel. Sans is
   the family that matches it. All three are declared because a face nobody
   references is never downloaded — switching is a one-line change to the
   tokens below.

   ── Cost ─────────────────────────────────────────────────────────────────
   Nothing here downloads on an English page. The browser fetches a face only
   when a character inside its unicode-range is actually painted, so /contact
   pays nothing and /ar/blog pays for the weights it uses.
   ========================================================================== */

/* ---- Thmanyah Sans — خط ثمانية الرقمي · UI, digital, interfaces ---- */
@font-face {
  font-family: "Thmanyah Sans";
  src: url("fonts/thmanyah/sans-300.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
  unicode-range:
    U+00AB, U+00BB,
    U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF,
    U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Thmanyah Sans";
  src: url("fonts/thmanyah/sans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range:
    U+00AB, U+00BB,
    U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF,
    U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Thmanyah Sans";
  src: url("fonts/thmanyah/sans-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range:
    U+00AB, U+00BB,
    U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF,
    U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Thmanyah Sans";
  src: url("fonts/thmanyah/sans-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range:
    U+00AB, U+00BB,
    U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF,
    U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Thmanyah Sans";
  src: url("fonts/thmanyah/sans-900.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
  unicode-range:
    U+00AB, U+00BB,
    U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF,
    U+FB50-FDFF, U+FE70-FEFF;
}

/* ---- Thmanyah Serif Text — خط ثمانية للنصوص · long-form body copy ---- */
@font-face {
  font-family: "Thmanyah Serif Text";
  src: url("fonts/thmanyah/serif-text-300.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
  unicode-range:
    U+00AB, U+00BB,
    U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF,
    U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Thmanyah Serif Text";
  src: url("fonts/thmanyah/serif-text-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range:
    U+00AB, U+00BB,
    U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF,
    U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Thmanyah Serif Text";
  src: url("fonts/thmanyah/serif-text-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range:
    U+00AB, U+00BB,
    U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF,
    U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Thmanyah Serif Text";
  src: url("fonts/thmanyah/serif-text-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range:
    U+00AB, U+00BB,
    U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF,
    U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Thmanyah Serif Text";
  src: url("fonts/thmanyah/serif-text-900.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
  unicode-range:
    U+00AB, U+00BB,
    U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF,
    U+FB50-FDFF, U+FE70-FEFF;
}

/* ---- Thmanyah Serif Display — خط ثمانية للعناوين · headlines, big type ---- */
@font-face {
  font-family: "Thmanyah Serif Display";
  src: url("fonts/thmanyah/serif-display-300.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
  unicode-range:
    U+00AB, U+00BB,
    U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF,
    U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Thmanyah Serif Display";
  src: url("fonts/thmanyah/serif-display-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range:
    U+00AB, U+00BB,
    U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF,
    U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Thmanyah Serif Display";
  src: url("fonts/thmanyah/serif-display-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range:
    U+00AB, U+00BB,
    U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF,
    U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Thmanyah Serif Display";
  src: url("fonts/thmanyah/serif-display-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range:
    U+00AB, U+00BB,
    U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF,
    U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Thmanyah Serif Display";
  src: url("fonts/thmanyah/serif-display-900.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
  unicode-range:
    U+00AB, U+00BB,
    U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF,
    U+FB50-FDFF, U+FE70-FEFF;
}
/* ---- The stacks -----------------------------------------------------------
   Redefined here rather than in handoff/globals.css or the _ds tokens, because
   both of those are design-tool exports and a re-export would silently drop
   the Arabic again. This file is ours and survives.

   Alliance No.2 stays FIRST in every stack. It has no Arabic glyphs, so the
   browser falls through to Thmanyah for Arabic on its own, and the
   unicode-range above guarantees the reverse can never happen — Thmanyah's own
   Latin is never used for a Latin character. Both halves point the same way,
   which is why no element has to know which script it holds.

   There is no 600 in this family. The site sets 400 and 500, which exist. */
:root {
  --font-thmanyah-sans: "Thmanyah Sans";
  --font-thmanyah-text: "Thmanyah Serif Text";
  --font-thmanyah-display: "Thmanyah Serif Display";

  --font-display: "Alliance No.2", var(--font-thmanyah-sans), "Neue Haas Grotesk Display Pro", "Geist Sans", Helvetica, Arial, sans-serif;
  --font-sans: var(--font-display);
  /* The mono face carries the eyebrows, labels and the instrument bar. Arabic
     lands there too — «مقالات», a date, a reference — and Geist Mono has no
     Arabic, so without this those few words fall back to the system again. */
  --font-mono: "Geist Mono", var(--font-thmanyah-sans), ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---- Letter-spacing -------------------------------------------------------
   Arabic is a joined script, and tracking is measured for a script that is not.
   The design sets letter-spacing inline almost everywhere: negative on display
   type, which at the hero's 180px comes to −8px and crowds Arabic letterforms
   into each other, and +0.14em on the mono labels, which pushes apart letters
   that are meant to be joined. Neither is a bug in the Arabic — the shaping is
   correct either way — but both are values chosen against Alliance No.2's Latin
   and wrong for Thmanyah's Arabic.

   !important because every one of those declarations is a style attribute, and
   nothing in a stylesheet beats an inline style otherwise.

   This also removes the 0.14em tracking from the handful of genuinely Latin
   strings that remain on an Arabic page — AMOS, Sovereign Warden, the ENG- and
   SYS- codes. Losing their tracking is a small loss of texture; leaving Arabic
   words broken is not a trade worth making for it. */
[dir="rtl"] [data-hz-root] *,
:root:lang(ar) [data-hz-root] * {
  letter-spacing: normal !important;
}

/* An Arabic page reads better with a touch more line height: the script has
   taller ascenders and deeper descenders than Latin at the same size, and the
   design's tight leading was measured against Alliance No.2. */
:root:lang(ar) [data-hz-root],
[dir="rtl"] [data-hz-root] {
  --lh-prose: 1.8;
}

/* ---- Kashida: swash finals and the kaf alternate --------------------------
   Thmanyah stretches Arabic two independent ways.

   SWASH FINALS (`swsh`) swap the isolated and final form of fifteen letters —
   ب ت ث س ش ص ض ف ق ك م ن ي ى ئ — for a long swept tail. Initial and medial
   forms are untouched, so it can only ever reach the last letter of a word,
   which is exactly the rule the foundry's guide states. Display type only: a
   swash on every word of a paragraph is noise, not calligraphy.

   THE KAF ALTERNATE (`salt`) is the one letter in this family carrying initial
   and medial alternates, which is why the feature does anything at all on a
   run that does not end in a swash letter. It is opt-in per element, because
   on a long run salt also swashes every word-final letter in the list above.

   TATWEEL is the third mechanism and it is not here: it is literal U+0640 in
   the copy, inserted by scripts/lib/kashida.mjs at build time, because the
   font draws it through its required-ligature table rather than a CSS feature.

   The foundry's rules, which the build follows: never on two adjacent words,
   at most one per sentence, never inside long body copy. */
/* Scoped by SIZE, not by tag. `h3` is the display heading of a section on one
   page and the title of a registry card on another, and the design tells them
   apart by which size token the inline style uses, not by the element. Keyed
   on h1/h2/h3 the swash reached all fifty-one cards on the command page, where
   a swept tail on every job title at 21px reads as a rendering fault rather
   than as calligraphy. The display register starts at --fs-h2, 44px. */
[dir="rtl"] [data-hz-root] [style*="var(--fs-display-xl)"],
[dir="rtl"] [data-hz-root] [style*="var(--fs-display-lg)"],
[dir="rtl"] [data-hz-root] [style*="var(--fs-h1)"],
[dir="rtl"] [data-hz-root] [style*="var(--fs-h2)"],
:root:lang(ar) [data-hz-root] [style*="var(--fs-display-xl)"],
:root:lang(ar) [data-hz-root] [style*="var(--fs-display-lg)"],
:root:lang(ar) [data-hz-root] [style*="var(--fs-h1)"],
:root:lang(ar) [data-hz-root] [style*="var(--fs-h2)"] {
  font-feature-settings: "swsh" 1;
}

/* And off again below that, because the feature inherits: a card title is a
   child of nothing that sets it, but a small label inside a display heading
   would otherwise keep the swash its parent turned on. */
[dir="rtl"] [data-hz-root] [style*="var(--fs-h3)"],
[dir="rtl"] [data-hz-root] [style*="var(--fs-body)"],
[dir="rtl"] [data-hz-root] [style*="var(--fs-label)"],
:root:lang(ar) [data-hz-root] [style*="var(--fs-h3)"],
:root:lang(ar) [data-hz-root] [style*="var(--fs-body)"],
:root:lang(ar) [data-hz-root] [style*="var(--fs-label)"] {
  font-feature-settings: normal;
}

/* Opt one run in or out, on top of the rule above. */
[dir="rtl"] .kashida,      :root:lang(ar) .kashida      { font-feature-settings: "swsh" 1; }
[dir="rtl"] .kashida-none, :root:lang(ar) .kashida-none { font-feature-settings: normal; }

/* The brand mark and any run that should carry the kaf alternate. */
[dir="rtl"] .salt-ar,  :root:lang(ar) .salt-ar,
[dir="rtl"] .brand-ar, :root:lang(ar) .brand-ar { font-feature-settings: "salt" 1; }

/* ─── LEADING ───────────────────────────────────────────────────────────────
   Arabic needs more room between lines than this design gives English, and it
   is not a matter of taste. A Latin display line set at line-height 0.88 has
   almost nothing above the cap or below the baseline, so the lines can nearly
   touch and the stack reads as one block — which is the look. Arabic ink
   reaches about 0.9em above the baseline and 0.4em below it, so at 0.88 the
   two lines of a split heading occupy the same space: ما الذي / نبنيه. had the
   tail of ي running straight through the line beneath it.

   1.7 for body is the firm's value, already in use on the Hoquqi site's
   Arabic. Headings start from its 1.25 and go a little past it, to 1.30,
   because Horizon sets display type two or three times larger than Hoquqi's
   headings ever reach, and at 106px a pair like نبني over بالفعل puts the
   deepest descender in the face directly above a full-height stack. Measured
   at 1.25 that pair still touched by two pixels; every pair on the site clears
   at 1.30. The number is the smallest round one that does.

   `!important` because every one of these line-heights is an inline style
   written by the design tool, and a re-export would otherwise undo this.

   Scoped to the heading's own lines rather than to every element: the footer
   wordmark and the instrument bar measure their own masks from line-height,
   and loosening theirs would move chrome that is correct as it stands. */
[dir="rtl"] [data-hz-root] h1,
[dir="rtl"] [data-hz-root] h2,
[dir="rtl"] [data-hz-root] h3,
[dir="rtl"] [data-hz-root] [data-hz="masklines"],
[dir="rtl"] [data-hz-root] [data-hz-line],
:root:lang(ar) [data-hz-root] h1,
:root:lang(ar) [data-hz-root] h2,
:root:lang(ar) [data-hz-root] h3,
:root:lang(ar) [data-hz-root] [data-hz="masklines"],
:root:lang(ar) [data-hz-root] [data-hz-line] {
  line-height: 1.3 !important;
}

[dir="rtl"] [data-hz-root] p,
[dir="rtl"] [data-hz-root] li,
:root:lang(ar) [data-hz-root] p,
:root:lang(ar) [data-hz-root] li {
  line-height: 1.7 !important;
}
