/* Barrierefreiheit: Sprunglink, Fokus, Bewegung und Lesehilfe. Farben aus dem CD von Mendels, anpassbar über die Variablen. */
:root {
    --bf-gruen: #2f7a30;
    --bf-dunkel: #3b4453;
    --bf-hell: #f4f6f4;
}

/* ---------------------------------------------------------------- Sprunglink: unsichtbar, bis er den Fokus hat */

.bf-sprung {
    position: absolute;
    left: 12px;
    top: -200px;
    z-index: 100000;
    padding: 12px 18px;
    background: var(--bf-dunkel);
    color: #fff !important;
    font: 600 16px/1.3 var(--e-global-typography-text-font-family, inherit), sans-serif;
    border-radius: 0 0 6px 6px;
    text-decoration: none;
}

.bf-sprung:focus {
    top: 0;
}

/* ---------------------------------------------------------------- Fokus: grüner Rahmen mit weißem Rand, auf hellem und dunklem Grund sichtbar */

html.bf-fokus :is(a, button, input, select, textarea, summary, [tabindex], [role="button"]):focus-visible {
    outline: 3px solid var(--bf-gruen) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 2px #fff !important;
}

/* ---------------------------------------------------------------- Bewegung: aus, wenn am Gerät eingestellt oder in der Lesehilfe gewählt */

@media (prefers-reduced-motion: reduce) {
    html.bf-system-ruhig *,
    html.bf-system-ruhig *::before,
    html.bf-system-ruhig *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    html.bf-system-ruhig .elementor-invisible {
        visibility: visible !important;
    }
}

html.bf-ruhig *,
html.bf-ruhig *::before,
html.bf-ruhig *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

html.bf-ruhig .elementor-invisible {
    visibility: visible !important;
}

/* ---------------------------------------------------------------- Lesehilfe: Links unterstreichen, Kontrast für Formularfelder */

html.bf-links a:not(.elementor-button):not(.bf-sprung) {
    text-decoration: underline !important;
    text-decoration-thickness: 2px !important;
    text-underline-offset: 3px !important;
}

html.bf-kontrast :is(input, select, textarea) {
    border-color: #000 !important;
}

/* Negativ: helle Flächen werden dunkel und umgekehrt. hue-rotate dreht die Farbtöne zurück, Grün bleibt grünlich.
   Am <html> ändert der Filter nichts an festen Elementen (Kopfzeile, Lesehilfe), anders als an jedem anderen Element.
   Fotos, Videos und Karten werden noch einmal umgekehrt und sehen so aus wie immer; PNG und SVG (Logos, Symbole) nicht,
   sonst wäre ein dunkles Logo auf dunklem Grund unsichtbar. Ganz passt nicht alles zusammen, das ist bei Negativ so. */
html.bf-negativ {
    filter: invert(1) hue-rotate(180deg);
    background: #fff;
}

html.bf-negativ :is(img:not([src*=".png"]):not([src*=".svg"]):not([src*=".gif"]), video, iframe, canvas) {
    filter: invert(1) hue-rotate(180deg);
}

html.bf-kontrast ::placeholder {
    color: #333 !important;
    opacity: 1 !important;
}

/* ---------------------------------------------------------------- Lesehilfe: Knopf und Feld
   Alles über #bf-lesehilfe, denn Theme und Elementor-Kit gestalten jeden <button> der Seite
   (z. B. „.elementor-kit-… button:hover“, „[type=button]“ von Hello Elementor). Mit der ID gewinnt immer diese Datei. */

#bf-lesehilfe {
    position: fixed;
    bottom: 16px;
    z-index: 99999;
    font-family: var(--e-global-typography-text-font-family, inherit), sans-serif;
    font-size: 16px;
    line-height: 1.4;
    color: var(--bf-dunkel);
}

#bf-lesehilfe.bf-pos-rechts {
    right: 16px;
}

#bf-lesehilfe.bf-pos-links {
    left: 16px;
}

/* Grundlage für alle Knöpfe der Lesehilfe: nichts vom Theme übernehmen */
#bf-lesehilfe button {
    display: inline-block;
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: inherit;
    font: inherit;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: normal;
    text-transform: none;
    text-decoration: none;
    text-align: left;
    white-space: normal;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

#bf-lesehilfe .bf-knopf {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 10px 16px 10px 12px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: var(--bf-dunkel);
    color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

#bf-lesehilfe .bf-knopf:hover {
    background: #2c3340;
    color: #fff;
}

#bf-lesehilfe .bf-knopf svg {
    flex: none;
}

