/* ============================================================
   Bildergalerie – Layout, Filter, Masonry, Lightbox-Caption
   Dark-Theme im Stil von virtuelles-museum.com
   ============================================================ */

:root {
    --color-text:          #f5f5f4;
    --color-muted:         #b8b4af;
    --color-accent:        #6b85e6;
    --color-accent-hover:  #9ab0f0;

    --header-bg:           rgba(40, 40, 40, 0.7);
    --header-border:       rgba(255, 255, 255, 0.08);

    --surface:             rgba(40, 40, 40, 0.85);
    --surface-hover:       rgba(60, 60, 60, 0.85);
    --field-bg:            rgba(20, 20, 20, 0.75);
    --field-border:        rgba(255, 255, 255, 0.15);
    --field-border-focus:  rgba(155, 175, 240, 0.7);

    --shadow-sm:           0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md:           0 6px 18px rgba(0, 0, 0, 0.55);
    --radius:              10px;
    --gutter:              16px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    color: var(--color-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
}

body {
    background: #1a1a1a url('../img/grunge-bg.jpg') repeat;
    background-attachment: fixed;
}

a { color: var(--color-accent); }
a:hover { color: var(--color-accent-hover); }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}

/* ---------- Header & Filter ---------- */

.site-header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: var(--shadow-sm);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 24px;
}

.site-header__brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.site-header__logo img {
    display: block;
    height: 48px;
    width: auto;
}

.site-header__title {
    margin: 0;
    font-size: 20px;
    font-weight: 500;
    color: var(--color-text);
    letter-spacing: 0.01em;
}

.filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: var(--radius);
    padding: 8px 14px;
    cursor: pointer;
    font: inherit;
    color: var(--color-text);
    transition: background .15s ease, border-color .15s ease;
}
.filter-toggle:hover {
    background: var(--surface-hover);
    border-color: var(--field-border-focus);
}

.filterbar {
    padding: 14px 24px 18px;
    border-top: 1px solid var(--header-border);
    background: rgba(20, 20, 20, 0.6);
}
.filterbar[hidden] { display: none; }

.filterbar__form {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 12px;
    align-items: stretch;
}

.filterbar__field { display: flex; }

.filterbar__field input,
.filterbar__field select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--field-border);
    border-radius: var(--radius);
    background: var(--field-bg);
    color: var(--color-text);
    font: inherit;
}
.filterbar__field input::placeholder { color: var(--color-muted); }

/* Select-Pfeil hell + eigener Hintergrund */
.filterbar__field select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path fill='%23b8b4af' d='M6 8L0 0h12z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 10px;
    padding-right: 32px;
}
.filterbar__field select option {
    /* Native Dropdown-Popup: Browser zwingt oft auf Default — wir versuchen es trotzdem */
    background: #2a2a2a;
    color: var(--color-text);
}

.filterbar__field input:focus,
.filterbar__field select:focus {
    outline: 2px solid var(--field-border-focus);
    outline-offset: -1px;
    border-color: var(--field-border-focus);
}

.filterbar__reset {
    padding: 9px 16px;
    background: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: var(--radius);
    cursor: pointer;
    font: inherit;
    color: var(--color-muted);
    transition: background .15s ease, color .15s ease;
}
.filterbar__reset:hover {
    background: var(--surface-hover);
    color: var(--color-text);
}

.filterbar__count {
    margin: 14px 0 0;
    color: var(--color-muted);
    font-size: 13px;
}

@media (max-width: 720px) {
    .filterbar__form { grid-template-columns: 1fr; }
    .site-header__logo img { height: 40px; }
}

/* ---------- Galerie / Masonry ---------- */

main { padding: 24px; }

.gallery-status {
    text-align: center;
    color: var(--color-muted);
    padding: 60px 20px;
}

.gallery {
    margin: 0 auto;
    max-width: 1600px;
}

.grid-sizer,
.gallery__item {
    width: calc((100% - 3 * var(--gutter)) / 4);
}

