/* =========================================================
   OWK PDF Panel – normaler Bereich unter dem Header
   ========================================================= */

.owk-pdf-panel-wrap {
    --owk-pdf-panel-color: rgba(255, 127, 0, 0.82);
    --owk-pdf-panel-color-active: rgba(255, 127, 0, 1);

    position: relative;
    z-index: 50;

    width: 100%;

    background: transparent;
    color: var(--owk-text);
    text-align: center;
}

.owk-pdf-panel-wrap::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    z-index: 4;

    width: 100%;
    height: 2px;

    background: var(--owk-pdf-panel-color);
    pointer-events: none;
}

.owk-pdf-panel-wrap:has(.owk-pdf-panel-badge:hover)::before,
body.owk-pdf-panel-open .owk-pdf-panel-wrap::before {
    background: var(--owk-pdf-panel-color-active);
}

.owk-pdf-panel-wrap:has(.owk-pdf-panel-badge:hover)::before,
body.owk-pdf-panel-open .owk-pdf-panel-wrap::before {
    background: var(--owk-pdf-panel-color-active);
}


/* =========================================================
   Badge / Lasche
   ========================================================= */

.owk-pdf-panel-badge {
    position: absolute;
    top: 0;
    left: 50%;
    z-index: 5;

    transform: translateX(-50%);

    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 150px;
    min-height: 38px;
    padding: 0 34px;

    margin: 0;

    border: 0;
    border-radius: 0 0 12px 12px;

    background: var(--owk-pdf-panel-color);
    color: #ffffff;

    font-family: "Open Sans", sans-serif;
    font-size: 1.02rem;
    font-style: italic;
    font-weight: 800;
    line-height: 1;

    cursor: pointer;

    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);

    transition:
        background-color 0.22s ease,
        box-shadow 0.22s ease;
}

/* Verbindung zwischen Linie und Badge */
.owk-pdf-panel-badge::before {
    content: "";
    position: absolute;
    top: -2px;
    left: 0;
    right: 0;
    z-index: -1;

    height: 2px;

    background: var(--owk-pdf-panel-color);
    pointer-events: none;
}

