/* H33 Accessibility Styles
 * WCAG 2.1 AA Compliant
 */

/* Skip Link - Hidden until focused */
.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bronze);
    color: var(--black);
    padding: 12px 24px;
    border-radius: 0 0 8px 8px;
    font-weight: 600;
    text-decoration: none;
    z-index: 10000;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid var(--bronze-light);
    outline-offset: 2px;
}

/* Focus Styles - Enhanced visibility */
*:focus {
    outline: 2px solid var(--bronze);
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 3px solid var(--bronze-light);
    outline-offset: 3px;
}

/* Interactive elements focus states */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--bronze-light);
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(201, 149, 108, 0.25);
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --text: #ffffff;
        --text-muted: #cccccc;
        --border: #666666;
        --bronze: #ffb366;
        --bronze-light: #ffc080;
    }

    body {
        background: #000000;
    }

    .btn, .btn-primary {
        border: 2px solid currentColor;
    }
}

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

/* Screen Reader Only Content */
.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,
.sr-only-focusable:active {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Keyboard Navigation Indicator */
body.keyboard-nav *:focus {
    outline: 3px solid var(--bronze-light) !important;
    outline-offset: 3px !important;
}

/* Text Resize Support - Ensure readability up to 200% */
html {
    font-size: 100%;
}

@media screen and (min-width: 320px) {
    html {
        font-size: calc(100% + 0.2vw);
    }
}

/* Minimum touch target size (44x44px for WCAG) */
.touch-target {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Link underlines for clarity */
.article-content a,
.content a:not(.btn) {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Error states with icons (not color alone) */
.error-message {
    color: var(--red);
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-message::before {
    content: "!";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--red);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 14px;
}

/* Success states with icons */
.success-message {
    color: var(--green);
    display: flex;
    align-items: center;
    gap: 8px;
}

.success-message::before {
    content: "\2713";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--green);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 14px;
}

/* Form Labels - Always visible */
label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

/* Required field indicator */
.required::after {
    content: " *";
    color: var(--red);
}

/* Accessible hiding for decorative elements */
[aria-hidden="true"] {
    pointer-events: none;
}

/* Focus trap container */
.focus-trap {
    position: relative;
}

/* Modal accessibility */
.modal[aria-hidden="true"] {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
}

.modal-content {
    position: relative;
    background: var(--black-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

/* Print styles for accessibility */
@media print {
    .skip-link,
    .cookie-banner,
    nav,
    .no-print {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    a {
        text-decoration: underline;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
}
