/* Typography and Heading Optimization for SEO */

/* Improved font loading with fallbacks */
body {
    font-family: 'Roboto', 'OpenSans', 'Helvetica', Arial, sans-serif;
    font-display: swap;
    line-height: 1.6;
}

/* Heading hierarchy optimization */
h1 {
    font-family: 'Roboto-Bold', 'OpenSans-Bold', 'Roboto', sans-serif;
    font-weight: 700;
    font-size: 2.5rem;
    line-height: 1.2;
    margin: 0 0 1rem 0;
    color: #333;
}

h2 {
    font-family: 'Roboto-Bold', 'OpenSans-Bold', 'Roboto', sans-serif;
    font-weight: 600;
    font-size: 2rem;
    line-height: 1.3;
    margin: 1.5rem 0 0.75rem 0;
    color: #444;
}

h3 {
    font-family: 'Roboto-Medium', 'OpenSans-Semibold', 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 1.5rem;
    line-height: 1.4;
    margin: 1.25rem 0 0.5rem 0;
    color: #555;
}

h4 {
    font-family: 'Roboto-Medium', 'OpenSans-Semibold', 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 1.25rem;
    line-height: 1.4;
    margin: 1rem 0 0.5rem 0;
    color: #666;
}

h5, h6 {
    font-family: 'Roboto', 'OpenSans', sans-serif;
    font-weight: 500;
    font-size: 1.1rem;
    line-height: 1.5;
    margin: 0.75rem 0 0.5rem 0;
    color: #666;
}

/* Screen reader only class for SEO-optimized H1 */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Improved heading spacing for better readability */
.page-heading h1 {
    margin-bottom: 0.5rem;
}

.page-heading h3 {
    margin-top: 0;
}

/* Responsive typography */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    h3 {
        font-size: 1.375rem;
    }
    
    h4 {
        font-size: 1.125rem;
    }
}

/* Font loading optimization */
@font-face {
    font-family: 'Roboto';
    src: url('font/roboto-regular.eot');
    src: url('font/roboto-regular.eot?#iefix') format('embedded-opentype'),
         url('font/roboto-regular.woff') format('woff'),
         url('font/roboto-regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'OpenSans';
    src: url('font/opensans.eot');
    src: url('font/opensans.eot?#iefix') format('embedded-opentype'),
         url('font/opensans.woff') format('woff'),
         url('font/opensans.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Improved text rendering */
body, h1, h2, h3, h4, h5, h6 {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Focus styles for accessibility */
h1:focus, h2:focus, h3:focus, h4:focus, h5:focus, h6:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}
