/**
 * @file accessibility.css
 * @description Universal Accessibility & DYS/ULIS Inclusion Stylesheet for EduCycle.
 * Includes OpenDyslexic, Luciole & Lexend fonts, high contrast themes, reading ruler, and speech synthesis UI.
 */

/* =============================================================================
   1. WEBFONTS DYS / ULIS (Loaded dynamically on-demand by accessibility.js)
   ============================================================================= */

/* =============================================================================
   2. TYPOGRAPHY MODIFIERS (DYS, Luciole, Lexend)
   ============================================================================= */

body.a11y-font-opendyslexic,
body.a11y-font-opendyslexic button,
body.a11y-font-opendyslexic input,
body.a11y-font-opendyslexic select,
body.a11y-font-opendyslexic textarea,
body.a11y-font-opendyslexic .statement-card,
body.a11y-font-opendyslexic .choice-card {
    font-family: 'OpenDyslexic', 'Comic Sans MS', sans-serif !important;
}

body.a11y-font-luciole,
body.a11y-font-luciole button,
body.a11y-font-luciole input,
body.a11y-font-luciole select,
body.a11y-font-luciole textarea,
body.a11y-font-luciole .statement-card,
body.a11y-font-luciole .choice-card {
    font-family: 'Luciole', sans-serif !important;
}

body.a11y-font-lexend,
body.a11y-font-lexend button,
body.a11y-font-lexend input,
body.a11y-font-lexend select,
body.a11y-font-lexend textarea,
body.a11y-font-lexend .statement-card,
body.a11y-font-lexend .choice-card {
    font-family: 'Lexend', sans-serif !important;
}

/* Text Size Modifiers */
body.a11y-size-125 {
    font-size: 115% !important;
}
body.a11y-size-125 .statement-card {
    font-size: 32px !important;
}
body.a11y-size-125 .choice-card {
    font-size: 26px !important;
}

body.a11y-size-150 {
    font-size: 130% !important;
}
body.a11y-size-150 .statement-card {
    font-size: 38px !important;
}
body.a11y-size-150 .choice-card {
    font-size: 30px !important;
}

body.a11y-size-175 {
    font-size: 145% !important;
}
body.a11y-size-175 .statement-card {
    font-size: 44px !important;
}
body.a11y-size-175 .choice-card {
    font-size: 34px !important;
}

/* Spacing Modifiers */
body.a11y-spacing-airy,
body.a11y-spacing-airy .statement-card,
body.a11y-spacing-airy .choice-card,
body.a11y-spacing-airy p {
    letter-spacing: 0.08em !important;
    word-spacing: 0.18em !important;
    line-height: 1.85 !important;
}

body.a11y-spacing-very-airy,
body.a11y-spacing-very-airy .statement-card,
body.a11y-spacing-very-airy .choice-card,
body.a11y-spacing-very-airy p {
    letter-spacing: 0.14em !important;
    word-spacing: 0.28em !important;
    line-height: 2.2 !important;
}

/* =============================================================================
   3. HIGH CONTRAST & DYSLEXIA THEMES
   ============================================================================= */

/* Yellow on Black (Recommended by speech therapists & visual specialists) */
body.a11y-theme-yellow-black {
    background-color: #000000 !important;
    color: #fef08a !important;
}
body.a11y-theme-yellow-black .projector-header,
body.a11y-theme-yellow-black .portal-header,
body.a11y-theme-yellow-black .portal-tab-btn,
body.a11y-theme-yellow-black .statement-card,
body.a11y-theme-yellow-black .choice-card,
body.a11y-theme-yellow-black .card,
body.a11y-theme-yellow-black .stat-card,
body.a11y-theme-yellow-black .exercise-card,
body.a11y-theme-yellow-black .admin-table-card,
body.a11y-theme-yellow-black .pin-pill {
    background-color: #0a0a0a !important;
    color: #fef08a !important;
    border-color: #eab308 !important;
}
body.a11y-theme-yellow-black .portal-tab-btn.active {
    background-color: #eab308 !important;
    color: #000000 !important;
    font-weight: 900 !important;
}
body.a11y-theme-yellow-black h1,
body.a11y-theme-yellow-black h2,
body.a11y-theme-yellow-black h3,
body.a11y-theme-yellow-black strong,
body.a11y-theme-yellow-black .pin-code-highlight,
body.a11y-theme-yellow-black #studentFullName {
    color: #ffffff !important;
}
body.a11y-theme-yellow-black .btn-primary {
    background-color: #eab308 !important;
    color: #000000 !important;
    font-weight: 900 !important;
    border: 2px solid #fef08a !important;
}

