/* Root variables (we apply via JS) */
:root {
    --dor-a11y-font: inherit;
    --dor-a11y-line-height: 1.6;
    --dor-a11y-letter-spacing: 0;
    --dor-a11y-word-spacing: 0;
    --dor-a11y-font-scale: 1;
}

/* Apply globally */
html,
body {
    font-family: var(--dor-a11y-font);
}
html {
     font-size: calc(16px * var(--dor-a11y-font-scale));
}

body {
    line-height: var(--dor-a11y-line-height);
    letter-spacing: var(--dor-a11y-letter-spacing);
    word-spacing: var(--dor-a11y-word-spacing);
    
}

/* =========================================================
   High contrast theme: must/kollane (global)
   + Gutenberg / inline-style overrides
   ========================================================= */

body.dor-theme-contrast {
    background: #000 !important;
    color: #ffeb3b !important;
}

/* Text everywhere (beats many inline colors) */
body.dor-theme-contrast :where(p, span, strong, em, b, i,
    h1, h2, h3, h4, h5, h6,
    li, dt, dd, blockquote,
    label, small, figcaption, .br-counter__label,
    .br-counter__value) {
    color: #ffeb3b !important;
}

/* Links */
body.dor-theme-contrast :where(a, a:visited) {
    color: #ffeb3b !important;
    text-decoration: underline !important;
    text-underline-offset: 0.2em;
}

/* Focus */
body.dor-theme-contrast :where(a, button, input, textarea, select, [tabindex]):focus {
    outline: 3px solid #ffeb3b !important;
    outline-offset: 3px !important;
}

/* Borders/separators */
body.dor-theme-contrast :where(hr, .wp-block-separator) {
    border-color: #ffeb3b !important;
    background-color: #ffeb3b !important;
}

/* Buttons (Gutenberg + generic) */
body.dor-theme-contrast :where(.wp-block-button__link,
    button,
    input[type="submit"],
    input[type="button"],
    input[type="reset"]) {
    background: #000 !important;
    color: #ffeb3b !important;
    border: 2px solid #ffeb3b !important;
}

/* Inputs/selects/textareas */
body.dor-theme-contrast :where(input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="search"],
    input[type="url"],
    input[type="number"],
    input[type="password"],
    textarea,
    select) {
    background: #000 !important;
    color: #ffeb3b !important;
    border: 2px solid #ffeb3b !important;
}

body.dor-theme-contrast :where(input::placeholder, textarea::placeholder) {
    color: rgba(255, 235, 59, 0.75) !important;
}

/* Core Gutenberg containers: kill gradients/inline backgrounds */
body.dor-theme-contrast :where(.wp-site-blocks,
    .wp-block-group,
    .wp-block-columns,
    .wp-block-column,
    .wp-block-cover,
    .wp-block-cover__inner-container,
    .wp-block-media-text,
    .wp-block-accordion,
    .wp-block-accordion-item,
    .wp-block-accordion-panel,
    .cv-card,
    .dor-rv-card,
    .br-counters) {
    background: transparent !important;
    background-color: transparent !important;
    color: #ffeb3b !important;
    border-color: #ffeb3b !important;
}

/* Ensure main layout is black */
body.dor-theme-contrast :where(.wp-site-blocks, main, header, footer) {
    background-color: #000 !important;
}

/* Blocks that declare background via Gutenberg classes */
body.dor-theme-contrast :where(.has-background,
    .has-background-background-color,
    .has-background-color,
    [class*="has-background-"]) {
    background: transparent !important;
    background-color: transparent !important;
}

/* Cover overlay remains dark for readability */
body.dor-theme-contrast .wp-block-cover__background {
    background-color: rgba(0, 0, 0, 0.65) !important;
}

/* Optional: mute cover image for readability */
body.dor-theme-contrast .wp-block-cover__image-background {
    filter: grayscale(1) contrast(1.1) brightness(0.8);
}

/* WPForms readability (if present) */
body.dor-theme-contrast :where(.wpforms-container, .wpforms-form) {
    color: #ffeb3b !important;
}

body.dor-theme-contrast :where(.wpforms-field-label, .wpforms-field-sublabel, .wpforms-field-description) {
    color: #ffeb3b !important;
}

body.dor-theme-contrast :where(.wpforms-error) {
    color: #ff6b6b !important;
}

