/* ==========================================================================
   WCAG 2.1 AA Accessibility Styles
   ========================================================================== */

/* Skip to content link - visible on focus */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: 9999;
}

.skip-link:focus {
    position: fixed;
    top: 0.5rem;
    left: 0.5rem;
    width: auto;
    height: auto;
    padding: 0.75rem 1.5rem;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background-color: #f58320;
    border-radius: 0.375rem;
    text-decoration: none;
    z-index: 99999;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Skip link target */
#main-content {
    position: relative;
}

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

/* Focus visible styles for keyboard navigation */
:focus-visible {
    outline: 2px solid #f58320;
    outline-offset: 2px;
}

.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    padding: 0.5rem;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Skip link for screen readers */
.sr-only-focusable:not(:focus) {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* High contrast mode support */
@media (forced-colors: active) {
    .skip-link:focus {
        outline: 2px solid CanvasText;
        outline-offset: 2px;
    }
    
    :focus-visible {
        outline: 2px solid CanvasText;
        outline-offset: 2px;
    }
}

/* Reduced motion support */
@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;
    }
}

/* Focus trap for modals */
.focus-trap {
    outline: none;
}

/* Skip link container */
.skip-links {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 99999;
}

/* Accessible button states */
.btn-focusable:focus-visible {
    outline: 2px solid #f58320;
    outline-offset: 2px;
}

/* Accessible link states */
a:focus-visible {
    outline: 2px solid #f58320;
    outline-offset: 2px;
    text-decoration: underline;
}

/* Form field focus states */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #f58320;
    outline-offset: 2px;
    border-color: #f58320;
}

/* Table focus states */
tr:focus-within {
    outline: 2px solid #f58320;
    outline-offset: -2px;
    background-color: #fef3c7;
}

/* Skip navigation landmarks */
[role="navigation"]:focus-within,
[role="main"]:focus-within,
[role="complementary"]:focus-within,
[role="banner"]:focus-within,
[role="contentinfo"]:focus-within {
    outline: none;
}

/* Skip link text only */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
