/* -------------- popup ----------- */
.nmw-popup {
    position: fixed;
    inset: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 60px 20px;
    background: rgba(0,0,0,.6);
    z-index: 99999;
    box-sizing: border-box;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior:contain;
    -ms-overflow-style: none;
    scrollbar-width: none !important;
    scrollbar-color: transparent transparent;

    opacity:0;
    visibility:hidden;
    transition:opacity .3s ease, visibility .3s ease;
}

html.nmw-popup-open,
body.nmw-popup-open {
    overflow: hidden !important;
    -ms-overflow-style: none;
    scrollbar-width: none !important;
}

html.nmw-popup-open::-webkit-scrollbar,
body.nmw-popup-open::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.nmw-popup::-webkit-scrollbar,
#nmw-popup::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
}

.nmw-popup.active{
    opacity:1;
    visibility:visible;
}

.nmw-popup-content {
    position: relative;
    max-width: 650px;
    width: 100%;
    margin: 0 auto;
    background:rgba(255,255,255,.8);
    backdrop-filter:blur(3px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 18px;
    padding: 12px;
    box-sizing: border-box;
    z-index: 2;
    transform: translateY(100%);
    opacity: 0;
    will-change: transform;
    transition:
            transform .45s cubic-bezier(0.22, 1, 0.36, 1),
            opacity .3s ease;
}

#nmw-popup-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    width: 100%;
    padding: 0;
    gap: 12px;
    box-sizing: border-box;
}

#nmw-popup-inner h5, #nmw-popup-inner h2 {
    font-family: "Segoe UI", sans-serif;
    color: black;
}

#nmw-popup-inner h5 {
    font-size: 17px
}

.nmw-popup.active .nmw-popup-content{
    transform:translateY(0);
    opacity:1;
}

.nmw-popup-header {
    display: flex;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    box-sizing: border-box;
}

.nmw-popup-scroll-content {
    display: flex;
    width: 100%;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
}

.nmw-popup-scroll-content > * {
    flex: 0 0 auto;
}

.nmw-popup-heading-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    margin-left: 6px;
    gap: 4px;
}

.nmw-popup-title {
    margin: 0;
    line-height: 1.1;
    text-align: left;
}

.nmw-popup-overtitle {
    color: #d10b17;
    font-size: 15px;
    line-height: 1.2;
    text-align: left;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.nmw-popup-map {
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
}

.nmw-popup-google-maps {
    display: block;
    width: 100%;
    height: auto;
    min-height: 230px;
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: 18px;
    margin: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.nmw-popup-details {
    width: 100%;
    padding: 4px 0;
    box-sizing: border-box;
}

.nmw-popup-details-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
}

.nmw-popup-details-icon.material-symbols-rounded {
    color: #d10b17;
    font-size: 25px;
}

.nmw-popup-details-description {
    margin: 0;
    line-height: 1.55;
}

.nmw-popup-event-info-list {
    display: grid;
    width: 100%;
    overflow: hidden;
    gap: 2px;
    border: 0;
    border-radius: 18px;
    background: transparent;
    box-shadow: none;
    box-sizing: border-box;
}

.nmw-popup-additional-info {
    display: contents;
}

.nmw-popup-event-info-row--loading span {
    width: min(65%, 240px);
    height: 12px;
    margin-left: 38px;
    border-radius: 3px;
    background: linear-gradient(100deg, rgba(0, 0, 0, .06) 30%, rgba(255, 255, 255, .35) 50%, rgba(0, 0, 0, .06) 70%);
    background-size: 250% 100%;
    animation: nmw-gallery-loading 1.3s infinite linear;
}

.nmw-popup-event-info-row {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    min-height: 5px;
    padding: 8px 11px;
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 3px;
    background: rgba(255, 255, 255, .6);
    color: rgba(0, 0, 0, .82);
    font-size: 14px;
    line-height: 1.3;
    text-decoration: none;
    box-sizing: border-box;
}

a.nmw-popup-event-info-row:hover {
    background: rgba(255, 255, 255, .3);
    color: #d10b17;
}

.nmw-popup-event-info-row:first-child {
    border-radius: 18px 18px 3px 3px;
}

.nmw-popup-event-info-row:last-child {
    border-radius: 3px 3px 18px 18px;
}

.nmw-popup-additional-info .nmw-popup-event-info-row:first-child,
.nmw-popup-additional-info .nmw-popup-event-info-row:last-child {
    border-radius: 3px;
}

.nmw-popup-event-info-icon.material-symbols-rounded {
    display: grid;
    flex: 0 0 28px;
    width: 28px;
    height: 34px;
    place-items: center;
    background: transparent;
    color: #d10b17;
    font-size: 22px;
    line-height: 1;
}

.nmw-popup-event-info-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
}

