.gb-gallery,
.gb-gallery * {
    box-sizing: border-box;
}

.gb-gallery {
    --gb-bg: #ffffff;
    --gb-ink: #111111;
    --gb-muted: #9b9b9b;
    --gb-line: rgba(17, 17, 17, 0.12);
    --gb-placeholder: #f1f1f1;
    --gb-max: 1760px;
    /* Distance from the top of the screen for the sticky category list; raise it if the theme has a sticky header. */
    --gb-sticky-top: 120px;
    width: 100%;
    background: var(--gb-bg);
    color: var(--gb-ink);
    font-family: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
    padding: clamp(32px, 4.5vw, 64px) clamp(16px, 2.2vw, 40px);
}

.gb-gallery__wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px;
    grid-template-areas: "grid filters";
    align-items: start;
    column-gap: clamp(40px, 7vw, 150px);
    max-width: var(--gb-max);
    margin: 0 auto;
}

/* Category list */

.gb-gallery__filters {
    grid-area: filters;
    position: sticky;
    top: var(--gb-sticky-top);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 9px;
}

.gb-gallery button.gb-gallery__filter {
    appearance: none;
    display: inline-block;
    min-height: 0;
    margin: 0;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: none !important;
    box-shadow: none !important;
    color: var(--gb-ink) !important;
    font-family: inherit;
    font-size: 13px !important;
    font-weight: 400 !important;
    letter-spacing: 0.04em;
    line-height: 1.35;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    transition: color 180ms ease;
}

.gb-gallery button.gb-gallery__filter:hover,
.gb-gallery button.gb-gallery__filter.is-active {
    color: var(--gb-muted) !important;
}

.gb-gallery button.gb-gallery__filter:focus-visible {
    outline: 1px solid var(--gb-ink);
    outline-offset: 4px;
}

/* Grid */

.gb-gallery__grid {
    grid-area: grid;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: clamp(36px, 4.4vw, 64px) clamp(20px, 2.6vw, 50px);
}

.gb-gallery a.gb-gallery__card,
.gb-gallery a.gb-gallery__card:hover,
.gb-gallery a.gb-gallery__card:focus {
    position: relative;
    display: block;
    width: 100%;
    color: inherit;
    text-decoration: none;
    box-shadow: none;
}

.gb-gallery__image-wrap {
    position: relative;
    display: block;
    width: 100%;
    overflow: hidden;
    aspect-ratio: 3 / 2;
    background: var(--gb-placeholder);
}

.gb-gallery__image {
    position: absolute;
    inset: 0;
    display: block;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center center;
    transition: transform 700ms cubic-bezier(0.2, 0.6, 0.2, 1);
}

.gb-gallery__card:hover .gb-gallery__image,
.gb-gallery__card:focus-visible .gb-gallery__image {
    transform: scale(1.03);
}

/* Title: revealed over the image on hover (desktop) */

.gb-gallery__meta {
    position: absolute;
    inset: auto 0 0 0;
    display: block;
    padding: 48px 22px 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
    color: #ffffff;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 260ms ease, transform 260ms ease;
    pointer-events: none;
}

.gb-gallery__card:hover .gb-gallery__meta,
.gb-gallery__card:focus-visible .gb-gallery__meta {
    opacity: 1;
    transform: translateY(0);
}

.gb-gallery .gb-gallery__category {
    display: block;
    margin-bottom: 6px;
    font-size: 11px !important;
    letter-spacing: 0.12em;
    line-height: 1.2;
    text-transform: uppercase;
    opacity: 0.85;
}

.gb-gallery .gb-gallery__title {
    display: block;
    font-size: 18px !important;
    font-weight: 400;
    line-height: 1.25;
}

.gb-gallery__empty {
    display: none;
    grid-column: 1 / -1;
    margin: 0;
    color: var(--gb-muted);
    font-size: 14px;
}

/* Touch screens have no hover: show the title under the image instead */

@media (hover: none), (max-width: 860px) {
    .gb-gallery__meta {
        position: static;
        padding: 12px 0 0;
        background: none;
        color: var(--gb-ink);
        opacity: 1;
        transform: none;
    }

    .gb-gallery .gb-gallery__category {
        color: var(--gb-muted);
        opacity: 1;
    }

    .gb-gallery .gb-gallery__title {
        font-size: 16px !important;
    }
}

/* Tablet & mobile: categories become a horizontal row above the grid */

@media (max-width: 860px) {
    .gb-gallery__wrap {
        display: block;
    }

    .gb-gallery__filters {
        position: static;
        flex-direction: row;
        gap: 22px;
        margin: 0 calc(-1 * clamp(16px, 2.2vw, 40px)) 28px;
        padding: 0 clamp(16px, 2.2vw, 40px) 14px;
        border-bottom: 1px solid var(--gb-line);
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .gb-gallery__filters::-webkit-scrollbar {
        display: none;
    }

    .gb-gallery__grid {
        gap: 32px 16px;
    }
}

@media (max-width: 620px) {
    .gb-gallery__grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
}
