/* AlMaha — bilingual (EN/AR) integrity rules
   HARD RULE: NEVER letter-space Arabic. Use kashida (ـ, U+0640) for emphasis.
   Lifted verbatim from the original head.ejs <style> block, with new
   RTL component cleanup added below. */

/* Arabic never carries letter-spacing or word-spacing modifications. */
:lang(ar),
[lang="ar"],
[dir="rtl"] *,
.ar {
  letter-spacing: 0 !important;
  word-spacing: normal !important;
}
html[lang="ar"] * { letter-spacing: 0 !important; }

/* Eyebrow — Latin-only by design. Use .eyebrow-ar for AR. */
.eyebrow-ar {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0 !important;
}
html[lang="ar"] .eyebrow {
  text-transform: none;
  letter-spacing: 0 !important;
  font-size: 0.78rem;
}

/* Kashida (ـ) justification — enable tatweel justification for AR text where
   stretch is wanted. Use .kashida-justify on the parent, NOT letter-spacing. */
.kashida-justify {
  text-align: justify;
  text-align-last: justify;
  font-feature-settings: "kshd" 1, "calt" 1;
}
html[lang="ar"] .kashida-justify {
  word-spacing: 0 !important;
  letter-spacing: 0 !important;
}

/* Bilingual width-match — when an Arabic + Latin lockup is stacked, the AR row
   stretches via kashida to match Latin row width. Apply .wm-pair on parent,
   .wm-latin on EN row, .wm-arabic on AR row. */
.wm-pair {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
}
.wm-pair .wm-latin { display: block; }
.wm-pair .wm-arabic {
  display: block;
  text-align: justify;
  text-align-last: justify;
  font-feature-settings: "kshd" 1, "calt" 1;
  letter-spacing: 0 !important;
  word-spacing: 0 !important;
}
[dir="rtl"] .wm-pair { align-items: stretch; }

/* RTL component cleanup — mirror the new geometry primitives correctly */
[dir="rtl"] .frame { /* brackets are symmetric — nothing to flip */ }
[dir="rtl"] .link-grow::after { transform-origin: inline-end; }
[dir="rtl"] .with-rail > .rail { /* sticky stays; CSS Grid handles direction */ }
[dir="rtl"] .spec-grid > dt,
[dir="rtl"] .spec-grid > .label { text-align: right; }
[dir="rtl"] .spec-grid > dd,
[dir="rtl"] .spec-grid > .value { text-align: right; }

/* Inline numerals inside RTL text — keep LTR ordering for years, coords, ASTM */
[dir="rtl"] .ltr-num,
[dir="rtl"] .num,
[dir="rtl"] [data-num] {
  direction: ltr;
  unicode-bidi: isolate;
}

/* Arabic block paragraphs read better with relaxed leading */
:lang(ar) p,
[dir="rtl"] p {
  line-height: 1.85;
}
:lang(ar) h1,
:lang(ar) h2,
:lang(ar) h3,
[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3 {
  line-height: 1.35;
}