/* Sepia (Soft background against visual fatigue & glare) */
body.a11y-theme-sepia {
    background-color: #fbf7ee !important;
    color: #261f14 !important;
}
body.a11y-theme-sepia .projector-header,
body.a11y-theme-sepia .portal-header,
body.a11y-theme-sepia .portal-tab-btn,
body.a11y-theme-sepia .statement-card,
body.a11y-theme-sepia .choice-card,
body.a11y-theme-sepia .card,
body.a11y-theme-sepia .stat-card,
body.a11y-theme-sepia .exercise-card,
body.a11y-theme-sepia .pin-pill {
    background-color: #f4ece1 !important;
    color: #261f14 !important;
    border-color: #d5c3af !important;
}
body.a11y-theme-sepia .portal-tab-btn.active {
    background-color: #78350f !important;
    color: #ffffff !important;
    border-color: #78350f !important;
}
body.a11y-theme-sepia h1,
body.a11y-theme-sepia h2,
body.a11y-theme-sepia h3,
body.a11y-theme-sepia strong,
body.a11y-theme-sepia .pin-code-highlight,
body.a11y-theme-sepia #studentFullName {
    color: #17120a !important;
}
body.a11y-theme-sepia .btn-primary {
    background-color: #78350f !important;
    color: #ffffff !important;
}

/* High Contrast Pure Black & White */
body.a11y-theme-high-contrast {
    background-color: #ffffff !important;
    color: #000000 !important;
}
body.a11y-theme-high-contrast .statement-card,
body.a11y-theme-high-contrast .choice-card,
body.a11y-theme-high-contrast .card,
body.a11y-theme-high-contrast .stat-card,
body.a11y-theme-high-contrast .exercise-card,
body.a11y-theme-high-contrast .projector-header,
body.a11y-theme-high-contrast .portal-header,
body.a11y-theme-high-contrast .portal-tab-btn {
    background-color: #ffffff !important;
    color: #000000 !important;
    border: 3px solid #000000 !important;
}
body.a11y-theme-high-contrast .portal-tab-btn.active {
    background-color: #000000 !important;
    color: #ffffff !important;
    border: 3px solid #000000 !important;
}
body.a11y-theme-high-contrast h1,
body.a11y-theme-high-contrast h2,
body.a11y-theme-high-contrast h3,
body.a11y-theme-high-contrast strong,
body.a11y-theme-high-contrast #studentFullName {
    color: #000000 !important;
}

/* =============================================================================
   4. READING RULER (Guide Visuel de Lecture)
   ============================================================================= */

.a11y-reading-ruler {
    position: fixed;
    left: 0;
    width: 100vw;
    height: 48px;
    background: rgba(254, 240, 138, 0.28);
    border-top: 2px solid rgba(234, 179, 8, 0.85);
    border-bottom: 2px solid rgba(234, 179, 8, 0.85);
    pointer-events: none;
    z-index: 999999;
    display: none;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.25);
    transition: top 0.05s ease-out;
}

/* =============================================================================
   5. COLORBLIND SHAPES BADGES (Daltonisme)
   ============================================================================= */

.a11y-shape-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-right: 6px;
    vertical-align: middle;
}

/* =============================================================================
   6. FLOATING BUTTON & DRAWER MODAL
   ============================================================================= */

.a11y-floating-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99990;
    background: #0f172a;
    color: #38bdf8;
    border: 2px solid #38bdf8;
    padding: 10px 18px;
    border-radius: 30px;
    font-size: 13.5px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
    user-select: none;
}

.a11y-floating-btn:hover {
    transform: translateY(-2px) scale(1.03);
    background: #1e293b;
    box-shadow: 0 10px 28px rgba(56, 189, 248, 0.4);
}

.a11y-floating-btn:active {
    transform: scale(0.96);
}

/* Quick Audio Button on question */
.a11y-audio-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.a11y-audio-btn:hover {
    background: rgba(56, 189, 248, 0.3);
    transform: translateY(-1px);
}

.a11y-audio-btn.speaking {
    background: #10b981;
    color: #ffffff;
    border-color: #10b981;
    animation: a11yPulse 1.2s infinite;
}

@keyframes a11yPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Modal Drawer */
.a11y-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 99995;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.a11y-modal-box {
    background: #0f172a;
    border: 2px solid #38bdf8;
    border-radius: 22px;
    max-width: 640px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 26px 28px;
    color: #f8fafc;
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.6);
    text-align: left;
    scrollbar-width: thin;
    scrollbar-color: rgba(56, 189, 248, 0.35) transparent;
}

.a11y-modal-box::-webkit-scrollbar {
    width: 6px;
}

.a11y-modal-box::-webkit-scrollbar-track {
    background: transparent;
    margin: 14px 0;
}

.a11y-modal-box::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.35);
    border-radius: 999px;
}

.a11y-modal-box::-webkit-scrollbar-thumb:hover {
    background: rgba(56, 189, 248, 0.7);
}

.a11y-section-title {
    font-size: 14px;
    font-weight: 800;
    color: #38bdf8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 18px 0 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.a11y-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
}

.a11y-choice-btn {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 10px;
    color: #cbd5e1;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
}

.a11y-choice-btn:hover {
    background: #334155;
    color: #ffffff;
}

.a11y-choice-btn.active {
    background: #2563eb;
    border-color: #60a5fa;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.a11y-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 10px;
    margin-bottom: 10px;
}
