/**
 * Режим для слабовидящих: только при html.a11y-mode (и data-* на корне).
 * Не влияет на обычное отображение сайта.
 */

/* Панель скрыта, пока режим выключен */
html:not(.a11y-mode) .a11y-settings-panel {
  display: none !important;
}

/*
 * Обычная вёрстка: .site-header__nav — position:absolute у нижнего края шапки (поверх hero),
 * высота .site-header не включает меню. Панель ВДС идёт сразу под шапкой и совпадает
 * по вертикали с полосой меню. В режиме ВДС держим навигацию в потоке (как на внутренних).
 */
@media (min-width: 1024px) {
  html.a11y-mode .site-header:not(.site-header--is-scrolled) .site-header__nav {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    z-index: 5;
  }
}

/*
 * Меню: в обычном режиме .primary-nav__link — color: var(--color-white) поверх hero.
 * В ВДС фон шапки и .primary-nav__sub — светлые (--color-white / --color-page), а вложенные
 * разделы в подменю тоже с классом .primary-nav__link → без переопределения получается белый текст.
 */
@media (min-width: 1024px) {
  html.a11y-mode .primary-nav__link {
    color: var(--color-ink) !important;
  }

  html.a11y-mode .primary-nav__link--current {
    color: var(--color-olive) !important;
  }

  html.a11y-mode .primary-nav__list:hover .primary-nav__link {
    color: var(--color-ink) !important;
  }

  html.a11y-mode .primary-nav__list:hover .primary-nav__link.primary-nav__link--current {
    color: var(--color-olive) !important;
  }

  html.a11y-mode .primary-nav__item:hover .primary-nav__link {
    color: var(--color-olive) !important;
  }

  html.a11y-mode .primary-nav__item:hover .primary-nav__link:hover {
    color: var(--color-olive) !important;
  }

  html.a11y-mode .primary-nav__sub-link {
    color: var(--color-ink) !important;
  }

  html.a11y-mode .primary-nav__sub-link:hover,
  html.a11y-mode .primary-nav__sub-link:focus-visible {
    color: var(--color-ink) !important;
    background: var(--header-link-hover-bg) !important;
  }

  html.a11y-mode .primary-nav__sub {
    background: var(--color-page) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  }

  html.a11y-mode .primary-nav__sub::before {
    border-bottom-color: var(--color-page) !important;
  }
}

