/* Gallery hero */

.gallery-hero {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;

    min-height: 470px;
    padding: 135px 20px 75px;

    color: #ffffff;
    text-align: center;

    background:
        url("../images/gallery/gallery-hero.jpg")
        center / cover no-repeat;
}

.gallery-hero-overlay {
    position: absolute;
    inset: 0;

    background:
        linear-gradient(
            180deg,
            rgba(18, 12, 10, 0.45),
            rgba(18, 12, 10, 0.86)
        );
}

.gallery-hero-content {
    position: relative;
    z-index: 2;

    max-width: 680px;
}

.gallery-hero-content > span {
    display: inline-flex;

    padding: 7px 17px;

    color: #f1d1a9;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50px;

    font-size: 13px;
}

.gallery-hero-content h1 {
    margin-top: 18px;

    font-size: clamp(37px, 7vw, 64px);
    font-weight: 800;
}

.gallery-hero-content p {
    max-width: 570px;
    margin: 17px auto 0;

    color: #e4dbd6;
    font-size: 15px;
    line-height: 2;
}

/* Gallery section */

.gallery-section {
    max-width: 1300px;
    margin: auto;
    padding: 85px 6%;
}

/* Filters */

.gallery-filter-wrapper {
    position: sticky;
    z-index: 30;
    top: 84px;

    margin-bottom: 36px;
    padding: 8px;

    background: rgba(246, 241, 233, 0.92);
    border-radius: 24px;

    backdrop-filter: blur(15px);
}

.gallery-filters {
    display: flex;
    justify-content: center;
    gap: 8px;

    max-width: 820px;
    margin: auto;
    padding: 7px;

    overflow-x: auto;

    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 9px 30px rgba(59, 39, 28, 0.08);

    scrollbar-width: none;
}

.gallery-filters::-webkit-scrollbar {
    display: none;
}

.gallery-filter {
    flex: 0 0 auto;

    min-height: 46px;
    padding: 9px 20px;

    color: var(--text-light);
    background: transparent;
    border-radius: 12px;

    font-size: 13px;
    font-weight: 600;

    transition: 0.25s;
}

.gallery-filter:hover {
    color: var(--primary);
    background: #f8f1e9;
}

.gallery-filter.active {
    color: #ffffff;
    background: var(--primary);
    box-shadow: 0 8px 20px rgba(140, 90, 56, 0.24);
}

/* Gallery grid */