.gallery__item {
    margin-bottom: var(--gutter);
    background: var(--surface);
    border: 1px solid var(--header-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    /* Kein transform in der CSS-transition — Masonry steuert das transform
       selbst per Inline-Style + eigener transitionDuration. Eine zusätzliche
       CSS-transition aufs transform würde mit Masonry's Animation
       konkurrieren und zu sichtbarem Flackern beim Resize/Filter führen.
       Aus dem selben Grund kein hover-translate: ein hover-transform würde
       Masonry's translate(X,Y) überschreiben → Item springt aus dem Grid. */
    transition: box-shadow .25s ease, border-color .25s ease;
    display: block;
    text-decoration: none;
    color: inherit;
}
.gallery__item:hover {
    border-color: rgba(255, 255, 255, 0.7);
    box-shadow:
        0 12px 28px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.35),
        0 0 24px rgba(255, 255, 255, 0.18);
    z-index: 2;
}

.gallery__item img {
    display: block;
    width: 100%;
    height: auto;
    transition: filter .25s ease, transform .25s ease;
}
/* Hover-Effekt nur aufs <img>, NICHT aufs .gallery__item selbst —
   sonst kollidiert es mit Masonry's translate(X,Y). Das <img> ist von
   overflow:hidden des Containers eingerahmt, der Zoom wirkt im Rahmen. */
.gallery__item:hover img {
    filter: brightness(1.08) saturate(1.1);
    transform: scale(1.05);
}

.gallery__item--hidden { display: none !important; }

/* ---------- Video- und Audio-Items ---------- */

.gallery__item--video,
.gallery__item--audio {
    position: relative;
}

/* <video>-Element in der Galerie-Kachel (wenn kein Poster vorhanden) */
.gallery__item--video video {
    display: block;
    width: 100%;
    height: auto;
    background: #000;
    /* Klick geht aufs wrapping <a>, nicht ins Video-Element */
    pointer-events: none;
}

/* Audio-Fallback-Cover: 16:9-Box mit Musiknoten-Icon (passt zum Video-
   Default und sorgt für gleichmäßiges Masonry-Layout bei Medien ohne
   eigenes Vorschaubild). */
.gallery__audio-cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #2a2a3a, #161620);
    display: flex;
    align-items: center;
    justify-content: center;
}
.gallery__audio-cover svg {
    width: 30%;
    height: 60%;
}

/* Play-Overlay zentral über Bild-/Video-Bereich; bottom: 35px reserviert
   für die Caption darunter (font-size 12 + padding 8/8 + border 1 ≈ 35 px). */
.gallery__play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.gallery__play-overlay svg {
    width: 56px;
    height: 56px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
    transition: transform .25s ease, opacity .25s ease;
    opacity: .85;
}
.gallery__item:hover .gallery__play-overlay svg {
    transform: scale(1.1);
    opacity: 1;
}

/* GLightbox setzt für inline-Type per Default einen weißen Hintergrund
   und Padding — wir wollen einen transparenten Container, damit das
   GLightbox-Backdrop (dunkel) durchschimmert. */
.glightbox-clean .gslide-inline {
    background: transparent !important;
    color: var(--color-text) !important;
    box-shadow: none !important;
}
.glightbox-clean .gslide-inline .ginlined-content {
    padding: 0 !important;
}

/* ---------- Video in der Lightbox ---------- */

.video-lightbox {
    text-align: center;
    padding: 20px;
    max-width: 95vw;
    margin: 0 auto;
}
.video-lightbox__wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
    line-height: 0; /* Verhindert Inline-Baseline-Gap unter <video> */
}
.video-lightbox__player {
    display: block;
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    margin: 0 auto;
    background: #000;
    border-radius: var(--radius);
}

/* Custom-Play-Button über dem Video — überlagert den nativen Browser-Play
   bis zum ersten Klick, danach übernimmt die <video controls>-Leiste. */
.video-lightbox__playbtn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity .25s ease;
}
.video-lightbox__playbtn svg {
    width: 88px;
    height: 88px;
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.7));
    transition: transform .25s ease;
}
.video-lightbox__playbtn:hover svg {
    transform: scale(1.08);
}
.video-lightbox__playbtn--hidden {
    opacity: 0;
    pointer-events: none;
}

