/* Версия для слабовидящих — бейдж, модалка настроек и режимы отображения
   (стиль alfa-beta-med.ru, палитра Эстом) */

:root {
  --a11y-primary: var(--rv-blue, var(--color-primary));
  --a11y-secondary: var(--color-muted);
  --a11y-border: var(--color-line);
  --a11y-block: #fff;
}

/* ---------- бейдж в шапке ---------- */

.accessibility-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .375rem 1rem;
  margin: 4px 0;
  background: var(--color-surface);
  color: var(--color-ink);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-2);
  cursor: pointer;
  justify-content: center;
  white-space: nowrap;
  font: inherit;
  font-size: var(--fs-13);
  transition: transform var(--transition), background var(--transition),
              border-color var(--transition), color var(--transition);
}

.accessibility-badge svg { width: 1.25rem; height: 1.25rem; fill: var(--a11y-primary); }

/* специфичность выше theme button:hover; единый ховер белых кнопок */
.rv-header__utility .accessibility-badge:hover {
  background: var(--color-hover);
  transform: translateY(-2px);
  color: var(--color-primary);
}

/* ---------- модалка настроек ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, .56);
  padding: 2rem;
}

.modal-overlay.is-open { display: flex; }

.modal {
  position: relative;
  overflow: hidden;
  overflow-y: auto;
  background: #fff;
  border-radius: 1.5rem;
  max-height: calc(100vh - 4rem);
  max-width: 75rem;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .15), var(--shadow-lg);
}

.modal--compact {
  height: auto;
  align-self: center;
  border-radius: 1.5rem;
}

.accessibility-settings { width: 68.75rem; padding: 2.25rem 1.75rem; box-sizing: border-box; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .25rem .5rem 1rem;
  border-bottom: .0625rem solid var(--a11y-border);
}

.rv-a11y__title { font-size: var(--fs-20); font-weight: 700; color: var(--color-ink); }

.rv-a11y__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  border: 0;
  border-radius: 50%;
  background: var(--color-surface-alt);
  color: var(--color-muted);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.rv-a11y__close:hover { background: #e3eaf5; color: var(--color-ink); }

.modal-content { flex: 1; overflow-y: auto; }

.accessibility-settings__content {
  margin-top: 1.75rem;
  display: flex;
  column-gap: 3.8125rem;
  row-gap: 2.375rem;
  flex-wrap: wrap;
  padding: 0 .25rem 1rem;
}

.accessibility-settings__group { border: none; padding: 0; margin: 0; }

.accessibility-settings__group.full-width { flex-grow: 1; }

.accessibility-settings__controls { display: flex; flex-wrap: wrap; gap: .75rem; }

.accessibility-settings__controls-wrapper {
  display: flex;
  gap: .75rem;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

.accessibility-settings__control {
  padding: .4375rem 1rem;
  font: inherit;
  font-size: 1rem;
  line-height: 1.75rem;
  border-radius: var(--radius-2);
  border: 1px solid var(--a11y-border);
  color: var(--color-ink);
  background: var(--a11y-block);
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.accessibility-settings__control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.accessibility-settings__control:has(input:checked) {
  background: var(--a11y-primary);
  border-color: var(--a11y-primary);
  color: #fff;
}

.accessibility-settings__control:hover { border-color: var(--a11y-primary); }

.accessibility-settings__control-title {
  color: var(--a11y-secondary);
  margin-bottom: .75rem;
  padding: 0;
  font-size: 1rem;
}

.accessibility-settings__control.reset {
  background: var(--a11y-block);
  color: var(--a11y-primary);
  border-color: var(--a11y-primary);
}

.accessibility-settings__control.reset:hover {
  background: var(--a11y-primary);
  color: #fff;
}

/* ---------- режимы отображения ---------- */

html.font-size--normal { zoom: 1; }
html.font-size--medium { zoom: 1.15; }
html.font-size--large { zoom: 1.3; }

.images-off * { background-image: none !important; }

.images-off img,
.images-off .rv-photo-card__img-wrap,
.images-off .rv-contacts-card__photo { visibility: hidden; }

/* модалки и оверлеи не перекрашиваются темами */
.modal-overlay,
.modal-overlay *,
.rv-modal,
.rv-modal * { /* защищены исключениями ниже */ }

