/* =========================================================
   Galerie-App
   ========================================================= */

.gallery-app {
    width: 100%;
    max-width: 1440px;
    margin-inline: auto;
}

.gallery-app [hidden] {
    display: none !important;
}

/* =========================================================
   Albumübersicht
   ========================================================= */

.gallery-overview {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    width: 100%;
}

.gallery-card {
    width: 100%;
    min-width: 0;
    margin: 0;
}

.gallery-card__button {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--station-border);
    background: var(--station-panel);
    color: var(--station-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.gallery-card__button:focus {
    outline: none;
    box-shadow: none;
}

.gallery-card__button:focus-visible {
    outline: 3px solid var(--station-green);
    outline-offset: 4px;
}

.gallery-card__image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

.gallery-card__content {
    padding: 24px;
}

.gallery-card__title {
    margin: 0 0 10px;
    font-size: clamp(1.45rem, 2vw, 1.8rem);
}

.gallery-card__button:hover .gallery-card__image {
    opacity: 0.94;
    transform: scale(1.015);
}

.gallery-card__content {
    display: flex;
    flex: 1;
    flex-direction: column;
    width: 100%;
    padding: 26px;
}

.gallery-card__title {
    margin: 0 0 10px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.45rem;
    font-weight: 400;
    line-height: 1.2;
}

.gallery-card__description {
    margin: 0;
    color: var(--vollenborn-muted);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1rem;
    line-height: 1.55;
}

/* =========================================================
   Einzelnes Album
   ========================================================= */

.gallery-album {
    width: 100%;
}

.gallery-back {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    margin: 0 0 28px;
    padding: 8px 0;
    border: 0;
    background: transparent;
    color: var(--station-green-dark);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 4px;
    -webkit-tap-highlight-color: transparent;
}

.gallery-back:focus {
    outline: none;
    box-shadow: none;
}

.gallery-back:focus-visible {
    outline: 2px solid var(--vollenborn-accent);
    outline-offset: 3px;
}

.gallery-album__title {
    margin: 0 0 14px;
    color: var(--station-text);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 8vw, 3rem);
    font-weight: 400;
    line-height: 1.1;
}

.gallery-album__description {
    max-width: 760px;
    margin: 0 0 32px;
    color: var(--vollenborn-muted);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.05rem;
    line-height: 1.6;
}

/*
 * Dichtes, masonry-artiges Bilderraster.
 */
.gallery-album__grid {
    width: 100%;
    columns: 1;
    column-gap: 14px;
}

.gallery-album__item {
    display: inline-block;
    width: 100%;
    margin: 0 0 14px;
    break-inside: avoid;
    vertical-align: top;
}

.gallery-album__image-button {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
    -webkit-tap-highlight-color: transparent;
}

.gallery-album__image-button:focus {
    outline: none;
    box-shadow: none;
}

.gallery-album__image-button:focus-visible {
    outline: 3px solid var(--station-green);
    outline-offset: 3px;
}

.gallery-album__image {
    display: block;
    width: 100%;
    height: 260px;
    object-fit: cover;
    transition:
        opacity 160ms ease,
        transform 180ms ease;
}

.gallery-album__image-button:hover .gallery-album__image {
    opacity: 0.94;
    transform: scale(1.01);
}

.gallery-album__caption {
    padding: 8px 4px 4px;
    color: var(--vollenborn-muted);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 0.9rem;
    line-height: 1.4;
}

.gallery-app__empty {
    margin: 0;
    padding: 24px;
    border: 1px solid var(--station-border);
    background: var(--station-panel);
    text-align: center;
}

/* =========================================================
   Lightbox
   ========================================================= */

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    align-items: center;
    gap: 6px;
    width: 100%;
    height: 100dvh;
    padding: 64px 8px 20px;
    background: rgba(0, 0, 0, 0.92);
}

.gallery-lightbox.is-open {
    display: grid;
}

.gallery-lightbox__figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    max-height: calc(100dvh - 84px);
    margin: 0;
}

.gallery-lightbox__image {
    display: block;
    max-width: 100%;
    max-height: calc(100dvh - 140px);
    object-fit: contain;
}

.gallery-lightbox__caption {
    min-height: 1.4em;
    margin-top: 14px;
    color: #ffffff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 0.95rem;
    line-height: 1.4;
    text-align: center;
}

.gallery-lightbox__close,
.gallery-lightbox__control {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.gallery-lightbox__close:focus,
.gallery-lightbox__control:focus {
    outline: none;
    box-shadow: none;
}

.gallery-lightbox__close:focus-visible,
.gallery-lightbox__control:focus-visible {
    outline: 2px solid var(--vollenborn-accent);
    outline-offset: 3px;
}

.gallery-lightbox__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 42px;
    height: 42px;
}

.gallery-lightbox__close span {
    position: relative;
    display: block;
    width: 26px;
    height: 26px;
}

.gallery-lightbox__close span::before,
.gallery-lightbox__close span::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 27px;
    height: 2px;
    background: currentColor;
}

.gallery-lightbox__close span::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.gallery-lightbox__close span::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.gallery-lightbox__control {
    width: 42px;
    height: 52px;
}

.gallery-lightbox__control span {
    display: block;
    width: 14px;
    height: 14px;
    border-top: 3px solid currentColor;
    border-right: 3px solid currentColor;
}

.gallery-lightbox__control--previous span {
    transform: rotate(-135deg);
}

.gallery-lightbox__control--next span {
    transform: rotate(45deg);
}

body.has-open-gallery-lightbox {
    overflow: hidden;
}

.gallery-page__content,
.gallery-page__content .entry-content,
.gallery-page__content .wp-block-post-content {
    width: 100%;
    max-width: none;
}

.gallery-page__content .entry-content > *,
.gallery-page__content .wp-block-post-content > * {
    max-width: none;
}

/* =========================================================
   Responsive
   ========================================================= */

@media (min-width: 560px) {
    .gallery-overview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gallery-album__grid {
        columns: 2;
    }
}

@media (min-width: 900px) {
    .gallery-overview {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 28px;
    }

    .gallery-album__grid {
        columns: 3;
        column-gap: 10px;
    }

    .gallery-album__item {
        margin-bottom: 10px;
    }

    .gallery-lightbox {
        grid-template-columns: 64px minmax(0, 1fr) 64px;
        gap: 12px;
        padding-inline: 24px;
    }
}

@media (min-width: 700px) {
    .gallery-overview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 28px;
    }
}

@media (min-width: 1200px) {
    .gallery-overview {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 32px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-card__image,
    .gallery-album__image {
        transition: none;
    }
}

@media (min-width: 700px) {
    .gallery-album__grid {
        columns: 2;
        column-gap: 16px;
    }

    .gallery-album__item {
        margin-bottom: 16px;
    }
}

@media (min-width: 1100px) {
    .gallery-album__grid {
        columns: 3;
        column-gap: 18px;
    }

    .gallery-album__item {
        margin-bottom: 18px;
    }
}