/* ---------- Audio in der Lightbox ---------- */

.audio-lightbox {
    text-align: center;
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
    color: var(--color-text);
}
.audio-lightbox__cover {
    display: block;
    max-width: 100%;
    max-height: 55vh;
    height: auto;
    margin: 0 auto 20px;
    border-radius: var(--radius);
}
.audio-lightbox__icon {
    width: 220px;
    height: 220px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #2a2a3a, #161620);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}
.audio-lightbox__icon svg {
    width: 50%;
    height: 50%;
}
.audio-lightbox__title {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 14px;
}
.audio-lightbox__player {
    width: 100%;
    max-width: 500px;
}

.gallery__caption {
    padding: 8px 10px;
    font-size: 12px;
    color: var(--color-muted);
    border-top: 1px solid var(--header-border);
    /* Eigener Stacking-Context + solid Hintergrund, damit das skalierte
       Bild beim Hover nicht über die Caption ragt — transform: scale aufs
       <img> erzeugt einen eigenen Layer, der die Caption sonst überdeckt.
       Solid (kein alpha), damit das Bild garantiert nicht durchschimmert. */
    background: #282828;
    position: relative;
    z-index: 1;
}
.gallery__caption strong {
    display: block;
    color: var(--color-text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 1200px) {
    .grid-sizer, .gallery__item {
        width: calc((100% - 2 * var(--gutter)) / 3);
    }
}
@media (max-width: 800px) {
    .grid-sizer, .gallery__item {
        width: calc((100% - 1 * var(--gutter)) / 2);
    }
}
@media (max-width: 500px) {
    main { padding: 12px; }
    .grid-sizer, .gallery__item { width: 100%; }
}

/* ---------- Footer ---------- */

.site-footer {
    margin-top: 40px;
    padding: 18px 24px;
    background: var(--header-bg);
    border-top: 1px solid var(--header-border);
    color: var(--color-text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.site-footer__links {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}
.site-footer a {
    color: var(--color-text);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    padding-bottom: 1px;
    transition: border-color .15s ease;
}
.site-footer a:hover {
    border-bottom-color: var(--color-accent);
    color: var(--color-accent-hover);
}

/* ---------- GLightbox-Caption (EXIF/IPTC-Tabelle) ---------- */

/* Klick aufs Bild in der Lightbox wirkt als "Zoom auf Anzeigefläche":
   die EXIF-Description wird ausgeblendet und das Bild selbst auf bis zu
   95vw / 95vh skaliert. Da `zoomable: false` aktiv ist, setzt GLightbox
   keine Inline-Styles auf das img — das CSS greift sauber durch.
   Toggle-Klasse .gallery-zoomed wird per JS auf dem .gslide gesetzt. */
.gslide.gallery-zoomed .gslide-description {
    display: none !important;
}
.gslide.gallery-zoomed .gslide-image img {
    max-width:  95vw !important;
    max-height: 95vh !important;
    width:      auto !important;
    height:     auto !important;
    object-fit: contain;
}

.glightbox-clean .gslide-description {
    background: rgba(20, 20, 20, 0.95) !important;
    color: var(--color-text) !important;
    max-height: 45vh;
    overflow-y: auto;
}
.glightbox-clean .gslide-title {
    color: #fff !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    margin-bottom: 8px !important;
}
.glightbox-clean .gdesc-inner { padding: 16px 20px !important; }

.exif-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 4px;
}
.exif-table th,
.exif-table td {
    text-align: left;
    padding: 4px 8px 4px 0;
    vertical-align: top;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.exif-table th {
    width: 130px;
    color: var(--color-muted);
    font-weight: 400;
}
.exif-table td a {
    color: var(--color-accent-hover);
    text-decoration: underline;
}
.exif-tags {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.exif-tag {
    background: rgba(255,255,255,0.10);
    border-radius: 3px;
    padding: 2px 7px;
    font-size: 11px;
}
