/* Textbaustein-Popup — geladen mit [textbaustein_popup] */

:root {
    --mk-color-primary: #80abb5;
    --mk-color-dark: #1c5f6b;
}

.mk-textbaustein-popup[hidden] {
    display: none !important;
}

.mk-textbaustein-popup {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 3vw, 24px);
    box-sizing: border-box;
    font-family: "DM Sans", system-ui, sans-serif;
}

.mk-textbaustein-popup__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    cursor: pointer;
}

.mk-textbaustein-popup__dialog {
    position: relative;
    z-index: 1;
    width: min(720px, 100%);
    max-height: min(100%, 100dvh - 24px);
    overflow: auto;
    background: #fff;
    border-radius: 8px;
    padding: clamp(16px, 3vw, 28px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
    box-sizing: border-box;
}

.mk-textbaustein-popup__close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 4px;
    background: rgba(28, 95, 107, 0.12);
    color: var(--mk-color-dark);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.mk-textbaustein-popup__close:hover {
    background: rgba(28, 95, 107, 0.22);
}

/* Header: Logo links, Titel mittig (Close bleibt rechts oben) */
.mk-textbaustein-popup__header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    margin: 0 0 20px;
    padding: 0 44px;
}

.mk-textbaustein-popup__title {
    margin: 0;
    max-width: 70%;
    color: var(--mk-color-dark);
    font-size: clamp(1.05rem, 2.4vw, 1.35rem);
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
    word-break: break-word;
}

.mk-textbaustein-popup__title[hidden] {
    display: none !important;
}

.mk-textbaustein-popup__logo-wrap {
    position: absolute;
    left: 0;
    top: 0;
    max-width: 96px;
}

.mk-textbaustein-popup__logo {
    display: block;
    max-width: 96px;
    max-height: 72px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.mk-textbaustein-popup__body {
    color: #1a1a1a;
    font-size: 1rem;
    line-height: 1.55;
}

.mk-textbaustein-popup__body p {
    margin: 0 0 1em;
    min-height: 1em;
}

.mk-textbaustein-popup__body p:last-child {
    margin-bottom: 0;
}

.mk-textbaustein-popup__body ul,
.mk-textbaustein-popup__body ol {
    margin: 0 0 1em 1.25em;
    padding: 0;
}

.mk-textbaustein-popup__body li {
    margin: 0 0 0.35em;
}

.mk-textbaustein-popup__body h1,
.mk-textbaustein-popup__body h2,
.mk-textbaustein-popup__body h3 {
    margin: 1.1em 0 0.55em;
    line-height: 1.3;
    color: var(--mk-color-dark);
}

.mk-textbaustein-popup__actions {
    margin-top: 24px;
    display: flex;
    justify-content: center;
}

.mk-textbaustein-popup__download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 22px;
    border-radius: 4px;
    background: var(--mk-color-dark);
    color: #fff !important;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 0.95rem;
}

.mk-textbaustein-popup__download:hover {
    background: #164a54;
}

.mk-textbaustein-popup__download[hidden] {
    display: none !important;
}

/* Scroll sperren, Scrollbar-Breite per JS kompensieren (--mk-scrollbar-compensate) */
html.mk-textbaustein-popup-open,
html.mk-textbaustein-popup-open body {
    overflow: hidden;
}

html.mk-textbaustein-popup-open body {
    padding-right: var(--mk-scrollbar-compensate, 0px);
}

/* Fixe/sticky Header oft am Viewport — gleicher Ausgleich gegen Jump */
html.mk-textbaustein-popup-open .bde-header,
html.mk-textbaustein-popup-open .breakdance-header,
html.mk-textbaustein-popup-open header.sticky,
html.mk-textbaustein-popup-open [data-sticky="true"] {
    padding-right: var(--mk-scrollbar-compensate, 0px);
}

@media (max-width: 600px) {
    .mk-textbaustein-popup {
        align-items: flex-start;
        padding: 10px;
        padding-top: max(10px, env(safe-area-inset-top));
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    .mk-textbaustein-popup__dialog {
        width: 100%;
        max-height: calc(100dvh - 20px);
        border-radius: 6px;
        padding: 16px;
        padding-top: 18px;
    }

    .mk-textbaustein-popup__close {
        width: 36px;
        height: 36px;
        font-size: 24px;
    }

    .mk-textbaustein-popup__header {
        min-height: 48px;
        margin-bottom: 16px;
        padding: 0 36px;
    }

    .mk-textbaustein-popup__logo-wrap {
        max-width: 72px;
    }

    .mk-textbaustein-popup__logo {
        max-width: 72px;
        max-height: 56px;
    }

    .mk-textbaustein-popup__download {
        width: 100%;
    }
}
