/*
 * Версия для слабовидящих (ГОСТ Р 52872-2019).
 * Разделы: 1 — видно всем; 2 — схемы и размеры; 3 — общие правила режима; 4 — панель; 5 — адаптация под сайт.
 * Разделы 1–4 не зависят от вёрстки сайта. При смене вёрстки править только раздел 5.
 */

/* ===== 1. Кнопка включения и ссылка пропуска — видны в обычной версии ===== */

.a11y-skip {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 100000;
    box-sizing: border-box;
    max-width: calc(100vw - 16px);
    padding: 12px 16px;
    background: #000;
    color: #fff;
    font-size: 18px;
    text-decoration: underline;
    transform: translateY(-200%);
}

.a11y-skip:focus {
    transform: none;
    outline: 3px solid #fff;
    outline-offset: -6px;
}

.a11y-open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #0f172a;
    cursor: pointer;
}

.a11y-open:hover {
    background: rgba(15, 23, 42, 0.08);
}

.a11y-open:focus-visible {
    outline: 3px solid #0f172a;
    outline-offset: 2px;
}

.a11y-open--floating {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 9000;
    background: #fff;
    border: 2px solid #0f172a;
}

.a11y-panel[hidden],
.a11y-panel__body[hidden] {
    display: none !important;
}

/* ===== 2. Цветовые схемы, размеры, интервалы, шрифты ===== */

