/* ============================================================================
   CoreConsept · Arabic (RTL) corrections
   Loaded only when TRANSLATIONS['dir'] === 'rtl' — see themes/coreconsept/layouts/head.php
   ============================================================================ */

/* ─── Design tokens, restated for Arabic ──────────────────────────────────
   The design system is well tokenised — 56 rules in cc-components.css reach the
   mono face through var(--cc-mono) rather than naming it — so the whole
   "Arabic set in a typewriter" class of defect is fixed by redefining the
   tokens once here instead of chasing every component selector.

   Custom properties inherit, so putting them on [dir="rtl"] (which is on <html>)
   reaches every element on the page. This corrects .cc-eyebrow, .cc-btn,
   .cc-nav__link, .cc-topbar, .cc-footer-stamp/-legal/-copy,
   .cc-finder__field-label, .cc-dossier and the rest in one place.

   Why each value changes:
   --cc-mono      JetBrains Mono has no Arabic glyphs. Arabic has no monospace
                  tradition either, so the mono ROLE (labels, eyebrows, stamps)
                  is carried by a clean geometric sans instead.
   --cc-tracking* Arabic is cursive: letters JOIN. Latin tracking inserts gaps
                  between strokes that must connect, so 0.18em–0.32em does real
                  damage. Set to 0; the mono role stays legible through case,
                  colour and size instead.
   --cc-fs-mono-* 9px and 10px are far below the size Arabic stays legible at —
                  Arabic needs more x-height than Latin for the same size. */
/* `html[dir="rtl"]` (0,1,1) rather than `[dir="rtl"]` (0,1,0): a plain
   attribute selector only ties with `:root`, and ties are settled by source
   order — which any later inline <style> block would win. */
html[dir="rtl"] {
    --cc-mono: 'Tajawal', 'Geeza Pro', 'Segoe UI', sans-serif;
    /* Fraunces has no Arabic glyphs, so every Arabic heading and the masthead
       fell back to the OS serif — the same undefined-typography problem as the
       body text, just at display size. */
    --cc-display: 'Tajawal', 'Geeza Pro', Georgia, serif;
    --cc-tracking-mono:    0;
    --cc-tracking-eyebrow: 0;
    --cc-tracking-stamp:   0;
    --cc-fs-mono-sm: 12px;
    --cc-fs-mono-xs: 12px;
    --cc-fs-eyebrow: 13px;
}

/* The eyebrow and the legacy buttons are also declared with literal values in
   head.php's inline <style>, which is emitted AFTER this sheet and so wins on
   source order — the tokens above cannot reach them. `!important` is the only
   lever here, and it is scoped to Arabic so the Latin sites keep the intended
   tracked-uppercase editorial look exactly as designed.
   `text-transform: uppercase` is a no-op on Arabic; dropping it costs nothing
   and stops the rule leaking into any Latin fragment inside an Arabic label. */
html[dir="rtl"] .cc-eyebrow,
html[dir="rtl"] .cc-eyebrow *,
html[dir="rtl"] .cc-mono,
html[dir="rtl"] .cc-btn,
html[dir="rtl"] a.cc-btn,
html[dir="rtl"] button.cc-btn,
html[dir="rtl"] .cc-nav__link,
html[dir="rtl"] .cc-topbar,
html[dir="rtl"] .cc-topbar__brand,
html[dir="rtl"] .cc-issue-mark__brand,
html[dir="rtl"] .cc-footer-stamp,
html[dir="rtl"] .cc-footer-legal,
html[dir="rtl"] .cc-footer-copy,
html[dir="rtl"] .cc-finder__field-label,
html[dir="rtl"] .btn,
html[dir="rtl"] .agile-blue-color {
    letter-spacing: 0 !important;
    text-transform: none !important;
}

/* The legacy course/event pages restate the mono face and its tracking as
   literals inside a page-level <style>, e.g.
     .courses-page .btn-main, .courses-page .btn-main-2 {
         font-family: "JetBrains Mono", monospace !important; letter-spacing: 0.18em !important }
     .courses-page h4.agile-blue-color { letter-spacing: 0.22em !important }
   Those are (0,2,0) and (0,2,1) with !important and are emitted after this
   sheet, so they win on source order at equal specificity. Matching them with
   an extra element step puts the Arabic correction back on top. */
