/* Mobile Font Loading Fixes */

/* Force font loading on mobile */
@media screen and (max-width: 768px) {
    /* Preload fonts for mobile */
    body::before {
        content: '';
        font-family: 'IRANSans', 'IRANSansWeb(FaNum)', Tahoma, Arial, sans-serif;
        position: absolute;
        left: -9999px;
        visibility: hidden;
    }
    
    /* Ensure font rendering on mobile */
    body, input, select, textarea, p, div, span, li, h1, h2, h3, h4, h5, h6 {
        font-family: 'IRANSans', 'IRANSansWeb(FaNum)', Tahoma, Arial, sans-serif !important;
        text-rendering: optimizeLegibility !important;
        -webkit-font-smoothing: antialiased !important;
        -moz-osx-font-smoothing: grayscale !important;
        font-display: swap !important;
    }
    
    /* Specific fixes for Persian text */
    [dir="rtl"], [style*="text-align: right"], [style*="direction: rtl"] {
        font-family: 'IRANSans', 'IRANSansWeb(FaNum)', Tahoma, Arial, sans-serif !important;
    }
    
    /* Fix for navigation */
    nav ul li a {
        font-family: 'IRANSans', 'IRANSansWeb(FaNum)', Tahoma, Arial, sans-serif !important;
    }
    
    /* Fix for headings */
    .major, h1, h2, h3 {
        font-family: 'IRANSans', 'IRANSansWeb(FaNum)', Tahoma, Arial, sans-serif !important;
    }
}

/* Additional mobile optimizations */
@media screen and (max-width: 480px) {
    /* Force font loading for small screens */
    * {
        font-family: 'IRANSans', 'IRANSansWeb(FaNum)', Tahoma, Arial, sans-serif !important;
    }
    
    /* Improve text readability on small screens */
    body {
        font-size: 16px !important;
        line-height: 1.6 !important;
    }
    
    /* Better heading display */
    h1 { font-size: 1.8em !important; }
    h2 { font-size: 1.5em !important; }
    h3 { font-size: 1.3em !important; }
}

/* Font loading animation for better UX */
@keyframes fontLoad {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* Apply animation to text elements */
body.loaded * {
    animation: fontLoad 0.3s ease-in-out;
}