html.a11y {
    --a11y-fg: #000;
    --a11y-bg: #fff;
    --a11y-fs: 24px;
    --a11y-lh: 1.5;
    --a11y-ls: 0.02em;
    --a11y-ws: 0.05em;
    --a11y-para: 1em;
    --a11y-font: Arial, "Helvetica Neue", Roboto, sans-serif;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html.a11y[data-a11y-scheme="wb"] { --a11y-fg: #fff; --a11y-bg: #000; }
html.a11y[data-a11y-scheme="blue"] { --a11y-fg: #063462; --a11y-bg: #9dd1ff; }
html.a11y[data-a11y-scheme="brown"] { --a11y-fg: #4d4b43; --a11y-bg: #f7f3d6; }
html.a11y[data-a11y-scheme="green"] { --a11y-fg: #a9e44d; --a11y-bg: #3b2716; }

html.a11y[data-a11y-size="20"] { --a11y-fs: 20px; }
html.a11y[data-a11y-size="24"] { --a11y-fs: 24px; }
html.a11y[data-a11y-size="32"] { --a11y-fs: 32px; }

html.a11y[data-a11y-spacing="wide"] { --a11y-lh: 1.75; --a11y-ls: 0.12em; --a11y-ws: 0.16em; --a11y-para: 2em; }
html.a11y[data-a11y-spacing="wider"] { --a11y-lh: 2; --a11y-ls: 0.2em; --a11y-ws: 0.3em; --a11y-para: 2em; }

html.a11y[data-a11y-font="serif"] { --a11y-font: Georgia, "Times New Roman", "Noto Serif", serif; }

/* ===== 3. Общие правила режима ===== */

html.a11y,
html.a11y body {
    background: var(--a11y-bg) !important;
    color: var(--a11y-fg) !important;
}

/* :where() держит специфичность низкой, чтобы панель и адаптер ниже могли это переопределять. */
html.a11y body :where(*:not(svg, svg *, ymaps, ymaps *, iframe, video, script, style)) {
    background-color: var(--a11y-bg) !important;
    background-image: none !important;
    color: var(--a11y-fg) !important;
    border-color: var(--a11y-fg) !important;
    box-shadow: none !important;
    text-shadow: none !important;
    filter: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    font-family: var(--a11y-font) !important;
    font-size: var(--a11y-fs) !important;
    font-weight: 400 !important;
    font-style: normal !important;
    line-height: var(--a11y-lh) !important;
    letter-spacing: var(--a11y-ls) !important;
    word-spacing: var(--a11y-ws) !important;
    text-align: left !important;
    text-transform: none !important;
    text-overflow: clip !important;
    white-space: normal;
    overflow-wrap: anywhere;
    -webkit-hyphens: auto;
    hyphens: auto;
    min-width: 0;
    max-width: 100%;
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
    -webkit-line-clamp: none !important;
    /* Любая сетка становится одной колонкой, строки переносятся: так крупный текст умещается на 320 px (п. 1.4.10). */
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: none !important;
    grid-template-areas: none !important;
    grid-column: auto !important;
    grid-row: auto !important;
    flex-wrap: wrap !important;
}

/* Высота содержимого определяется текстом: при увеличении он не обрезается (п. 1.4.4). */
html.a11y body :where(main, .site-footer-area) :where(*:not(svg, svg *, ymaps, ymaps *, iframe, video, img)) {
    height: auto !important;
    max-height: none !important;
    min-height: 0;
    overflow: visible !important;
    opacity: 1 !important;
}

html.a11y body :where(h1) { font-size: calc(var(--a11y-fs) * 1.4) !important; font-weight: 700 !important; }
html.a11y body :where(h2) { font-size: calc(var(--a11y-fs) * 1.25) !important; font-weight: 700 !important; }
html.a11y body :where(h3) { font-size: calc(var(--a11y-fs) * 1.1) !important; font-weight: 700 !important; }
html.a11y body :where(h4, h5, h6, b, strong, th, legend) { font-weight: 700 !important; }
html.a11y body :where(em, i) { font-style: italic !important; }

html.a11y body :where(p, ul, ol, table, blockquote) {
    margin-top: 0 !important;
    margin-bottom: var(--a11y-para) !important;
}

html.a11y body :where(p, li, blockquote) { max-width: 70ch; }

html.a11y body :where(a) { text-decoration: underline !important; }

html.a11y body :where(a:hover, button:hover, summary:hover) {
    background-color: var(--a11y-fg) !important;
    color: var(--a11y-bg) !important;
}

html.a11y body :where(a:hover *, button:hover *) {
    background-color: transparent !important;
    color: inherit !important;
}

html.a11y body :where(a, button, summary, input, select, textarea, [tabindex="0"]):focus-visible {
    outline: 4px solid var(--a11y-fg) !important;
    outline-offset: 3px !important;
}

html.a11y body :where(button, select, input:not([type="radio"], [type="checkbox"], [type="hidden"]), textarea) {
    min-height: 48px;
    padding: 8px 12px !important;
    border: 2px solid var(--a11y-fg) !important;
    border-radius: 0 !important;
    width: 100%;
    box-sizing: border-box;
}

html.a11y body :where(button) {
    width: auto;
    cursor: pointer;
}

html.a11y body :where(input, textarea)::placeholder {
    color: var(--a11y-fg) !important;
    opacity: 1 !important;
}

html.a11y body :where(img, video, iframe, canvas, svg) { max-width: 100%; }
html.a11y body :where(img) { height: auto; }

html.a11y body :where(main, .site-footer-area) :where(img) {
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 60vh !important;
    object-fit: contain !important;
    border-radius: 0 !important;
}

html.a11y[data-a11y-images="gray"] body :where(img, video, iframe, canvas) {
    filter: grayscale(1) !important;
}

html.a11y[data-a11y-images="off"] body :where(img, video, picture, canvas) {
    display: none !important;
}

html.a11y .a11y-alt {
    display: block;
    padding: 8px 12px;
    border: 2px dashed var(--a11y-fg) !important;
}

html.a11y .a11y-table-scroll {
    display: block;
    width: 100%;
    overflow-x: auto !important;
    margin-bottom: var(--a11y-para);
}

html.a11y .a11y-table-scroll table {
    width: auto;
    max-width: none;
    min-width: calc(var(--a11y-fs) * 30);
}

html.a11y body :where(td, th) {
    padding: 8px !important;
    border: 1px solid var(--a11y-fg) !important;
    overflow-wrap: break-word;
}

html.a11y .a11y-open--floating { display: none; }
html.a11y .a11y-skip { max-width: calc(100vw - 16px); }

/* ===== 4. Панель настроек ===== */

html.a11y .a11y-panel {
    display: block;
    order: -1;
    flex: 0 0 auto;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 16px;
    border-bottom: 4px solid var(--a11y-fg);
}

html.a11y .a11y-panel * {
    font-size: 20px !important;
    line-height: 1.3 !important;
    letter-spacing: 0 !important;
    word-spacing: 0 !important;
    hyphens: manual;
    -webkit-hyphens: manual;
    overflow-wrap: break-word;
}

html.a11y .a11y-panel__bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

html.a11y .a11y-panel__bar button,
html.a11y .a11y-panel__reset {
    flex: 1 1 200px;
    width: auto;
    min-height: 48px;
    font-weight: 700 !important;
    text-align: center !important;
}

html.a11y .a11y-panel__body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)) !important;
    gap: 12px 24px;
    margin-top: 12px;
}

html.a11y .a11y-group {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

html.a11y .a11y-group legend {
    padding: 0 0 6px;
    font-weight: 700 !important;
}

html.a11y .a11y-option {
    position: relative;
    display: block;
    margin-bottom: 6px;
    cursor: pointer;
}

html.a11y .a11y-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
}

html.a11y .a11y-option span {
    display: flex;
    align-items: center;
    box-sizing: border-box;
    min-height: 48px;
    padding: 6px 12px 6px 44px;
    position: relative;
    border: 2px solid var(--a11y-fg);
}

/* Выбранный вариант отмечен кружком, а не только цветом (п. 1.4.1). */
html.a11y .a11y-option span::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 50%;
    width: 22px;
    height: 22px;
    margin-top: -11px;
    box-sizing: border-box;
    border: 2px solid currentColor;
    border-radius: 50%;
}

html.a11y .a11y-option input:checked + span {
    border-width: 4px;
    font-weight: 700 !important;
}

html.a11y .a11y-option input:checked + span::before {
    background: radial-gradient(circle, currentColor 0 5px, transparent 6px);
}

html.a11y .a11y-option input:focus-visible + span {
    outline: 4px solid var(--a11y-fg);
    outline-offset: 2px;
}

html.a11y .a11y-panel .a11y-option--bw span { background-color: #fff !important; color: #000 !important; border-color: #000 !important; }
html.a11y .a11y-panel .a11y-option--wb span { background-color: #000 !important; color: #fff !important; border-color: #fff !important; }
html.a11y .a11y-panel .a11y-option--blue span { background-color: #9dd1ff !important; color: #063462 !important; border-color: #063462 !important; }
html.a11y .a11y-panel .a11y-option--brown span { background-color: #f7f3d6 !important; color: #4d4b43 !important; border-color: #4d4b43 !important; }
html.a11y .a11y-panel .a11y-option--green span { background-color: #3b2716 !important; color: #a9e44d !important; border-color: #a9e44d !important; }

html.a11y .a11y-panel__reset { align-self: start; }

/* ===== 5. Адаптация под вёрстку сайта ===== */

/* Кнопка в шапке обычной версии: на узких экранах блок действий сайта скрыт, поэтому показываем только кнопку. */
html:not(.a11y) .a11y-mount { gap: 8px; }
html:not(.a11y) .a11y-mount .a11y-open { position: relative; z-index: 1; }
html:not(.a11y) .header-inner:has(.a11y-mount) .header-brand { min-width: 0; }

@media (max-width: 1200px) {
    html:not(.a11y) .header-inner:has(.a11y-mount) { grid-template-columns: auto 1fr auto; }
    html:not(.a11y) .a11y-mount { display: flex !important; align-items: center; margin-right: 8px; }
    html:not(.a11y) .a11y-mount .header-search-btn { display: none; }
}

@media (max-width: 420px) {
    html:not(.a11y) .a11y-mount { margin-right: 2px; }
    html:not(.a11y) .a11y-mount .a11y-open { width: 44px; }
    html:not(.a11y) .header-inner:has(.a11y-mount) { gap: 2px; }
}

/* Шапка: в обычном потоке страницы, меню — всегда через бургер (выпадающие меню не вмещают крупный текст). */
html.a11y .site-header {
    position: static !important;
    transform: none !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border-width: 0 0 2px !important;
    border-style: solid !important;
}

html.a11y .header-inner {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    min-height: 0;
}

html.a11y .header-brand {
    display: flex;
    flex: 1 1 240px;
    align-items: center;
    gap: 12px;
    margin: 0;
    text-decoration: none !important;
}

html.a11y .header-crest {
    position: static !important;
    transform: none !important;
    width: auto !important;
    height: 56px !important;
    margin: 0 !important;
}

html.a11y .header-title {
    display: block;
    flex: 1 1 160px;
    padding: 0 !important;
}

html.a11y .header-title br { display: none; }

html.a11y .menu,
html.a11y .header-actions,
html.a11y .header-search-panel,
html.a11y .mobile-menu-backdrop,
html.a11y .site-footer-banner,
html.a11y .hero-slider-logo,
html.a11y .hero-loading,
html.a11y .slider-thumbs { display: none !important; }

html.a11y .burger {
    display: inline-flex !important;
    flex: 0 0 56px;
    flex-direction: column;
    flex-wrap: nowrap !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 56px !important;
    height: 56px !important;
    margin: 0 !important;
    padding: 0 !important;
}

html.a11y .burger span {
    display: block;
    position: static;
    width: 28px;
    height: 3px;
    margin: 0;
    transform: none;
    background-color: currentColor !important;
}

html.a11y .burger:hover span { background-color: var(--a11y-bg) !important; }

html.a11y .mobile-menu {
    width: 100% !important;
    max-width: none !important;
    height: 100vh;
    height: 100dvh;
    box-sizing: border-box;
    overflow-y: auto !important;
    overscroll-behavior: contain;
}

html.a11y .mobile-menu-close {
    display: block;
    width: 56px !important;
    height: 56px !important;
    padding: 0 !important;
    font-size: 0 !important;
    color: var(--a11y-fg) !important;
}

html.a11y .mobile-menu-close::before,
html.a11y .mobile-menu-close::after {
    width: 30px;
    height: 3px;
    background: var(--a11y-fg);
}

html.a11y .mobile-menu-search-form {
    display: flex;
    gap: 8px;
}

html.a11y .mobile-menu-nav ul { display: block; padding: 0; margin: 0 !important; list-style: none; }
html.a11y .mobile-menu-nav li { position: relative; display: block; padding: 0; margin: 0 0 4px; max-width: none; }
html.a11y .mobile-menu-nav li.has-children > .menu-node { margin-right: 60px; }
html.a11y .mobile-menu-nav li > ul { display: none; padding-left: 12px; border-left: 2px solid var(--a11y-fg); }
html.a11y .mobile-menu-nav li.expanded > ul { display: block; }

html.a11y .mobile-menu-nav .menu-node {
    display: block;
    padding: 8px 0 !important;
    min-height: 48px;
    box-sizing: border-box;
}

html.a11y .mobile-menu-nav .menu-toggle {
    position: absolute !important;
    top: 0;
    right: 0;
    left: auto !important;
    width: 52px !important;
    height: 52px !important;
    padding: 0 !important;
}

html.a11y .mobile-menu-nav .menu-toggle::before {
    content: "+";
    display: block;
    text-align: center;
    font-size: 32px;
    line-height: 1;
}

html.a11y .mobile-menu-nav li.expanded > .menu-toggle::before { content: "\2212"; }

/* Служебное объявление сайта на псевдоэлементе body::before */
html.a11y body::before {
    display: block !important;
    position: static !important;
    transform: none !important;
    width: auto !important;
    max-width: none !important;
    padding: 8px 16px !important;
    border: 0 !important;
    border-bottom: 2px solid var(--a11y-fg) !important;
    border-radius: 0 !important;
    background: var(--a11y-bg) !important;
    color: var(--a11y-fg) !important;
    font-family: var(--a11y-font) !important;
    font-size: var(--a11y-fs) !important;
    line-height: var(--a11y-lh) !important;
    text-align: left !important;
}

html.a11y body.inner-page { padding-top: 0 !important; }

html.a11y .container,
html.a11y .wrap {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
    box-sizing: border-box;
}

html.a11y .card,
html.a11y .section {
    margin-top: 0 !important;
    padding-top: 16px !important;
    padding-bottom: 16px !important;
}

/* Главный слайдер: без смены слайдов, все слайды списком (п. 2.2.2). */
html.a11y .hero-slider {
    width: 100% !important;
    margin: 0 !important;
    padding: 16px;
    box-sizing: border-box;
    aspect-ratio: auto !important;
    border-radius: 0 !important;
}

html.a11y .hero-slider-track { display: block; }

html.a11y .hero-slide {
    display: block !important;
    position: static !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    margin-bottom: 12px;
}

html.a11y .hero-slide img { display: block; max-height: 50vh !important; }

/* Slick: остановленный слайдер превращается в обычный список. */
html.a11y .slick-list {
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
}

html.a11y .slick-track {
    display: block !important;
    width: auto !important;
    height: auto !important;
    transform: none !important;
    opacity: 1 !important;
}

html.a11y .slick-slide {
    display: block !important;
    float: none !important;
    width: auto !important;
    height: auto !important;
    opacity: 1 !important;
    position: static !important;
    left: auto !important;
    margin: 0 0 12px !important;
}

html.a11y .slick-cloned,
html.a11y .slick-arrow,
html.a11y .slick-dots { display: none !important; }

html.a11y .slider,
html.a11y .slick-slider { padding: 0 !important; margin: 0 !important; list-style: none; }

html.a11y .home-links-slider { opacity: 1 !important; }

html.a11y .home-links-slide-inner {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border: 2px solid var(--a11y-fg);
    border-radius: 0 !important;
}

html.a11y .home-links-slide-image {
    position: static !important;
    flex: 0 0 auto;
    max-height: 64px !important;
    max-width: 100% !important;
}

html.a11y .home-links-slide-label { position: static !important; }

/* Календарь анонсов */
html.a11y .calendar-bar,
html.a11y .calendar-dates {
    display: flex;
    flex-wrap: wrap !important;
    gap: 8px;
    transform: none !important;
}

html.a11y .calendar-date {
    flex: 0 0 auto;
    min-width: 96px;
    min-height: 48px;
}

/* Общие правила снимают прозрачность и обрезку: то, что сайт скрывает этими способами намеренно, возвращаем здесь. */
html.a11y .map-area-go:not(.is-visible) { display: none !important; }

html.a11y .map-area-go.is-visible {
    width: 56px;
    min-width: 56px;
    height: 56px !important;
    margin: 8px 0 0;
    transform: none;
    text-decoration: none !important;
}

html.a11y .map-picker-label {
    position: static;
    display: block;
    width: auto;
    height: auto;
    margin: 0 0 4px;
    clip: auto;
}

html.a11y .administration-modal-position { opacity: 1 !important; }

/* Недоступные элементы отличаются начертанием, а не только бледностью (п. 1.4.1). */
html.a11y .calendar-date.disabled,
html.a11y .pagination a.disabled,
html.a11y .section-pagination a.disabled { text-decoration: line-through !important; }

/* Карта: фиксированная высота и чистая отрисовка — двумерный контент, исключение п. 1.4.10. */
html.a11y .city-map-wrap { height: auto !important; }

html.a11y .city-map {
    width: 100% !important;
    height: 60vh !important;
    overflow: hidden !important;
}

/* Таблица документов: карточками при любой ширине, подписи ячеек уже есть в data-label. */
html.a11y .docs-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden !important;
    clip-path: inset(50%);
}

html.a11y .docs-table,
html.a11y .docs-table tbody,
html.a11y .docs-table tr,
html.a11y .docs-table td {
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
}

html.a11y .docs-table tr {
    margin-bottom: 16px;
    border: 2px solid var(--a11y-fg);
}

html.a11y .docs-table td { border-width: 0 0 1px !important; }

html.a11y .docs-table td::before {
    content: attr(data-label);
    display: block;
    font-weight: 700;
    color: var(--a11y-fg);
    background: none;
}

html.a11y .select2-container { width: 100% !important; }
html.a11y .select2-selection,
html.a11y .select2-selection__rendered { height: auto !important; line-height: var(--a11y-lh) !important; white-space: normal !important; }
html.a11y .select2-selection { min-height: 48px; padding: 6px 32px 6px 4px; border: 2px solid var(--a11y-fg) !important; border-radius: 0 !important; }

/* Подвал: значки-фоны убраны, поэтому отступы под них не нужны; мелкие логотипы не растягиваются. */
html.a11y .footer-block :where(p, div, a) { padding-left: 0 !important; }
html.a11y .footer-grid { gap: 16px; padding-top: 16px !important; padding-bottom: 16px !important; }
html.a11y .site-footer-area img { max-height: 120px !important; }

/* Меню: как и в основном содержимом, высота определяется текстом. */
html.a11y .mobile-menu :where(input, button:not(.mobile-menu-close, .menu-toggle), a) {
    height: auto !important;
    line-height: var(--a11y-lh) !important;
}

/* Плавающие элементы не должны закрывать страницу на узком экране. */
html.a11y .cookie-consent {
    position: static !important;
    order: -1;
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    padding: 12px 16px;
    border-bottom: 4px solid var(--a11y-fg);
}

html.a11y .cookie-consent__panel {
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0 !important;
}

html.a11y .cookie-consent__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
html.a11y .cookie-consent__btn { display: inline-block; min-height: 48px; box-sizing: border-box; border-radius: 0 !important; }

html.a11y body.menu-open .ai-consultant-widget { display: none !important; }

html.a11y .ai-consultant-button {
    background-color: #000 !important;
    border: 2px solid #fff !important;
    padding: 0 !important;
    width: 64px;
    height: 64px;
}

html.a11y .ai-consultant-button img { display: block !important; width: 34px; height: 34px; background: transparent !important; filter: none !important; }
html.a11y .ai-consultant-widget.open .ai-consultant-button { display: none; }

html.a11y .ai-consultant-chat {
    border: 3px solid var(--a11y-fg);
    border-radius: 0 !important;
}

html.a11y .ai-consultant-chat * { font-size: min(var(--a11y-fs), 24px) !important; }
html.a11y .ai-consultant-resize { display: none !important; }

html.a11y .ai-consultant-chat header {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: flex-start;
    gap: 8px;
}

html.a11y .ai-consultant-test-mode {
    position: static !important;
    transform: none !important;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0;
    border: 0 !important;
    white-space: normal !important;
}

html.a11y .ai-consultant-close {
    position: static !important;
    flex: 0 0 48px;
    width: 48px !important;
    height: 48px !important;
    padding: 0 !important;
    text-align: center !important;
}
