.gb-popup-open {
    overflow: hidden;
}

.gb-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(17, 17, 17, .72);
    opacity: 0;
    transition: opacity .18s ease;
}

.gb-popup-overlay.is-visible {
    opacity: 1;
}

.gb-popup {
    position: relative;
    width: min(720px, 100%);
    max-height: 88vh;
    overflow: auto;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
    transform: translateY(12px) scale(.98);
    transition: transform .18s ease;
    outline: 0;
}

.gb-popup-overlay.is-visible .gb-popup {
    transform: none;
}

/*
 * Das X wird aus zwei Linien gezeichnet. Dadurch sitzt es unabhängig
 * von Schriftart und Font-Metrik exakt mittig im runden Schließen-Button.
 */
.gb-popup__close {
    position: absolute;
    top: .75rem;
    right: .75rem;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .95);
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .18);
    appearance: none;
}

.gb-popup__close::before,
.gb-popup__close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.15rem;
    height: 2px;
    border-radius: 999px;
    background: #1d2327;
    transform-origin: center;
}

.gb-popup__close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.gb-popup__close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.gb-popup__close:hover {
    background: #fff;
}

.gb-popup__close:focus-visible {
    outline: 3px solid #222;
    outline-offset: 2px;
}

.gb-popup__media {
    display: grid;
    place-items: center;
    width: 100%;
    background: #eee;
}

/* Bild immer proportional und ohne Beschnitt darstellen. */
.gb-popup__image {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    object-fit: contain;
    object-position: center;
}

/*
 * Wenn der Textbereich deaktiviert ist, wird die Grafik so skaliert,
 * dass sie vollständig in das verfügbare Browserfenster passt.
 */
.gb-popup--image-only {
    width: min(900px, 100%);
    overflow: hidden;
}

.gb-popup--image-only .gb-popup__media {
    max-height: 88vh;
    background: #fff;
}

.gb-popup--image-only .gb-popup__image {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 88vh;
}

.gb-popup__content {
    padding: clamp(1.35rem, 4vw, 2.25rem);
    text-align: center;
}

.gb-popup__title {
    margin: 0 0 .75rem;
    font-size: clamp(1.75rem, 5vw, 2.6rem);
    line-height: 1.12;
}

.gb-popup__message {
    font-size: 1.05rem;
    line-height: 1.65;
}

.gb-popup__message:empty {
    display: none;
}

.gb-popup__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    margin-top: 1.25rem;
    padding: .75rem 1.25rem;
    border-radius: 999px;
    background: #8b1e1e;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}

.gb-popup__button:hover,
.gb-popup__button:focus-visible {
    background: #681515;
    color: #fff;
    outline: 3px solid #681515;
    outline-offset: 3px;
}

@media (max-width: 640px) {
    .gb-popup-overlay {
        align-items: end;
        padding: .5rem;
    }

    .gb-popup {
        max-height: 92vh;
        border-radius: 18px 18px 8px 8px;
    }

    .gb-popup--image-only .gb-popup__media,
    .gb-popup--image-only .gb-popup__image {
        max-height: 92vh;
    }

    .gb-popup__close {
        top: .6rem;
        right: .6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gb-popup-overlay,
    .gb-popup {
        transition: none;
    }
}
