/* =========================================================
   عيادات د. إيمان العبرة — نظام الخطوط
   Zain      → العناوين (Display)  | OFL
   IBM Plex Sans Arabic → المتن (Body) | OFL
   Source Serif 4      → اللاتيني     | OFL
   كل الملفات self-hosted، subset عربي/لاتيني، woff2.
   ========================================================= */

/* ---------- Zain — Display ---------- */
@font-face {
  font-family: 'Zain';
  src: url('../fonts/Zain-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Zain';
  src: url('../fonts/Zain-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Zain';
  src: url('../fonts/Zain-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Zain';
  src: url('../fonts/Zain-Black.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- IBM Plex Sans Arabic — Body ---------- */
@font-face {
  font-family: 'Plex Arabic';
  src: url('../fonts/IBMPlexSansArabic-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Plex Arabic';
  src: url('../fonts/IBMPlexSansArabic-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Plex Arabic';
  src: url('../fonts/IBMPlexSansArabic-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Plex Arabic';
  src: url('../fonts/IBMPlexSansArabic-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Source Serif 4 — Latin (variable 200–900) ---------- */
@font-face {
  font-family: 'Source Serif 4';
  src: url('../fonts/SourceSerif4-Variable.woff2') format('woff2-variations');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

/* =========================================================
   Tokens
   ========================================================= */
:root {
  --font-display: 'Zain', 'Plex Arabic', system-ui, sans-serif;
  --font-body: 'Plex Arabic', 'Zain', system-ui, sans-serif;
  --font-latin: 'Source Serif 4', Georgia, serif;

  /* مقياس مبني على clamp — يتمدد بين الموبايل والديسكتوب */
  --step--1: clamp(0.83rem, 0.79rem + 0.18vw, 0.94rem);
  --step-0: clamp(1rem, 0.95rem + 0.24vw, 1.13rem);
  --step-1: clamp(1.2rem, 1.11rem + 0.43vw, 1.44rem);
  --step-2: clamp(1.44rem, 1.3rem + 0.7vw, 1.84rem);
  --step-3: clamp(1.73rem, 1.51rem + 1.09vw, 2.35rem);
  --step-4: clamp(2.07rem, 1.75rem + 1.62vw, 3rem);
  --step-5: clamp(2.49rem, 2.01rem + 2.36vw, 3.82rem);
  --step-6: clamp(2.99rem, 2.31rem + 3.38vw, 4.88rem);

  /* ارتفاع السطر أعلى للعربي — لا تنزل تحت 1.75 في المتن */
  --lh-tight: 1.15;
  --lh-heading: 1.3;
  --lh-body: 1.8;
}

/* =========================================================
   Base — RTL
   ========================================================= */
html[lang='ar'] {
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: var(--lh-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: var(--lh-heading);
  font-weight: 700;
  /* Zain عريض بطبعه — لا تضف letter-spacing سالب على العربي */
  letter-spacing: 0;
}

h1 { font-size: var(--step-5); line-height: var(--lh-tight); }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

/* الأرقام والكلمات اللاتينية جوه نص عربي */
.latin,
[lang='en'] {
  font-family: var(--font-latin);
  font-feature-settings: 'lnum' 1;
}

/* الأرقام في الواجهة: عربية شرقية أو لاتينية — اختر واحدة والتزم بها */
.num {
  font-family: var(--font-latin);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
}
