.gallery-marquee {
    --page-width: calc(100vw - var(--scrollbar-width, 0px));
    --gm-item: clamp(220px, 26vw, 380px);
    --gm-gap: clamp(10px, 1.2vw, 18px);
    --gm-duration: 100s;
    position: relative;
    display: grid;
    gap: var(--gm-gap);
    width: var(--page-width);
    margin-left: calc(50% - var(--page-width) / 2);
    padding: clamp(24px, 3vw, 40px) 0;
    overflow: hidden;
    background: linear-gradient(180deg, #f8f8f4 0%, #f8f8f4 100%);
}

.gallery-marquee__row {
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 6%, #000 94%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 6%, #000 94%, transparent 100%);
}

.gallery-marquee__track {
    display: flex;
    width: max-content;
    animation: gallery-marquee var(--gm-duration) linear infinite;
    will-change: transform;
}

.gallery-marquee__row--reverse .gallery-marquee__track {
    animation-direction: reverse;
}

.gallery-marquee__item {
    position: relative;
    display: block;
    flex: 0 0 var(--gm-item);
    aspect-ratio: 4 / 3;
    margin-right: var(--gm-gap);
    overflow: hidden;
    border-radius: 16px;
    background: #e6ebf2;
    box-shadow: 0 8px 22px rgba(36, 20, 100, .08);
}

.gallery-marquee__item img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    transition: transform .8s ease;
    -webkit-user-drag: none;
}

.gallery-marquee__item::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(18, 30, 70, 0) 55%, rgba(18, 30, 70, .28));
    opacity: 0;
    transition: opacity .4s ease;
    pointer-events: none;
}

@media (hover: hover) {
    .gallery-marquee__row:hover .gallery-marquee__track {
        animation-play-state: paused;
    }

    .gallery-marquee__item:hover img {
        transform: scale(1.06);
    }

    .gallery-marquee__item:hover::after {
        opacity: 1;
    }
}

@keyframes gallery-marquee {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(-50%, 0, 0); }
}

/* ---------- Lightbox ---------- */
.gallery-lightbox-open {
    overflow: hidden;
}

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(56px, 7vw, 80px) clamp(12px, 7vw, 96px);
    background: rgba(14, 18, 44, .9);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity .25s ease;
    font-family: "Plus Jakarta Sans", "Montserrat", sans-serif;
}

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

.gallery-lightbox.is-open {
    opacity: 1;
}

.gallery-lightbox__figure {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    margin: 0;
}

.gallery-lightbox__img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .4);
    object-fit: contain;
    transform: scale(.97);
    transition: opacity .3s ease, transform .3s ease;
}

.gallery-lightbox.is-open .gallery-lightbox__img {
    transform: scale(1);
}

.gallery-lightbox.is-loading .gallery-lightbox__img {
    opacity: .35;
}

.gallery-lightbox .gallery-lightbox__close,
.gallery-lightbox .gallery-lightbox__arrow {
    position: absolute;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    cursor: pointer;
    transition: background .25s ease, border-color .25s ease;
}

.gallery-lightbox .gallery-lightbox__close:hover,
.gallery-lightbox .gallery-lightbox__arrow:hover,
.gallery-lightbox .gallery-lightbox__close:focus-visible,
.gallery-lightbox .gallery-lightbox__arrow:focus-visible {
    border-color: transparent;
    background: linear-gradient(90deg, #f9842b 0%, #fb6427 50%, #fb4423 100%);
}

.gallery-lightbox svg {
    width: 22px;
    height: 22px;
}

.gallery-lightbox .gallery-lightbox__close {
    top: 16px;
    right: 16px;
}

.gallery-lightbox .gallery-lightbox__arrow {
    top: 50%;
    transform: translateY(-50%);
}

.gallery-lightbox__arrow--prev {
    left: clamp(8px, 2vw, 28px);
}

.gallery-lightbox__arrow--next {
    right: clamp(8px, 2vw, 28px);
}

.gallery-lightbox__counter {
    position: absolute;
    bottom: 18px;
    left: 50%;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    transform: translateX(-50%);
}

@media (max-width: 767px) {
    .gallery-lightbox .gallery-lightbox__arrow {
        top: auto;
        bottom: 10px;
        width: 42px;
        height: 42px;
        transform: none;
    }
}

@media (max-width: 767px) {
    .gallery-marquee {
        --gm-item: 62vw;
        --gm-duration: 70s;
    }

    .gallery-marquee__item {
        border-radius: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-marquee__row {
        overflow-x: auto;
        scrollbar-width: none;
    }

    .gallery-marquee__track {
        animation: none;
    }
}
