
    .gallery-grid {
        column-count: 3;
        column-gap: 20px;
        column-fill: balance;
        justify-items: center;
    }

    @media (max-width: 992px) {
        .gallery-grid {
            column-count: 2;
            justify-items: center;
            
        }
    }

    @media (max-width: 576px) {
        .gallery-grid {
            column-count: 1;
            justify-items: center;
        }

        .gallery-item {
            height: auto; /* Allow height to adjust to image aspect ratio */
            min-height: 250px; /* Minimum height for consistency */
        }

        .gallery-item img {
            object-fit: contain; /* Ensure full image is visible without cutoff */
            background: #f5f7fa; /* Background color for any empty space */
        }
    }

    .filter-buttons {
        display: flex;
        justify-content: center;
        gap: 10px;
        margin-bottom: 1.5rem;
        flex-wrap: wrap;
    }

    .filter-btn {
        padding: 8px 20px;
        border: 2px solid var(--primary-color);
        background: white;
        color: var(--primary-color);
        border-radius: 10px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.25s ease;
    }

    .filter-btn:hover,
    .filter-btn.active {
        background: var(--primary-color);
        color: white;
        transform: translateY(-2px);
    }

    .gallery-item {
        position: relative;
        height: 220px;
        border-radius: 15px;
        overflow: hidden;
        cursor: pointer;
        background: #f5f7fa;
        box-shadow: 0 6px 20px rgba(0,0,0,0.06);
        transition: opacity 0.28s ease, transform 0.28s ease;
        opacity: 1;
        transform: scale(1);
    }

    .gallery-item.hidden {
        opacity: 0;
        transform: scale(0.96);
        pointer-events: none;
    }

    .gallery-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        transition: transform 0.45s ease, filter 0.3s ease;
        -webkit-backface-visibility: hidden; /* crisp rendering */
    }

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

    /* Lightbox styles */
    .lightbox {
        position: fixed;
        inset: 0;
        display: none;
        align-items: center;
        justify-content: center;
        background: rgba(0,0,0,0.85);
        z-index: 9999;
        padding: 30px;
    }

    .lightbox.open {
        display: flex;
    }

    .lightbox-content {
        position: relative;
        max-width: 1100px;
        width: 100%;
        text-align: center;
    }

    .lightbox img {
        max-width: 100%;
        max-height: 80vh;
        border-radius: 8px;
        box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    }

    .lightbox .caption {
        margin-top: 10px;
        color: rgba(255,255,255,0.95);
        font-weight: 600;
    }

    .lightbox .btn-close,
    .lightbox .btn-prev,
    .lightbox .btn-next {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(0,0,0,0.5);
        color: #fff;
        border: none;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

    .lightbox .btn-close {
        top: 20px;
        right: 20px;
        transform: none;
        width: 36px;
        height: 36px;
    }

    .lightbox .btn-prev { left: -68px; }
    .lightbox .btn-next { right: -68px; }

    @media (max-width: 768px) {
        .lightbox .btn-prev { left: 8px; }
        .lightbox .btn-next { right: 8px; }
        .lightbox .btn-prev, .lightbox .btn-next { top: auto; bottom: 20px; transform: none; }
    }
