/* ============================================================
   Панель доступности для слабовидящих — ГОСТ Р 52872-2019
   ============================================================ */

/* --- Панель и кнопка-переключатель --- */
.accessibility-panel {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 10000;
}

.visibility-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 16px;
    font-weight: 600;
    background: #fff;
    border: 2px solid #333;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #333;
    line-height: 1;
}

.visibility-toggle:hover,
.visibility-toggle:focus {
    background: #e8e8e8;
    outline: 2px solid #005fcc;
    outline-offset: 2px;
}

.visibility-toggle .eye-icon {
    font-size: 20px;
    line-height: 1;
}

/* --- Выпадающая панель настроек --- */
.accessibility-settings {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    max-height: 85vh;
    overflow-y: auto;
    background: #fff;
    border: 2px solid #333;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    padding: 16px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    color: #333;
}

.accessibility-settings.open {
    display: block;
}

.accessibility-settings h4 {
    margin: 0 0 8px;
    padding: 0;
    font-size: 15px;
    font-weight: 700;
    color: #222;
    border: none;
    background: none;
}

.acc-group {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid #ddd;
}

.acc-group:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.acc-group-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

/* --- Кнопки-выборы (общий стиль) --- */
.acc-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.acc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 600;
    background: #f5f5f5;
    border: 2px solid #aaa;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #333;
    line-height: 1.2;
    font-family: inherit;
}

.acc-btn:hover {
    border-color: #555;
    background: #e8e8e8;
}

.acc-btn:focus {
    outline: 2px solid #005fcc;
    outline-offset: 1px;
}

.acc-btn.active {
    background: #005fcc;
    color: #fff;
    border-color: #005fcc;
}

/* Кнопки размера шрифта */
.acc-btn-font-normal { font-size: 14px; }
.acc-btn-font-large { font-size: 18px; }
.acc-btn-font-xlarge { font-size: 22px; }

