/* ================================================================
   KI-Galerie Stylesheet
   ================================================================ */

/* ── Reset / Grundlagen ───────────────────────────────────── */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 Helvetica, Arial, sans-serif;
    color: #2a2a2a;
    background: #fafafa;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ── Platzhalter Header / Footer ──────────────────────────── */
.placeholder-header,
.placeholder-footer {
    background: #fff;
    border-bottom: 1px solid #ececec;
    padding: 16px 24px;
    font-size: 14px;
}

.placeholder-footer {
    border-top: 1px solid #ececec;
    border-bottom: none;
    margin-top: 60px;
    color: #777;
}

.placeholder-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.placeholder-logo {
    font-weight: 600;
    font-size: 16px;
    color: #333;
}

.placeholder-nav a {
    margin-left: 20px;
    color: #555;
}

.placeholder-nav a:hover {
    color: #000;
}

/* ── Hauptcontainer ──────────────────────────────────────── */
.gallery-page {
    max-width: 1280px;
    margin: 0 auto;
    padding: 40px 24px 60px;
}

/* ── Intro-Block ─────────────────────────────────────────── */
.gallery-intro {
    margin-bottom: 32px;
}

.gallery-intro h1 {
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #222;
}

.gallery-intro p {
    margin: 0;
    color: #666;
    font-size: 15px;
}

/* ── Leere Galerie ───────────────────────────────────────── */
.gallery-empty {
    padding: 60px 20px;
    text-align: center;
    color: #888;
    background: #fff;
    border: 1px dashed #ddd;
    border-radius: 8px;
}

/* ── Controls (Sortierung / Filter) ──────────────────────── */
.gallery-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 32px;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 8px;
}

.gallery-controls .control {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #555;
}

.gallery-controls select {
    padding: 6px 10px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    color: #2a2a2a;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.gallery-controls select:hover {
    border-color: #b0b0b0;
}

.gallery-controls select:focus {
    outline: none;
    border-color: #888;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

/* ── Kategorien ──────────────────────────────────────────── */
.gallery-category {
    margin-bottom: 48px;
}

.gallery-category-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e8e8e8;
}

/* ── Grid ────────────────────────────────────────────────── */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

@media (max-width: 960px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 640px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* ── Einzelne Kachel ─────────────────────────────────────── */
.gallery-tile {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #ececec;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.gallery-tile-link {
    display: block;
    color: inherit;
}

.gallery-tile-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f0f0f0;
    overflow: hidden;
}

.gallery-tile-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-tile:hover .gallery-tile-thumb img {
    transform: scale(1.03);
}

/* ── Play-Icon für Filme ─────────────────────────────────── */
.gallery-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 20px;
    border-radius: 50%;
    backdrop-filter: blur(2px);
    transition: background 0.2s ease, transform 0.2s ease;
    padding-left: 4px;
}

.gallery-tile:hover .gallery-play-icon {
    background: rgba(0, 0, 0, 0.75);
    transform: translate(-50%, -50%) scale(1.08);
}

/* ── Titel unter der Kachel ──────────────────────────────── */
.gallery-tile-title {
    padding: 10px 12px 12px;
    font-size: 13px;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-tile:hover .gallery-tile-title {
    color: #222;
}


/* ================================================================
   Lightbox — Cinema-Modus mit Thumb-Leiste und Diashow
   ================================================================ */

:root {
    --lightbox-thumbs-width: 160px;
    --lightbox-topbar-height: 48px;
    --lightbox-caption-height: 56px;
}

.lightbox {
    position: fixed;
    inset: 0;
    background: #0a0a0a;
    z-index: 1000;
    display: none;
    animation: lightbox-fade 0.2s ease;
}

.lightbox.is-open {
    display: block;
}

@keyframes lightbox-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Topbar (oben, über dem Bild) ────────────────────────── */
.lightbox-topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: var(--lightbox-topbar-height);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 10px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7), rgba(0,0,0,0));
    z-index: 20;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lightbox-topbar > * {
    pointer-events: auto;
}

.lightbox-topbar .spacer {
    flex: 1;
}

.lightbox-topbar button,
.lightbox-topbar input {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    line-height: 1;
}

.lightbox-topbar button:hover,
.lightbox-topbar input:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.35);
}

.lightbox-topbar button:focus,
.lightbox-topbar input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
}

.lightbox-topbar label {
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lightbox-topbar input[type="number"] {
    width: 56px;
    text-align: center;
    padding: 6px 4px;
}

.lightbox-close,
.lightbox-thumbs-toggle,
.lightbox-fullscreen {
    width: 36px;
    height: 36px;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
    font-size: 18px;
    line-height: 1;
}

.lightbox-close {
    font-size: 22px;
}

/* ── Thumb-Leiste links ──────────────────────────────────── */
.lightbox-thumbs {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--lightbox-thumbs-width);
    overflow-y: auto;
    padding: calc(var(--lightbox-topbar-height) + 8px) 8px 8px 8px;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10;
    transition: transform 0.25s ease, width 0.25s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.25) transparent;
}

