/**
 * Gallery Block Styles
 */

.block-gallery {
    padding: 5em 2.5em;
    background-color: var(--color-1, #F1EEE9);
}

@media screen and (max-width: 1024px) {
    .block-gallery {
        padding: 3em 0.5em;
    }
}

.block-gallery__container {
    max-width: 88.25em;
    margin: 0 auto;
    position: relative;
}

/* Header */
.block-gallery__header {
    width: 100%;
    max-width: 21.0625em;
    margin: 10em auto 12.6em;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2.5em;
}

@media screen and (max-width: 1024px) {
    .block-gallery__header {
        margin: 5em auto;
    }
}

.block-gallery__title {
    margin: 0;
    color: var(--color-2, #03090D);
}

/* Main Layout */

.block-gallery__main {
    position: relative;
    margin-bottom: 6em;
}

.block-gallery__filter-menu {
    position: fixed;
    left: 50%;
    bottom: 1.25em;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.625em;
    width: min(14.875em, calc(100vw - 2em));
    height: 3.75em;
    margin: 0;
    padding: 0 1.5em;
    border-radius: 0.375em;
    background: var(--color-6);
    color: var(--color-2);
    box-shadow: 0 1em 2em rgba(3, 9, 13, 0.04);
    transform: translateX(-50%);
}

.block-gallery__filter-menu.is-docked {
    position: absolute;
    top: calc(100% + 1.25em);
    bottom: auto;
}

.block-gallery__filter-label {
    color: var(--color-9);
}

@media screen and (max-width: 1024px) {
    .block-gallery__filter-menu {
        gap: 0.5em;
        width: max-content;
        min-width: 8.75em;
        max-width: calc(100vw - 2em);
        height: 2.75em;
        padding: 0 0.5em;
    }
}

.block-gallery__filter-toggle,
.block-gallery__filter-option {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--color-2, #03090D);
}

.block-gallery__filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
}

.block-gallery__filter-toggle svg {
    transition: transform 0.25s ease;
}

.block-gallery__filter-menu.is-open .block-gallery__filter-toggle svg {
    transform: rotate(180deg);
}

.block-gallery__filter-dropdown {
    position: absolute;
    left: 0;
    bottom: calc(100% + 0.125em);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25em;
    width: 100%;
    padding: 1.875em 2.5em;
    border-radius: 0.375em;
    background: var(--color-6);
    color: var(--color-2);
    box-shadow: 0 1em 2em rgba(3, 9, 13, 0.04);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(0.5em);
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
}

.block-gallery__filter-menu.is-open .block-gallery__filter-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.block-gallery__filter-option {
    text-align: left;
}

.block-gallery__filter-option.is-active {
    color: var(--color-9);
}

@media screen and (max-width: 1024px) {
    .block-gallery__filter-dropdown {
        gap: 0.75em;
        width: 100%;
        padding: 0.875em 0.5em;
    }

    .block-gallery__filter-toggle {
        flex-wrap: nowrap;
        justify-content: center;
        white-space: nowrap;
    }

    .block-gallery__filter-option {
        width: 100%;
        white-space: nowrap;
        overflow-wrap: normal;
        word-break: normal;
    }
}

/* Gallery Grid */
.block-gallery__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 18.875em));
    justify-content: center;
    gap: 4.25em;
}

@media screen and (max-width: 1024px) {
    .block-gallery__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5em;
    }
}

.block-gallery__item {
    margin: 0;
    overflow: hidden;
    aspect-ratio: 302 / 332;
    border-radius: 0.375em;
    cursor: pointer;
    opacity: 1;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.block-gallery__item:hover {
    transform: scale(1.02);
}

.block-gallery__item.is-hidden {
    display: none;
}

.block-gallery__item.is-animating-out {
    opacity: 0;
    transform: scale(0.92);
    pointer-events: none;
}

.block-gallery__item.is-animating-in {
    opacity: 0;
    transform: translateY(1.25em);
}

.block-gallery__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Footer */
.block-gallery__footer {
    display: flex;
    justify-content: center;
    margin-top: 3em;
}

.block-gallery .block-gallery__view-more.button-primary.button-dark {
    border-radius: 500px;
}

@media screen and (max-width: 1024px) {
    .block-gallery__footer {
        margin-top: 2em;
    }
}

/* =====================
   LIGHTBOX STYLES
   ===================== */

.block-gallery__lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.block-gallery__lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.block-gallery__lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-1, #F1EEE9);
}

.block-gallery__lightbox-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5em;
    height: 100vh;
    padding: 1em;
}

@media screen and (max-width: 1024px) {
    .block-gallery__lightbox-container {
        gap: 3.5em;
        justify-content: space-between;
        padding: 0.625em;
    }
}

/* Lightbox Header */
.block-gallery__lightbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 45em;
    background: var(--color-6);
    margin: 0 auto;
    width: 100%;
    padding: 1.5rem 2em;
    border-radius: 0.375em;
    height: 3.75em;
    flex-shrink: 0;
}

@media screen and (max-width: 1024px) {
    .block-gallery__lightbox-header {
        height: 2.875em;
        padding: 0 1em;
    }
}


