/* ==========================================================================
   Accessibility Enhancements
   ========================================================================== */

/* ==========================================================================
   Focus Management
   ========================================================================== */

/* Global focus styles */
*:focus {
    outline: 2px solid #E1AA05;
    outline-offset: 2px;
}

/* Remove default focus outline and add custom */
button:focus,
input:focus,
select:focus,
textarea:focus,
a:focus {
    outline: none;
    box-shadow: 0 0 0 2px #E1AA05;
    -webkit-box-shadow: 0 0 0 2px #E1AA05;
    -moz-box-shadow: 0 0 0 2px #E1AA05;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid #E1AA05;
    outline-offset: 2px;
}

/* ==========================================================================
   Skip Links
   ========================================================================== */

.skip-link {
    position: absolute;
    left: -9999px;
    z-index: 999999;
    padding: 8px 16px;
    background: #E1AA05;
    color: #333;
    text-decoration: none;
    font-weight: 600;
    border-radius: 4px;
    font-size: 14px;
}

.skip-link:focus {
    left: 6px;
    top: 6px;
    outline: 2px solid #333;
    outline-offset: 2px;
}

/* ==========================================================================
   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 {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ==========================================================================
   ARIA Labels and Descriptions
   ========================================================================== */

/* Form labels */
label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

/* Required field indicators */
.required::after {
    content: " *";
    color: #DC3545;
    font-weight: bold;
}

/* Error states */
.error {
    border-color: #DC3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2);
}

.error-message {
    color: #DC3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

/* Success states */
.success {
    border-color: #28A745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.2);
}

.success-message {
    color: #28A745;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

/* ==========================================================================
   High Contrast Mode Support
   ========================================================================== */

@media (prefers-contrast: high) {
    :root {
        --primary-color: #000000;
        --accent-color: #FFD700;
        --text-color: #000000;
        --background-color: #FFFFFF;
        --border-color: #000000;
    }
    
    * {
        color: #000000;
        background-color: #FFFFFF;
    }
    
    button,
    .btn {
        border: 2px solid #000000;
        background-color: #FFFFFF;
        color: #000000;
    }
    
    button:hover,
    .btn:hover {
        background-color: #000000;
        color: #FFFFFF;
    }
}

/* ==========================================================================
   Reduced Motion Support
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms;
        animation-iteration-count: 1;
        transition-duration: 0.01ms;
        scroll-behavior: auto;
    }
    
    /* Disable parallax and other motion effects */
    .parallax {
        transform: none;
    }
}

/* ==========================================================================
   Color Blind Support
   ========================================================================== */

/* Ensure information isn't conveyed through color alone */
.status-indicator {
    position: relative;
}

.status-indicator::before {
    content: "";
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.status-indicator.success::before {
    background-color: #28A745;
    content: "✓";
    color: white;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-indicator.error::before {
    background-color: #DC3545;
    content: "✗";
    color: white;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-indicator.warning::before {
    background-color: #FFC107;
    content: "!";
    color: black;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   Touch Target Sizes
   ========================================================================== */

/* Ensure touch targets are at least 44px */
button,
.btn,
input[type="submit"],
input[type="button"],
a,
[role="button"] {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Checkboxes and radios should maintain their natural size */
input[type="checkbox"],
input[type="radio"] {
    min-height: auto;
    min-width: auto;
    display: inline-block;
    width: 18px;
    height: 18px;
    transform: scale(1);
}

/* ==========================================================================
   Keyboard Navigation
   ========================================================================== */

/* Tab order management */
.tab-order-1 { order: 1; }
.tab-order-2 { order: 2; }
.tab-order-3 { order: 3; }
.tab-order-4 { order: 4; }
.tab-order-5 { order: 5; }

/* Skip to content links */
.skip-to-content {
    position: absolute;
    left: -9999px;
    z-index: 999999;
    padding: 8px 16px;
    background: #E1AA05;
    color: #333;
    text-decoration: none;
    font-weight: 600;
    border-radius: 4px;
}

.skip-to-content:focus {
    left: 6px;
    top: 6px;
}

/* ==========================================================================
   Form Accessibility
   ========================================================================== */

/* Fieldset and legend */
fieldset {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
}

legend {
    font-weight: 600;
    padding: 0 0.5rem;
    color: #333;
}

/* Input groups */
.input-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

.input-group label {
    margin-bottom: 0.25rem;
}

.input-group input,
.input-group select,
.input-group textarea {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

/* ==========================================================================
   Navigation Accessibility
   ========================================================================== */

/* Main navigation */
.main-navigation {
    position: relative;
}

.main-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
}

.main-navigation li {
    position: relative;
}

.main-navigation a {
    display: block;
    padding: 1rem;
    color: #333;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.main-navigation a:hover,
.main-navigation a:focus {
    background-color: #f8f9fa;
    outline: none;
}

.main-navigation a:focus {
    box-shadow: 0 0 0 2px #E1AA05;
}

/* ==========================================================================
   Table Accessibility
   ========================================================================== */

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

th,
td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
}

/* ==========================================================================
   Image Accessibility
   ========================================================================== */

img {
    max-width: 100%;
    height: auto;
}

/* Decorative images */
img[alt=""] {
    border: 0;
    clip: rect(0 0 0 0);
    height: auto;
    margin: 0;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    white-space: nowrap;
}

/* ==========================================================================
   Video Accessibility
   ========================================================================== */

video {
    max-width: 100%;
    height: auto;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .no-print {
        display: none;
    }
    
    * {
        background: transparent;
        color: black;
        box-shadow: none;
        text-shadow: none;
    }
    
    a,
    a:visited {
        text-decoration: underline;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
    
    abbr[title]:after {
        content: " (" attr(title) ")";
    }
    
    .ir a:after,
    a[href^="javascript:"]:after,
    a[href^="#"]:after {
        content: "";
    }
    
    pre,
    blockquote {
        border: 1px solid #999;
        page-break-inside: avoid;
    }
    
    thead {
        display: table-header-group;
    }
    
    tr,
    img {
        page-break-inside: avoid;
    }
    
    img {
        max-width: 100%;
    }
    
    p,
    h2,
    h3 {
        orphans: 3;
        widows: 3;
    }
    
    h2,
    h3 {
        page-break-after: avoid;
    }
}
