/* Zoom Function Disabled */
body #eb .eb-post-image.eb-image-popup-button {
    pointer-events: none;
}

/* =============================================
   Flying Table of Contents
   ============================================= */

#toc {
    position: relative;
    margin: 32px 0;
    padding: 22px 28px;
    background-color: #ffffff;
    border: 2px solid #02267e;
    border-radius: 8px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* ── Toggle-Button (vertikaler Griff) ── */

#tocToggleBtn {
    display: none;
}

.toc-active #tocToggleBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    background: #ffffff;
    border: 2px solid #02267e;
    color: #02267e;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    z-index: 10;
    transition: background 0.2s ease;
    outline: none;
}

.toc-active #tocToggleBtn:hover {
    background: #f0f4fa;
}

/* Focus nur bei Tastaturnavigation, nicht bei Mausklick */
.toc-active #tocToggleBtn:focus {
    outline: none;
}

.toc-active #tocToggleBtn:focus-visible {
    outline: 2px solid #ee9c38;
    outline-offset: 2px;
}

.toc-active #tocToggleBtn i {
    transform: scale(2, 5.5);
}

/* ── Aktiver Zustand (fixed) ── */

.toc-active {
    position: fixed;
    top: 6em;
    left: 10px;
    max-width: 380px;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .15);
    animation: tocIn 0.2s ease-out;
    /* KEIN overflow-y hier – geht auf die Liste */
    overflow: visible;
}

@keyframes tocIn {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scrolling auf die Liste verlagern */
.toc-active #tocList {
    max-height: calc(100vh - 14em);
    overflow-y: auto;
}

/* ── Titel ── */

#tocTitle {
    display: block;
    margin-bottom: 14px;
    font-size: 1.15em;
    font-weight: bold;
    color: #283583;
}

/* Alte Pfeile am Titel komplett entfernen */
#tocTitle::before {
    content: none !important;
    display: none !important;
}

/* ── Liste ── */

#tocList {
    counter-reset: item;
    list-style: none;
    margin-top: 8px;
    margin-bottom: 0;
    padding: 0;
}

#tocList li {
    counter-increment: item;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

#tocList li::before {
    content: counter(item);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #283583;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

#tocList li a {
    color: #4a4a4a;
    font-weight: bold;
}

#toc a.active {
    text-decoration: underline !important;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

/* =============================================
   Desktop (>= 768px)
   ============================================= */

@media (min-width: 768px) {

    #toc.toc-active {
        position: fixed;
        top: 8em;
        left: 0;
        min-width: 250px;
        margin: 0;
        z-index: 9999;
        /* Eingeklappt: eigene Breite nach links, nur Button bleibt sichtbar */
        transform: translateX(calc(-100% - 2px));
        transition: transform 0.3s ease;
        border: 2px solid #02267e;
        border-radius: 8px;
        overflow: visible;
    }

    #toc.toc-active.toc-open {
        transform: translateX(0);
    }

    /* Toggle-Button: AUSSERHALB des TOC positioniert */
    #toc.toc-active #tocToggleBtn {
        top: 50%;
        transform: translateY(-50%);
        right: -44px;
        width: 42px;
        height: 120px;
        border-left: none;
        border-radius: 0 12px 12px 0;
        box-shadow: 4px 2px 8px rgba(0, 0, 0, 0.10);
    }
}

/* =============================================
   Mobile (< 768px)
   ============================================= */

@media (max-width: 767px) {

    /* Chevron-Button auf Mobile komplett ausblenden */
    #toc.toc-active #tocToggleBtn {
        display: none !important;
    }

    /* Titel wird zum klickbaren Toggle */
    #toc.toc-active #tocTitle {
        cursor: pointer;
        margin-bottom: 0;
        text-align: center;
        padding: 4px 0;
    }

    #toc.toc-active #tocTitle:active {
        opacity: 0.7;
    }

    /* Liste im eingeklappten Zustand verstecken */
    #toc.toc-active:not(.toc-open) #tocList {
        display: none;
    }

    /* Liste im ausgeklappten Zustand: Abstand zum Titel */
    #toc.toc-active.toc-open #tocTitle {
        margin-bottom: 14px;
    }

    #toc.toc-active {
        position: fixed;
        left: 50%;
        transform: translateX(-50%);
        top: unset;
        bottom: -15em;
        width: 100%;
        margin: 0;
        transition: bottom 0.3s ease;
        z-index: 9999;
        border-radius: 12px 12px 0 0;
        border-bottom: none;
    }

    #toc.toc-active:not(.toc-open) {
        bottom: 0;
        padding: 12px 28px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    #toc.toc-active.toc-open {
        bottom: 0;
        padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    }
}

