/* Safari Font Detection and Fallback */

/* Test if Montserrat is available */
@supports (-webkit-touch-callout: none) {
    /* Safari-specific font detection */
    .font-test {
        font-family: 'Montserrat', monospace;
        visibility: hidden;
        position: absolute;
        top: -9999px;
        left: -9999px;
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    
    /* If Montserrat is not available, use system fonts */
    body:not(.fonts-loaded) {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif !important;
    }
    
    /* Force system fonts if local fonts fail */
    .fonts-failed body {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif !important;
    }
    
    /* Ensure Google Fonts work as fallback */
    .fonts-failed .navbar-toggler,
    .fonts-failed .nav-link,
    .fonts-failed .section-header,
    .fonts-failed .section-text,
    .fonts-failed .impressum-title,
    .fonts-failed .impressum-section h2,
    .fonts-failed .impressum-section h3 {
        font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    }
}

/* Safari font rendering fixes */
@supports (-webkit-touch-callout: none) {
    /* Prevent font flickering */
    * {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    /* Fix for Safari font loading issues */
    .navbar-toggler,
    .nav-link,
    .section-header,
    .section-text,
    .impressum-title,
    .impressum-section h2,
    .impressum-section h3 {
        font-display: swap;
    }
    
    /* Ensure proper font loading in Safari */
    @media screen and (-webkit-min-device-pixel-ratio: 0) {
        body {
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            text-rendering: optimizeLegibility;
        }
    }
} 