/*
 * Flex Ideas
 *
 * Flipbares Header-Motiv mit Hotspots.
 * Hotspots öffnen die passende Card aus #details als Popup.
 */


/*
 * Header
 */
.flex-ideas-header {
    padding: 40px 20px !important;
    height: auto;
    background-color: var(--pcb-off-white);
    overflow: visible;
}


/*
 * Flip Card
 *
 * Wichtig:
 * Die Hintergrundfarbe liegt nur auf .flex-ideas-header.
 * Die Flip-Card selbst bleibt transparent, damit beim Flippen
 * nicht die Hintergrundfläche mitgedreht wird.
 */
.flex-ideas-flip-card {
    position: relative;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    aspect-ratio: 2400 / 1260;
    background: transparent;
    perspective: 1200px;
}

.flex-ideas-flip-card__inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s ease;
    transform-style: preserve-3d;
}

.flex-ideas-flip-card__front,
.flex-ideas-flip-card__back {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.flex-ideas-flip-card__back {
    transform: rotateY(180deg);
}

.flex-ideas-flip-card.is-flipped .flex-ideas-flip-card__inner {
    transform: rotateY(180deg);
}


/*
 * Hotspots je Seite sauber trennen
 */
.flex-ideas-flip-card:not(.is-flipped) .flex-ideas-flip-card__back .flex-ideas-hotspot {
    display: none;
}

.flex-ideas-flip-card.is-flipped .flex-ideas-flip-card__front .flex-ideas-hotspot {
    display: none;
}

.flex-ideas-flip-card.is-flipped .flex-ideas-flip-card__back .flex-ideas-hotspot {
    display: block;
}


/*
 * Hotspot Viewer
 */
.flex-ideas-hotspot-viewer {
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0;
}

.flex-ideas-hotspot-viewer img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}


/*
 * Hotspots
 */
.flex-ideas-hotspot {
    --size: 2rem;
    --dot: 0.5rem;

    position: absolute;
    left: calc(var(--x) * 1%);
    top: calc(var(--y) * 1%);
    width: var(--size);
    height: var(--size);
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.flex-ideas-hotspot::before,
.flex-ideas-hotspot::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.flex-ideas-hotspot::before {
    width: var(--size);
    height: var(--size);
    background-color: var(--pcb-green);
    opacity: 0.35;
    animation: flexIdeasHotspotPulse 2s infinite ease-in-out;
}

.flex-ideas-hotspot::after {
    width: var(--dot);
    height: var(--dot);
    background-color: var(--pcb-green);
}

.flex-ideas-hotspot.is-active {
    z-index: 20;
}

.flex-ideas-hotspot.is-active::before {
    animation: none;
    background-color: var(--pcb-green-2);
    opacity: 0.4;
}

.flex-ideas-hotspot.is-active::after {
    background-color: var(--pcb-green-2);
}

@keyframes flexIdeasHotspotPulse {
    0%,
    100% {
        opacity: 0.35;
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(0.8);
    }
}


/*
 * Flip Button
 */
#flexIdeasFlipBtn {
    position: absolute;
    left: 20px;
    top: 20px;
    z-index: 30;
    padding: 6px 14px;
    border: 1px solid var(--pcb-green);
    border-radius: 6px;
    background: transparent;
    color: var(--pcb-green);
    font-size: 1rem;
    line-height: 1;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
}


/*
 * Popup
 */
.flex-ideas-popup {
    position: fixed;
    left: 50%;
    bottom: 20px;
    z-index: 9999;
    width: min(92vw, 520px);
    max-height: calc(100vh - 40px);
    overflow: auto;
    padding: 0;
    border-radius: 6px;
    background-color: var(--white);
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.25);
    transform: translateX(-50%);
}

.flex-ideas-popup__close {
    position: sticky;
    top: 0;
    z-index: 2;
    display: block;
    margin-left: auto;
    padding: 8px 12px;
    border: 0;
    background-color: var(--package-black);
    color: var(--white);
    cursor: pointer;
}

.flex-ideas-popup__content {
    padding: 20px;
}

.flex-ideas-popup__content .cards__item {
    width: 100%;
    padding: 0;
    background: transparent;
    color: inherit;
}

.flex-ideas-popup__content .cards__media {
    margin-bottom: 15px;
}

body.flex-ideas-popup-active {
    overflow-x: hidden;
}


/*
 * Aktive Card im normalen Content optional markieren
 */
#details .cards__item.is-hotspot-active {
    outline: 2px solid var(--pcb-green);
    outline-offset: 4px;
}


/*
 * Debug-Punkt für ALT + Klick
 */
.flex-ideas-debug-point {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: red;
    border: 2px solid white;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 999;
}


/*
 * Mobile
 */
@media (max-width: 640px) {
    .flex-ideas-header {
        padding: 30px 20px !important;
    }

    .flex-ideas-flip-card {
        max-width: none;
        width: 100%;
        aspect-ratio: auto;
        padding-top: 42px;
    }

    .flex-ideas-flip-card__inner {
        aspect-ratio: 2400 / 1260;
    }

    #flexIdeasFlipBtn {
        top: 0;
        left: 0;
    }

    .flex-ideas-hotspot {
        --size: 1.5rem;
        --dot: 0.4rem;
    }

    .flex-ideas-popup {
        left: 10px;
        right: 10px;
        bottom: 10px;
        width: auto;
        max-height: calc(100vh - 20px);
        transform: none;
    }
}