/**
 * Masonry Gallery Block - Frontend Styles
 *
 * @package TechTrustEvents
 * @since 1.0.0
 */

.techtrust-masonry-gallery {
    column-count: var(--masonry-columns, 4);
    column-gap: var(--masonry-gap, 25px);
    column-fill: balance;
    margin: 0 0 2rem 0;
}

.masonry-item {
    display: inline-block;
    width: 100%;
    margin-bottom: var(--masonry-gap, 25px);
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    -moz-column-break-inside: avoid;
    page-break-inside: avoid;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.masonry-item img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    object-fit: cover;
}

.masonry-item:nth-child(odd) img {
    height: 300px;
}

.masonry-item:nth-child(even) img {
    height: 450px;
}

.masonry-item:nth-child(3n) img {
    height: 380px;
}

.masonry-item:nth-child(4n) img {
    height: 320px;
}

.masonry-item:nth-child(5n) img {
    height: 500px;
}

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

.masonry-item a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.masonry-item a:hover img {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.masonry-caption {
    width: 100%;
    max-width: max-content;
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.7);
    color: #454545;
    padding: 9px 12px;
    line-height: 1.2;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    border-radius: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.techtrust-masonry-gallery-empty {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-style: italic;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .techtrust-masonry-gallery {
        column-count: calc(var(--masonry-columns, 4) - 1);
    }
}

@media (max-width: 768px) {
    .techtrust-masonry-gallery {
        column-count: 2;
        column-gap: 12px;
    }

    .masonry-item {
        margin-bottom: 12px;
    }
}

@media (max-width: 480px) {
    .techtrust-masonry-gallery {
        column-count: 1;
        column-gap: 0;
    }

    .masonry-item {
        margin-bottom: 16px;
    }

    .masonry-item img {
        aspect-ratio: 1 / 1;
        object-fit: cover;
        height: auto !important;
    }
}

/* Animation for loading */
.masonry-item {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.masonry-item:nth-child(1) {
    animation-delay: 0.1s;
}

.masonry-item:nth-child(2) {
    animation-delay: 0.2s;
}

.masonry-item:nth-child(3) {
    animation-delay: 0.3s;
}

.masonry-item:nth-child(4) {
    animation-delay: 0.4s;
}

.masonry-item:nth-child(5) {
    animation-delay: 0.5s;
}

.masonry-item:nth-child(6) {
    animation-delay: 0.6s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}