/* Öffentliche Galerie — Masonry, Lightbox */

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

.gallery-page {
    width: 100%;
    max-width: var(--public-gallery-main-max);
    margin: 0 auto;
}

.gallery-header {
    margin-bottom: 1.25rem;
}

.gallery-title {
    margin: 0 0 0.35rem;
    font-size: clamp(1.5rem, 4vw, 2rem);
}

.gallery-desc {
    margin: 0;
    color: var(--public-muted, #475569);
    max-width: 42rem;
}

.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

@media (max-width: 479px) {
    .gallery-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 0.4rem;
        padding-bottom: 0.35rem;
        margin-left: -0.25rem;
        margin-right: -0.25rem;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
        scrollbar-width: thin;
    }

    .gallery-filter {
        flex-shrink: 0;
    }
}

.gallery-filter {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: var(--header-bg);
    color: var(--text);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
}

.gallery-filter:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}

.gallery-filter.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.gallery-sort {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.gallery-sort-label {
    font-size: 0.88rem;
    margin-right: 0.15rem;
}

@media (max-width: 479px) {
    .gallery-sort {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 0.4rem;
        padding-bottom: 0.35rem;
        margin-left: -0.25rem;
        margin-right: -0.25rem;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
        scrollbar-width: thin;
    }

    .gallery-sort-opt {
        flex-shrink: 0;
    }
}

.gallery-sort-opt {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: var(--header-bg);
    color: var(--text);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
}

.gallery-sort-opt:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}

.gallery-sort-opt.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.gallery-empty {
    color: var(--muted);
    padding: 2rem 0;
}

.gallery-masonry {
    column-count: 1;
    column-gap: 0.75rem;
}

@media (min-width: 480px) {
    .gallery-masonry {
        column-count: 2;
    }
}

@media (min-width: 640px) {
    .gallery-masonry {
        column-count: 3;
        column-gap: 1rem;
    }
}

@media (min-width: 1024px) {
    .gallery-masonry {
        column-count: 4;
    }
}

.gallery-tile {
    break-inside: avoid;
    margin-bottom: 0.75rem;
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    border-radius: 8px;
    overflow: hidden;
    cursor: zoom-in;
    background: var(--tile-bg);
    box-shadow: var(--card-shadow-strong);
    -webkit-tap-highlight-color: transparent;
}

@media (min-width: 640px) {
    .gallery-tile {
        margin-bottom: 1rem;
    }
}

.gallery-tile:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.gallery-tile:focus:not(:focus-visible) {
    outline: none;
}

.gallery-tile-img {
    width: 100%;
    height: auto;
    vertical-align: middle;
    display: block;
    aspect-ratio: 1;
    object-fit: cover;
}

.gallery-lightbox {
    padding: 0;
    border: none;
    max-width: none;
    max-height: none;
    width: 100%;
    height: 100%;
    background: transparent;
}

.gallery-lightbox::backdrop {
    background: rgba(2, 6, 23, 0.88);
}

.lb-fs-root {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    border: none;
    background: transparent;
}

.lb-fs-root.lb-faux-fullscreen {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2147483000;
}

.lb-inner {
    position: fixed;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top) min(1rem, 3vw) env(safe-area-inset-bottom);
    pointer-events: none;
}

.lb-toolbar {
    position: fixed;
    bottom: max(0.5rem, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 23;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 0.75rem;
    padding: 0.45rem 0.65rem;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(248, 250, 252, 0.12);
    pointer-events: auto;
    max-width: calc(100vw - 2rem);
}

.lb-toolbar-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
}

.lb-tool {
    padding: 0.35rem 0.65rem;
    border-radius: 8px;
    border: 1px solid rgba(248, 250, 252, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.lb-tool:hover {
    background: rgba(255, 255, 255, 0.16);
}

.lb-tool[aria-pressed='true'] {
    background: rgba(56, 189, 248, 0.35);
    border-color: rgba(125, 211, 252, 0.45);
}

.lb-toolbar-label {
    display: flex;
    align-items: center;
    margin: 0;
    font-size: 0.82rem;
}

.lb-select {
    padding: 0.3rem 0.45rem;
    border-radius: 6px;
    border: 1px solid rgba(248, 250, 252, 0.2);
    background: rgba(2, 6, 23, 0.6);
    color: #f8fafc;
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    max-width: 6rem;
}

.lb-audio-hidden {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.lb-inner > * {
    pointer-events: auto;
}

.lb-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1;
    cursor: pointer;
}

.lb-close {
    position: fixed;
    top: max(0.5rem, env(safe-area-inset-top));
    right: max(0.5rem, env(safe-area-inset-right));
    z-index: 22;
    width: 2.75rem;
    height: 2.75rem;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
}

.lb-close:hover {
    background: rgba(255, 255, 255, 0.22);
}

.lb-fs-root > .lb-nav {
    pointer-events: auto;
}

.lb-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 25;
    min-width: 2.75rem;
    min-height: 3rem;
    width: 2.85rem;
    height: 3.35rem;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding-bottom: 0.2rem;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.lb-nav:hover {
    background: rgba(255, 255, 255, 0.22);
}

.lb-prev {
    left: max(0.5rem, env(safe-area-inset-left));
}

.lb-next {
    right: max(0.5rem, env(safe-area-inset-right));
}

@media (max-width: 479px) {
    .lb-nav {
        width: 3.1rem;
        height: 3.6rem;
        min-width: 44px;
        min-height: 44px;
        font-size: 2.25rem;
    }

    .lb-toolbar {
        max-width: calc(100vw - 1rem);
        font-size: 0.8rem;
    }

    .lb-figure {
        max-height: calc(100vh - 7rem);
    }

    .lb-img {
        max-height: calc(100vh - 9rem);
    }
}

.lb-figure {
    position: relative;
    z-index: 2;
    margin: 0;
    max-width: min(96vw, 1200px);
    max-height: calc(100vh - 8rem);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lb-img {
    max-width: 100%;
    max-height: calc(100vh - 10rem);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
}

.lb-caption {
    margin-top: 0.75rem;
    color: #e2e8f0;
    text-align: center;
    max-width: 42rem;
    font-size: 0.95rem;
}

.lb-title {
    display: block;
    margin-bottom: 0.25rem;
}

.lb-desc {
    display: block;
    color: #94a3b8;
    white-space: pre-wrap;
}
