/* --- Main Gallery Styles --- */
.flexigrid-gallery-wrapper {
    display: grid;
    grid-template-columns: repeat(var(--gallery-columns, 4), 1fr);
    gap: var(--gallery-spacing, 10px);
}

.layout-masonry {
    display: block;
    position: relative;
}

.gallery-item {
    overflow: hidden;
    position: relative;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    background: #eee;
    /* For Masonry layout */
    transition: top 0.4s ease, left 0.4s ease;
}

.gallery-item a {
    display: block;
    line-height: 0;
}

.gallery-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* --- Hover Effects --- */
.gallery-item .overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.4s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.gallery-item .overlay .icon {
    width: 50px;
    height: 50px;
    background: white;
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="black"><path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16zm-5 8h4V8h2v4h4v2h-4v4h-2v-4H7v-2z"/></svg>');
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="black"><path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16zm-5 8h4V8h2v4h4v2h-4v4h-2v-4H7v-2z"/></svg>');
    mask-size: contain;
    -webkit-mask-size: contain;
    transform: scale(0.8);
    transition: transform 0.4s ease;
}

.gallery-item:hover .overlay {
    opacity: 1;
}

.gallery-item:hover .overlay .icon {
    transform: scale(1);
}

.gallery-item:hover .gallery-image {
    transform: scale(1.1);
}

/* --- Advanced Lightbox Styles --- */
.flexigrid-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100000;
    opacity: 0;
    transition: opacity 0.3s ease;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.flexigrid-lightbox-overlay.show {
    opacity: 1;
}

.flexigrid-lightbox-content {
    position: relative;
    text-align: center;
}

@keyframes fadeInScale {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.flexigrid-lightbox-overlay img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    animation: fadeInScale 0.4s ease-in-out;
}

.flexigrid-lightbox-caption {
    color: #fff;
    margin-top: 15px;
    font-style: italic;
}

.lightbox-close, .lightbox-nav {
    position: absolute;
    background: rgba(30,30,30,0.6);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 24px;
    z-index: 100001;
    transition: background 0.2s ease;
}
.lightbox-close:hover, .lightbox-nav:hover {
    background: rgba(0,0,0,0.8);
}

.lightbox-close {
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

/* --- Responsive Breakpoints (Same as before) --- */
@media (max-width: 1024px) { /*...*/ }
@media (max-width: 767px) { /*...*/ }
@media (max-width: 480px) { /*...*/ }