/**
 * Flexbox gallery — GSAP Flip filtering
 *
 * @see https://demos.gsap.com/demo/flexbox-filtering/
 * @see https://codepen.io/GreenSock/pen/NWRxarv
 */

.rc-gallery-flex {
    width: 100%;
}

.rc-gallery-flex__header {
    margin-bottom: clamp(1.25rem, 3vw, 2rem);
}

.rc-gallery-flex__filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: clamp(1.25rem, 3vw, 2rem);
}

.rc-gallery-flex__filter {
    border: 2px solid var(--color-night);
    background: transparent;
    color: var(--color-night);
    border-radius: 999px;
    padding: 0.45rem 1.1rem;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.rc-gallery-flex__filter:hover,
.rc-gallery-flex__filter:focus-visible {
    border-color: var(--color-flare, var(--color-volt));
    outline: none;
}

.rc-gallery-flex__filter.is-active {
    background: var(--color-volt);
    border-color: var(--color-volt);
    color: var(--color-night);
}

.rc-gallery-flex__stage {
    position: relative;
}

.rc-gallery-flex__grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}

.rc-gallery-flex__item {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 9.5rem;
    max-width: 100%;
    box-sizing: border-box;
}

@media (min-width: 640px) {
    .rc-gallery-flex__item {
        flex: 1 1 calc(33.333% - 0.67rem);
        min-width: 11rem;
    }
}

@media (min-width: 1024px) {
    .rc-gallery-flex__item {
        flex: 1 1 calc(25% - 0.75rem);
    }
}

.rc-gallery-flex__card {
    margin: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--color-snow);
    box-shadow: var(--shadow-card);
}

.rc-gallery-flex__trigger {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.rc-gallery-flex__trigger img,
.rc-gallery-flex__card > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.rc-gallery-flex__trigger:hover img,
.rc-gallery-flex__trigger:focus-visible img {
    transform: scale(1.05);
}

.rc-gallery-flex__trigger:focus-visible {
    outline: 2px solid var(--color-volt);
    outline-offset: 2px;
}

.rc-gallery-flex__caption {
    padding: 0.75rem 0.9rem;
    font-size: var(--font-small);
    line-height: 1.4;
}

.rc-gallery-flex__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 10rem;
    padding: 1rem;
    font-weight: 600;
}

.rc-gallery-flex__lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(13, 15, 18, 0.92);
}

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

.rc-gallery-flex__lightbox-content img {
    max-width: min(92vw, 72rem);
    max-height: 88vh;
    width: auto;
    height: auto;
    display: block;
    border-radius: var(--radius-sm);
}

.rc-gallery-flex__lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.75rem;
    height: 2.75rem;
    border: 0;
    border-radius: 50%;
    background: var(--color-volt);
    color: var(--color-night);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

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

@media (prefers-reduced-motion: reduce) {
    .rc-gallery-flex__trigger img {
        transition: none;
    }
}
