/* Fascia gallery: geometria Swiper e interazioni derivate dal tema WordPress originale. */
.gallery-strip .gallery-item {
    position: relative;
    display: block;
    overflow: hidden;
    background: #201714;
    cursor: pointer;
}

.gallery-strip .gallery-item img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.gallery-strip .gallery-item::before,
.gallery-strip .gallery-item::after {
    position: absolute;
    z-index: 1;
    content: "";
    opacity: 0;
    transition: opacity 300ms ease;
    pointer-events: none;
}

.gallery-strip .gallery-item::before {
    inset: 0;
    background: rgba(32, 23, 20, 0.3);
}

.gallery-strip .gallery-item::after {
    top: 50%;
    left: 50%;
    width: 48px;
    height: 48px;
    background-color: #f3f3ee;
    background-image:
        linear-gradient(#201714, #201714),
        linear-gradient(#201714, #201714);
    background-position: center;
    background-repeat: no-repeat;
    background-size: 18px 2px, 2px 18px;
    transform: translate(-50%, -50%);
}

.gallery-strip .gallery-item:hover::before,
.gallery-strip .gallery-item:hover::after,
.gallery-strip .gallery-item:focus-visible::before,
.gallery-strip .gallery-item:focus-visible::after {
    opacity: 1;
}

.gallery-strip .gallery-item:focus-visible {
    outline: 2px solid #201714;
    outline-offset: 3px;
}

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

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 24px 32px;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
}

.gallery-lightbox[hidden] {
    display: none;
}

.gallery-lightbox-inner {
    display: flex;
    max-width: calc(100vw - 192px);
    height: 90vh;
    align-items: center;
    justify-content: center;
}

.gallery-lightbox-inner img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 90vh;
    object-fit: contain;
    user-select: none;
}

.gallery-close,
.gallery-nav {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    color: currentColor;
    background: transparent;
    cursor: pointer;
}

.gallery-close {
    position: absolute;
    z-index: 2;
    top: calc(5vh + 8px);
    right: calc((100vw - min(112.5vh, 90vw)) / 2 + 8px);
    width: 48px;
    height: 48px;
}

.gallery-close svg {
    width: 48px;
    height: 48px;
}

.gallery-nav {
    width: 48px;
    height: 48px;
}

.gallery-nav svg {
    width: 48px;
    height: 28px;
}

.gallery-prev {
    transform: rotate(180deg);
}

.gallery-close:focus-visible,
.gallery-nav:focus-visible {
    outline: 2px solid #f3f3ee;
    outline-offset: 4px;
}

body.gallery-open {
    overflow: hidden;
}

@media (max-width: 767px) {
    .gallery-lightbox {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: minmax(0, 1fr) auto;
        gap: 16px;
        padding: 16px;
    }

    .gallery-lightbox-inner {
        grid-column: 1 / -1;
        grid-row: 1;
        max-width: 100%;
        height: auto;
        min-height: 0;
    }

    .gallery-lightbox-inner img {
        max-height: calc(100vh - 96px);
    }

    .gallery-close {
        top: 24px;
        right: 24px;
    }

    .gallery-nav {
        position: static;
        grid-row: 2;
    }

    .gallery-prev {
        grid-column: 1;
        justify-self: start;
    }

    .gallery-next {
        grid-column: 2;
        justify-self: end;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-strip .gallery-item::before,
    .gallery-strip .gallery-item::after {
        transition: none;
    }
}