.lightbox-thumbs::-webkit-scrollbar {
    width: 6px;
}
.lightbox-thumbs::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.25);
    border-radius: 3px;
}

.lightbox-thumbs img {
    width: 100%;
    margin-bottom: 6px;
    border-radius: 4px;
    opacity: 0.55;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.15s ease, outline-color 0.15s ease;
    outline: 2px solid transparent;
    outline-offset: 0;
    display: block;
}

.lightbox-thumbs img:hover {
    opacity: 1;
    transform: scale(1.03);
}

.lightbox-thumbs img.is-active {
    opacity: 1;
    outline-color: #fff;
}

/* Thumb-Leiste ausgeblendet */
.lightbox.thumbs-hidden .lightbox-thumbs {
    transform: translateX(-100%);
}

/* ── Stage (Bildbereich) ─────────────────────────────────── */
/*
 * WICHTIG: Die Stage beginnt jetzt ganz oben (top: 0),
 * weil die Topbar als transparentes Overlay DARÜBER liegt.
 * Das Bild kann damit die volle Höhe nutzen, auch wenn die
 * Topbar sichtbar ist — sie legt sich nur optisch drüber.
 */
.lightbox-stage {
    position: absolute;
    top: 0;
    left: var(--lightbox-thumbs-width);
    right: 0;
    bottom: 0;
    overflow: hidden;
    background: #0a0a0a;
    cursor: zoom-in;
    transition: left 0.25s ease;
    touch-action: none;
}

.lightbox.thumbs-hidden .lightbox-stage {
    left: 0;
}

.lightbox-stage.is-zoomed {
    cursor: grab;
}

.lightbox-stage.is-panning {
    cursor: grabbing;
}

/* ── Bild ────────────────────────────────────────────────── */
.lightbox-image {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    will-change: transform;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    max-width: none;
    max-height: none;
}

.lightbox-image.is-animating {
    transition: transform 0.18s ease;
}

/* ── Prev/Next Pfeile auf dem Bild ───────────────────────── */
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15;
    backdrop-filter: blur(4px);
    transition: background 0.15s ease, transform 0.15s ease, opacity 0.3s ease;
    opacity: 0.75;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(0, 0, 0, 0.7);
    opacity: 1;
    transform: translateY(-50%) scale(1.05);
}

.lightbox-prev {
    left: calc(var(--lightbox-thumbs-width) + 16px);
    transition: background 0.15s ease, transform 0.15s ease, opacity 0.3s ease, left 0.25s ease;
}

.lightbox.thumbs-hidden .lightbox-prev {
    left: 16px;
}

.lightbox-next {
    right: 16px;
}

/* ── Caption-Leiste unten ────────────────────────────────── */
.lightbox-caption {
    position: absolute;
    bottom: 0;
    left: var(--lightbox-thumbs-width);
    right: 0;
    height: var(--lightbox-caption-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: linear-gradient(to top, rgba(0,0,0,0.75), rgba(0,0,0,0));
    color: #fff;
    font-size: 13px;
    z-index: 15;
    pointer-events: none;
    transition: opacity 0.3s ease, left 0.25s ease;
}

.lightbox.thumbs-hidden .lightbox-caption {
    left: 0;
}

.lightbox-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 16px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.lightbox-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    font-variant-numeric: tabular-nums;
    opacity: 0.85;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    white-space: nowrap;
}

.lightbox-counter,
.lightbox-zoom-indicator {
    opacity: 0.9;
}

/* ── Auto-Hide (Controls verschwinden nach 2 s Inaktivität) ── */
.lightbox.is-idle .lightbox-topbar,
.lightbox.is-idle .lightbox-caption,
.lightbox.is-idle .lightbox-prev,
.lightbox.is-idle .lightbox-next {
    opacity: 0;
    pointer-events: none;
}

/* Thumb-Leiste bleibt sichtbar, auch im idle-Zustand */

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 640px) {
    :root {
        --lightbox-thumbs-width: 110px;
        --lightbox-topbar-height: 44px;
        --lightbox-caption-height: 48px;
    }

    .lightbox-topbar {
        padding: 0 8px;
        gap: 6px;
    }

    .lightbox-topbar button,
    .lightbox-topbar input,
    .lightbox-topbar label {
        font-size: 12px;
    }

    .lightbox-topbar label {
        display: none;
    }

    .lightbox-topbar input[type="number"] {
        width: 44px;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .lightbox-prev {
        left: calc(var(--lightbox-thumbs-width) + 8px);
    }
    .lightbox.thumbs-hidden .lightbox-prev {
        left: 8px;
    }
    .lightbox-next {
        right: 8px;
    }

    .lightbox-caption {
        padding: 0 12px;
        font-size: 12px;
    }
}