.nmw-popup-event-info-arrow.material-symbols-rounded {
    flex: 0 0 auto;
    margin-left: auto;
    color: rgba(0, 0, 0, .5);
    font-size: 22px;
}

#nmw-toast{
    position:fixed;
    left:50%;
    bottom:32px;
    transform:translateX(-50%) translateY(30px);
    background: rgb(34 34 34 / 0.7);
    color:#fff;
    padding:14px 18px;
    border-radius:18px;
    font-size:14px;
    line-height:1.5;
    white-space:pre-line;
    box-shadow:0 10px 30px rgba(0,0,0,.25);
    opacity:0;
    pointer-events:none;
    transition:.25s;
    z-index:999999;
    max-width:90%;
}

#nmw-toast.show{
    opacity:1;
    transform:translateX(-50%) translateY(0);
}

/* ------------------ Galerie ---------------- */
.nmw-popup-gallery {
    width: 100%;
    box-sizing: border-box;
}

.nmw-popup-gallery-grid,
.nmw-popup-gallery-loading {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    width: 100%;
    padding: 7px 4px 10px;
    box-sizing: border-box;
}

.nmw-popup-gallery-item {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    margin: 0;
    overflow: hidden;
    border-radius: 15px;
    background: #e8e8e8;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .14);
    cursor: zoom-in;
    transform: rotate(var(--nmw-gallery-rotation, 0deg));
    transition: transform .2s ease, box-shadow .2s ease;
}

.nmw-popup-gallery-item:hover {
    box-shadow: 0 6px 17px rgba(0, 0, 0, .2);
    transform: rotate(var(--nmw-gallery-rotation, 0deg)) translateY(-2px);
}

.nmw-popup-gallery-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nmw-popup-gallery-item figcaption {
    position: absolute;
    right: 10px;
    bottom: 10px;
    left: 10px;
    padding: 7px 10px;
    border-radius: 9px;
    background: rgba(0, 0, 0, .58);
    color: #fff;
    font-size: 13px;
    backdrop-filter: blur(5px);
}

.nmw-popup-gallery-loading {
    overflow: hidden;
}

.nmw-popup-gallery-loading span:not(.screen-reader-text) {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 15px;
    background: linear-gradient(100deg, #e4e4e4 30%, #f5f5f5 50%, #e4e4e4 70%);
    background-size: 250% 100%;
    animation: nmw-gallery-loading 1.3s infinite linear;
}

/* ------------------ Lightbox ---------------- */
.nmw-lightbox {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 55px 70px;
    background: rgba(8, 8, 8, .92);
    backdrop-filter: blur(8px);
    z-index: 100000;
    box-sizing: border-box;
}

.nmw-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 110px);
    border-radius: 12px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, .45);
    object-fit: contain;
}

.nmw-lightbox-caption {
    position: absolute;
    bottom: 18px;
    left: 50%;
    max-width: min(700px, 80vw);
    padding: 8px 13px;
    border-radius: 9px;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    transform: translateX(-50%);
}

.nmw-lightbox-close,
.nmw-lightbox-previous,
.nmw-lightbox-next {
    position: absolute;
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 50%;
    background: rgba(255, 255, 255, .13);
    color: #fff;
    cursor: pointer;
}

.nmw-lightbox-close {
    top: 18px;
    right: 18px;
}

.nmw-lightbox-previous {
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
}

.nmw-lightbox-next {
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
}

@keyframes nmw-gallery-loading {
    to { background-position-x: -250%; }
}

@media (prefers-reduced-motion: reduce) {
    .nmw-popup-gallery-loading span:not(.screen-reader-text) { animation: none; }
    .nmw-popup-event-info-row--loading span { animation: none; }
    .nmw-popup-gallery-item { transition: none !important; }
}

/* Handy und Tablet verwenden ausschliesslich die echte Event-Einzelseite. */
@media (max-width: 1024px) {
    .nmw-popup:not(.nmw-event-page) {
        display: none !important;
    }
}

/* --------------------------------------------------------------------------
 * Desktop: festes Event-Panel rechts, Website im verbleibenden Raum
 * ----------------------------------------------------------------------- */