.gallery-grid {
    display: grid;
    grid-auto-rows: 260px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.gallery-item {
    position: relative;

    overflow: hidden;

    min-height: 260px;

    background: #ded3c8;
    border-radius: 22px;
    box-shadow: 0 12px 35px rgba(45, 31, 24, 0.09);

    cursor: pointer;

    transition:
        opacity 0.3s,
        transform 0.3s;
}

.gallery-item.hidden {
    display: none;
}

.gallery-item-large {
    grid-column: span 2;
    grid-row: span 2;
}

.gallery-item-wide {
    grid-column: span 2;
}

.gallery-item-tall {
    grid-row: span 2;
}

.gallery-item img {
    width: 100%;
    height: 100%;

    object-fit: cover;

    transition: 0.55s ease;
}

.gallery-item:hover img {
    transform: scale(1.07);
}

.gallery-item-overlay {
    position: absolute;
    inset: 0;

    display: flex;
    flex-direction: column;
    justify-content: flex-end;

    padding: 23px;

    color: #ffffff;

    background:
        linear-gradient(
            180deg,
            transparent 35%,
            rgba(15, 10, 8, 0.85)
        );

    opacity: 0;
    transition: 0.3s;
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-item-overlay > span {
    color: #e4ba87;

    font-size: 11px;
    font-weight: 600;
}

.gallery-item-overlay h3 {
    margin-top: 5px;

    font-size: 18px;
}

.gallery-item-overlay button {
    position: absolute;
    top: 18px;
    left: 18px;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    color: #ffffff;
    background: rgba(255, 255, 255, 0.17);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;

    font-size: 23px;

    backdrop-filter: blur(8px);
}

/* Empty state */

.gallery-empty {
    display: none;

    padding: 70px 20px;

    text-align: center;
}

.gallery-empty.visible {
    display: block;
}

.gallery-empty > span {
    color: var(--primary);
    font-size: 52px;
}

.gallery-empty h3 {
    margin-top: 13px;
}

.gallery-empty p {
    margin-top: 8px;

    color: var(--text-light);
}

/* Lightbox */

.gallery-lightbox {
    position: fixed;
    z-index: 2000;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    visibility: hidden;
    opacity: 0;

    transition: 0.3s;
}

.gallery-lightbox.active {
    visibility: visible;
    opacity: 1;
}

.gallery-lightbox-backdrop {
    position: absolute;
    inset: 0;

    background: rgba(10, 7, 6, 0.92);
    backdrop-filter: blur(12px);
}

.lightbox-content {
    position: relative;
    z-index: 2;

    display: flex;
    flex-direction: column;

    width: min(1050px, calc(100% - 150px));
    max-height: calc(100vh - 90px);

    overflow: hidden;

    background: #1c1512;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.45);

    transform: scale(0.94);
    transition: 0.3s;
}

.gallery-lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-content img {
    display: block;

    width: 100%;
    max-height: calc(100vh - 190px);

    object-fit: contain;
    background: #0e0a08;
}

.lightbox-caption {
    padding: 18px 22px 20px;

    color: #ffffff;
}

.lightbox-caption span {
    color: var(--secondary);

    font-size: 11px;
}

.lightbox-caption h3 {
    margin-top: 4px;

    font-size: 18px;
}

.lightbox-close,
.lightbox-navigation {
    position: fixed;
    z-index: 3;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;

    backdrop-filter: blur(8px);

    transition: 0.25s;
}

.lightbox-close:hover,
.lightbox-navigation:hover {
    background: var(--primary);
}

.lightbox-close {
    top: 24px;
    left: 24px;

    width: 46px;
    height: 46px;

    font-size: 29px;
}

.lightbox-navigation {
    top: 50%;

    width: 52px;
    height: 52px;

    font-size: 37px;

    transform: translateY(-50%);
}

.lightbox-next {
    right: 25px;
}

.lightbox-previous {
    left: 25px;
}

/* Responsive */

@media (max-width: 950px) {
    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gallery-item-large {
        grid-column: span 2;
    }

    .gallery-item-wide {
        grid-column: span 2;
    }

    .lightbox-content {
        width: calc(100% - 120px);
    }
}

@media (max-width: 650px) {
    .gallery-hero {
        min-height: 390px;
        padding-top: 110px;
    }

    .gallery-hero-content p {
        font-size: 13px;
    }

    .gallery-section {
        padding: 65px 14px;
    }

    .gallery-filter-wrapper {
        top: 73px;

        margin-right: -5px;
        margin-left: -5px;
    }

    .gallery-filters {
        justify-content: flex-start;
    }

    .gallery-filter {
        min-height: 43px;
        padding: 8px 15px;

        font-size: 11px;
    }

    .gallery-grid {
        grid-auto-rows: 220px;
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .gallery-item,
    .gallery-item-large,
    .gallery-item-wide,
    .gallery-item-tall {
        grid-column: span 1;
        grid-row: span 1;

        min-height: 220px;
    }

    .gallery-item-overlay {
        opacity: 1;
    }

    .lightbox-content {
        width: calc(100% - 24px);
        max-height: calc(100vh - 150px);

        border-radius: 17px;
    }

    .lightbox-content img {
        max-height: calc(100vh - 250px);
    }

    .lightbox-close {
        top: 16px;
        left: 16px;

        width: 42px;
        height: 42px;
    }

    .lightbox-navigation {
        top: auto;
        bottom: 22px;

        width: 46px;
        height: 46px;
    }

    .lightbox-next {
        right: calc(50% - 55px);
    }

    .lightbox-previous {
        left: calc(50% - 55px);
    }
}