/**
 * Masonry Gallery Styles
 * Nero Theme
 */

/* Masonry Container */
.block-gallery__items.masonry-layout {
    display: block;
    column-count: 3;
    column-gap: 1rem;
    column-fill: balance;
}

.block-gallery__items.masonry-layout .block-gallery__item {
    display: inline-block;
    width: 100%;
    margin-bottom: 1rem;
    break-inside: avoid;
    page-break-inside: avoid;
    vertical-align: top;
}

/* Masonry Item Styling */
.block-gallery__item.masonry-item {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    background: #fff;
}

.block-gallery__item.masonry-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.block-gallery__item.masonry-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.block-gallery__item.masonry-item:hover img {
    transform: scale(1.05);
}

/* Caption Overlay */
.block-gallery__item.masonry-item .caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 20px 15px 15px;
    font-size: 14px;
    line-height: 1.4;
    opacity: 0;
    transform: translateY(100%);
    transition: all 0.3s ease;
}

.block-gallery__item.masonry-item:hover .caption {
    opacity: 1;
    transform: translateY(0);
}

/* Hover Overlay */
.block-gallery__item.masonry-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.block-gallery__item.masonry-item:hover::before {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .block-gallery__items.masonry-layout {
        column-count: 2;
    }
}

@media (max-width: 768px) {
    .block-gallery__items.masonry-layout {
        column-count: 1;
        column-gap: 0;
    }
    
    .block-gallery__items.masonry-layout .block-gallery__item {
        margin-bottom: 1.5rem;
    }
}

/* Loading State */

.block-gallery.masonry-loading .block-gallery__items {
    opacity: 0.5;
}

.block-gallery.masonry-loading::after {
    /*content: 'Ładowanie układu masonry...';*/
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    color: #666;
    z-index: 10;
}

/* Masonry with JavaScript fallback */
.js .block-gallery__items.masonry-layout {
    column-count: auto;
}

.js .masonry-container {
    position: relative;
}

.js .masonry-item {
    position: absolute;
    left: 0;
    top: 0;
}

/* Animation dla elementów masonry */
@keyframes masonryFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.masonry-item.animate-in {
    animation: masonryFadeIn 0.5s ease forwards;
}

/* Preloader dla masonry */
.masonry-preloader {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    font-size: 16px;
    color: #666;
}

.masonry-preloader::after {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}