/* ===== A11Y button ===== */
/* ===== A11Y button styled like .main-menu a ===== */
.a11y-btn {
    /* как ссылка в меню */
    color: #A37781;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.5rem;
    letter-spacing: 0.04em;
    font-family: var(--mydict-heading-font, 'Zara', serif);

    /* важно для ::after */
    position: relative;

    /* чтобы button выглядел как <a> */
    background: transparent;
    border: 0;
    padding: 0;
    /* можно 0, либо чуть-чуть если надо кликабельность */
    line-height: 1;
    cursor: pointer;

    /* иконка + текст */
    display: inline-flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.a11y-btn::before {
    content: "";
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    background-image: url("/wp-content/themes/3009viimane/assets/images/a11y.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.a11y-btn::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -6px;
    width: 0;
    height: 2px;
    background: var(--gold);
    transition: width .25s ease;
}

.a11y-btn:hover::after,
.a11y-btn:focus-visible::after,
.a11y-btn[aria-current="page"]::after {
    width: 100%;
}

/* чтобы фокус был WCAG-ок (и красиво) */
.a11y-btn:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 6px;
    border-radius: 6px;
}

/* ===== Modal shell ===== */
.a11y-modal[hidden] {
    display: none;
}

.a11y-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 70px 16px 16px;
    background: rgba(0, 0, 0, .55);
    overflow-y: auto;
    /* <-- ключевое */
    -webkit-overflow-scrolling: touch;
    /* iOS momentum scroll */
    overscroll-behavior: contain;
    /* чтобы не скроллило страницу под модалкой */
}

.a11y-btn--inmenu {
    display: none;
    width: 100%;
    justify-content: center;
    padding: 14px 16px;
    border-radius: 12px;
    color: rgb(163, 119, 129);
    font-family: var(--mydict-heading-font, 'Zara', serif);
    font-size: 2rem;
    letter-spacing: .04em;
}

.a11y-modal__panel {
    width: min(1200px, 96vw);
    background: #571003;
    /* близко к твоему синему на скрине */
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 0;
    color: #fff;
    padding: 22px 22px 18px;
    position: relative;
    border-radius: 15px;
    max-height: calc(100dvh - 70px - 16px - 16px);
    /* top padding (70) + paddings (16+16) */
    overflow: auto;
    /* <-- внутренний скролл */
    -webkit-overflow-scrolling: touch;
}

@supports not (height: 100dvh) {
    .a11y-modal__panel {
        max-height: calc(100vh - 70px - 16px - 16px);
    }
}

.a11y-modal__close {
    position: absolute;
    right: 12px;
    top: 10px;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, .8);
    background: transparent;
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.a11y-modal__close:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

.a11y-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.a11y-col {
    padding: 6px 6px;
}

.a11y-h {
    margin: 0 0 14px 0;
    font-family: system-ui, sans-serif;
    font-weight: 700;
    font-size: 28px;
}

.a11y-radio,
.a11y-check {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 6px;
    font-family: system-ui, sans-serif;
    font-size: 18px;
}

.a11y-radio input,
.a11y-check input {
    width: 20px;
    height: 20px;
}

/* ===== A11Y info block (statement) ===== */
.a11y-info {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, .25);
}

.a11y-info__title {
    margin: 0 0 10px 0;
    font-family: system-ui, sans-serif;
    font-weight: 800;
    font-size: 22px;
}

.a11y-info__muted {
    margin: 0 0 10px 0;
    opacity: .92;
    line-height: calc(1.5 * var(--a11y-line-mul, 1));
}

.a11y-info__link {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 2px;
}

.a11y-info__note {
    margin: 12px 0 0;
    font-family: system-ui, sans-serif;
    opacity: .85;
}

/* accordion via details/summary */
.a11y-acc {
    margin: 10px 0;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, .06);
}

.a11y-acc__sum {
    list-style: none;
    cursor: pointer;
    padding: 12px 14px;
    font-family: system-ui, sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    position: relative;
    line-height: calc(1.3 * var(--a11y-line-mul, 1));
}

.a11y-acc__sum::-webkit-details-marker {
    display: none;
}

/* плюс/минус справа */
.a11y-acc__sum::after {
    content: "+";
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    line-height: 1;
    opacity: .9;
}

.a11y-acc[open] .a11y-acc__sum::after {
    content: "–";
}

.a11y-acc__body {
    padding: 0 14px 12px;
    font-family: system-ui, sans-serif;
    font-size: 1rem;
    line-height: calc(1.55 * var(--a11y-line-mul, 1));
    opacity: .95;
}

.a11y-acc__body p {
    margin: 10px 0;
}

.a11y-acc__body ul {
    margin: 10px 0 0 18px;
}

.a11y-acc__body li {
    margin: 6px 0;
}

/* focus for summary */
.a11y-acc__sum:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
    border-radius: 10px;
}