/* --- монохромный: всё в оттенках серого --- */

body.theme--monochrome img,
body.theme--monochrome svg,
body.theme--monochrome .rv-map,
body.theme--monochrome .rv-hero,
body.theme--monochrome .rv-header,
body.theme--monochrome .rv-section,
body.theme--monochrome footer,
body.theme--monochrome .elementor-section,
body.theme--monochrome [style*="background"] { filter: grayscale(1); }

body.theme--monochrome a:hover { text-decoration: underline; text-underline-offset: .25rem; }

/* --- инверсивный монохромный: чёрный фон, белый текст --- */

body.theme--inverse-monochrome,
body.theme--inverse-monochrome .site-content,
body.theme--inverse-monochrome .rv-hero,
body.theme--inverse-monochrome footer { background: #000 !important; background-image: none !important; }

body.theme--inverse-monochrome *:not(img):not(svg):not(svg *):not(path):not(use):not(.modal-overlay):not(.modal-overlay *):not(.rv-modal):not(.rv-modal *):not(.accessibility-badge):not(.rv-header__cta) {
  background-color: transparent !important;
  background-image: none !important;
  color: #fff !important;
  border-color: #555 !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

body.theme--inverse-monochrome img,
body.theme--inverse-monochrome .rv-map { filter: grayscale(1); }

body.theme--inverse-monochrome .accessibility-badge,
body.theme--inverse-monochrome .rv-header__cta {
  background: #fff !important;
  color: #000 !important;
  border-color: #fff !important;
}

body.theme--inverse-monochrome a:hover { text-decoration: underline; text-underline-offset: .25rem; }

/* --- синий фон: голубой фон, тёмно-синий текст --- */

body.theme--blue,
body.theme--blue .site-content,
body.theme--blue .rv-hero,
body.theme--blue footer { background: #9dd1ff !important; background-image: none !important; }

body.theme--blue *:not(img):not(svg):not(svg *):not(path):not(use):not(.modal-overlay):not(.modal-overlay *):not(.rv-modal):not(.rv-modal *):not(.accessibility-badge):not(.rv-header__cta) {
  background-color: #9dd1ff !important;
  background-image: none !important;
  color: #063462 !important;
  border-color: #063462 !important;
}

body.theme--blue .accessibility-badge,
body.theme--blue .rv-header__cta {
  background: #063462 !important;
  color: #9dd1ff !important;
  border-color: #063462 !important;
}

body.theme--blue a:hover { text-decoration: underline; text-underline-offset: .25rem; }

/* ---------- адаптив ---------- */

@media (max-width: 768px) {
  .modal-overlay { padding: 0; align-items: flex-end; }

  .modal--compact {
    width: 100dvw;
    max-width: 100dvw;
    max-height: 90dvh;
    border-radius: 1.25rem 1.25rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow-y: hidden;
    align-self: flex-end;
  }

  .modal-header {
    padding: 14px 16px;
    position: sticky;
    top: 0;
    background: #fff;
    border-bottom: 1px solid var(--a11y-border);
  }

  .rv-a11y__title { font-size: var(--fs-18); }

  .rv-a11y__close { width: 34px; height: 34px; }

  .modal-content { flex: 1; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom); }

  .accessibility-settings { width: 100%; padding: 0; }

  .accessibility-settings__content {
    margin-top: 0;
    row-gap: 0;
    flex-direction: column;
    padding: 0 0 12px;
  }

  .accessibility-settings__controls {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0 16px;
    scrollbar-width: none;
  }

  .accessibility-settings__controls::-webkit-scrollbar { display: none; }

  .accessibility-settings__controls-wrapper { flex-direction: column; row-gap: 1.25rem; }

  .accessibility-settings__control.reset { margin: 4px 16px 0; align-self: flex-start; }

  .accessibility-settings__control-title { margin-bottom: 0; padding: 14px 16px 8px; }

  .accessibility-settings__group { padding: 6px 0; border-bottom: 1px solid var(--color-line-soft); }

  .accessibility-settings__group:last-child { border-bottom: 0; }
}

@media (max-width: 640px) {
  .accessibility-badge { margin-right: 8px; }
}