/* Кнопки цветовых схем */
.acc-btn-scheme-bw { background: #fff; color: #000; border-color: #000; }
.acc-btn-scheme-bw.active { outline: 3px solid #005fcc; }
.acc-btn-scheme-wb { background: #000; color: #fff; border-color: #fff; }
.acc-btn-scheme-wb.active { outline: 3px solid #ffdd00; }
.acc-btn-scheme-db { background: #9DD1FF; color: #063462; border-color: #063462; }
.acc-btn-scheme-db.active { outline: 3px solid #063462; }
.acc-btn-scheme-bg { background: #F5E6C8; color: #4D3B1A; border-color: #4D3B1A; }
.acc-btn-scheme-bg.active { outline: 3px solid #4D3B1A; }
.acc-btn-scheme-gb { background: #3B3B3B; color: #A9E44D; border-color: #A9E44D; }
.acc-btn-scheme-gb.active { outline: 3px solid #A9E44D; }

/* Кнопка сброса */
.acc-reset-btn {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 4px;
    font-size: 14px;
    font-weight: 700;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    font-family: Arial, sans-serif;
}

.acc-reset-btn:hover {
    background: #c0392b;
}

.acc-reset-btn:focus {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
}

/* ============================================================
   1. РАЗМЕР ШРИФТА
   ============================================================ */
html[data-acc-fontsize="large"] {
    font-size: 130% !important;
}
html[data-acc-fontsize="xlarge"] {
    font-size: 160% !important;
}

/* ============================================================
   2. ЦВЕТОВЫЕ СХЕМЫ
   ============================================================ */

/* --- Чёрный на белом (высокий контраст) --- */
html[data-acc-scheme="bw"],
html[data-acc-scheme="bw"] body {
    background: #fff !important;
    color: #000 !important;
}
html[data-acc-scheme="bw"] * {
    background-color: transparent !important;
    color: #000 !important;
    border-color: #000 !important;
}
html[data-acc-scheme="bw"] a,
html[data-acc-scheme="bw"] a * {
    color: #0000EE !important;
    text-decoration: underline !important;
}
html[data-acc-scheme="bw"] a:visited,
html[data-acc-scheme="bw"] a:visited * {
    color: #551A8B !important;
}
html[data-acc-scheme="bw"] button,
html[data-acc-scheme="bw"] input[type="submit"],
html[data-acc-scheme="bw"] .acc-btn,
html[data-acc-scheme="bw"] .visibility-toggle {
    background-color: #fff !important;
    color: #000 !important;
    border: 2px solid #000 !important;
}
html[data-acc-scheme="bw"] .acc-btn.active {
    background-color: #000 !important;
    color: #fff !important;
}
html[data-acc-scheme="bw"] .acc-reset-btn {
    background-color: #000 !important;
    color: #fff !important;
}
html[data-acc-scheme="bw"] .accessibility-settings {
    background: #fff !important;
    border-color: #000 !important;
}

/* --- Белый на чёрном (инвертированный) --- */
html[data-acc-scheme="wb"],
html[data-acc-scheme="wb"] body {
    background: #000 !important;
    color: #fff !important;
}
html[data-acc-scheme="wb"] * {
    background-color: transparent !important;
    color: #fff !important;
    border-color: #fff !important;
}
html[data-acc-scheme="wb"] a,
html[data-acc-scheme="wb"] a * {
    color: #ffdd00 !important;
    text-decoration: underline !important;
}
html[data-acc-scheme="wb"] button,
html[data-acc-scheme="wb"] input[type="submit"],
html[data-acc-scheme="wb"] .acc-btn,
html[data-acc-scheme="wb"] .visibility-toggle {
    background-color: #222 !important;
    color: #fff !important;
    border: 2px solid #fff !important;
}
html[data-acc-scheme="wb"] .acc-btn.active {
    background-color: #fff !important;
    color: #000 !important;
}
html[data-acc-scheme="wb"] .acc-reset-btn {
    background-color: #fff !important;
    color: #000 !important;
}
html[data-acc-scheme="wb"] .accessibility-settings {
    background: #111 !important;
    border-color: #fff !important;
}

/* --- Тёмно-синий на голубом --- */
html[data-acc-scheme="db"],
html[data-acc-scheme="db"] body {
    background: #9DD1FF !important;
    color: #063462 !important;
}
html[data-acc-scheme="db"] * {
    background-color: transparent !important;
    color: #063462 !important;
    border-color: #063462 !important;
}
html[data-acc-scheme="db"] a,
html[data-acc-scheme="db"] a * {
    color: #00008B !important;
    text-decoration: underline !important;
}
html[data-acc-scheme="db"] button,
html[data-acc-scheme="db"] input[type="submit"],
html[data-acc-scheme="db"] .acc-btn,
html[data-acc-scheme="db"] .visibility-toggle {
    background-color: #b8dfff !important;
    color: #063462 !important;
    border: 2px solid #063462 !important;
}
html[data-acc-scheme="db"] .acc-btn.active {
    background-color: #063462 !important;
    color: #9DD1FF !important;
}
html[data-acc-scheme="db"] .acc-reset-btn {
    background-color: #063462 !important;
    color: #9DD1FF !important;
}
html[data-acc-scheme="db"] .accessibility-settings {
    background: #9DD1FF !important;
    border-color: #063462 !important;
}

/* --- Коричневый на бежевом --- */
html[data-acc-scheme="bg"],
html[data-acc-scheme="bg"] body {
    background: #F5E6C8 !important;
    color: #4D3B1A !important;
}
html[data-acc-scheme="bg"] * {
    background-color: transparent !important;
    color: #4D3B1A !important;
    border-color: #4D3B1A !important;
}
html[data-acc-scheme="bg"] a,
html[data-acc-scheme="bg"] a * {
    color: #7B3F00 !important;
    text-decoration: underline !important;
}
html[data-acc-scheme="bg"] button,
html[data-acc-scheme="bg"] input[type="submit"],
html[data-acc-scheme="bg"] .acc-btn,
html[data-acc-scheme="bg"] .visibility-toggle {
    background-color: #eedcba !important;
    color: #4D3B1A !important;
    border: 2px solid #4D3B1A !important;
}
html[data-acc-scheme="bg"] .acc-btn.active {
    background-color: #4D3B1A !important;
    color: #F5E6C8 !important;
}
html[data-acc-scheme="bg"] .acc-reset-btn {
    background-color: #4D3B1A !important;
    color: #F5E6C8 !important;
}
html[data-acc-scheme="bg"] .accessibility-settings {
    background: #F5E6C8 !important;
    border-color: #4D3B1A !important;
}

/* --- Зелёный на тёмном --- */
html[data-acc-scheme="gb"],
html[data-acc-scheme="gb"] body {
    background: #3B3B3B !important;
    color: #A9E44D !important;
}
html[data-acc-scheme="gb"] * {
    background-color: transparent !important;
    color: #A9E44D !important;
    border-color: #A9E44D !important;
}
html[data-acc-scheme="gb"] a,
html[data-acc-scheme="gb"] a * {
    color: #C8FF5D !important;
    text-decoration: underline !important;
}
html[data-acc-scheme="gb"] button,
html[data-acc-scheme="gb"] input[type="submit"],
html[data-acc-scheme="gb"] .acc-btn,
html[data-acc-scheme="gb"] .visibility-toggle {
    background-color: #4a4a4a !important;
    color: #A9E44D !important;
    border: 2px solid #A9E44D !important;
}
html[data-acc-scheme="gb"] .acc-btn.active {
    background-color: #A9E44D !important;
    color: #3B3B3B !important;
}
html[data-acc-scheme="gb"] .acc-reset-btn {
    background-color: #A9E44D !important;
    color: #3B3B3B !important;
}
html[data-acc-scheme="gb"] .accessibility-settings {
    background: #3B3B3B !important;
    border-color: #A9E44D !important;
}

/* ============================================================
   3. ТИП ШРИФТА
   ============================================================ */
html[data-acc-font="arial"],
html[data-acc-font="arial"] * {
    font-family: Arial, Helvetica, sans-serif !important;
}
html[data-acc-font="times"],
html[data-acc-font="times"] * {
    font-family: "Times New Roman", Times, Georgia, serif !important;
}

/* ============================================================
   4. МЕЖБУКВЕННЫЙ ИНТЕРВАЛ
   ============================================================ */
html[data-acc-letterspacing="medium"],
html[data-acc-letterspacing="medium"] * {
    letter-spacing: 2px !important;
}
html[data-acc-letterspacing="large"],
html[data-acc-letterspacing="large"] * {
    letter-spacing: 4px !important;
}

/* ============================================================
   5. МЕЖСТРОЧНЫЙ ИНТЕРВАЛ
   ============================================================ */
html[data-acc-linespacing="medium"],
html[data-acc-linespacing="medium"] * {
    line-height: 1.8 !important;
}
html[data-acc-linespacing="large"],
html[data-acc-linespacing="large"] * {
    line-height: 2.4 !important;
}

/* ============================================================
   6. ИЗОБРАЖЕНИЯ
   ============================================================ */

/* --- Чёрно-белые изображения --- */
html[data-acc-images="grayscale"] img,
html[data-acc-images="grayscale"] picture,
html[data-acc-images="grayscale"] video {
    filter: grayscale(100%) !important;
}
html[data-acc-images="grayscale"] [style*="background-image"] {
    filter: grayscale(100%) !important;
}

/* --- Скрытые изображения --- */
html[data-acc-images="hide"] img,
html[data-acc-images="hide"] picture,
html[data-acc-images="hide"] svg:not(.acc-icon),
html[data-acc-images="hide"] video {
    opacity: 0 !important;
    position: relative !important;
}
/* Заглушка для скрытых изображений — рамка, чтобы было видно что здесь была картинка */
html[data-acc-images="hide"] img,
html[data-acc-images="hide"] picture img,
html[data-acc-images="hide"] video {
    border: 2px dashed #999 !important;
    min-height: 40px !important;
    min-width: 40px !important;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(150,150,150,0.15) 10px,
        rgba(150,150,150,0.15) 20px
    ) !important;
}
html[data-acc-images="hide"] [style*="background-image"] {
    background-image: none !important;
}

/* --- Убираем фоновые изображения при всех цветовых схемах (кроме стандартной) --- */
html[data-acc-scheme="bw"] [style*="background-image"],
html[data-acc-scheme="wb"] [style*="background-image"],
html[data-acc-scheme="db"] [style*="background-image"],
html[data-acc-scheme="bg"] [style*="background-image"],
html[data-acc-scheme="gb"] [style*="background-image"] {
    background-image: none !important;
}

/* ============================================================
   7. МЕЖСЛОВНЫЙ ИНТЕРВАЛ
   ============================================================ */
html[data-acc-wordspacing="medium"],
html[data-acc-wordspacing="medium"] * {
    word-spacing: 4px !important;
}
html[data-acc-wordspacing="large"],
html[data-acc-wordspacing="large"] * {
    word-spacing: 8px !important;
}

/* ============================================================
   8. ВЫДЕЛЕНИЕ ССЫЛОК
   ============================================================ */
html[data-acc-links="underline"] a {
    text-decoration: underline !important;
    text-underline-offset: 3px !important;
}
html[data-acc-links="underline"] a:hover,
html[data-acc-links="underline"] a:focus {
    text-decoration-thickness: 3px !important;
}

/* ============================================================
   9. УВЕЛИЧЕННЫЙ КУРСОР
   ============================================================ */
html[data-acc-cursor="large"],
html[data-acc-cursor="large"] * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cpath d='M5 1L5 28L12 20L20 20Z' fill='black' stroke='white' stroke-width='2'/%3E%3C/svg%3E") 5 1, auto !important;
}
html[data-acc-cursor="large"] a,
html[data-acc-cursor="large"] button,
html[data-acc-cursor="large"] [role="button"],
html[data-acc-cursor="large"] input[type="submit"],
html[data-acc-cursor="large"] select,
html[data-acc-cursor="large"] label {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cpath d='M3 6C3 6 9 1 16 1C23 1 29 6 29 6L29 10C29 10 23 16 16 16C9 16 3 10 3 10Z' fill='white' stroke='black' stroke-width='2'/%3E%3Ccircle cx='16' cy='8' r='4' fill='black'/%3E%3Cpath d='M6 22L26 22' stroke='black' stroke-width='3'/%3E%3C/svg%3E") 16 16, pointer !important;
}
html[data-acc-cursor="large"] input[type="text"],
html[data-acc-cursor="large"] input[type="email"],
html[data-acc-cursor="large"] input[type="search"],
html[data-acc-cursor="large"] input[type="password"],
html[data-acc-cursor="large"] textarea {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cline x1='16' y1='2' x2='16' y2='30' stroke='black' stroke-width='3'/%3E%3Cline x1='10' y1='2' x2='22' y2='2' stroke='black' stroke-width='3'/%3E%3Cline x1='10' y1='30' x2='22' y2='30' stroke='black' stroke-width='3'/%3E%3C/svg%3E") 16 16, text !important;
}

/* ============================================================
   10. ВИДИМЫЕ ФОКУСНЫЕ РАМКИ (клавиатурная навигация)
   ============================================================ */
*:focus-visible {
    outline: 3px solid #005fcc !important;
    outline-offset: 2px !important;
}
/* Более контрастный фокус для тёмных схем */
html[data-acc-scheme="wb"] *:focus-visible,
html[data-acc-scheme="gb"] *:focus-visible {
    outline-color: #ffdd00 !important;
}
html[data-acc-scheme="db"] *:focus-visible {
    outline-color: #063462 !important;
}
html[data-acc-scheme="bg"] *:focus-visible {
    outline-color: #4D3B1A !important;
}

/* ============================================================
   11. ССЫЛКА «ПЕРЕЙТИ К СОДЕРЖИМОМУ» (Skip to content)
   ============================================================ */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 10px;
    z-index: 100000;
    padding: 12px 20px;
    background: #005fcc;
    color: #fff !important;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    border-radius: 0 0 6px 6px;
    transition: top 0.2s;
    font-family: Arial, sans-serif;
}
.skip-to-content:focus {
    top: 0;
    outline: 3px solid #ffdd00;
    outline-offset: 2px;
}

/* ============================================================
   12. АДАПТИВНОСТЬ ПАНЕЛИ
   ============================================================ */
@media (max-width: 480px) {
    .accessibility-settings {
        width: calc(100vw - 24px);
        right: -4px;
    }

    .accessibility-panel {
        right: 6px;
    }

    .visibility-toggle span.acc-label {
        display: none;
    }
}

