/*!
 * MED Theme — Self-hosted Typography
 * IBM Plex Sans (Latin) + IBM Plex Sans Arabic (Arabic)
 * Licence: SIL Open Font License 1.1
 * Author: QB Studio
 * Version: 1.0.0
 *
 * The Arabic faces are declared twice:
 *   1) under "IBM Plex Sans" with an Arabic unicode-range, so mixed
 *      English/Arabic text renders correctly from a single family name;
 *   2) under "IBM Plex Sans Arabic" for explicit use in Elementor.
 * ------------------------------------------------------------------ */

/* =========================================================
   1. Latin faces — IBM Plex Sans
   ========================================================= */
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-sans/IBMPlexSans-Thin.woff2") format("woff2");
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-sans/IBMPlexSans-ThinItalic.woff2") format("woff2");
  font-weight: 100;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-sans/IBMPlexSans-ExtraLight.woff2") format("woff2");
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-sans/IBMPlexSans-ExtraLightItalic.woff2") format("woff2");
  font-weight: 200;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-sans/IBMPlexSans-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-sans/IBMPlexSans-LightItalic.woff2") format("woff2");
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-sans/IBMPlexSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-sans/IBMPlexSans-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-sans/IBMPlexSans-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-sans/IBMPlexSans-MediumItalic.woff2") format("woff2");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-sans/IBMPlexSans-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-sans/IBMPlexSans-SemiBoldItalic.woff2") format("woff2");
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-sans/IBMPlexSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-sans/IBMPlexSans-BoldItalic.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

/* =========================================================
   2. Arabic faces — mapped onto "IBM Plex Sans" via unicode-range
   ========================================================= */
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-arabic/IBMPlexSansArabic-Thin.woff2") format("woff2");
  font-weight: 100;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1,
    U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41,
    U+FB50-FDFF, U+FE70-FEFF, U+FBB2-FBC1;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-arabic/IBMPlexSansArabic-ExtraLight.woff2") format("woff2");
  font-weight: 200;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1,
    U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41,
    U+FB50-FDFF, U+FE70-FEFF, U+FBB2-FBC1;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-arabic/IBMPlexSansArabic-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1,
    U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41,
    U+FB50-FDFF, U+FE70-FEFF, U+FBB2-FBC1;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-arabic/IBMPlexSansArabic-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1,
    U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41,
    U+FB50-FDFF, U+FE70-FEFF, U+FBB2-FBC1;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-arabic/IBMPlexSansArabic-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1,
    U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41,
    U+FB50-FDFF, U+FE70-FEFF, U+FBB2-FBC1;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-arabic/IBMPlexSansArabic-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1,
    U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41,
    U+FB50-FDFF, U+FE70-FEFF, U+FBB2-FBC1;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-arabic/IBMPlexSansArabic-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1,
    U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41,
    U+FB50-FDFF, U+FE70-FEFF, U+FBB2-FBC1;
}

/* =========================================================
   3. Arabic faces — standalone family name
   ========================================================= */
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("../fonts/plex-arabic/IBMPlexSansArabic-Thin.woff2") format("woff2");
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("../fonts/plex-arabic/IBMPlexSansArabic-ExtraLight.woff2") format("woff2");
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("../fonts/plex-arabic/IBMPlexSansArabic-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("../fonts/plex-arabic/IBMPlexSansArabic-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("../fonts/plex-arabic/IBMPlexSansArabic-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("../fonts/plex-arabic/IBMPlexSansArabic-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("../fonts/plex-arabic/IBMPlexSansArabic-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* =========================================================
   4. Tokens
   ========================================================= */
:root {
  --med-font-sans: "IBM Plex Sans", "IBM Plex Sans Arabic",
                   -apple-system, BlinkMacSystemFont, "Segoe UI",
                   Helvetica, Arial, sans-serif;
  --med-font-arabic: "IBM Plex Sans Arabic", "IBM Plex Sans",
                     -apple-system, BlinkMacSystemFont, Tahoma, Arial, sans-serif;
  --med-font-heading: var(--med-font-sans);
  --med-font-body: var(--med-font-sans);
}

/* =========================================================
   5. Base application (low specificity — themeable)
   ========================================================= */
html,
body {
  font-family: var(--med-font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
}

:where(h1, h2, h3, h4, h5, h6) {
  font-family: var(--med-font-heading);
}

/* Form controls do not inherit by default */
:where(button, input, optgroup, select, textarea) {
  font-family: inherit;
}

/* =========================================================
   6. RTL / Arabic refinements
   ========================================================= */
:where([lang|="ar"], .rtl, [dir="rtl"]) body,
body:where(.rtl) {
  font-family: var(--med-font-arabic);
}

:where(.rtl, [dir="rtl"]) {
  letter-spacing: 0; /* Arabic must never be letter-spaced */
}

:where(.rtl, [dir="rtl"]) :where(p, li, dd, blockquote) {
  line-height: 1.9;
}

:where(.rtl, [dir="rtl"]) :where(h1, h2, h3, h4, h5, h6) {
  line-height: 1.45;
}

/* Latin numerals inside Arabic copy stay in Plex Sans */
:where(.rtl, [dir="rtl"]) :where(.med-num, time, .elementor-counter-number) {
  font-family: "IBM Plex Sans", var(--med-font-sans);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
}
