/*=============== ENCODING & FONT FIX ===============*/

/* Fix for UTF-8 encoding issues and font rendering */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Ensure proper UTF-8 character rendering */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: 'Cairo', 'Noto Sans', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
    font-feature-settings: "kern" 1, "liga" 1;
    -webkit-font-feature-settings: "kern" 1, "liga" 1;
    -moz-font-feature-settings: "kern" 1, "liga" 1;
}

/* Fix for mixed Arabic-English text */
.mixed-text,
.home__description,
.project-card__description,
.news-slide__description,
p, span, div {
    font-family: 'Cairo', 'Noto Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    unicode-bidi: plaintext;
    /*text-align: start;*/
}
.stats-section__description {
    text-align: center !important;
}
/* Specific fix for problematic characters */
.encoding-fix {
    font-family: 'Cairo', 'Noto Sans', 'Arial Unicode MS', sans-serif !important;
    font-weight: 400;
    line-height: 1.6;
    letter-spacing: 0.01em;
}

/* Fix for em dash and special characters */
.text-content {
    font-variant-ligatures: none;
    -webkit-font-variant-ligatures: none;
    -moz-font-variant-ligatures: none;
}

/* Ensure proper rendering of Arabic and English together */
[lang="ar"], .arabic-text {
    font-family: 'Cairo', 'Noto Sans Arabic', 'Arial Unicode MS', sans-serif;
    direction: rtl;
    text-align: right;
}

[lang="en"], .english-text {
    font-family: 'Noto Sans', 'Cairo', 'Segoe UI', sans-serif;
    direction: ltr;
    text-align: left;
}

/* Fix for typing animation text */
.typing-text {
    font-family: 'Cairo', 'Noto Sans', monospace, sans-serif;
    font-weight: 500;
    white-space: nowrap;
}

/* Fix for navigation and UI elements */
.nav__menu,
.nav__link,
.button,
.section__title,
.section__subtitle {
    font-family: 'Cairo', 'Noto Sans', sans-serif;
    font-weight: 500;
}

/* Fallback for unsupported characters */
@supports not (font-feature-settings: "kern") {
    body {
        font-family: 'Arial Unicode MS', Arial, sans-serif;
    }
}

/* Media queries for better font rendering on different devices */
@media screen and (max-width: 768px) {
    body {
        -webkit-text-size-adjust: none;
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body {
        -webkit-font-smoothing: subpixel-antialiased;
    }
}

/* Fix for specific problematic text areas */
.home__description,
.project-card__description,
.news-slide__description {
    font-family: 'Cairo', 'Noto Sans', 'Segoe UI', sans-serif !important;
    font-weight: 400;
    line-height: 1.7;
   
    text-rendering: optimizeLegibility;
}

/* Ensure em dashes render correctly */
.dash-fix::before {
    content: "—";
    font-family: 'Noto Sans', 'Segoe UI', monospace;
}

/* Hide broken characters and replace with proper ones */
.text-content {
    font-variant-numeric: normal;
    font-variant-east-asian: normal;
}

/* Force UTF-8 rendering */
.utf8-fix {
    font-family: 'Cairo', 'Noto Sans', 'Arial Unicode MS', 'Lucida Sans Unicode', sans-serif;
    unicode-bidi: embed;
}