/* Poppins Font - Enhanced with better fallbacks and loading optimization */

/* Preload hint for better performance - add this to HTML head if possible:
<link rel="preload" href="static/fonts/Poppins-Regular.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="static/fonts/Poppins-Medium.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="static/fonts/Poppins-SemiBold.woff2" as="font" type="font/woff2" crossorigin>
*/

/* Google Fonts fallback - loads first for immediate text display */
@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;1,400&display=swap');

/* Local font definitions - will override Google Fonts when available */
@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 400;
    font-display: swap; /* Ensures text is visible during font load */
    src: url('../fonts/Poppins-Regular.woff2') format('woff2'),
         url('../fonts/Poppins-Regular.woff') format('woff'),
         url('../fonts/Poppins-Regular.ttf') format('truetype');
    /* Unicode range for Latin characters */
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/Poppins-Medium.woff2') format('woff2'),
         url('../fonts/Poppins-Medium.woff') format('woff'),
         url('../fonts/Poppins-Medium.ttf') format('truetype');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/Poppins-SemiBold.woff2') format('woff2'),
         url('../fonts/Poppins-SemiBold.woff') format('woff'),
         url('../fonts/Poppins-SemiBold.ttf') format('truetype');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Poppins';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/Poppins-Italic.woff2') format('woff2'),
         url('../fonts/Poppins-Italic.woff') format('woff'),
         url('../fonts/Poppins-Italic.ttf') format('truetype');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Font loading optimization */
.font-loading {
    /* Hide text until font loads to prevent flash of unstyled text */
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
}

/* Enhanced font stack with better fallbacks */
:root {
    --font-family-primary: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
    --font-family-fallback: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
}

/* Fallback font stack for critical text (loads immediately) */
.font-critical {
    font-family: var(--font-family-fallback);
}

/* Progressive enhancement - use Poppins when loaded */
.fonts-loaded {
    font-family: var(--font-family-primary);
}

/* Performance optimization for font rendering */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Font loading detection script - add to HTML if needed:
<script>
// Detect when fonts are loaded and add class
if ('fonts' in document) {
    document.fonts.ready.then(function() {
        document.documentElement.classList.add('fonts-loaded');
    });
} else {
    // Fallback for older browsers
    setTimeout(function() {
        document.documentElement.classList.add('fonts-loaded');
    }, 3000);
}
</script>
*/

/* Print optimization */
@media print {
    * {
        font-family: var(--font-family-fallback) !important;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    @font-face {
        font-display: block; /* Don't swap fonts for users who prefer reduced motion */
    }
}