/**
 * Sharp Pop Ups – Frontend
 *
 * Aufbau:  Overlay > Karte (Hintergrundbild) > Banner (Pinselstrich) + Info-Fläche (Papier)
 * Farben kommen als Custom Properties inline vom Server (--sp-accent / --sp-paper / --sp-text).
 */

.sharp-popup-overlay {
    --sp-accent: #4c5c42;
    --sp-paper: #f4f1e8;
    --sp-text: #2f3a29;
    --sp-title-font: Georgia, "Iowan Old Style", "Times New Roman", serif;

    /* Pinselstrich als Maske – wird auf die Bannergröße gestreckt. */
    --sp-brush: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 170' preserveAspectRatio='none'%3E%3Cpath d='M13 41C132 12 302 27 470 19 640 11 822 31 1000 17 1090 10 1152 21 1191 31 1197 67 1195 109 1187 143 1071 159 879 141 689 149 499 157 319 141 149 151 89 154 39 145 11 135 5 101 7 71 13 41Z' fill='%23000'/%3E%3C/svg%3E");

    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    inset: 0;
    z-index: 999990;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(16, 20, 14, 0.72);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.28s ease;
}

.sharp-popup-overlay[hidden] {
    display: none;
}

.sharp-popup-overlay.is-open {
    opacity: 1;
}

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

html.sharp-popup-lock,
html.sharp-popup-lock body {
    overflow: hidden;
}

/* ------------------------------------------------------------------
   Karte
------------------------------------------------------------------ */

/* Ohne Hintergrundbild: kein Rahmen – nur Banner und Info-Fläche. */
.sharp-popup {
    position: relative;
    width: 100%;
    max-width: 1010px;
    max-height: calc(100vh - 40px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: none;
    opacity: 0;
    transform: translateY(18px) scale(0.985);
    transition: opacity 0.34s ease, transform 0.34s cubic-bezier(0.2, 0.75, 0.3, 1);
}

.sharp-popup-overlay.is-open .sharp-popup {
    opacity: 1;
    transform: none;
}

.sharp-popup-overlay .sharp-popup__body {
    padding: 26px 12px 16px;
}

/* Mit Hintergrundbild: Foto als Karte, Info-Fläche liegt darauf.
   Das Bild selbst kommt als Inline-Style vom Server. */
.sharp-popup--photo {
    border-radius: 4px;
    background-color: #33302a;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    box-shadow: 0 26px 70px rgba(0, 0, 0, 0.5);
}

.sharp-popup-overlay .sharp-popup--photo .sharp-popup__body {
    padding: 30px 34px 34px;
}

/* ------------------------------------------------------------------
   Schließen
------------------------------------------------------------------ */

.sharp-popup-overlay .sharp-popup__close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    /* Akzentfarbe + weißer Ring: sichtbar auf Foto, Info-Fläche und abgedunkelter Seite. */
    background: var(--sp-accent);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 2px 12px rgba(0, 0, 0, 0.35);
    transition: filter 0.2s ease, transform 0.2s ease;
}

.sharp-popup-overlay .sharp-popup__close:hover,
.sharp-popup-overlay .sharp-popup__close:focus-visible {
    filter: brightness(1.15);
    transform: scale(1.07);
}

.sharp-popup-overlay .sharp-popup__close svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* ------------------------------------------------------------------
   Banner (Pinselstrich)
------------------------------------------------------------------ */

.sharp-popup-overlay .sharp-popup__banner {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    max-width: 810px;
    margin: 0 0 -30px;
    padding: 18px 54px 22px 40px;
    background-color: var(--sp-accent);
    color: #fff;
    transform: rotate(-0.7deg);
    -webkit-mask-image: var(--sp-brush);
    mask-image: var(--sp-brush);
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

.sharp-popup-overlay .sharp-popup__banner-icon {
    flex: 0 0 auto;
    width: clamp(30px, 3.6vw, 42px);
    height: clamp(30px, 3.6vw, 42px);
    color: #fff;
}

.sharp-popup-overlay .sharp-popup__banner-icon svg {
    width: 100%;
    height: 100%;
    display: block;
    stroke-width: 1.6;
}

.sharp-popup-overlay .sharp-popup__title {
    margin: 0;
    padding: 0;
    font-family: var(--sp-title-font);
    font-size: clamp(21px, 3.6vw, 40px);
    font-style: italic;
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: 0.005em;
    text-transform: none;
    color: #fff;
}

/* ------------------------------------------------------------------
   Info-Fläche ("Papier")
------------------------------------------------------------------ */

.sharp-popup-overlay .sharp-popup__paper {
    position: relative;
    z-index: 1;
    padding: 54px 42px 34px;
    background: var(--sp-paper);
    color: var(--sp-text);
    filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.3));

    /* leicht unruhige Kanten wie bei gerissenem Papier */
    -webkit-clip-path: polygon(
        0.5% 1.6%, 26% 0.3%, 58% 1.5%, 84% 0.2%, 99.4% 1.9%,
        100% 34%, 98.8% 66%, 99.6% 93%, 95% 99.3%,
        66% 98.2%, 33% 99.5%, 7% 98%, 0.4% 95%, 1.1% 62%, 0 30%
    );
    clip-path: polygon(
        0.5% 1.6%, 26% 0.3%, 58% 1.5%, 84% 0.2%, 99.4% 1.9%,
        100% 34%, 98.8% 66%, 99.6% 93%, 95% 99.3%,
        66% 98.2%, 33% 99.5%, 7% 98%, 0.4% 95%, 1.1% 62%, 0 30%
    );
}