.a11y-settings-panel {
  border-bottom: 1px solid var(--color-ink, #000);
  background: var(--color-page, #fff);
  color: var(--color-ink, #000);
}

.a11y-settings-panel__inner {
  max-width: var(--layout-max-width, 1600px);
  margin: 0 auto;
  padding: 6px var(--grid-margin-x-mobile, 16px) 8px;
  box-sizing: border-box;
  position: relative;
  /* Блок настроек по центру страницы; при нехватке места — горизонтальный скролл */
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 12px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 1024px) {
  .a11y-settings-panel__inner {
    padding-left: var(--grid-margin-x, 24px);
    padding-right: var(--grid-margin-x, 24px);
  }
}

.a11y-settings-panel__body {
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
  /* Одна линия — все fieldset одной высоты (как самый высокий блок) */
  align-items: stretch;
  gap: 8px 12px;
  flex: 0 1 auto;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.a11y-settings-panel__fieldset {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--color-ink, #000);
  border-radius: 2px;
  flex: 0 1 auto;
  align-self: stretch;
  min-height: 4.75rem;
  box-sizing: border-box;
}

.a11y-settings-panel__fieldset > .a11y-settings-panel__radios,
.a11y-settings-panel__fieldset > .a11y-settings-panel__row {
  align-self: stretch;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
}

.a11y-settings-panel__legend {
  padding: 0 4px;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.25;
  white-space: nowrap;
  text-align: center;
}

.a11y-settings-panel__row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin-top: 0;
}

.a11y-settings-panel__row--stepper {
  flex-wrap: nowrap;
  align-items: center;
}

.a11y-settings-panel__step-btn {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px !important;
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  line-height: 1 !important;
}

.a11y-settings-panel__hint {
  margin: 0;
  font-size: 1rem;
  min-width: 9ch;
  flex: 0 1 auto;
  text-align: center;
  line-height: 1.25;
  white-space: nowrap;
  /* Один flex-ребёнок (.readout), чтобы не дробить текстовые узлы пробелами */
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
}

/* Счётчик «1 / 5»: ровные отступы у слэша без хрупких пробелов в разметке */
.a11y-settings-panel__readout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25em;
  font-variant-numeric: tabular-nums;
}

/* Группа радиокнопок темы (обёртка — div) */
div.a11y-settings-panel__radios {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  gap: 4px 12px;
}

div.a11y-settings-panel__radios label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1.25;
  white-space: nowrap;
}

/* Чекбокс «Упростить оформление» — тот же BEM-класс на <label> */
label.a11y-settings-panel__radios {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1.25;
  white-space: nowrap;
}

/* Скрытый live-регион для объявлений скринридерам */
.a11y-settings__live {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/*
 * Корень: только rem — на html проценты в font-size в части движков дают не то основание
 * для rem по странице; из-за этого рост шага почти не доходил до типографики.
 * rem на корне привязан к initial (CSS Values); шаги = +6.25% к базе 1rem.
 * Плюс абсолютный пол 16px, чтобы при мелком UA не опускаться ниже читаемого минимума.
 */
html.a11y-mode {
  font-size: max(16px, 1rem);
}

html.a11y-mode[data-a11y-font-step="1"] {
  font-size: max(17px, 1.0625rem);
}

html.a11y-mode[data-a11y-font-step="2"] {
  font-size: max(18px, 1.125rem);
}

html.a11y-mode[data-a11y-font-step="3"] {
  font-size: max(19px, 1.1875rem);
}

html.a11y-mode[data-a11y-font-step="4"] {
  font-size: max(20px, 1.25rem);
}

html.a11y-mode body {
  font-size: max(1rem, 0.9375rem);
  line-height: max(1.35, 1.45);
}

html.a11y-mode[data-a11y-line-step="1"] body {
  line-height: max(1.35, 1.65);
}

html.a11y-mode[data-a11y-line-step="2"] body {
  line-height: max(1.35, 1.85);
}

html.a11y-mode[data-a11y-line-step="3"] body {
  line-height: max(1.35, 2.05);
}

/* Явные минимумы там, где в макете заданы 10–11px */
html.a11y-mode .site-footer__a11y,
html.a11y-mode .site-footer__search-input,
html.a11y-mode .site-footer__search-submit,
html.a11y-mode .site-footer__actions .btn--primary,
html.a11y-mode .site-footer__actions .btn--footer-outline,
html.a11y-mode .site-footer__subbar.layout-grid,
html.a11y-mode .list-filters__pill,
html.a11y-mode .list-filters__select,
html.a11y-mode .pager,
html.a11y-mode .pager__btn,
html.a11y-mode .pager__page-link,
html.a11y-mode .hero__perm-mobile {
  font-size: max(1rem, 1em) !important;
}

html.a11y-mode .module-card__meta {
  font-size: max(1rem, 0.8125rem) !important;
}

/* Заголовки и блоки с плотным межстрочным интервалом */
html.a11y-mode .hero__info-title,
html.a11y-mode .hero__info-text,
html.a11y-mode .photo-showcase__title,
html.a11y-mode .photo-showcase__author,
html.a11y-mode .featured-tile__title,
html.a11y-mode .featured-tile__badge,
html.a11y-mode .page-content,
html.a11y-mode .inner-page__title {
  line-height: max(1.35, 1.2);
}

/* Базовая контрастная схема (чёрное на белом) */
html.a11y-mode {
  --color-page: #ffffff;
  --color-ink: #0a0a0a;
  --color-muted: #222222;
  --color-muted-light: #333333;
  --color-white: #ffffff;
  --color-olive: #1a4d1a;
  --color-line-soft: #000000;
  --color-line-soft-dark: #000000;
  --color-header-link-border: #000000;
  --header-link-hover-bg: rgba(0, 0, 0, 0.08);
  --color-orange-widget: #b35900;
}

/* Сине-белая схема */
html.a11y-mode[data-a11y-theme="blue"] {
  --color-page: #e8f4ff;
  --color-ink: #001a33;
  --color-muted: #002244;
  --color-muted-light: #003355;
  --color-white: #f7fbff;
  --color-olive: #003d7a;
  --color-line-soft: #003d7a;
  --color-line-soft-dark: #00264d;
  --color-header-link-border: #003d7a;
  --header-link-hover-bg: rgba(0, 61, 122, 0.12);
  --color-orange-widget: #8a4200;
}

/* Светлый текст на тёмном фоне */
html.a11y-mode[data-a11y-theme="dark"] {
  --color-page: #121212;
  --color-ink: #f5f5f5;
  --color-muted: #e0e0e0;
  --color-muted-light: #cccccc;
  --color-white: #1e1e1e;
  --color-olive: #c8e6c9;
  --color-line-soft: #f5f5f5;
  --color-line-soft-dark: #f5f5f5;
  --color-header-link-border: #888888;
  --header-link-hover-bg: rgba(255, 255, 255, 0.08);
  --color-orange-widget: #ffb74d;
}

html.a11y-mode .site-page {
  background: var(--color-page);
  color: var(--color-ink);
}

/* Декоративный фон подвала — скрываем полностью в режиме для слабовидящих */
html.a11y-mode .site-footer__illustration {
  display: none !important;
}

/* Межстрочный интервал у крупных заголовков hero (без подложки под текст) */
html.a11y-mode .hero__kicker,
html.a11y-mode .hero__title {
  line-height: max(1.35, 1.05);
}

/* Усиленный видимый фокус */
html.a11y-mode *:focus-visible {
  outline: 3px solid var(--color-olive);
  outline-offset: 2px;
}

/*
 * В ВДС нет текста мельче 16px: всё, что в основных стилях задано < 1rem,
 * поднимаем через max(1rem, исходное) — при шагах увеличения корня пропорции сохраняются.
 * (Скан по stolby/static/styles; списки селекторов через запятую — вручную дополнены.)
 */
@media (max-width: 600px) {
  html.a11y-mode .search-page__input {
    font-size: max(1rem, 0.9375rem) !important;
  }
}

@media (min-width: 1024px) {
  html.a11y-mode .quick-card__cta-label,
  html.a11y-mode .featured-tile__cta-label,
  html.a11y-mode .photo-showcase__more-label {
    font-size: max(1rem, 0.75rem) !important;
  }

  html.a11y-mode .featured-tile__badge {
    font-size: max(1rem, 0.9375rem) !important;
  }

  html.a11y-mode .hero__info-text {
    font-size: max(1rem, 0.875rem) !important;
  }

  html.a11y-mode .module-card__title {
    font-size: max(1rem, 0.875rem) !important;
  }

  html.a11y-mode .module-card__meta {
    font-size: max(1rem, 0.75rem) !important;
  }

  html.a11y-mode .primary-nav__link {
    font-size: max(1rem, 0.9375rem) !important;
  }

  html.a11y-mode .news-card__title {
    font-size: max(1rem, 0.875rem) !important;
  }

  html.a11y-mode .news-card__date {
    font-size: max(1rem, 0.75rem) !important;
  }
}

html.a11y-mode .app-download-modal__lead {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .attached-file__icon-tag {
  font-size: max(1rem, 0.4375rem) !important;
}

html.a11y-mode .attached-file__title {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .attached-file__meta {
  font-size: max(1rem, 0.75rem) !important;
}

html.a11y-mode .attached-photos__footer {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .attached-tabs__meta {
  font-size: max(1rem, 0.75rem) !important;
}

html.a11y-mode .attached-tabs__empty {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .btn {
  font-size: max(1rem, 0.8125rem) !important;
}

html.a11y-mode .btn--perm {
  font-size: max(1rem, 0.75rem) !important;
}

html.a11y-mode .btn--green-pill {
  font-size: max(1rem, 0.75rem) !important;
}

html.a11y-mode .hero__info-more {
  font-size: max(1rem, 0.6875rem) !important;
}

html.a11y-mode .documents-module__empty {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .featured-tile__badge {
  font-size: max(1rem, 0.8125rem) !important;
}

html.a11y-mode .site-footer__search-input {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .site-footer__search-submit {
  font-size: max(1rem, 0.75rem) !important;
}

html.a11y-mode .site-footer__a11y {
  font-size: max(1rem, 0.6875rem) !important;
}

html.a11y-mode .footer-pair {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .footer-pair__hint {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .site-footer__actions .btn--footer-outline {
  font-size: max(1rem, 0.625rem) !important;
}

html.a11y-mode .site-footer__inst-block {
  font-size: max(1rem, 0.75rem) !important;
}

html.a11y-mode .site-footer__inst-cta {
  font-size: max(1rem, 0.6875rem) !important;
}

html.a11y-mode .site-footer__subbar.layout-grid {
  font-size: max(1rem, 0.75rem) !important;
}

html.a11y-mode .m-nav__link {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .m-nav__sub-link {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .hero__kicker {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .hero__perm-mobile {
  font-size: max(1rem, 0.6875rem) !important;
}

html.a11y-mode .hero__info-text {
  font-size: max(1rem, 0.75rem) !important;
}

html.a11y-mode .breadcrumbs-nav {
  font-size: max(1rem, 0.8125rem) !important;
}

html.a11y-mode .inner-page-shell__body a.inner-page__back-link {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .inner-page-shell .section-sidebar-nav a {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .inner-page-shell .section-sidebar-nav .section-sidebar-nav__sub a {
  font-size: max(1rem, 0.8125rem) !important;
}

html.a11y-mode .page-content table {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .album-detail__back {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .list-filters__pill {
  font-size: max(1rem, 0.6875rem) !important;
}

html.a11y-mode .list-filters__select {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .primary-nav__sub .primary-nav__link {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .module-card__title {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .module-card__meta {
  font-size: max(1rem, 0.8125rem) !important;
}

html.a11y-mode .primary-nav__link {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .primary-nav__sub-link {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .news__link--all {
  font-size: max(1rem, 0.75rem) !important;
}

html.a11y-mode .news-card__title {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .news-card__date {
  font-size: max(1rem, 0.8125rem) !important;
}

html.a11y-mode .news-list-module__all-link {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode
  .news-list-module__link.news-list-module__link--tile
  .news-list-module__title {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode
  .news-list-module__link.news-list-module__link--tile
  .news-list-module__meta {
  font-size: max(1rem, 0.75rem) !important;
}

html.a11y-mode .news-list-module__meta {
  font-size: max(1rem, 0.75rem) !important;
}

html.a11y-mode .pager__btn {
  font-size: max(1rem, 0.75rem) !important;
}

html.a11y-mode .pager__pages-item--ellipsis {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .pager__page-link {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .park-map .leaflet-popup.park-map-leaflet-popup .leaflet-popup-content {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .park-map-chip {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .park-map-popup__body {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .park-map-popup__coords {
  font-size: max(1rem, 0.75rem) !important;
}

html.a11y-mode .park-map__status {
  font-size: max(1rem, 0.9rem) !important;
}

html.a11y-mode .park-stats__description {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .people-module__toolbar {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .people-module__chip {
  font-size: max(1rem, 0.8125rem) !important;
}

html.a11y-mode .people-module__block-desc {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .people-module__empty {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .people-accordion__position {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .people-accordion__richtext {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .people-accordion__contact-langs {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .people-accordion__field-label {
  font-size: max(1rem, 0.75rem) !important;
}

html.a11y-mode .people-accordion__certificate {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .people-accordion__email {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .guide-detail__certificate {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .guide-detail__field-label {
  font-size: max(1rem, 0.75rem) !important;
}

html.a11y-mode .photo-showcase__title {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .photo-showcase__author {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .search-page__submit {
  font-size: max(1rem, 0.75rem) !important;
}

html.a11y-mode .search-page__meta {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .search-results__source {
  font-size: max(1rem, 0.75rem) !important;
}

html.a11y-mode .search-results__snippet {
  font-size: max(1rem, 0.8125rem) !important;
}

html.a11y-mode .search-results__type {
  font-size: max(1rem, 0.6875rem) !important;
}

html.a11y-mode .error-page__text {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .error-page__code {
  font-size: max(5rem, clamp(7rem, 28vw, 12rem)) !important;
}

html.a11y-mode .search-page__empty {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .search-page__hint {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .services-module__empty {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .services-accordion__empty {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .services-row__index {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .services-row__title {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .services-row__desc {
  font-size: max(1rem, 0.8125rem) !important;
}

html.a11y-mode .services-row__price {
  font-size: max(1rem, 0.8125rem) !important;
}

html.a11y-mode .service-detail .page-content table {
  font-size: max(1rem, 0.875rem) !important;
}

html.a11y-mode .order-form__submit {
  font-size: max(1rem, 0.75rem) !important;
}

html.a11y-mode .order-form-page__service-meta {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .order-form__label {
  font-size: max(1rem, 0.8125rem) !important;
}

html.a11y-mode .order-form__control {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .order-form__field-errors {
  font-size: max(1rem, 0.8125rem) !important;
}

html.a11y-mode .sitemap-page__lead {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .sitemap-tree__item--level-1 > .sitemap-tree__link {
  font-size: max(1rem, 0.9375rem) !important;
}

html.a11y-mode .sitemap-tree__item--level-4 > .sitemap-tree__link {
  font-size: max(1rem, 0.875rem) !important;
}

@media (max-width: 639px) {
  html.a11y-mode .pager__btn {
    font-size: max(1rem, 0.6875rem) !important;
  }
}
