/**
 * JetPopup TOC (popup 1772) — series + manual [msw_toc] blocks.
 *
 * Loaded on every Swiper page (small file) so WP Rocket / Remove Unused CSS cannot
 * strip rules for AJAX/inlined popup HTML (.msw-series-link is not in initial DOM).
 *
 * JetPopup container padding is also set in Elementor (popup 1772) — these rules tighten
 * horizontal inset on phones without requiring an Elementor republish.
 *
 * @see assets/css/_responsive.css — duplicate baseline (this file wins via load order + !important).
 */

/* --- Unified link size: series + Startseite + manual TOC (beats Elementor popup typography) --- */
html body .jet-popup .msw-series-toc-container .msw-series-link,
html body .jet-popup .msw-series-toc-scroll > .msw-toc-item--start .msw-toc-link,
html body .jet-popup .msw-toc-container .msw-toc-link {
    font-size: 1rem !important;
    line-height: 1.45 !important;
    padding: 0.45rem 0.65rem !important;
    min-height: 0 !important;
    font-weight: 400 !important;
}

html body .jet-popup .msw-series-toc-scroll > .msw-toc-item--start .msw-toc-link {
    font-weight: 600 !important;
}

html body .jet-popup .msw-series-toc-container .msw-series-link.is-current {
    font-weight: 600 !important;
}

html body .jet-popup .msw-series-toc-item--chapter .msw-series-link {
    padding-left: 0.85rem !important;
}

html body .jet-popup .msw-series-toc-item--detail .msw-series-link {
    padding-left: 1.15rem !important;
}

/* Divider between [msw_series_toc] and [msw_toc] */
html body .jet-popup .msw-toc-section-divider {
    display: block !important;
    border: 0 !important;
    border-top: 1px solid rgba(0, 0, 0, 0.18) !important;
    margin: 0.65rem 0.65rem 0.4rem !important;
    height: 0 !important;
    width: auto !important;
}

/* Series block: natural height (no independent scroll cap). */
html body .jet-popup .msw-series-toc-scroll {
    max-height: none !important;
    overflow: visible !important;
}

/* Manual TOC: only scroll region when both blocks are present. */
html body .jet-popup .msw-popup-toc-scroll.msw-toc-scroll {
    max-height: calc(100dvh - var(--msw-popup-chrome, 13rem)) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding-bottom: 3.5rem !important;
}

@media screen and (max-width: 767px) {
    /*
     * Tighten Elementor inner container + shortcode widgets (popup template adds side padding).
     * Targets TOC popup content only — not global Elementor pages.
     */
    html body .jet-popup .jet-popup__container-content .elementor-container,
    html body .jet-popup .jet-popup__container-content .e-con,
    html body .jet-popup .jet-popup__container-inner .elementor-container,
    html body .jet-popup .jet-popup__container-inner .e-con {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    html body .jet-popup .elementor-widget-shortcode,
    html body .jet-popup .elementor-widget-heading {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    html body .jet-popup .msw-series-toc-container .msw-series-link,
    html body .jet-popup .msw-series-toc-scroll > .msw-toc-item--start .msw-toc-link,
    html body .jet-popup .msw-toc-container .msw-toc-link {
        padding: 0.4rem 0.35rem !important;
    }

    html body .jet-popup .msw-series-toc-item--chapter .msw-series-link {
        padding-left: 0.5rem !important;
    }

    html body .jet-popup .msw-series-toc-item--detail .msw-series-link {
        padding-left: 0.75rem !important;
    }

    html body .jet-popup .msw-toc-section-divider {
        margin-left: 0.35rem !important;
        margin-right: 0.35rem !important;
    }

    html body .jet-popup:has(.msw-series-toc-scroll) .msw-popup-toc-scroll.msw-toc-scroll {
        max-height: min(44dvh, calc(100dvh - 17rem)) !important;
        padding-bottom: 4rem !important;
    }
}
