/**
 * HIT Elementor Basiselemente – Lightbox
 *
 * Die einstellbaren Farben kommen als CSS-Variablen aus dem Galerie-Widget;
 * die Werte hier sind die Rückfallebene.
 */

.hem-lb {
    --hem-lb-backdrop: rgba(12, 12, 14, 0.94);
    --hem-lb-text: #f2f2f3;
    --hem-lb-muted: #9a9aa2;
    --hem-lb-panel-bg: rgba(24, 24, 28, 0.96);
    --hem-lb-accent: #ffffff;
    --hem-lb-transition: 0.25s;

    position: fixed;
    inset: 0;
    z-index: 999999;
    color: var(--hem-lb-text);
    font-size: 14px;
    line-height: 1.5;
}

/* Die Seite darunter soll nicht mitscrollen */
body.hem-lb-open {
    overflow: hidden;
}

.hem-lb__backdrop {
    position: absolute;
    inset: 0;
    background: var(--hem-lb-backdrop);
}

/**
 * Bild und Aufnahmedaten stehen nebeneinander, die Leiste darunter über beide
 * Spalten. Alle drei Bereiche werden ausdrücklich platziert – ohne das rutscht
 * das automatisch platzierte Bild in eine eigene Zeile und drückt das Panel auf
 * Titelhöhe zusammen.
 *
 * Ist das Panel zugeklappt, fällt seine Spalte auf null zusammen (auto).
 */
.hem-lb__dialog {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: 1fr auto;
    width: 100%;
    height: 100%;
    outline: none;
}

.hem-lb__stage {
    grid-area: 1 / 1 / 2 / 2;
}

.hem-lb__bar {
    grid-area: 2 / 1 / 3 / 3;
}

/* ------------------------------------------------------------------ Bild */

.hem-lb__stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 24px 64px 8px;
}

.hem-lb__figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 0;
    max-width: 100%;
    max-height: 100%;
}

.hem-lb__image {
    max-width: 100%;
    /* Platz für Bildunterschrift und Leiste bleibt frei */
    max-height: calc(100vh - 170px);
    width: auto;
    height: auto;
    object-fit: contain;
    transition: opacity var(--hem-lb-transition) ease;
}

/* Beim Blättern bleibt das alte Bild stehen, leicht abgedunkelt, bis das
   neue geladen ist – dann wird getauscht und eingeblendet */
.hem-lb.is-loading .hem-lb__image {
    opacity: 0.6;
}

.hem-lb__image.is-swapping {
    opacity: 0;
    transition: none;
}

.hem-lb__caption {
    max-width: 70ch;
    color: var(--hem-lb-text);
    text-align: center;
}

.hem-lb__spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: var(--hem-lb-accent);
    border-radius: 50%;
    opacity: 0;
    animation: hem-lb-spin 0.8s linear infinite;
}

.hem-lb.is-loading .hem-lb__spinner {
    opacity: 1;
}

@keyframes hem-lb-spin {
    to { transform: rotate(360deg); }
}

/* ------------------------------------------------------- Aufnahmedaten */

.hem-lb__panel {
    grid-area: 1 / 2 / 2 / 3;
    width: min(320px, 80vw);
    padding: 24px;
    overflow-y: auto;
    background: var(--hem-lb-panel-bg);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.hem-lb__panel-title {
    margin: 0 0 16px;
    color: var(--hem-lb-text);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.hem-lb__meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 16px;
    margin: 0;
}

.hem-lb__meta dt {
    color: var(--hem-lb-muted);
    white-space: nowrap;
}

.hem-lb__meta dd {
    margin: 0;
    color: var(--hem-lb-text);
    /* Damit Kameranamen die Spalte nicht sprengen */
    overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- Leiste */

.hem-lb__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.hem-lb__counter {
    color: var(--hem-lb-muted);
    font-variant-numeric: tabular-nums;
}

.hem-lb__actions {
    display: flex;
    gap: 8px;
}

/* ------------------------------------------------------------ Schalter */

.hem-lb__btn,
.hem-lb__nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: var(--hem-lb-text);
    font: inherit;
    font-size: 18px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--hem-lb-transition) ease,
                border-color var(--hem-lb-transition) ease;
}

.hem-lb__btn:hover,
.hem-lb__nav:hover,
.hem-lb__btn:focus-visible,
.hem-lb__nav:focus-visible {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.4);
}

.hem-lb__btn:focus-visible,
.hem-lb__nav:focus-visible {
    outline: 2px solid var(--hem-lb-accent);
    outline-offset: 2px;
}

.hem-lb__btn--info[aria-pressed="true"],
.hem-lb__btn--play[aria-pressed="true"] {
    background: var(--hem-lb-accent);
    color: #17171a;
}

/* Diashow: Start- oder Pause-Symbol, je nach Zustand */
.hem-lb__btn--play {
    font-size: 13px;
}

.hem-lb__btn--play .hem-lb__icon-pause,
.hem-lb__btn--play[aria-pressed="true"] .hem-lb__icon-play {
    display: none;
}

.hem-lb__btn--play[aria-pressed="true"] .hem-lb__icon-pause {
    display: inline;
}

.hem-lb__nav {
    position: absolute;
    top: 50%;
    width: 48px;
    height: 48px;
    margin-top: -24px;
    font-size: 26px;
}

.hem-lb__nav--prev { left: 12px; }
.hem-lb__nav--next { right: 12px; }

/* ----------------------------------------------------------- Schmale Geräte */

@media (max-width: 782px) {
    .hem-lb__dialog {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto auto;
    }

    .hem-lb__stage { grid-area: 1 / 1 / 2 / 2; }
    .hem-lb__bar   { grid-area: 3 / 1 / 4 / 2; }

    .hem-lb__stage {
        padding: 12px 12px 4px;
    }

    .hem-lb__image {
        max-height: calc(100vh - 210px);
    }

    /* Die Aufnahmedaten rutschen unter das Bild statt an die Seite */
    .hem-lb__panel {
        grid-area: 2 / 1 / 3 / 2;
        width: auto;
        max-height: 34vh;
        padding: 16px 20px;
        border-left: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    .hem-lb__nav {
        width: 40px;
        height: 40px;
        margin-top: -20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hem-lb__image,
    .hem-lb__btn,
    .hem-lb__nav {
        transition: none;
    }

    .hem-lb__spinner {
        animation: none;
    }
}