.block-gallery__lightbox-label {
    color: var(--color-2, #03090D);
}

.block-gallery__lightbox-counter {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    color: var(--color-2, #03090D);
}

.block-gallery__lightbox-current {
    color: var(--color-9);
}

.block-gallery__lightbox-separator {
    margin: 0 0.25em;
    opacity: 0.5;
}

.block-gallery__lightbox-close {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-2, #03090D);
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
}

.block-gallery__lightbox-close:hover {
    opacity: 0.6;
}

.block-gallery__lightbox-stage {
    display: contents;
}

@media screen and (max-width: 1024px) {
    .block-gallery__lightbox-stage {
        display: flex;
        flex-direction: column;
        gap: 1em;
        min-height: 0;
    }
}

/* Lightbox Main */
.block-gallery__lightbox-main {
    position: relative;
    flex: 1;
    display: flex;
    gap: 1.5em;
    min-height: 0;
    overflow: hidden;
}

@media screen and (max-width: 1024px) {
    .block-gallery__lightbox-main {
        flex-direction: column;
        width: 100%;
    }
}

/* Lightbox Thumbnails - Desktop (Left side) */
.block-gallery__lightbox-thumbs {
    width: 6.5em;
    flex-shrink: 0;
    overflow: hidden;
    position: absolute;
    right: 1em;
    top: 0;
    bottom: 0;
    z-index: 2;
    pointer-events: auto;
}

@media screen and (max-width: 1024px) {
    .block-gallery__lightbox-thumbs {
        position: static;
        width: calc(100% + 1.25em);
        height: 6.5em;
        margin-left: -0.625em;
        margin-right: -0.625em;
        margin-bottom: 0;
    }
}

.block-gallery__lightbox-thumbs-track {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow-y: scroll;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

.block-gallery__lightbox-thumbs-track::-webkit-scrollbar {
    display: none;
}

@media screen and (max-width: 1024px) {
    .block-gallery__lightbox-thumbs-track {
        flex-direction: row;
        gap: 0.5em;
        overflow-x: auto;
        overflow-y: hidden;
        height: 100%;
        max-height: 100%;
        padding: 0 0.625em;
        touch-action: pan-x;
    }
}

.block-gallery__lightbox-thumb {
    flex-shrink: 0;
    width: 6.5em;
    height: 9.75em;
    border-radius: 0.25em;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

@media screen and (max-width: 1024px) {
    .block-gallery__lightbox-thumb {
        width: 4.6875em;
        height: 6.25em;
    }
}

.block-gallery__lightbox-thumb:hover,
.block-gallery__lightbox-thumb.is-active {
    opacity: 1;
}

.block-gallery__lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Lightbox Main Image */
.block-gallery__lightbox-image-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

@media screen and (max-width: 1024px) {
    .block-gallery__lightbox-image-wrapper {
        order: 1;
        flex: 0 0 auto;
        align-items: flex-start;
        aspect-ratio: 405 / 512;
        max-height: none;
        width: 100%;
    }
}

.block-gallery__lightbox-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 0.375em;
}

@media screen and (max-width: 1024px) {
    .block-gallery__lightbox-image {
        display: block;
        width: 100%;
        height: 100%;
        min-width: 100%;
        max-width: none;
        max-height: none;
        object-fit: cover;
    }
}

/* Lightbox Navigation */
.block-gallery__lightbox-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25em;
    width: 19.125em;
    max-width: 100%;
    height: 4.625em;
    margin: 0;
    padding: 0 1.25em;
    flex-shrink: 0;
    align-self: center;
    border: 1px solid var(--color-8);
    border-radius: 500px;
}

@media screen and (max-width: 1024px) {
    .block-gallery__lightbox-nav {
        position: static;
        gap: 0.825em;
        padding: 0 0.875em;
        padding-bottom: 0;
        width: min(12.9375em, calc(100% - 3.75em));
        height: 3.3125em;
    }

}

.block-gallery__lightbox-prev,
.block-gallery__lightbox-next {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5em;
    height: 2.5em;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-2, #03090D);
    transition: opacity 0.3s ease;
    padding: 0;
}

.block-gallery__lightbox-prev:hover,
.block-gallery__lightbox-next:hover {
    opacity: 0.6;
}

.block-gallery__lightbox-prev svg,
.block-gallery__lightbox-next svg {
    width: 1.875em;
    height: auto;
}

@media screen and (max-width: 1024px) {
    .block-gallery__lightbox-prev,
    .block-gallery__lightbox-next {
        width: 1.75em;
        height: 1.75em;
    }

    .block-gallery__lightbox-prev svg,
    .block-gallery__lightbox-next svg {
        width: 0.875em;
        height: 0.875em;
    }
}

.block-gallery__lightbox-progress {
    flex: 1;
    height: 2px;
    background-color: rgba(3, 9, 13, 0.2);
    position: relative;
    overflow: hidden;
    border-radius: 500px;
}

.block-gallery__lightbox-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background-color: var(--color-2, #03090D);
    border-radius: inherit;
    transition: width 0.3s ease;
}
