/* ============================================================
   Accessibility — версия для слабовидящих (ГОСТ Р 52872-2019)
   ============================================================ */

/* ── 1. Плавающая кнопка (всегда видна) ─────────────────── */
.a11y-trigger {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 99998;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    background: #0d1f3c;
    color: #fff;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 999px;
    font-family: 'Inter', 'Segoe UI', system-ui, Arial, sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 22px rgba(13,31,60,.35);
    transition: transform .18s, box-shadow .18s, background .18s;
    -webkit-font-smoothing: antialiased;
}
.a11y-trigger:hover  { background: #152d5e; transform: translateY(-1px); box-shadow: 0 10px 28px rgba(13,31,60,.45); }
.a11y-trigger:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.a11y-trigger__icon  { flex-shrink: 0; color: #93c5fd; }
.a11y-trigger__text  { white-space: nowrap; }

/* На планшетах/узких десктопах прячем текст и уезжаем в правый НИЖНИЙ угол —
   в шапке темы слева логотип, справа бургер, оба угла сверху заняты. */
@media (max-width: 1100px) {
    .a11y-trigger__text { display: none; }
    .a11y-trigger {
        top: auto;
        right: 14px;
        bottom: 14px;
        padding: 9px;
        width: 44px;
        height: 44px;
        justify-content: center;
    }
}
@media (max-width: 520px) {
    .a11y-trigger {
        right: 10px;
        bottom: 10px;
        width: 42px;
        height: 42px;
    }
}

/* Кнопкой-триггером управляет JS: прячется, пока панель открыта,
   возвращается, когда панель свёрнута крестиком (режим остаётся включён). */
.a11y-trigger.is-hidden { display: none !important; }

/* ── 2. Панель настроек ─────────────────────────────────── */
.a11y-panel {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 99999;
    background: #ffffff;
    border-bottom: 2px solid #0d1f3c;
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    font-family: 'Inter', 'Segoe UI', system-ui, Arial, sans-serif;
    color: #111827;
    transform: translateY(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.a11y-panel[aria-hidden="false"],
.a11y-panel.is-open {
    transform: translateY(0);
}
.a11y-panel:not([hidden]) { display: block; }

.a11y-panel__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 56px 18px 24px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px 28px;
    align-items: center;
}

/* Крестик «свернуть панель» */
.a11y-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1.5px solid rgba(17,24,39,.18);
    border-radius: 8px;
    color: #111827;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.a11y-close:hover { background: #f5f7fc; border-color: #0d1f3c; }
.a11y-close:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }

.a11y-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.a11y-row__label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #6b7280;
}
.a11y-row__controls {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* кнопки в панели */
.a11y-btn,
.a11y-swatch {
    min-width: 38px;
    min-height: 38px;
    padding: 8px 12px;
    background: #f5f7fc;
    border: 1.5px solid transparent;
    border-radius: 8px;
    font: 600 13px/1 'Inter', system-ui, Arial, sans-serif;
    color: #111827;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.a11y-btn:hover,
.a11y-swatch:hover { background: #eef2fb; }
.a11y-btn:focus-visible,
.a11y-swatch:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.a11y-btn[aria-pressed="true"],
.a11y-swatch[aria-pressed="true"] {
    background: #0d1f3c;
    color: #fff;
    border-color: #0d1f3c;
}
.a11y-btn--lg { font-size: 16px; }
.a11y-btn--xl { font-size: 20px; }
.a11y-btn--font-serif { font-family: Georgia, 'Times New Roman', serif; }

.a11y-swatch--bw    { background: #fff;    color: #000;    border-color: #111827; }
.a11y-swatch--wb    { background: #000;    color: #fff;    border-color: #000; }
.a11y-swatch--blue  { background: #9DD1FF; color: #063462; border-color: #063462; }
.a11y-swatch--beige { background: #F7F3D6; color: #4D4B43; border-color: #4D4B43; }

.a11y-swatch[aria-pressed="true"] { box-shadow: inset 0 0 0 3px #fff, 0 0 0 2px #0d1f3c; }

/* действия справа/в конце */
.a11y-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 6px;
    border-top: 1px solid rgba(17,24,39,.08);
}
.a11y-action {
    padding: 10px 18px;
    background: #f5f7fc;
    border: 1.5px solid rgba(17,24,39,.12);
    border-radius: 8px;
    font: 600 13px 'Inter', system-ui, Arial, sans-serif;
    color: #111827;
    cursor: pointer;
    transition: all .15s;
}
.a11y-action:hover { background: #eef2fb; }
.a11y-action:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.a11y-action--primary { background: #0d1f3c; color: #fff; border-color: #0d1f3c; }
.a11y-action--primary:hover { background: #152d5e; }

/* ============================================================
   3. РЕЖИМ СЛАБОВИДЯЩИХ — применяется на <html class="a11y-on">
   Стили перебивают тему через !important (по ГОСТ — приоритет читаемости).
   ============================================================ */

html.a11y-on { padding-top: 0 !important; }
html.a11y-on body { padding-top: 110px !important; }

/* убираем декоративные фоны/анимации/градиенты темы — мешают читаемости */
html.a11y-on body,
html.a11y-on body.home {
    background: var(--a11y-bg) !important;
    background-image: none !important;
    color: var(--a11y-fg) !important;
    font-family: var(--a11y-font, Arial, sans-serif) !important;
    -webkit-font-smoothing: auto !important;
}
html.a11y-on *,
html.a11y-on *::before,
html.a11y-on *::after {
    text-shadow: none !important;
    box-shadow: none !important;
    animation: none !important;
    transition: none !important;
}
html.a11y-on .gp-hero::before,
html.a11y-on .gp-hero::after,
html.a11y-on .gp2-blob,
html.a11y-on .gp2-hero-mesh,
html.a11y-on .gp2-hero-dots,
html.a11y-on .gp-hero-ring,
html.a11y-on [aria-hidden="true"][class*="blob"],
html.a11y-on [aria-hidden="true"][class*="mesh"],
html.a11y-on [aria-hidden="true"][class*="dots"],
html.a11y-on [aria-hidden="true"][class*="ring"] {
    display: none !important;
}

/* всё цветное приводим к выбранной паре */
html.a11y-on,
html.a11y-on body,
html.a11y-on main,
html.a11y-on header,
html.a11y-on footer,
html.a11y-on aside,
html.a11y-on section,
html.a11y-on article,
html.a11y-on nav,
html.a11y-on div,
html.a11y-on p,
html.a11y-on h1, html.a11y-on h2, html.a11y-on h3,
html.a11y-on h4, html.a11y-on h5, html.a11y-on h6,
html.a11y-on li,
html.a11y-on span,
html.a11y-on td, html.a11y-on th,
html.a11y-on blockquote,
html.a11y-on label,
html.a11y-on figcaption {
    background-color: transparent !important;
    color: var(--a11y-fg) !important;
    border-color: var(--a11y-fg) !important;
}
html.a11y-on a,
html.a11y-on a:visited {
    color: var(--a11y-link) !important;
    text-decoration: underline !important;
}
html.a11y-on a:hover,
html.a11y-on a:focus {
    background: var(--a11y-fg) !important;
    color: var(--a11y-bg) !important;
}

/* контейнеры — фон базовый, чёткая рамка */
html.a11y-on .gp-hero,
html.a11y-on .gp2-hero,
html.a11y-on .gp-news-section,
html.a11y-on .gp-top-layout,
html.a11y-on .gp-links-section,
html.a11y-on article,
html.a11y-on .widget,
html.a11y-on .container,
html.a11y-on .site-header,
html.a11y-on .site-footer {
    background: var(--a11y-bg) !important;
    border: 1px solid var(--a11y-fg) !important;
    border-radius: 0 !important;
    color: var(--a11y-fg) !important;
}

/* кнопки/инпуты */
html.a11y-on button:not(.a11y-btn):not(.a11y-swatch):not(.a11y-action):not(.a11y-trigger),
html.a11y-on input[type="submit"],
html.a11y-on input[type="button"],
html.a11y-on .btn,
html.a11y-on .button {
    background: var(--a11y-fg) !important;
    color: var(--a11y-bg) !important;
    border: 2px solid var(--a11y-fg) !important;
    border-radius: 0 !important;
    padding: 8px 16px !important;
}
html.a11y-on input[type="text"],
html.a11y-on input[type="search"],
html.a11y-on input[type="email"],
html.a11y-on textarea,
html.a11y-on select {
    background: var(--a11y-bg) !important;
    color: var(--a11y-fg) !important;
    border: 2px solid var(--a11y-fg) !important;
    border-radius: 0 !important;
    font-family: inherit !important;
}

/* ── 3.1 Размеры шрифта ─────────────────────────────────── */
html.a11y-on                              { font-size: 18px !important; }
html.a11y-on[data-a11y-size="large"]      { font-size: 22px !important; }
html.a11y-on[data-a11y-size="xlarge"]     { font-size: 26px !important; }
html.a11y-on p,
html.a11y-on li,
html.a11y-on td,
html.a11y-on a,
html.a11y-on span,
html.a11y-on label { font-size: 1rem !important; line-height: 1.6 !important; }
html.a11y-on h1 { font-size: 1.75rem !important; line-height: 1.3 !important; }
html.a11y-on h2 { font-size: 1.5rem !important;  line-height: 1.3 !important; }
html.a11y-on h3 { font-size: 1.3rem !important;  line-height: 1.3 !important; }
html.a11y-on h4 { font-size: 1.15rem !important; line-height: 1.3 !important; }

/* ── 3.2 Семейство шрифта ───────────────────────────────── */
html.a11y-on                              { --a11y-font: Arial, sans-serif; }
html.a11y-on[data-a11y-font="serif"]      { --a11y-font: Georgia, 'Times New Roman', serif; }

/* ── 3.3 Межбуквенный интервал ──────────────────────────── */
html.a11y-on                              { letter-spacing: normal !important; }
html.a11y-on[data-a11y-spacing="medium"]  { letter-spacing: .08em !important; }
html.a11y-on[data-a11y-spacing="large"]   { letter-spacing: .15em !important; word-spacing: .1em !important; }
html.a11y-on[data-a11y-spacing="medium"] *,
html.a11y-on[data-a11y-spacing="large"] *  { letter-spacing: inherit !important; }

/* ── 3.4 Цветовые схемы (по ГОСТ) ───────────────────────── */
/* Чёрным по белому — по умолчанию */
html.a11y-on,
html.a11y-on[data-a11y-scheme="bw"] {
    --a11y-bg:   #ffffff;
    --a11y-fg:   #000000;
    --a11y-link: #0000ee;
}
/* Белым по чёрному */
html.a11y-on[data-a11y-scheme="wb"] {
    --a11y-bg:   #000000;
    --a11y-fg:   #ffffff;
    --a11y-link: #ffe900;
}
/* Синим по голубому */
html.a11y-on[data-a11y-scheme="blue"] {
    --a11y-bg:   #9DD1FF;
    --a11y-fg:   #063462;
    --a11y-link: #003580;
}
/* Коричневым по бежевому */
html.a11y-on[data-a11y-scheme="beige"] {
    --a11y-bg:   #F7F3D6;
    --a11y-fg:   #4D4B43;
    --a11y-link: #5a3e1b;
}

/* ── 3.5 Изображения ─────────────────────────────────────── */
html.a11y-on[data-a11y-images="off"] img,
html.a11y-on[data-a11y-images="off"] picture,
html.a11y-on[data-a11y-images="off"] svg:not(.a11y-trigger__icon):not(.a11y-row svg) {
    display: none !important;
}
html.a11y-on[data-a11y-images="off"] [style*="background-image"] {
    background-image: none !important;
}
/* Фоновые картинки темы — отключаем */
html.a11y-on[data-a11y-images="off"] .gp-hero,
html.a11y-on[data-a11y-images="off"] .gp2-hero {
    background: var(--a11y-bg) !important;
}

/* ── 3.6 Панель в режиме — наследует тему режима ────────── */
html.a11y-on .a11y-panel {
    background: var(--a11y-bg) !important;
    color: var(--a11y-fg) !important;
    border-bottom: 2px solid var(--a11y-fg) !important;
}
html.a11y-on .a11y-panel .a11y-row__label { color: var(--a11y-fg) !important; opacity: .8; }
html.a11y-on .a11y-panel .a11y-btn,
html.a11y-on .a11y-panel .a11y-action {
    background: var(--a11y-bg) !important;
    color: var(--a11y-fg) !important;
    border: 2px solid var(--a11y-fg) !important;
}
html.a11y-on .a11y-panel .a11y-btn[aria-pressed="true"],
html.a11y-on .a11y-panel .a11y-action--primary {
    background: var(--a11y-fg) !important;
    color: var(--a11y-bg) !important;
}
html.a11y-on .a11y-panel .a11y-close {
    background: var(--a11y-bg) !important;
    color: var(--a11y-fg) !important;
    border: 2px solid var(--a11y-fg) !important;
}

/* ============================================================
   4. ИСКЛЮЧЕНИЯ — баннеры/виджеты/попапы/iframe'ы не трогаем
   В режиме слабовидящих эти контейнеры остаются как есть, чтобы
   сохранить работоспособность встроенных виджетов (Госуслуги
   "Решаем вместе", iframe'ы, слайдеры, бегущие строки и т.п.).
   ============================================================ */

/* Класс-маркер: всё, что внутри a11y-keep, не получает правил режима */
html.a11y-on .a11y-keep,
html.a11y-on .a11y-keep *,
html.a11y-on .a11y-keep *::before,
html.a11y-on .a11y-keep *::after,
/* Госуслуги «Решаем вместе» */
html.a11y-on #js-show-iframe-wrapper,
html.a11y-on #js-show-iframe-wrapper *,
html.a11y-on [class*="pos-banner"],
html.a11y-on [class*="pos-banner"] *,
html.a11y-on [class*="bf-1"],
html.a11y-on [class*="bf-1"] *,
/* iframe и его контейнеры — не трогаем */
html.a11y-on iframe,
html.a11y-on iframe *,
/* стандартные классы попапов/модалок/тостов */
html.a11y-on [role="dialog"],
html.a11y-on [role="dialog"] *,
html.a11y-on [class*="modal"]:not(.a11y-panel),
html.a11y-on [class*="modal"]:not(.a11y-panel) *,
html.a11y-on [class*="popup"],
html.a11y-on [class*="popup"] *,
html.a11y-on [class*="tooltip"],
html.a11y-on [class*="tooltip"] *,
/* слайдеры темы */
html.a11y-on .bx-wrapper,
html.a11y-on .bx-wrapper *,
html.a11y-on [class*="slider"],
html.a11y-on [class*="slider"] *,
html.a11y-on [class*="carousel"],
html.a11y-on [class*="carousel"] *,
/* бегущая строка */
html.a11y-on [class*="ticker"],
html.a11y-on [class*="ticker"] * {
    background-color: revert !important;
    background-image: revert !important;
    background: revert !important;
    color: revert !important;
    border: revert !important;
    border-radius: revert !important;
    font-family: revert !important;
    font-size: revert !important;
    letter-spacing: revert !important;
    line-height: revert !important;
    padding: revert !important;
    text-decoration: revert !important;
    box-shadow: revert !important;
    text-shadow: revert !important;
    animation: revert !important;
    transition: revert !important;
}

/* Внешние баннеры-картинки на главной — оставляем как есть,
   чтобы рамка/радиус/тень темы не превращались в "квадрат с серой обводкой". */
html.a11y-on .gp-ext-banners-grid,
html.a11y-on .gp-ext-banners-grid *,
html.a11y-on .gp-ext-banner-item,
html.a11y-on .gp-ext-banner-item * {
    background: revert !important;
    color: revert !important;
    border: revert !important;
    border-radius: revert !important;
    box-shadow: revert !important;
}

/* печать — не показываем плагин */
@media print {
    .a11y-trigger, .a11y-panel { display: none !important; }
}