@media (min-width: 1025px) {
    html {
        --nmw-desktop-popup-width: clamp(380px, 29vw, 440px);
    }

    body.nmw-popup-layout-ready {
        box-sizing: border-box;
        transition: padding-right .45s cubic-bezier(.22, 1, .36, 1);
    }

    html.nmw-popup-open,
    body.nmw-popup-open {
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -ms-overflow-style: auto;
        scrollbar-width: auto !important;
    }

    html.nmw-popup-open::-webkit-scrollbar,
    body.nmw-popup-open::-webkit-scrollbar {
        display: block;
        width: auto;
        height: auto;
    }

    body.nmw-popup-open {
        padding-right: var(--nmw-desktop-popup-width) !important;
    }

    /* Fixed und außerhalb des normalen Body-Flows positionierte Header werden
       vom Body-Padding nicht automatisch schmaler. Die üblichen Astra- und
       Elementor-Header erhalten deshalb dieselbe freie Seitenbreite. */
    body.nmw-popup-layout-ready :is(
        #masthead,
        .site-header,
        .ast-header-sticked,
        .elementor-location-header
    ) {
        transition:
            width .45s cubic-bezier(.22, 1, .36, 1),
            right .45s cubic-bezier(.22, 1, .36, 1);
    }

    body.nmw-popup-open :is(
        #masthead,
        .site-header,
        .ast-header-sticked,
        .elementor-location-header
    ) {
        right: var(--nmw-desktop-popup-width) !important;
        width: calc(100% - var(--nmw-desktop-popup-width)) !important;
        max-width: calc(100% - var(--nmw-desktop-popup-width)) !important;
    }

    /* Das Popup belegt nur seine eigene Spalte. Die übrige Seite bleibt
       sichtbar, wird nicht überlagert und erhält keinen dunklen Backdrop. */
    .nmw-popup {
        inset: 0 0 0 auto;
        width: var(--nmw-desktop-popup-width);
        height: 100vh;
        height: 100dvh;
        padding: 0 0 0 10px;
        overflow: hidden;
        background: transparent;
        pointer-events: none;
        box-sizing: border-box;
        opacity: 1;
        transition: visibility 0s linear .48s;
    }

    .nmw-popup.active {
        pointer-events: auto;
        transition-delay: 0s;
    }

    .nmw-popup-content {
        width: 100%;
        max-width: none;
        height: 100%;
        min-height: 0;
        max-height: none;
        margin: 0;
        padding: 14px 13px 0;
        overflow: hidden;
        border: 1px solid rgba(0, 91, 69, .13);
        border-right: 0;
        border-radius: 0 0 0 22px;
        background: #e2e9e6;
        box-shadow: -12px 0 32px rgba(0, 38, 29, .2);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        transform: translateY(calc(100% + 16px));
        opacity: 1;
        transition: transform .52s cubic-bezier(.22, 1, .36, 1);
    }

    .nmw-popup.active .nmw-popup-content {
        transform: translateY(0);
    }

    #nmw-popup-inner {
        display: flex;
        width: 100%;
        height: 100%;
        min-height: 0;
        justify-content: flex-start;
        align-items: stretch;
        gap: 0;
        overflow: hidden;
    }

    .nmw-popup-header {
        position: relative;
        flex: 0 0 auto;
        padding: 0 1px 10px;
        z-index: 2;
    }

    .nmw-popup-scroll-content {
        flex: 1 1 auto;
        min-height: 0;
        width: calc(100% + 13px);
        margin-right: -13px;
        padding: 2px 13px 20px 1px;
        align-items: stretch;
        overflow-x: clip;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        scrollbar-color: rgba(0, 91, 69, .42) transparent;
        -webkit-overflow-scrolling: touch;
    }

    .nmw-popup-scroll-content::-webkit-scrollbar {
        width: 6px;
    }

    .nmw-popup-scroll-content::-webkit-scrollbar-track {
        background: transparent;
    }

    .nmw-popup-scroll-content::-webkit-scrollbar-thumb {
        background: rgba(0, 91, 69, .35);
        border-radius: 999px;
    }

    .nmw-popup-title {
        font-size: clamp(26px, 2.25vw, 34px);
    }

    .nmw-popup-overtitle {
        font-size: 13px;
    }

    .nmw-popup-google-maps {
        min-height: 220px;
    }
}

@media (min-width: 1025px) and (prefers-reduced-motion: reduce) {
    body.nmw-popup-layout-ready,
    .nmw-popup-content {
        transition-duration: .01ms !important;
    }
}
