/**
 * Lyceum Modern — Web Accessibility (WCAG 2.1 AA) Styles
 * Версія для слабозорих та осіб з особливими освітніми потребами
 */

/* =========================================================
   1. ПЛАВАЮЧА КНОПКА ТА ПАНЕЛЬ ДОСТУПНОСТІ (MODAL / DRAWER)
========================================================= */
.a11y-floating-btn {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99999;
    background: #1e3a8a;
    color: #ffffff;
    border: 2px solid #60a5fa;
    border-radius: 9999px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.35);
    cursor: pointer;
    transition: all 0.25s ease;
}
.a11y-floating-btn:hover,
.a11y-floating-btn:focus {
    background: #2563eb;
    transform: scale(1.05);
    box-shadow: 0 15px 30px rgba(37, 99, 235, 0.45);
    outline: 3px solid #f59e0b;
}

/* Модальна панель доступності */
.a11y-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.a11y-overlay.active {
    display: flex;
}

.a11y-panel {
    background: #ffffff;
    color: #0f172a;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 20px;
    border: 3px solid #2563eb;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
    padding: 2rem;
}

.a11y-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e2e8f0;
}
.a11y-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.a11y-close-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
    border-radius: 10px;
    padding: 8px 14px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
}
.a11y-close-btn:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
}

/* Секції налаштувань */
.a11y-group {
    margin-bottom: 1.5rem;
}
.a11y-group-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    display: block;
}

.a11y-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.a11y-btn {
    background: #f8fafc;
    border: 2px solid #cbd5e1;
    color: #0f172a;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.a11y-btn:hover {
    border-color: #2563eb;
    background: #eff6ff;
}
.a11y-btn.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #1d4ed8;
}

/* =========================================================
   2. РЕЖИМИ РОЗМІРУ ШРИФТУ
========================================================= */
html.a11y-font-115 {
    font-size: 18px !important;
}
html.a11y-font-130 {
    font-size: 21px !important;
}
html.a11y-font-150 {
    font-size: 24px !important;
}

/* =========================================================
   3. РЕЖИМИ КОНТРАСТУ ТА КОЛЬОРИ
========================================================= */

/* Чорно-білий високий контраст (Black & White High Contrast) */
body.a11y-contrast-bw {
    background-color: #000000 !important;
    color: #ffffff !important;
}
body.a11y-contrast-bw * {
    background-color: #000000 !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
}
body.a11y-contrast-bw a,
body.a11y-contrast-bw button {
    color: #ffff00 !important;
    border: 2px solid #ffff00 !important;
    text-decoration: underline !important;
}

/* Жовтий на чорному (Yellow on Black) */
body.a11y-contrast-yb {
    background-color: #000000 !important;
    color: #ffff00 !important;
}
body.a11y-contrast-yb * {
    background-color: #000000 !important;
    color: #ffff00 !important;
    border-color: #ffff00 !important;
}
body.a11y-contrast-yb a {
    color: #00ffff !important;
    text-decoration: underline !important;
}

/* =========================================================
   4. ШРИФТ ДЛЯ ЗРУЧНОГО ЧИТАННЯ (ДИСЛЕКСІЯ / HIGH READABILITY)
========================================================= */
body.a11y-readable-font,
body.a11y-readable-font * {
    font-family: Arial, Verdana, sans-serif !important;
    letter-spacing: 0.08em !important;
    word-spacing: 0.16em !important;
    line-height: 1.85 !important;
}

/* =========================================================
   5. ПІДСВІЧУВАННЯ ПОСИЛАНЬ
========================================================= */
body.a11y-highlight-links a {
    background-color: #fef08a !important;
    color: #000000 !important;
    outline: 2px solid #ca8a04 !important;
    text-decoration: underline !important;
    font-weight: 800 !important;
    padding: 2px 4px !important;
}

/* =========================================================
   6. ВИМКНЕННЯ АНІМАЦІЙ
========================================================= */
body.a11y-no-animations * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}

/* =========================================================
   7. ВЕЛИКИЙ КУРСОР
========================================================= */
body.a11y-large-cursor,
body.a11y-large-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 24 24'%3E%3Cpath fill='%232563EB' stroke='%23ffffff' stroke-width='2' d='M5.5 3.21V20.8c0 .45.54.67.85.35l4.86-4.86a.5.5 0 0 1 .35-.15h6.87a.5.5 0 0 0 .35-.85L6.35 2.85a.5.5 0 0 0-.85.35Z'/%3E%3C/svg%3E"), auto !important;
}

/* =========================================================
   8. МОБІЛЬНА АДАПТАЦІЯ (MOBILE RESPONSIVE A11Y MENU)
========================================================= */
@media (max-width: 991px) {
    /* Кнопка доступності: на мобільних перетворюється на круглу іконку без тексту */
    .a11y-floating-btn {
        bottom: 16px !important;
        left: 16px !important;
        width: 54px !important;
        height: 54px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        justify-content: center !important;
        box-shadow: 0 8px 25px rgba(15, 23, 42, 0.45) !important;
    }
    .a11y-floating-btn span:not(:first-child),
    .a11y-floating-btn .a11y-btn-text {
        display: none !important;
    }
    .a11y-floating-btn span:first-child,
    .a11y-floating-btn .a11y-btn-icon {
        font-size: 1.7rem !important;
        margin: 0 !important;
        line-height: 1 !important;
    }

    /* Модальна панель на мобільних пристроях виїжджає знизу як зручний Bottom Sheet */
    .a11y-overlay {
        padding: 0 !important;
        align-items: flex-end !important;
    }
    .a11y-panel {
        max-width: 100% !important;
        width: 100% !important;
        max-height: 86vh !important;
        border-radius: 24px 24px 0 0 !important;
        border: none !important;
        border-top: 3px solid #2563eb !important;
        padding: 1.4rem 1.1rem 2.2rem !important;
    }
    .a11y-header {
        margin-bottom: 1.1rem !important;
        padding-bottom: 0.8rem !important;
    }
    .a11y-header h2 {
        font-size: 1.2rem !important;
    }
    .a11y-options-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.55rem !important;
    }
    .a11y-btn {
        padding: 0.7rem 0.6rem !important;
        font-size: 0.84rem !important;
    }
}

@media (max-width: 480px) {
    .a11y-options-grid {
        grid-template-columns: 1fr !important;
    }
    .a11y-btn[style*="grid-column: span 2"] {
        grid-column: span 1 !important;
    }
}
