/* WCAG Compliant Blog Styles - Best Practices for Web Article Formatting */

/* Base Typography - Following WCAG G169, G172, C21 */
.blog-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    font-size: 16px;
    color: #333;
    max-width: 800px;
    margin: 0 auto;
}

/* Headings - Following G141, H42 */
.blog-content h1,
.blog-content h2,
.blog-content h3,
.blog-content h4,
.blog-content h5,
.blog-content h6 {
    line-height: 1.3;
    color: #2c3e50;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.blog-content h1 { font-size: 2.5rem; border-bottom: 2px solid #0078D4; padding-bottom: 0.5rem; }
.blog-content h2 { font-size: 2rem; color: #0078D4; }
.blog-content h3 { font-size: 1.5rem; color: #495057; }
.blog-content h4 { font-size: 1.25rem; color: #6c757d; }

/* Paragraphs - Following G169 (no full justification) */
.blog-content p {
    margin-bottom: 1.5rem;
    text-align: left;
    text-justify: none;
    hyphens: none;
}

/* Links - Following G183, SCR39 */
.blog-content a {
    color: #0078D4;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.blog-content a:hover,
.blog-content a:focus {
    color: #0056b3;
    text-decoration: none;
}

.blog-content a:focus {
    outline: 2px solid #0078D4;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Lists - Following H48, T2 */
.blog-content ol,
.blog-content ul {
    padding-left: 2rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.blog-content li {
    margin-bottom: 0.5rem;
}

.blog-content ol li {
    padding-left: 0.5rem;
}

/* Tables - Following H39, H43, H63 */
.blog-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.9rem;
}

.blog-content th,
.blog-content td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid #dee2e6;
}

.blog-content th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.blog-content tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* Code blocks - Following general best practices */
.blog-content code {
    background-color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.blog-content pre {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    border: 1px solid #e9ecef;
    margin: 1.5rem 0;
}

.blog-content pre code {
    background: none;
    padding: 0;
}

/* Blockquotes - Following general semantic markup */
.blog-content blockquote {
    border-left: 4px solid #0078D4;
    padding-left: 1rem;
    margin: 2rem 0;
    font-style: italic;
    color: #6c757d;
    background-color: #f8f9ff;
    padding: 1rem 1.5rem;
    border-radius: 0 6px 6px 0;
}

/* Images and Figures - Following H37, G94 */
.blog-content figure {
    margin: 2rem 0;
    text-align: center;
}

.blog-content figcaption {
    font-size: 0.9rem;
    color: #6c757d;
    font-style: italic;
    margin-top: 0.5rem;
}

.blog-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Form elements - Following H44, H65 */
.blog-content input,
.blog-content textarea,
.blog-content select,
.blog-content button {
    padding: 0.5rem;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    font-size: 16px; /* Prevents zoom on iOS */
}

.blog-content input:focus,
.blog-content textarea:focus,
.blog-content select:focus {
    outline: none;
    border-color: #0078D4;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.blog-content button {
    background-color: #0078D4;
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.blog-content button:hover,
.blog-content button:focus {
    background-color: #0056b3;
}

/* Navigation and Table of Contents */
.table-of-contents {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 2rem;
    margin: 2rem 0;
}

.table-of-contents h2 {
    margin-bottom: 1rem;
    color: #0078D4;
    font-size: 1.2rem;
}

.table-of-contents ol {
    line-height: 1.8;
    padding-left: 1.5rem;
    margin: 0;
}

.table-of-contents li {
    margin-bottom: 0.5rem;
}

.table-of-contents a {
    color: #495057;
    text-decoration: none;
    display: block;
    padding: 0.25rem 0;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.table-of-contents a:hover,
.table-of-contents a:focus {
    background-color: #e9ecef;
    color: #0078D4;
}

/* Skip Links - Following G1, G124 */
.skip-link {
    position: absolute;
    left: -9999px;
    z-index: 9999;
    background: #0078D4;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
}

.skip-link:focus {
    position: static;
}

/* Screen Reader Only Content - Following G140 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    padding: 8px 16px;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
    background: #0078D4;
    color: white;
    border-radius: 4px;
}

/* Article sections - Following G115, H101 */
.article-section {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e9ecef;
}

.article-section:last-child {
    border-bottom: none;
}

/* Highlight boxes - Following general best practices */
.highlight-box {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #b3d9ff;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
    border-left: 4px solid #0078D4;
}

.highlight-box.success {
    background: linear-gradient(135deg, #f0fff4 0%, #e6fffa 100%);
    border-color: #9ae6b4;
    border-left-color: #38a169;
}

.highlight-box.warning {
    background: linear-gradient(135deg, #fffaf0 0%, #fefcbf 100%);
    border-color: #fbbf24;
    border-left-color: #d69e2e;
}

.highlight-box.error {
    background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
    border-color: #feb2b2;
    border-left-color: #e53e3e;
}

/* Responsive Design - Following G206 */
@media (max-width: 768px) {
    .blog-content {
        font-size: 16px; /* Prevent zoom on mobile */
        padding: 0 1rem;
    }

    .blog-content h1 { font-size: 2rem; }
    .blog-content h2 { font-size: 1.75rem; }
    .blog-content h3 { font-size: 1.25rem; }

    .table-of-contents {
        padding: 1rem;
    }

    .blog-content ol,
    .blog-content ul {
        padding-left: 1.5rem;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .blog-content {
        background: white;
        color: black;
    }

    .blog-content a {
        text-decoration: underline;
    }

    .highlight-box {
        border: 2px solid;
    }
}

/* Reduced Motion Support - Following G4 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles */
@media print {
    .blog-content a {
        color: black !important;
        text-decoration: underline !important;
    }

    .blog-content a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }

    .table-of-contents {
        page-break-inside: avoid;
    }
}