/* ------------------------------------------------------------------
   Spalten
------------------------------------------------------------------ */

.sharp-popup-overlay .sharp-popup__cols {
    display: grid;
    grid-template-columns: 1fr 1px 1fr;
    gap: 0 38px;
    align-items: start;
}

.sharp-popup-overlay .sharp-popup__cols--single {
    grid-template-columns: 1fr;
}

.sharp-popup-overlay .sharp-popup__divider {
    align-self: stretch;
    width: 1px;
    background: rgba(47, 58, 41, 0.2);
}

.sharp-popup-overlay .sharp-popup__item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.sharp-popup-overlay .sharp-popup__item + .sharp-popup__item {
    margin-top: 24px;
}

.sharp-popup-overlay .sharp-popup__item-icon {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    margin-top: 1px;
    color: var(--sp-accent);
}

.sharp-popup-overlay .sharp-popup__item-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.sharp-popup-overlay .sharp-popup__item-body {
    min-width: 0;
}

.sharp-popup-overlay .sharp-popup__label {
    display: block;
    margin: 0 0 3px;
    font-size: clamp(16px, 1.5vw, 19px);
    font-weight: 700;
    line-height: 1.3;
    color: var(--sp-text);
}

.sharp-popup-overlay .sharp-popup__text {
    margin: 0;
    font-size: clamp(14px, 1.3vw, 16px);
    line-height: 1.55;
    color: var(--sp-text);
}

.sharp-popup-overlay .sharp-popup__text a {
    color: var(--sp-accent);
    text-decoration: underline;
}

/* ------------------------------------------------------------------
   Freier Inhalt + Button
------------------------------------------------------------------ */

.sharp-popup-overlay .sharp-popup__content {
    margin-top: 26px;
    font-size: clamp(14px, 1.3vw, 16px);
    line-height: 1.6;
    color: var(--sp-text);
}

.sharp-popup-overlay .sharp-popup__content > *:first-child {
    margin-top: 0;
}

.sharp-popup-overlay .sharp-popup__content > *:last-child {
    margin-bottom: 0;
}

.sharp-popup-overlay .sharp-popup__cta-wrap {
    margin: 26px 0 0;
}

.sharp-popup-overlay .sharp-popup__cta {
    display: inline-flex;
    align-items: center;
    padding: 12px 28px;
    border-radius: 999px;
    background: var(--sp-accent);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    transition: filter 0.2s ease, transform 0.2s ease;
}

.sharp-popup-overlay .sharp-popup__cta:hover,
.sharp-popup-overlay .sharp-popup__cta:focus-visible {
    color: #fff;
    filter: brightness(1.12);
    transform: translateY(-1px);
}

/* ------------------------------------------------------------------
   Mobil
------------------------------------------------------------------ */

@media (max-width: 900px) {
    .sharp-popup-overlay .sharp-popup__body {
        padding: 22px 18px 22px;
    }

    .sharp-popup-overlay .sharp-popup__banner {
        max-width: 100%;
        gap: 14px;
        padding: 14px 30px 18px 26px;
        margin-bottom: -22px;
        transform: rotate(-0.5deg);
    }

    .sharp-popup-overlay .sharp-popup__paper {
        padding: 40px 24px 26px;
    }

    .sharp-popup-overlay .sharp-popup__cols {
        grid-template-columns: 1fr;
    }

    .sharp-popup-overlay .sharp-popup__divider {
        width: 100%;
        height: 1px;
        margin: 24px 0;
    }

    .sharp-popup-overlay .sharp-popup__item + .sharp-popup__item {
        margin-top: 20px;
    }
}

@media (max-width: 480px) {
    .sharp-popup-overlay {
        padding: 10px;
    }

    .sharp-popup {
        max-height: calc(100vh - 20px);
    }

    .sharp-popup-overlay .sharp-popup__item-icon {
        width: 28px;
        height: 28px;
    }
}

/* ------------------------------------------------------------------
   Sonstiges
------------------------------------------------------------------ */

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

    .sharp-popup {
        transform: none;
    }
}

@media print {
    .sharp-popup-overlay {
        display: none !important;
    }
}
