/**
 * Accessibility Stylesheet (WCAG 2.1 AA / AAA Compliant)
 * Includes High Contrast Modes, Font Scaling, Dyslexia Font, Focus Indicators
 */

/* Skip Link for Keyboard Navigation */
.skip-link {
    position: absolute;
    top: -100px;
    left: 20px;
    background: #f97316;
    color: #ffffff;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 700;
    z-index: 99999;
    border-radius: 0 0 8px 8px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: top 0.2s ease-in-out;
}

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

/* Universal Focus Indicator for Keyboard Nav */
:focus-visible {
    outline: 3px solid #f97316 !important;
    outline-offset: 3px !important;
}

/* Accessibility Floating Button */
.a11y-trigger {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9990;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #0f172a;
    color: #f97316;
    border: 2px solid #f97316;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s, box-shadow 0.2s;
}

.a11y-trigger:hover,
.a11y-trigger:focus-visible {
    transform: scale(1.1);
    background: #f97316;
    color: #0f172a;
    box-shadow: 0 12px 30px rgba(249, 115, 22, 0.5);
}

.a11y-trigger svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
}

/* Accessibility Drawer / Modal */
.a11y-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s;
}

.a11y-modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.a11y-panel {
    position: fixed;
    bottom: 90px;
    left: 24px;
    width: calc(100vw - 48px);
    max-width: 380px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: #0f172a;
    color: #f8fafc;
    border: 1px solid #334155;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    padding: 24px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.a11y-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.a11y-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #1e293b;
}

.a11y-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 10px;
}

.a11y-header h2 svg {
    color: #f97316;
}

.a11y-close-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}

.a11y-close-btn:hover {
    color: #ffffff;
    background: #1e293b;
}

.a11y-section {
    margin-bottom: 20px;
}

.a11y-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin-bottom: 10px;
}

.a11y-btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.a11y-btn {
    flex: 1 1 auto;
    background: #1e293b;
    color: #f8fafc;
    border: 1px solid #334155;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.a11y-btn:hover {
    background: #334155;
    border-color: #475569;
}

.a11y-btn.active {
    background: #f97316;
    color: #0f172a;
    border-color: #f97316;
    font-weight: 700;
}

.a11y-toggle-btn {
    width: 100%;
    margin-bottom: 8px;
    justify-content: space-between;
}

.a11y-reset-btn {
    width: 100%;
    margin-top: 10px;
    background: transparent;
    border: 1px dashed #475569;
    color: #94a3b8;
}

.a11y-reset-btn:hover {
    color: #f8fafc;
    border-color: #94a3b8;
}

/* =====================================================================
   ACCESSIBILITY MODIFIERS ON <html> / <body>
   ===================================================================== */

/* 1. Font Sizing */
html.a11y-font-large {
    font-size: 115%;
}

html.a11y-font-xlarge {
    font-size: 130%;
}

html.a11y-font-small {
    font-size: 90%;
}

/* 2. Dyslexia-Friendly Font */
body.a11y-dyslexia {
    font-family: 'Comic Sans MS', 'Trebuchet MS', 'Arial Rounded MT Bold', sans-serif !important;
    letter-spacing: 0.04em !important;
    word-spacing: 0.08em !important;
    line-height: 1.8 !important;
}

body.a11y-dyslexia * {
    font-family: inherit !important;
    letter-spacing: inherit !important;
}

/* 3. Highlight Links */
body.a11y-highlight-links a {
    text-decoration: underline 3px #f97316 !important;
    background-color: rgba(249, 115, 22, 0.15) !important;
    color: #ffedd5 !important;
    font-weight: 700 !important;
    padding: 2px 4px !important;
    border-radius: 4px !important;
}

/* 4. High Contrast Dark Mode */
body.a11y-contrast-dark {
    background: #000000 !important;
    color: #ffffff !important;
}

body.a11y-contrast-dark *:not(.a11y-panel):not(.a11y-panel *) {
    background-color: #000000 !important;
    color: #ffffff !important;
    border-color: #ffff00 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

body.a11y-contrast-dark a {
    color: #00ffff !important;
    text-decoration: underline !important;
}

body.a11y-contrast-dark button,
body.a11y-contrast-dark .btn {
    background-color: #000000 !important;
    color: #ffff00 !important;
    border: 2px solid #ffff00 !important;
}

body.a11y-contrast-dark input,
body.a11y-contrast-dark textarea,
body.a11y-contrast-dark select {
    background: #000000 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
}

/* 5. High Contrast Light Mode */
body.a11y-contrast-light {
    background: #ffffff !important;
    color: #000000 !important;
}

body.a11y-contrast-light *:not(.a11y-panel):not(.a11y-panel *) {
    background-color: #ffffff !important;
    color: #000000 !important;
    border-color: #000000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

body.a11y-contrast-light a {
    color: #0000ee !important;
    text-decoration: underline !important;
    font-weight: 700 !important;
}

body.a11y-contrast-light button,
body.a11y-contrast-light .btn {
    background-color: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
}

body.a11y-contrast-light input,
body.a11y-contrast-light textarea,
body.a11y-contrast-light select {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
}

/* 6. Reduced Motion / Paused Animations */
body.a11y-reduce-motion *,
body.a11y-reduce-motion *::before,
body.a11y-reduce-motion *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
}

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