/* ================================================================
   Webweek Popups 2.1 — Frontend
   Kleuren via CSS-variabelen (gezet door kleurthema's):
   --ww-bg, --ww-text, --ww-head-bg, --ww-head-title, --ww-head-border,
   --ww-close, --ww-close-bg
   ================================================================ */

.ww-popup,
.ww-popup *,
.ww-popup *::before,
.ww-popup *::after { box-sizing: border-box; }

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

.ww-desktop { display: block; }
.ww-mobile  { display: none; }

.ww-text > *:first-child { margin-top: 0; }
.ww-text > *:last-child  { margin-bottom: 0; }
.ww-text img { max-width: 100%; height: auto; }
.ww-text .iframe-wrap { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; }
.ww-text .iframe-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ── Sluitknop (gedeeld) ──────────────────────────────────────── */
.ww-popup button.ww-close,
.ww-popup button.ww-top-close {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ww-close, #8a8f98);
    cursor: pointer;
    line-height: 1;
    box-shadow: none;
    transition: background-color .15s, color .15s, transform .15s, opacity .15s;
}
.ww-popup button.ww-close svg,
.ww-popup button.ww-top-close svg { display: block; width: 20px; height: 20px; }
.ww-popup button.ww-close:hover { background: rgba(0,0,0,.06); color: var(--ww-close, #1d2327); }
.ww-popup button.ww-close:focus-visible,
.ww-popup button.ww-top-close:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.ww-popup button.ww-close-float {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    background: var(--ww-close-bg, rgba(255,255,255,.92));
    color: var(--ww-close, #1d2327);
    box-shadow: 0 2px 10px rgba(0,0,0,.15);
}
.ww-popup button.ww-close-float:hover { background: var(--ww-close-bg, #fff); transform: scale(1.06); }

/* Bestand tegen thema-CSS die alle <button>s stylet */
.ww-popup button.ww-close:not(#ww-x),
.ww-popup button.ww-top-close:not(#ww-x) {
    border: 0 !important;
    box-shadow: none;
    text-decoration: none !important;
    min-height: 0 !important;
    font-size: 0 !important;
}
.ww-popup .ww-header button.ww-close:not(#ww-x),
.ww-popup .ww-modal-text > button.ww-close:not(.ww-close-float):not(#ww-x) {
    background-color: transparent !important;
    color: var(--ww-close, var(--ww-head-title, #8a8f98)) !important;
}
.ww-popup .ww-header button.ww-close:not(#ww-x):hover { background-color: rgba(127,127,127,.15) !important; }
.ww-popup button.ww-close-float:not(#ww-x) {
    background-color: var(--ww-close-bg, rgba(255,255,255,.92)) !important;
    color: var(--ww-close, #1d2327) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,.15) !important;
}
.ww-popup .ww-modal-imgonly button.ww-close-float:not(#ww-x) {
    background-color: var(--ww-close-bg, rgba(0,0,0,.55)) !important;
    color: var(--ww-close, #fff) !important;
}
.ww-popup button.ww-top-close:not(#ww-x) {
    background-color: var(--ww-close-bg, rgba(127,127,127,.18)) !important;
    color: var(--ww-close, currentColor) !important;
}
.ww-popup button.ww-close:not(#ww-x):hover,
.ww-popup button.ww-top-close:not(#ww-x):hover { opacity: .85; }

/* ═══════════════════════════════════════════════════════════════
   BALK
   ═══════════════════════════════════════════════════════════════ */
.ww-popup-top {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 48px;
    padding: 10px 20px;
    background: var(--ww-bg, #197f3e);
    color: var(--ww-text, #fff);
    font-size: .95rem;
    line-height: 1.45;
    opacity: 0;
    transition: opacity .25s ease, transform .25s ease;
}
.ww-popup-top.has-close { padding-right: 60px; }
.ww-bar-top    { top: 0;    transform: translateY(-100%); }
.ww-bar-bottom { bottom: 0; transform: translateY(100%); box-shadow: 0 -2px 12px rgba(0,0,0,.12); }
.ww-popup-top.ww-is-open { opacity: 1; transform: none; }
.admin-bar .ww-bar-top { top: 32px; }

.ww-top-content { max-width: 1100px; width: 100%; text-align: center; }
.ww-top-content .ww-text p { margin: 0; }
.ww-top-content a { color: inherit; text-decoration: underline; }

.ww-popup button.ww-top-close {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: var(--ww-close-bg, rgba(255,255,255,.18));
    color: var(--ww-close, currentColor);
}
.ww-popup button.ww-top-close svg { width: 18px; height: 18px; }
.ww-popup button.ww-top-close:hover { background: var(--ww-close-bg, rgba(255,255,255,.32)); opacity: .85; }

html.ww-bar-top-active    body { padding-top:    var(--ww-bar-top-h, 48px); }
html.ww-bar-bottom-active body { padding-bottom: var(--ww-bar-bottom-h, 48px); }
html.ww-bar-top-active body .site-header.is-sticky,
html.ww-bar-top-active body header.sticky { top: var(--ww-bar-top-h, 48px); }

/* ═══════════════════════════════════════════════════════════════
   POPUP
   ═══════════════════════════════════════════════════════════════ */
.ww-popup-modal {
    position: fixed;
    inset: 0;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
}
.ww-popup-modal.has-overlay             { z-index: 100000; }
.ww-popup-modal.no-overlay              { pointer-events: none; }
.ww-popup-modal.no-overlay .ww-modal    { pointer-events: auto; }

.ww-pos-top          { align-items: flex-start; }
.ww-pos-bottom       { align-items: flex-end; }
.ww-pos-bottom-right { align-items: flex-end; justify-content: flex-end; }
.ww-pos-bottom-left  { align-items: flex-end; justify-content: flex-start; }

.ww-overlay {
    position: fixed;
    inset: 0;
    background: var(--ww-overlay, rgba(0,0,0,.5));
    animation: ww-fade-in .25s ease both;
}
.ww-overlay[data-ww-close] { cursor: pointer; }
.ww-popup .ww-modal:focus, .ww-popup .ww-modal:focus-visible { outline: none; }

/* ── Modal basis ─────────────────────────────────────────────── */
.ww-modal {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(var(--ww-width, 800px), 100%);
    max-height: var(--ww-max-h, calc(100vh - 60px));
    max-height: min(var(--ww-max-h, 100dvh), calc(100dvh - 60px));
    background: var(--ww-bg, #fff);
    color: var(--ww-text, inherit);
    border-radius: var(--ww-border-r, 4px);
    box-shadow: 0 20px 60px rgba(0,0,0,.25), 0 2px 8px rgba(0,0,0,.08);
    overflow: hidden;
    outline: none;
}
.no-overlay .ww-modal { box-shadow: 0 12px 40px rgba(0,0,0,.2), 0 0 0 1px rgba(0,0,0,.05); }

/* ── Titelbalk ───────────────────────────────────────────────── */
.ww-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 18px var(--ww-pad, 28px);
    background: var(--ww-head-bg, var(--ww-bg, #fff));
    border-bottom: 1px solid var(--ww-head-border, rgba(0,0,0,.08));
}
.ww-popup .ww-title {
    flex: 1;
    margin: 0;
    padding: 0;
    color: var(--ww-head-title, inherit);
    font-size: 1.8rem;
    font-weight: 600;
    line-height: 1.2;
}
.ww-header button.ww-close { color: var(--ww-close, var(--ww-head-title, #8a8f98)); }

/* ── Body ────────────────────────────────────────────────────── */
.ww-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.ww-content { padding: var(--ww-pad, 36px 40px); }
.ww-modal-text:not(:has(.ww-header)) .ww-content { padding-right: max(var(--ww-pad, 40px), 56px); }

/* ── Afbeelding naast tekst ──────────────────────────────────── */
.ww-split-body {
    flex: 1 1 auto;
    display: flex;
    min-height: min(var(--ww-img-h, 300px), calc(100dvh - 120px));
    overflow: hidden;
}
.ww-img-left .ww-split-body { flex-direction: row-reverse; }
.ww-split-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: var(--ww-pad, 40px);
    overflow-y: auto;
    overscroll-behavior: contain;
}
.ww-split-text > .ww-text { margin-block: auto; }
.ww-split-img {
    position: relative;
    flex: 0 0 var(--ww-img-w, 40%);
    max-width: 70%;
    overflow: hidden;
}
.ww-popup .ww-split-img-el {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    margin: 0;
    object-fit: var(--ww-img-fit, cover);
    object-position: var(--ww-img-pos, center center);
    display: block;
}

/* ── Alleen afbeelding ───────────────────────────────────────── */
.ww-modal-imgonly {
    width: auto;
    max-width: var(--ww-solo-w, 90vw);
    max-height: none;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}
.ww-popup .ww-solo-img {
    display: block;
    width: auto;
    height: auto;
    max-width: var(--ww-solo-w, 90vw);
    max-height: var(--ww-solo-h, 85vh);
    object-fit: var(--ww-img-fit, contain);
    border-radius: var(--ww-border-r, 4px);
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.ww-solo-link { display: block; }
.ww-modal-imgonly button.ww-close-float {
    top: 10px;
    right: 10px;
    background: var(--ww-close-bg, rgba(0,0,0,.55));
    color: var(--ww-close, #fff);
}
.ww-modal-imgonly button.ww-close-float:hover { background: var(--ww-close-bg, rgba(0,0,0,.8)); }

/* ═══════════════════════════════════════════════════════════════
   ANIMATIES
   ═══════════════════════════════════════════════════════════════ */
.ww-anim-slide .ww-modal { animation: ww-slide-up .32s cubic-bezier(.2,.9,.3,1.1) both; }
.ww-anim-fade  .ww-modal { animation: ww-fade-in .25s ease both; }
.ww-anim-zoom  .ww-modal { animation: ww-zoom-in .3s cubic-bezier(.2,.9,.3,1.15) both; }
.ww-anim-none  .ww-modal,
.ww-anim-none  .ww-overlay { animation: none; }
.ww-pos-top.ww-anim-slide .ww-modal { animation-name: ww-slide-down; }

.ww-popup-modal.ww-closing .ww-modal   { animation: ww-fade-out .18s ease forwards; }
.ww-popup-modal.ww-closing .ww-overlay { animation: ww-fade-out .2s ease forwards; }
.ww-anim-none.ww-closing .ww-modal,
.ww-anim-none.ww-closing .ww-overlay   { animation: none; }

@keyframes ww-fade-in    { from { opacity: 0; } to { opacity: 1; } }
@keyframes ww-fade-out   { from { opacity: 1; } to { opacity: 0; } }
@keyframes ww-slide-up   { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
@keyframes ww-slide-down { from { opacity: 0; transform: translateY(-28px); } to { opacity: 1; transform: none; } }
@keyframes ww-zoom-in    { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
    .ww-modal, .ww-overlay, .ww-popup-top { animation: none !important; transition: none !important; }
}

html.ww-scroll-lock, html.ww-scroll-lock body { overflow: hidden; }

/* ═══════════════════════════════════════════════════════════════
   APPARAAT
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .ww-device-desktop { display: none !important; }
}
@media (min-width: 769px) {
    .ww-device-mobile { display: none !important; }
}

/* ═══════════════════════════════════════════════════════════════
   MOBIEL
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 782px) {
    .admin-bar .ww-bar-top { top: 46px; }
}

@media (max-width: 768px) {
    .ww-desktop { display: none; }
    .ww-mobile  { display: block; }

    .ww-popup-top { min-height: 42px; padding: 8px 14px; font-size: .9rem; }
    .ww-popup-top.has-close { padding-right: 52px; }

    .ww-popup .ww-title { font-size: 1.4rem; }

    /* ── Zwevend (standaard): 15px vanaf boven en de zijkanten ── */
    .ww-popup-modal.ww-mob-float:not(.ww-popup-imgonly) {
        align-items: flex-start;
        justify-content: center;
        padding: 15px;
    }
    .ww-mob-float:not(.ww-popup-imgonly) .ww-modal {
        width: 100%;
        max-height: calc(100vh - 30px);
        max-height: calc(100dvh - 30px);
    }
    .ww-mob-float.ww-anim-slide .ww-modal { animation-name: ww-slide-down; }

    /* ── Paneel van onderen ───────────────────────────────────── */
    .ww-popup-modal.ww-mob-sheet:not(.ww-popup-imgonly) {
        align-items: flex-end;
        justify-content: center;
        padding: 0;
    }
    .ww-mob-sheet:not(.ww-popup-imgonly) .ww-modal {
        width: 100%;
        max-height: 90vh;
        max-height: 90dvh;
        border-radius: 16px 16px 0 0;
        animation: ww-slide-up-mob .32s cubic-bezier(.2,.9,.3,1) both;
    }
    .ww-anim-none.ww-mob-sheet .ww-modal { animation: none; }

    .ww-header  { padding: 12px 10px 12px 20px; }
    .ww-content { padding: 20px 20px 24px; }
    .ww-modal-text:not(:has(.ww-header)) .ww-content { padding-right: 56px; }

    /* Afbeelding boven, alleen het tekstvlak scrolt */
    .ww-split-body { flex-direction: column !important; min-height: 0; overflow: hidden; }
    .ww-split-img {
        flex: 0 0 var(--ww-img-mob-h, 220px);
        height: var(--ww-img-mob-h, 220px);
        max-width: none;
        width: 100%;
        order: -1;
    }
    .ww-split-img.ww-img-mob-hide { display: none; }
    .ww-split-text { flex: 1 1 auto; min-height: 0; padding: 20px 20px 24px; overflow-y: auto; }
    .ww-split-text > .ww-text { margin-block: 0; }

    .ww-popup-imgonly { padding: 16px; }
    .ww-popup .ww-solo-img { max-width: 92vw; max-height: 82vh; }
}

@keyframes ww-slide-up-mob { from { transform: translateY(100%); } to { transform: none; } }
