.gallery {
    --gallery-gap: 8px;
    --gallery-row-h: 160px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-auto-rows: var(--gallery-row-h);
    gap: var(--gallery-gap);
    padding: var(--gallery-gap);
    box-sizing: border-box;
}

.gallery-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    background: #e0dcd6;
    transition: box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

    .gallery-item.portrait {
        grid-row: span 2;
    }

    .gallery-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), filter 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .gallery-item::after {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg, rgba(201,169,110,0.08) 0%, rgba(26,23,20,0.28) 100%);
        opacity: 0;
        transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .gallery-item .zoom-icon {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%,-50%) scale(0.75);
        z-index: 2;
        opacity: 0;
        transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        width: 44px;
        height: 44px;
        border: 1.5px solid rgba(255,255,255,0.85);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255,255,255,0.12);
        backdrop-filter: blur(4px);
    }

        .gallery-item .zoom-icon svg {
            width: 18px;
            height: 18px;
            fill: none;
            stroke: #fff;
            stroke-width: 2;
            stroke-linecap: round;
            stroke-linejoin: round;
        }

    .gallery-item:hover {
        box-shadow: 0 12px 36px rgba(0,0,0,0.22);
    }

        .gallery-item:hover img {
            transform: scale(1.07);
            filter: brightness(0.82);
        }

        .gallery-item:hover::after {
            opacity: 1;
        }

        .gallery-item:hover .zoom-icon {
            opacity: 1;
            transform: translate(-50%,-50%) scale(1);
        }

.lb-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,8,6,0.93);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

    .lb-overlay.active {
        opacity: 1;
        pointer-events: all;
    }

.lb-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90vw;
    max-height: 90vh;
    transform: scale(0.93);
    transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

.lb-overlay.active .lb-container {
    transform: scale(1);
}

.lb-img-wrap {
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}

    .lb-img-wrap img {
        display: block;
        max-width: 88vw;
        max-height: 78vh;
        width: auto;
        height: auto;
        object-fit: contain;
        transition: opacity 0.2s ease;
    }

        .lb-img-wrap img.loading {
            opacity: 0;
        }

.lb-counter {
    font-size: 0.72rem;
    letter-spacing: 0.15em;
    color: rgba(255,255,255,0.38);
    margin-top: 1rem;
    text-transform: uppercase;
}

.lb-close {
    position: fixed;
    top: 1.5rem;
    right: 1.75rem;
    width: 40px;
    height: 40px;
    border: 1.5px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    background: rgba(255,255,255,0.07);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    z-index: 10000;
}

    .lb-close:hover {
        background: rgba(255,255,255,0.18);
        border-color: rgba(255,255,255,0.6);
        transform: rotate(90deg);
    }

    .lb-close svg {
        width: 16px;
        height: 16px;
        stroke: #fff;
        stroke-width: 2;
        stroke-linecap: round;
        fill: none;
    }

.lb-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: 1.5px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    background: rgba(255,255,255,0.07);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    z-index: 10000;
}

    .lb-arrow:hover {
        background: rgba(255,255,255,0.18);
        border-color: rgba(255,255,255,0.6);
    }

    .lb-arrow.prev {
        left: 1.5rem;
    }

        .lb-arrow.prev:hover {
            transform: translateY(-50%) translateX(-3px);
        }

    .lb-arrow.next {
        right: 1.5rem;
    }

        .lb-arrow.next:hover {
            transform: translateY(-50%) translateX(3px);
        }

    .lb-arrow svg {
        width: 18px;
        height: 18px;
        stroke: #fff;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
        fill: none;
    }

.lb-thumbs {
    display: flex;
    gap: 6px;
    margin-top: 14px;
    overflow-x: auto;
    max-width: 88vw;
    padding-bottom: 4px;
    scrollbar-width: none;
}

    .lb-thumbs::-webkit-scrollbar {
        display: none;
    }

.lb-thumb {
    width: 54px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.38;
    border: 1.5px solid transparent;
    transition: opacity 0.2s, border-color 0.2s;
}

    .lb-thumb.active {
        opacity: 1;
        border-color: var(--gallery-accent);
    }

    .lb-thumb:hover {
        opacity: 0.75;
    }

    .lb-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

@media (max-width: 700px) {
    .gallery {
        grid-template-columns: repeat(2, 1fr);
        --gallery-row-h: 130px;
    }

    .lb-arrow {
        display: none;
    }
}
