/* ============================================================
   BMB — Arabic typography
   Loaded only on /ar/ pages. Overrides the Latin stacks
   (Archivo / Sora / JetBrains Mono) with Arabic faces that
   actually have Arabic glyphs, so text stops falling back to
   the browser's default serif.
   Body: IBM Plex Sans Arabic  ·  Display: Cairo
   ============================================================ */

:root{
  --ar-body:'IBM Plex Sans Arabic','Segoe UI',Tahoma,sans-serif;
  --ar-display:'Cairo','IBM Plex Sans Arabic','Segoe UI',Tahoma,sans-serif;
}

/* --- body copy ------------------------------------------------ */
html[lang="ar"] body,
html[lang="ar"] .bmb-root,
[dir="rtl"] .bmb-root{
  font-family:var(--ar-body);
  /* Arabic has no capitals and a smaller x-height presence: nudge up */
  font-size:16.5px;
  line-height:1.95;
  letter-spacing:0;               /* Latin tracking hurts Arabic joins */
  -webkit-font-smoothing:antialiased;
}

[dir="rtl"] .bmb-root :where(p,li,dd,blockquote,.lead,.copy,figcaption){
  font-family:var(--ar-body);
  line-height:2.0;
  letter-spacing:0;
  word-spacing:.02em;
}

/* --- headings / display --------------------------------------- */
[dir="rtl"] .bmb-root :where(h1,h2,h3,h4,h5,h6,.hero-tagline,.sec-head,.kicker,.eyebrow,.stat .n,.brand){
  font-family:var(--ar-display);
  font-weight:700;
  letter-spacing:0;
  line-height:1.5;
}
[dir="rtl"] .bmb-root .hero-tagline{
  font-weight:900;
  line-height:1.45;
  font-size:clamp(26px,3.5vw,44px);
}
[dir="rtl"] .bmb-root :where(h1,h2){ font-weight:900; }

/* --- buttons, nav, labels ------------------------------------- */
[dir="rtl"] .bmb-root :where(a,button,.btn,.nav a,.chip,.tag,label,th,td,input,textarea,select){
  font-family:var(--ar-body);
  letter-spacing:0;
}
[dir="rtl"] .bmb-root :where(.btn,button){ font-weight:600; }

/* --- keep Latin/technical runs in a Latin face ----------------- */
/* language keys (EN RU FR AR TR), alloy codes, units, brand name */
[dir="rtl"] .langs,
[dir="rtl"] .bmb-root :where(.mono,code,kbd,.spec-code,[lang="en"]){
  font-family:'JetBrains Mono',monospace;
  letter-spacing:.06em;
}
/* mixed Arabic + Latin (e.g. "45–65 HRC", "Ø 20–40 mm") renders in logical order */
[dir="rtl"] .bmb-root :where(td,th,.spec,.n,.stat,.bm-table td,.bm-table th){
  unicode-bidi:plaintext;
}

/* --- numerals: keep Western digits, they read better with units - */
[dir="rtl"] .bmb-root{ font-variant-numeric:lining-nums; }

/* --- justification: Arabic justifies well, but avoid hyphens --- */
[dir="rtl"] .bmb-root :where(p,.lead){
  text-align:justify;
  -webkit-hyphens:none;
  hyphens:none;
}

/* --- small screens -------------------------------------------- */
@media(max-width:600px){
  html[lang="ar"] body,[dir="rtl"] .bmb-root{ font-size:16px; line-height:1.9; }
  [dir="rtl"] .bmb-root .hero-tagline{ font-size:26px; line-height:1.5; }
}