html[dir="rtl"] .courses-page .btn,
html[dir="rtl"] .courses-page .btn-main,
html[dir="rtl"] .courses-page .btn-main-2,
html[dir="rtl"] .courses-page h4.agile-blue-color {
    font-family: var(--cc-mono) !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    font-size: 13px !important;
}
/* .categroy-title is a heading, not a label — it keeps its display size and
   only loses the Latin tracking. */
html[dir="rtl"] .courses-page .categroy-title {
    letter-spacing: 0 !important;
    text-transform: none !important;
}
/* head.php pins the eyebrow at 11px and the finder label at 9px. */
[dir="rtl"] .cc-eyebrow          { font-size: 13px !important; }
[dir="rtl"] .cc-finder__field-label { font-size: 12px !important; }
[dir="rtl"] .cc-footer-stamp,
[dir="rtl"] .cc-footer-legal,
[dir="rtl"] .cc-footer-copy      { font-size: 12px !important; }
[dir="rtl"] .btn                 { font-size: 13px !important; }

/* ─── Faux-italic Arabic ──────────────────────────────────────────────────
   Arabic script has no italic tradition, and the display face (Fraunces)
   carries no Arabic glyphs — verified: 'الممارسين' measures identically in
   Fraunces and in generic serif, i.e. the browser falls back and then
   SYNTHESISES an oblique. Slanted Arabic reads as broken to a native reader.

   Emphasis is already carried by the accent colour, so the slant is dropped
   and a little extra weight restores the contrast it was providing.
   Latin runs inside the same elements keep their real italic, because the
   rule is applied to the Arabic-bearing element, not to :lang(en) children. */
[dir="rtl"] .cc-home-hero__title em,
[dir="rtl"] .cc-hero__title em,
[dir="rtl"] .cc-statement,
[dir="rtl"] .cc-pullquote__quote,
[dir="rtl"] .cc-footer-issue {
    font-style: normal;
}

[dir="rtl"] .cc-home-hero__title em,
[dir="rtl"] .cc-hero__title em {
    /* Fraunces italic was doing the emphasis; without the slant the accent
       colour alone is a little weak at display size. */
    font-weight: 600;
}

[dir="rtl"] .cc-statement,
[dir="rtl"] .cc-pullquote__quote {
    /* A quoted passage loses its "voice" without the slant — give it the
       traditional Arabic device instead: a heavier weight and a rule. */
    font-weight: 500;
}

/* ─── Latin fragments inside Arabic text ──────────────────────────────────
   Course codes, "PRINCE2", dates and the masthead volume mark stay Latin.
   Forcing LTR on them stops bidi dragging trailing punctuation to the wrong
   end (the reason the English hero previously rendered as ".senior
   practitioners").

   NOTE: no `display: inline-block` here. `unicode-bidi: isolate` works on
   inline elements as-is, and forcing inline-block broke the top-bar email,
   which is a flex row — the envelope icon dropped onto its own line. */
[dir="rtl"] .cc-issue-mark__date,
[dir="rtl"] .cc-topbar__email,
[dir="rtl"] .phone,
[dir="rtl"] code,
[dir="rtl"] .cc-mono {
    direction: ltr;
    unicode-bidi: isolate;
}

/* ─── Form field labels ───────────────────────────────────────────────────
   The editorial label style (coreconsept-static.css `.cc-form label`) is Latin
   typography: 10px JetBrains Mono, 0.22em tracking, uppercase. Every part of
   that is wrong for Arabic.

   JetBrains Mono carries no Arabic glyphs — verified the same way as the
   Fraunces faux-italic: "الإسم" measures 24px in JetBrains Mono and 24px in
   generic monospace, i.e. the browser is already falling back. `uppercase` is
   a no-op on Arabic. And the tracking is the real damage: Arabic is cursive,
   so 0.22em inserted between every pair of letters pulls apart strokes that
   are meant to JOIN. At 10px the result is below the size Arabic stays legible
   at anyway.

   The label keeps its job — small, muted, sitting above the field — in the
   face the rest of the Arabic page is set in. Latin labels are untouched: this
   sheet only loads on the Arabic domains.

   The :not() pair keeps this off the consent row, which is also a <label> but
   is body copy and is styled by .cc-form-terms in cc-components.css. */
[dir="rtl"] .cc-form label:not(.cc-form-terms):not(.cc-reg-terms),
[dir="rtl"] .cc-form .field-label {
    font-family: 'Lora', 'Tajawal', Georgia, serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}
