/* path : accessibility.css */
/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   - Improved contrast ratios (WCAG AA)
   - Visible focus states
   - Skip links
   ======================================== */

/* ----------------------------------------
   1. IMPROVED TEXT CONTRASTS
   Replacing low-contrast grays with accessible alternatives
   ---------------------------------------- */

/* Override Tailwind's gray utilities for better contrast on cream background */
.text-gray-400 {
    color: #666666 !important; /* Ratio ~5.5:1 on #FDFBF9 */
}

.text-gray-500 {
    color: #555555 !important; /* Ratio ~7:1 on #FDFBF9 */
}

.text-gray-600 {
    color: #4a4a4a !important; /* Ratio ~8:1 on #FDFBF9 */
}

/* Specific overrides for common patterns */
.text-dark-green\/50,
.text-dark-green\/60,
.text-dark-green\/70 {
    color: #2d5f58 !important; /* Darker green for better contrast */
}

/* Placeholder text - needs to be readable but distinct */
::placeholder {
    color: #777777 !important;
    opacity: 1;
}

/* Timeline and decorative elements - ensure readability */
.timeline-time {
    color: #c4967d !important; /* Darker peach for contrast */
}

/* ----------------------------------------
   2. VISIBLE FOCUS STATES
   Clear, consistent focus indicators
   ---------------------------------------- */

/* Global focus reset - remove default outline, add custom */
*:focus {
    outline: none;
}

/* Primary focus style - for interactive elements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid #6FAFA6;
    outline-offset: 2px;
    border-radius: 4px;
    transition: outline-offset 0.1s ease;
}

/* High contrast focus for dark backgrounds */
.bg-dark-green a:focus-visible,
.bg-dark-green button:focus-visible,
.bg-euca a:focus-visible,
.bg-euca button:focus-visible {
    outline-color: #ffffff;
}

/* Focus style for cards and interactive containers */
.game-card:focus-visible,
.info-card:focus-visible,
.nav-card:focus-visible,
.admin-card:focus-visible {
    outline: 3px solid #e9c1ad;
    outline-offset: 4px;
    transform: translateY(-2px);
}

/* Focus style for navigation items */
.nav-item:focus-visible,
.nav-pill:focus-visible {
    outline: 2px solid #6FAFA6;
    outline-offset: 2px;
    background: rgba(111, 175, 166, 0.1);
}

/* Focus style for form inputs - more subtle */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #6FAFA6;
    outline-offset: 0;
    border-color: #6FAFA6 !important;
    box-shadow: 0 0 0 4px rgba(111, 175, 166, 0.15);
}

/* Focus style for buttons */
button:focus-visible,
.btn-primary:focus-visible {
    outline: 3px solid #3F7F76;
    outline-offset: 3px;
    transform: translateY(-1px);
}

/* Focus within for drop zones */
.drop-zone:focus-within {
    border-color: #6FAFA6;
    background: linear-gradient(135deg, rgba(111, 175, 166, 0.1), rgba(233, 193, 173, 0.1));
    box-shadow: 0 0 0 4px rgba(111, 175, 166, 0.2);
}

/* ----------------------------------------
   3. SKIP LINK
   Allow keyboard users to skip navigation
   ---------------------------------------- */

.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: #3F7F76;
    color: white;
    padding: 12px 24px;
    border-radius: 0 0 8px 8px;
    z-index: 9999;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #e9c1ad;
    outline-offset: 2px;
}

/* ----------------------------------------
   4. REDUCED MOTION
   Respect user preferences for reduced motion
   ---------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-fade-in-up,
    .animate-fade-in,
    .animate-sway,
    .animate-float {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ----------------------------------------
   5. ARIA & SCREEN READER UTILITIES
   ---------------------------------------- */

/* Visually hidden but accessible to screen readers */
.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;
}

/* Make decorative elements invisible to screen readers */
[aria-hidden="true"] {
    pointer-events: none;
}

/* Live region for dynamic content announcements */
.aria-live-region {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ----------------------------------------
   6. ERROR STATES
   Clear visual feedback for form errors
   ---------------------------------------- */

.input-error,
input.error,
select.error,
textarea.error {
    border-color: #dc2626 !important;
    background-color: #fef2f2;
}

.input-error:focus-visible,
input.error:focus-visible {
    outline-color: #dc2626;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.15);
}

.error-message {
    color: #b91c1c;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.error-message::before {
    content: "⚠";
}

/* ----------------------------------------
   7. SUCCESS STATES
   Clear visual feedback for success
   ---------------------------------------- */

.input-success,
input.success {
    border-color: #059669 !important;
    background-color: #f0fdf4;
}

.success-message {
    color: #047857;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* ----------------------------------------
   8. DISABLED STATES
   More visible disabled states
   ---------------------------------------- */

button:disabled,
input:disabled,
select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f3f4f6;
}

button:disabled {
    background: #d1d5db !important;
    color: #6b7280 !important;
}

/* ----------------------------------------
   9. LINK UNDERLINES
   Make links more discoverable
   ---------------------------------------- */

/* Content links should be underlined */
.content-area a:not(.btn):not(.nav-link):not(.nav-pill) {
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: currentColor;
    text-decoration-thickness: 1px;
}

.content-area a:hover {
    text-decoration-thickness: 2px;
}

/* ----------------------------------------
   10. HIGH CONTRAST MODE SUPPORT
   ---------------------------------------- */

@media (prefers-contrast: high) {
    .text-gray-400,
    .text-gray-500 {
        color: #000000 !important;
    }
    
    .border-euca\/10,
    .border-euca\/20,
    .border-peach\/20 {
        border-color: #000000 !important;
    }
    
    button,
    .btn-primary {
        border: 2px solid currentColor;
    }
}