/* Benutzt? Dann ein grüner Ring am Knopf, damit man weiß, woher die große Schrift kommt. */
#bf-lesehilfe.bf-benutzt .bf-knopf {
    border-color: var(--bf-gruen);
    box-shadow: 0 0 0 3px var(--bf-gruen), 0 2px 10px rgba(0, 0, 0, 0.25);
}

#bf-lesehilfe .bf-feld {
    position: absolute;
    bottom: 60px;
    width: 300px;
    max-width: calc(100vw - 32px);
    box-sizing: border-box;
    padding: 16px;
    background: #fff;
    border: 1px solid #c8cdd3;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
    text-align: left;
}

#bf-lesehilfe.bf-pos-rechts .bf-feld {
    right: 0;
}

#bf-lesehilfe.bf-pos-links .bf-feld {
    left: 0;
}

#bf-lesehilfe .bf-feld[hidden] {
    display: none;
}

#bf-lesehilfe .bf-titel {
    margin: 0 40px 12px 0;
    padding: 0;
    color: var(--bf-dunkel);
    font-family: var(--e-global-typography-primary-font-family, inherit), sans-serif;
    font-weight: 700;
    font-size: 18px;
    line-height: 1.3;
}

#bf-lesehilfe .bf-untertitel {
    margin: 0 0 6px;
    padding: 0;
    color: var(--bf-dunkel);
    font-weight: 600;
}

#bf-lesehilfe .bf-gruppe {
    margin-bottom: 12px;
}

#bf-lesehilfe .bf-reihe {
    display: flex;
    gap: 6px;
}

/* Aus: weiß mit dunklem Rand. An: grün mit weißer Schrift. */
#bf-lesehilfe :is(.bf-wahl, .bf-schalter, .bf-zurueck) {
    box-sizing: border-box;
    min-height: 44px;
    border: 2px solid var(--bf-dunkel);
    border-radius: 8px;
    background: #fff;
    color: var(--bf-dunkel);
}

#bf-lesehilfe :is(.bf-wahl, .bf-schalter, .bf-zurueck):hover {
    background: var(--bf-hell);
    color: var(--bf-dunkel);
}

#bf-lesehilfe :is(.bf-wahl, .bf-schalter)[aria-pressed="true"] {
    border-color: var(--bf-gruen);
    background: var(--bf-gruen);
    color: #fff;
}

#bf-lesehilfe :is(.bf-wahl, .bf-schalter)[aria-pressed="true"]:hover {
    border-color: #276628;
    background: #276628;
    color: #fff;
}

#bf-lesehilfe .bf-wahl {
    flex: 1 1 auto;
    padding: 6px 8px;
    font-size: 14px;
    text-align: center;
}

#bf-lesehilfe .bf-schalter {
    position: relative;
    display: block;
    width: 100%;
    margin: 0 0 6px;
    padding: 8px 12px 8px 44px;
}

/* Kleiner Schalter vor dem Text: aus = leerer Kreis, an = weißer Kreis mit Haken */
#bf-lesehilfe .bf-schalter::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 50%;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    border: 2px solid var(--bf-dunkel);
    border-radius: 50%;
    box-sizing: border-box;
    background: #fff;
}

#bf-lesehilfe .bf-schalter[aria-pressed="true"]::before {
    border-color: #fff;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%232f7a30' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}

#bf-lesehilfe .bf-zurueck {
    display: block;
    width: 100%;
    margin: 4px 0 0;
    padding: 8px 12px;
    text-align: center;
    border-style: dashed;
}

#bf-lesehilfe .bf-hinweis {
    margin: 12px 0 0;
    padding: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #59616d;
}

#bf-lesehilfe .bf-hinweis a {
    color: var(--bf-gruen);
    text-decoration: underline;
}

#bf-lesehilfe .bf-hinweis kbd {
    font: inherit;
    font-weight: 600;
    padding: 0 4px;
    border: 1px solid #c8cdd3;
    border-radius: 4px;
    background: var(--bf-hell);
    color: var(--bf-dunkel);
}

#bf-lesehilfe .bf-schliessen {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--bf-dunkel);
    font-size: 26px;
    line-height: 1;
    text-align: center;
}

#bf-lesehilfe .bf-schliessen:hover {
    background: var(--bf-hell);
    color: var(--bf-dunkel);
}

#bf-lesehilfe :is(button, a):focus-visible {
    outline: 3px solid var(--bf-gruen) !important;
    outline-offset: 2px !important;
}

@media (max-width: 480px) {
    #bf-lesehilfe .bf-knopf-text {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    #bf-lesehilfe .bf-knopf {
        padding: 10px;
    }
}

@media print {
    #bf-lesehilfe,
    .bf-sprung {
        display: none !important;
    }
}
