/* Elldus Pop-up (Inhaltselement elldus_popup) */

dialog.ep {
    --ep-ink: #2d4c5a;
    --ep-sage: #7ba9ac;
    --ep-sand: #efe9e1;
    --ep-gold: #ebc988;
    --ep-accent: var(--ep-sage);
    margin: auto !important; /* das Theme setzt margin: 0 auf alle Elemente */
    inset: 0;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: #fff;
    color: var(--ep-ink);
    font: inherit;
    max-width: calc(100vw - 32px);
    max-height: calc(100dvh - 48px);
    overflow: auto;
    overscroll-behavior: contain;
    box-shadow: 0 30px 70px rgba(15, 30, 36, .4);
}
dialog.ep--closing,
dialog.ep--offer { --ep-accent: var(--ep-gold); }
dialog.ep::backdrop { background: rgba(28, 46, 54, .58); backdrop-filter: blur(2px); }
dialog.ep[open] { animation: ep-in .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes ep-in { from { opacity: 0; transform: translateY(16px); } }

/* Layouts Desktop */
dialog.ep--split { width: 780px; }
dialog.ep--split[open] { display: grid; grid-template-columns: 42% minmax(0, 1fr); }
dialog.ep--top,
dialog.ep--plain { width: 540px; }
dialog.ep--plain { border-top: 6px solid var(--ep-accent); }
dialog.ep--corner {
    position: fixed;
    inset: auto 20px 20px auto;
    margin: 0 !important;
    width: 380px;
    max-width: calc(100vw - 40px);
    z-index: 2147483000; /* ueber Chat- und Bewertungs-Widgets */
    border-radius: 8px;
    box-shadow: 0 16px 40px rgba(15, 30, 36, .3);
}
dialog.ep--corner.ep--no-media { border-top: 5px solid var(--ep-accent); }

/* Bild */
.ep-media { position: relative; background: var(--ep-sand); min-height: 220px; }
.ep-media img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.ep--top .ep-media,
.ep--corner .ep-media { min-height: 0; aspect-ratio: 16 / 7; }
.ep-badge {
    position: absolute; left: 18px; bottom: 18px;
    display: grid; place-items: center; text-align: center;
    width: 104px; height: 104px; border-radius: 50%;
    background: var(--ep-gold); color: var(--ep-ink);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
    transform: rotate(-6deg);
}
.ep-badge b { display: block; font-size: 22px; font-weight: 600; line-height: 1.05; }
.ep-badge small { display: block; margin-top: 2px; font-size: 11px; line-height: 1.25; }
.ep--corner .ep-badge { width: 78px; height: 78px; left: 12px; bottom: 12px; }
.ep--corner .ep-badge b { font-size: 17px; }
.ep--corner .ep-badge small { font-size: 9.5px; }

/* Schliessen */
.ep-close {
    position: absolute; top: 12px; right: 12px; z-index: 3;
    width: 40px; height: 40px; padding: 0;
    display: grid; place-items: center;
    border: 0; border-radius: 50%;
    background: rgba(255, 255, 255, .92); color: var(--ep-ink);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
    cursor: pointer;
}
.ep-close:hover { background: var(--ep-sand); }
.ep-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.ep--corner .ep-close { width: 34px; height: 34px; top: 8px; right: 8px; }

/* Inhalt */
.ep-body { display: grid; gap: 14px; align-content: start; padding: 34px 34px 28px; min-width: 0; }
.ep--corner .ep-body { gap: 10px; padding: 20px 20px 18px; }
.ep-kicker {
    display: inline-flex; align-items: center; gap: 8px; justify-self: start;
    padding: 5px 12px 5px 9px; border-radius: 999px;
    background: color-mix(in srgb, var(--ep-accent) 28%, #fff); color: var(--ep-ink);
    font-size: 11.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; line-height: 1.3;
}
.ep-kicker svg { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ep-title {
    margin: 0 !important; padding-right: 28px;
    color: var(--ep-ink); font-size: 26px; font-weight: 500; line-height: 1.2; text-wrap: balance;
}
.ep--corner .ep-title { font-size: 19px; }
.ep-price { justify-self: start; padding: 4px 12px; border-radius: 999px; background: var(--ep-gold); font-weight: 600; font-size: 14px; }
.ep-text { font-size: 15px; line-height: 1.6; }
.ep--corner .ep-text { font-size: 14px; }
.ep-text > :first-child, .ep-note > :first-child { margin-top: 0; }
.ep-text > :last-child, .ep-note > :last-child { margin-bottom: 0; }
.ep-text p { margin: 0 0 8px; }
.ep-text ul { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.ep-text li { position: relative; padding-left: 18px; }
.ep-text li::before { content: "\203A"; position: absolute; left: 2px; top: -1px; color: var(--ep-sage); font-weight: 600; font-size: 18px; }
.ep-text a, .ep-note a { color: var(--ep-ink); text-decoration: underline; }

/* Termine (Schliesszeiten) */
.ep-dates { display: grid; border: 1px solid #e4ddd2; border-radius: 8px; overflow: hidden; }
.ep-dates > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 14px; padding: 10px 14px; background: #fbf9f6; }
.ep-dates > div + div { border-top: 1px solid #e4ddd2; }
.ep-dates b { font-weight: 500; font-size: 14.5px; }
.ep-dates span { font-size: 13.5px; color: #5f7883; font-variant-numeric: tabular-nums; }
.ep-status { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-style: normal; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #f3dedb; color: #8a3b30; white-space: nowrap; }
.ep-status--limited { background: #f7e6c4; color: #75561b; }
.ep-status--open { background: #dcebec; color: var(--ep-ink); }

.ep-valid { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: #5f7883; }
.ep-valid svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.ep-note { padding: 10px 14px; border-radius: 8px; background: var(--ep-sand); font-size: 13.5px; line-height: 1.55; }

/* Buttons */
.ep-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.ep-btn {
    display: inline-block; padding: 12px 22px;
    border: 2px solid var(--ep-ink); border-radius: 0;
    background: var(--ep-ink); color: #fff !important;
    font: inherit; font-size: 14px; font-weight: 600; line-height: 1.3;
    text-decoration: none !important; cursor: pointer;
}
.ep-btn:hover { background: #fff; color: var(--ep-ink) !important; }
.ep-btn--secondary { background: transparent; color: var(--ep-ink) !important; }
.ep-btn--secondary:hover { background: var(--ep-sand); }
.ep--offer .ep-btn:not(.ep-btn--secondary) { background: var(--ep-gold); border-color: var(--ep-gold); color: var(--ep-ink) !important; }
.ep--offer .ep-btn:not(.ep-btn--secondary):hover { background: #fff; }
dialog.ep :focus-visible { outline: 3px solid var(--ep-gold); outline-offset: 2px; }

/* Smartphone: jedes Layout als Karte von unten */
@media (max-width: 560px) {
    dialog.ep,
    dialog.ep--corner {
        position: fixed;
        inset: auto 0 0 0;
        margin: 0 !important;
        width: 100%;
        max-width: 100%;
        max-height: 88dvh;
        border-top: 0;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -12px 40px rgba(15, 30, 36, .35);
    }
    dialog.ep[open] { display: flex; flex-direction: column; overflow: hidden; animation-name: ep-up; }
    @keyframes ep-up { from { transform: translateY(100%); } }
    dialog.ep::before {
        content: ""; position: absolute; top: 8px; left: 50%; z-index: 4;
        width: 40px; height: 4px; margin-left: -20px; border-radius: 2px;
        background: rgba(255, 255, 255, .85); box-shadow: 0 0 0 1px rgba(45, 76, 90, .15);
    }
    .ep-media, .ep--top .ep-media, .ep--corner .ep-media { flex: none; height: 150px; min-height: 0; aspect-ratio: auto; }
    .ep-body, .ep--corner .ep-body { overflow: auto; gap: 12px; padding: 22px 20px calc(20px + env(safe-area-inset-bottom, 0px)); }
    .ep--no-media .ep-body { padding-top: 30px; }
    .ep-title, .ep--corner .ep-title { font-size: 21px; }
    .ep-text { font-size: 14.5px; }
    .ep-badge, .ep--corner .ep-badge { width: 80px; height: 80px; left: auto; right: 16px; bottom: -22px; }
    .ep-badge b, .ep--corner .ep-badge b { font-size: 17px; }
    .ep-badge small, .ep--corner .ep-badge small { font-size: 9.5px; }
    .ep-actions { flex-direction: column; }
    .ep-btn { width: 100%; text-align: center; }
    .ep-close, .ep--corner .ep-close { top: 12px; right: 12px; width: 36px; height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
    dialog.ep[open] { animation: none; }
}