/* =========================================================
   Modal
   ========================================================= */

.dor-a11y-modal[hidden] {
    display: none !important;
}

.dor-a11y-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
}

.dor-a11y-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .55);
}

.dor-a11y-modal__panel {
    position: relative;

    width: min(720px, calc(100% - 24px));

    /* ВАЖНО */
    max-height: 85vh;
    display: flex;
    flex-direction: column;

    margin: 5vh auto;

    background: #fff;
    color: #111;
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);

    overflow: hidden;
}

body.dor-theme-contrast .dor-a11y-modal__panel {
    background: #000;
    color: #ffeb3b;
    border: 2px solid #ffeb3b;
}

.dor-a11y-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 10px 18px;
}

.dor-a11y-modal__title {
    margin: 0;
    font-size: 1.4rem;
}

.dor-a11y-modal__close {
    border: 0;
    background: transparent;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 10px;
}

.dor-a11y-modal__close:focus {
    outline: 3px solid #ffbf47;
    outline-offset: 2px;
}

.dor-a11y-modal__body {
    padding: 12px 18px 18px 18px;
    overflow-y: auto;
    flex: 1 1 auto;
    -webkit-overflow-scrolling: touch;
}

.dor-a11y-fieldset {
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 14px;
    padding: 14px;
    margin: 0 0 12px 0;
}

body.dor-theme-contrast .dor-a11y-fieldset {
    border-color: #ffeb3b;
}

.dor-a11y-legend {
    font-weight: 700;
    padding: 0 6px;
}

.dor-a11y-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.dor-a11y-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, .10);
}

body.dor-theme-contrast .dor-a11y-option {
    border-color: #ffeb3b;
}

.dor-a11y-option input {
    transform: scale(1.15);
}

.dor-a11y-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 18px 18px 18px;
    border-top: 1px solid rgba(0, 0, 0, .08);
}

body.dor-theme-contrast .dor-a11y-modal__footer {
    border-top-color: #ffeb3b;
}

.dor-a11y-btn {
    border: 1px solid rgba(0, 0, 0, .18);
    background: #f7f7f7;
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
}

.dor-a11y-btn:focus {
    outline: 3px solid #ffbf47;
    outline-offset: 2px;
}

body.dor-theme-contrast .dor-a11y-btn {
    background: #000;
    color: #ffeb3b;
    border-color: #ffeb3b;
}

@media (max-width: 520px) {
    .dor-a11y-options {
        grid-template-columns: 1fr;
    }

    .dor-a11y-modal__panel {
        margin: 6vh auto;
    }
}


/* ===== Trigger button (2 variants) ===== */
.dor-a11y-btn-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;

    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 700;
    font-size: 1.2rem;
    line-height: 1;

    cursor: pointer;
    user-select: none;

    border: 2px solid transparent;
    background: transparent;
}

.dor-a11y-btn__icon {
    display: inline-flex;
    width: 22px;
    height: 22px;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.dor-a11y-btn__img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: inline-block;
}

.dor-a11y-btn--primary {
    background: #0b1b3a;
    color: #fff;
    border-color: rgba(255, 255, 255, .18);
}

.dor-a11y-btn--primary:hover {
    transform: translateY(-1px);
}

.dor-a11y-btn--ghost {
    background: rgba(255, 255, 255, .08);
    color: #fff;
    border-color: rgba(255, 255, 255, .25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.dor-a11y-btn-trigger:focus {
    outline: 3px solid #ffbf47;
    outline-offset: 3px;
}

/* In contrast mode button must stay readable */
body.dor-theme-contrast .dor-a11y-btn-trigger {
    background: #000 !important;
    color: #ffeb3b !important;
    border-color: #ffeb3b !important;
}

.dor-a11y-statement {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(0,0,0,0.12);
}

.dor-a11y-statement__title {
  margin: 0 0 10px 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.dor-a11y-statement__content {
  max-height: 38vh;       /* чтобы не раздувало модалку */
  overflow: auto;
  padding-right: 6px;
}

.dor-a11y-statement__content p {
  margin: 0 0 10px 0;
}

.dor-a11y-statement__content h4 {
  margin: 14px 0 8px 0;
  font-size: 0.98rem;
}

.dor-a11y-statement__content a {
  text-decoration: underline;
}