@media (max-width: 768px) {
    .a11y-btn--inmenu {
        display: inline-flex;
    }
}

@media (max-width: 980px) {
    .a11y-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 520px) {
    .a11y-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== APPLY SETTINGS via html data-attrs ===== */

/* Font scale */
html[data-a11y-font="md"] {
    --a11y-font-scale: 1;
}

html[data-a11y-font="lg"] {
    --a11y-font-scale: 1.15;
}

html[data-a11y-font="xl"] {
    --a11y-font-scale: 1.3;
}

body {
    font-size: calc(1rem * var(--a11y-font-scale, 1));
}

/* Line height multiplier */

html[data-a11y-line="1"] {
    --a11y-line-mul: 1;
}

html[data-a11y-line="2"] {
    --a11y-line-mul: 1.35;
}

html[data-a11y-line="4"] {
    --a11y-line-mul: 1.7;
}

/* базовая "нормальная" высота строки (можешь менять) */
:root {
    --a11y-line-base: 1.45;
}

/* применяем ко всему тексту */
body {
    line-height: calc(var(--a11y-line-base, 1.45) * var(--a11y-line-mul, 1));
}

/* чтобы формы/контролы тоже подхватывали комфортную высоту */
button,
input,
select,
textarea {
    line-height: inherit;
}

html {
    font-size: calc(100% * var(--a11y-font-scale, 1));
}

body {
    font-size: 1rem;
    /* можно вообще не задавать */
}

/* Contrast presets */
html[data-a11y-contrast="default"] {
    --a11y-bg: var(--bg);
    --a11y-text: var(--text);
}

html[data-a11y-contrast="yb"] {
    --a11y-bg: #000;
    --a11y-text: #ffd400;
}

html[data-a11y-contrast="bw"] {
    --a11y-bg: #001e57;
    --a11y-text: #ffffff;
}

html[data-a11y-contrast="yb"] :is(body, .lead-block, .monkey-section, .subscribe-section, .a11y-modal__panel, .schools-Lessons, .schools-FAQ, .schools-3DModels, .schools-Details, .schools-exp-card__text, .dor-modal__panel, .container_summary, .container_ardipithecus, .container_keyart, .container_trailers, .container_screenshots, .container_gifs, .container_media_coverage, .container_about_us, .container_key_features, .dor-es, .dor-ve, .museums-Experiences, .museums-Details, .schools-faq),
html[data-a11y-contrast="bw"] :is(body, .lead-block, .monkey-section, .subscribe-section, .a11y-modal__panel, .schools-Lessons, .schools-FAQ, .schools-3DModels, .schools-Details, .schools-exp-card__text, .dor-modal__panel, .container_summary, .container_ardipithecus, .container_keyart, .container_trailers, .container_screenshots, .container_gifs, .container_media_coverage, .container_about_us, .container_key_features, .dor-es, .dor-ve, .museums-Experiences, .museums-Details, .schools-faq) {
    background: var(--a11y-bg) !important;
    color: var(--a11y-text) !important;
}

/* Force most text to match contrast mode (т.к. у тебя много явных цветов) */
html[data-a11y-contrast="yb"] body :where(p, h1, h2, h3, h4, h5, h6, li, span, small, strong, em, a, button, label, input, textarea, select) {
    color: var(--a11y-text) !important;
}

/* Remove heavy visuals for readability (можно расширить) */
/* html[data-a11y-contrast="yb"] .hero-bg,
html[data-a11y-contrast="bw"] .hero-bg{
  background: none !important;
} */

html[data-a11y-contrast="yb"] .feature-row,
html[data-a11y-contrast="bw"] .feature-row {
    background: none !important;
    border: 2px solid rgba(255, 255, 255, .35);
}

html[data-a11y-contrast="yb"] :is(#dorMsLead, .subscribe-box),
html[data-a11y-contrast="bw"] :is(#dorMsLead, .subscribe-box) {
    background: none !important;
    border: 2px solid rgba(255, 255, 255, .35);
}

html[data-a11y-contrast="yb"] :is(.subscribe-btn, .footer-btn, .dor-card, .schools-exp-card, .get_qiote_button, .dor-card__btn, .dor-modal__submit),
html[data-a11y-contrast="bw"] :is(.subscribe-btn, .footer-btn, .dor-card, .schools-exp-card, .get_qiote_button, .dor-card__btn, .dor-modal__submit) {
    background: none !important;
    border: 2px solid rgba(255, 255, 255, .35);
}


html[data-a11y-contrast="yb"] .feature-row::before,
html[data-a11y-contrast="bw"] .feature-row::before {
    background: none !important;
}

/* Optional: emphasize links if enabled by JS (adds html[data-a11y-emph-links="1"]) */
html[data-a11y-emph-links="1"] a {
    text-decoration: underline !important;
    text-underline-offset: 4px;
    text-decoration-thickness: 2px;
    font-weight: 700;
}