/* Hover/geöffnet: keine Bewegung, nur kräftiger */
.owk-pdf-panel-badge:hover,
.owk-pdf-panel-badge[aria-expanded="true"] {
    background: var(--owk-pdf-panel-color-active);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.owk-pdf-panel-badge:hover::before,
.owk-pdf-panel-badge[aria-expanded="true"]::before {
    background: var(--owk-pdf-panel-color-active);
}

.owk-pdf-panel-badge__text {
    position: relative;
    z-index: 2;
    white-space: nowrap;
    pointer-events: none;
}

/* =========================================================
   Ausklappbarer Gutenberg-Bereich – Desktop
   ========================================================= */

.owk-pdf-panel {
    position: relative;
    z-index: 1;

    display: grid;
    grid-template-rows: 0fr;

    overflow: hidden;
    opacity: 0;

    background: var(--owk-bg-page);
    color: var(--owk-text);

    transition:
        grid-template-rows 1.7s cubic-bezier(0.65, 0, 0.35, 1),
        opacity 0.75s ease;
}

body.owk-pdf-panel-open .owk-pdf-panel {
    grid-template-rows: 1fr;
    opacity: 1;
}

.owk-pdf-panel__inner {
    min-height: 0;
    overflow: hidden;

    width: min(1180px, calc(100% - 48px));
    margin: 0 auto;
    padding: 0;

    transform: translateY(-14px);

    transition:
        padding 1.7s cubic-bezier(0.65, 0, 0.35, 1),
        transform 1.7s cubic-bezier(0.65, 0, 0.35, 1);
}

body.owk-pdf-panel-open .owk-pdf-panel__inner {
    padding: 64px 0 38px;
    transform: translateY(0);
}


/* =========================================================
   Gutenberg-Inhalte im Panel
   ========================================================= */

.owk-pdf-panel__inner > *:first-child {
    margin-top: 0;
}

.owk-pdf-panel__inner > *:last-child {
    margin-bottom: 0;
}

.owk-pdf-panel__inner h1,
.owk-pdf-panel__inner h2,
.owk-pdf-panel__inner h3,
.owk-pdf-panel__inner h4,
.owk-pdf-panel__inner p {
    text-align: center;
    color: var(--owk-text);
}


/* =========================================================
   Gutenberg-Spalten im PDF-Panel neutralisieren
   ========================================================= */

.owk-pdf-panel .wp-block-columns,
.owk-pdf-panel .wp-block-column,
.owk-pdf-panel .wp-block-group {
    background: transparent !important;
    box-shadow: none !important;
}

.owk-pdf-panel .wp-block-columns {
    justify-content: center;
    align-items: start;
    gap: 22px;
    margin-bottom: 0;
}

.owk-pdf-panel .wp-block-column {
    text-align: center;
}


/* =========================================================
   PDF-Thumbnails ohne Kartenklasse
   Automatische Overlaybuttons werden per JS erzeugt
   ========================================================= */

.owk-pdf-panel .wp-block-image,
.owk-pdf-panel figure {
    margin: 0 auto 12px;
    background: transparent !important;
}

/* Wird per JS gesetzt */
.owk-pdf-thumb {
    position: relative;
    display: block;
    width: fit-content;
    max-width: 100%;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Thumbnail Desktop */
.owk-pdf-thumb img,
.owk-pdf-panel .wp-block-image img,
.owk-pdf-panel figure img {
    display: block;

    width: 135px !important;
    height: 200px !important;
    max-width: 100%;

    margin: 0 auto;

    object-fit: cover;

    border-radius: 14px !important;

    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
}


/* =========================================================
   Automatische Overlaybuttons unten im Thumbnail
   ========================================================= */

.owk-pdf-thumb-actions {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 8px;
    z-index: 5;

    display: flex;
    align-items: center;
    justify-content: space-evenly;

    width: 100%;
    padding: 0;

    opacity: 0;

    transition:
        opacity 0.22s ease;
}

.owk-pdf-thumb:hover .owk-pdf-thumb-actions {
    opacity: 1;
}

/* Touchgeräte: Buttons direkt sichtbar */
@media (hover: none) {
    .owk-pdf-thumb-actions {
        opacity: 1;
    }
}

/* Einzelner Button */
.owk-pdf-thumb-action {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 9px;

    background: rgba(45, 45, 45, 0.88);
    color: #ffffff;
    text-decoration: none;

    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);

    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.owk-pdf-thumb-action:hover {
    background: rgba(25, 25, 25, 0.96);
    color: #ffffff;
    transform: translateY(-1px);
    text-decoration: none;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.34);
}

/* SVG-Icon im Button */
.owk-pdf-thumb-icon {
    display: block;
    width: 22px;
    height: 22px;
    fill: currentColor;
}


/* =========================================================
   OWK PDF Panel – Mobile Scroll-Korrektur
   ========================================================= */

@media (max-width: 768px) {
    .owk-pdf-panel-badge {
        min-width: 210px;
        min-height: 34px;
        padding: 0 26px;

        border-radius: 0 0 9px 9px;

        font-size: 0.92rem;
    }

    /* Mobil: statt Grid-Animation eine stabile max-height-Fläche */
    .owk-pdf-panel {
        display: block;
        max-height: 0;
        opacity: 0;
        overflow: hidden;

        transition:
            max-height 0.65s cubic-bezier(0.65, 0, 0.35, 1),
            opacity 0.3s ease;
    }

	body.owk-pdf-panel-open .owk-pdf-panel {
		max-height: 80dvh;
		opacity: 1;

		overflow-y: auto;
		overflow-x: hidden;

		-webkit-overflow-scrolling: touch;
		overscroll-behavior: contain;
		touch-action: pan-y;
	}

    /* Innenbereich darf mobil nicht selbst abschneiden */
    .owk-pdf-panel__inner {
        overflow: visible;
        min-height: auto;

        width: 100%;
        padding: 0;

        transform: none;
        transition: padding 0.45s ease;
        box-sizing: border-box;
    }

    body.owk-pdf-panel-open .owk-pdf-panel__inner {
        padding: 54px 14px 110px;
    }

    /* Mobile: zweispaltige Dokumente */
    .owk-pdf-panel .wp-block-columns {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 14px !important;
        align-items: start !important;
        margin-bottom: 0 !important;
    }

    .owk-pdf-panel .wp-block-column {
        width: auto !important;
        flex-basis: auto !important;
        min-width: 0 !important;
    }

    .owk-pdf-thumb {
        width: 100%;
    }

    .owk-pdf-thumb img,
    .owk-pdf-panel .wp-block-image img,
    .owk-pdf-panel figure img {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 135 / 200;

        object-fit: cover;

        border-radius: 12px !important;
    }

    .owk-pdf-thumb-actions {
        bottom: 7px;
    }

    .owk-pdf-thumb-action {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;

        border-radius: 8px;
    }

    .owk-pdf-thumb-icon {
        width: 21px;
        height: 21px;
    }
}


/* =========================================================
   OWK PDF Flipbook Lightbox
   ========================================================= */

body.owk-pdf-lightbox-open {
    overflow: hidden;
}

.owk-pdf-lightbox[hidden] {
    display: none !important;
}

.owk-pdf-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;

    box-sizing: border-box;
    pointer-events: auto;
    isolation: isolate;
}

.owk-pdf-lightbox__backdrop {
    position: absolute;
    inset: 0;
    z-index: 1;

    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
}

.owk-pdf-lightbox__dialog {
    position: relative;
    z-index: 2;

    width: min(1180px, 96vw);
    height: min(820px, 90vh);
    min-height: 420px;

    border-radius: 18px;

    overflow: visible;

    background: #ffffff;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
}

.owk-pdf-lightbox__iframe {
    position: relative;
    z-index: 1;

    display: block;

    width: 100%;
    height: 100%;

    border: 0;
    border-radius: inherit;

    background: #ffffff;
}

/* Schließen-Button außerhalb der Lightbox */
.owk-pdf-lightbox__close {
    position: absolute;
    top: -22px;
    right: -22px;
    z-index: 5;

    width: 44px;
    height: 44px;

    border: 0;
    border-radius: 999px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    background: rgba(25, 25, 25, 0.92);
    color: #ffffff;

    font-size: 32px;
    line-height: 1;

    cursor: pointer;

    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.38);
}

.owk-pdf-lightbox__close:hover {
    background: rgba(0, 0, 0, 0.98);
}


/* =========================================================
   OWK PDF Flipbook Lightbox – Mobile
   ========================================================= */

@media (max-width: 768px) {
    .owk-pdf-lightbox {
        align-items: flex-start;
        padding: 78px 12px 12px;
        box-sizing: border-box;
    }

    .owk-pdf-lightbox__dialog {
        width: 100%;
        height: calc(100dvh - 140px);
        min-height: 360px;

        border-radius: 14px;
        overflow: visible;
    }

    .owk-pdf-lightbox__iframe {
        border-radius: 14px;
    }

    .owk-pdf-lightbox__close {
        top: -54px;
        right: 8px;

        width: 40px;
        height: 40px;

        font-size: 28px;
    }
}