/* Scrollbalken durch Button-Overflow verhindern */
html.toc-is-active {
    overflow-x: hidden !important;
}

/* =============================================
   CTA-Produktkarten – Responsive
   Deckt beide Varianten ab:
   - Bildkarte (Spalte mit background-image)
   - Iconkarte (Spalte mit <img>, beide Spalten
     haben background-color)
   Unterscheidung ueber die flex-Werte:
   flex: 0 0 ...  = Bild-/Icon-Spalte
   flex: 1        = Text-Spalte
   ============================================= */

@media (max-width: 900px) {

    /* ── Container: von Zeile auf Spalte umbrechen ── */
    .ts-cta-card,
    #eb div[style*="display: flex"][style*="box-shadow"],
    .eb-entry-body div[style*="display: flex"][style*="box-shadow"] {
        flex-direction: column !important;
    }

    /* ── Bild-/Icon-Spalte: volle Breite ── */
    .ts-cta-card>div:first-child,
    #eb div[style*="display: flex"][style*="box-shadow"]>div[style*="flex: 0 0"],
    .eb-entry-body div[style*="display: flex"][style*="box-shadow"]>div[style*="flex: 0 0"] {
        flex: 0 0 auto !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Bildkarte: feste Hoehe fuer background-image */
    #eb div[style*="display: flex"][style*="box-shadow"]>div[style*="background-image"],
    .eb-entry-body div[style*="display: flex"][style*="box-shadow"]>div[style*="background-image"] {
        min-height: 200px !important;
        height: 200px !important;
    }

    /* Iconkarte: Hoehe nach Inhalt, kompakteres Padding */
    #eb div[style*="display: flex"][style*="box-shadow"]>div[style*="flex: 0 0"]:not([style*="background-image"]),
    .eb-entry-body div[style*="display: flex"][style*="box-shadow"]>div[style*="flex: 0 0"]:not([style*="background-image"]) {
        min-height: 0 !important;
        height: auto !important;
        padding: 28px 20px 12px !important;
    }

    /* Icon selbst etwas kleiner auf Mobile */
    #eb div[style*="display: flex"][style*="box-shadow"]>div[style*="flex: 0 0"] img,
    .eb-entry-body div[style*="display: flex"][style*="box-shadow"]>div[style*="flex: 0 0"] img {
        width: 90px !important;
        max-width: 100% !important;
        height: auto !important;
    }

    /* ── Text-Spalte: volle Breite, weniger Padding ── */
    .ts-cta-card>div:last-child,
    #eb div[style*="display: flex"][style*="box-shadow"]>div[style*="flex: 1"],
    .eb-entry-body div[style*="display: flex"][style*="box-shadow"]>div[style*="flex: 1"] {
        flex: 1 1 auto !important;
        width: 100% !important;
        padding: 22px 20px !important;
        box-sizing: border-box !important;
        /* Trennlinie der Iconkarte: seitlich weg, oben hin */
        border-left: none !important;
        border-top: 1px solid #d8eaf4 !important;
    }

    /* ── CTA-Button: volle Breite, umbruchfaehig ── */
    .ts-cta-card a[href],
    #eb div[style*="display: flex"][style*="box-shadow"] a[style*="border-radius: 25px"],
    .eb-entry-body div[style*="display: flex"][style*="box-shadow"] a[style*="border-radius: 25px"] {
        display: block !important;
        width: 100% !important;
        text-align: center !important;
        padding: 14px 18px !important;
        box-sizing: border-box !important;
        white-space: normal !important;
        overflow-wrap: break-word !important;
        hyphens: auto;
    }

    /* ── Ueberschrift umbruchfaehig ── */
    .ts-cta-card strong,
    #eb div[style*="display: flex"][style*="box-shadow"] strong,
    .eb-entry-body div[style*="display: flex"][style*="box-shadow"] strong {
        overflow-wrap: break-word !important;
        hyphens: auto;
    }
}