/* Pinterest-style Masonry Gallery
 * Responsive, rounded corners, maintains aspect ratios
 * 4 columns on desktop, adapts for mobile
 */

.masonry-gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.masonry-gallery {
    column-count: 4;
    column-gap: 1.5rem;
    margin: 0;
    padding: 0;
}

.masonry-item {
    break-inside: avoid;
    margin-bottom: 1.5rem;
    background: rgba(18, 26, 27, 0.6);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(15, 118, 110, 0.2);
    position: relative;
    cursor: pointer;
}

.masonry-item:hover {
    transform: translateY(-8px);
    box-shadow:
        0 20px 40px rgba(15, 118, 110, 0.3),
        0 10px 20px rgba(255, 122, 26, 0.2);
    border-color: rgba(15, 118, 110, 0.6);
}

.masonry-item-media {
    width: 100%;
    height: auto;
    display: block;
    position: relative;
}

.masonry-item img,
.masonry-item video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 20px 20px 0 0;
    object-fit: cover;
}

.masonry-item video {
    background: #0C1E1F;
}

.masonry-item-content {
    padding: 1.25rem;
    background: linear-gradient(180deg, rgba(12, 30, 31, 0.95) 0%, rgba(13, 20, 21, 0.98) 100%);
}

.masonry-item-title {
    font-size: 1rem;
    font-weight: 600;
    color: #E6F0EF;
    margin-bottom: 0.5rem;
    font-family: 'Space Grotesk', sans-serif;
}

.masonry-item-description {
    font-size: 0.875rem;
    color: #B7C7C4;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.masonry-item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.masonry-tag {
    padding: 0.25rem 0.75rem;
    background: rgba(15, 118, 110, 0.2);
    color: #0F766E;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.masonry-tag:hover {
    background: rgba(255, 122, 26, 0.2);
    color: #FF7A1A;
}

.masonry-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(12, 30, 31, 0.9) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    padding: 1.5rem;
    border-radius: 20px;
}

.masonry-item:hover .masonry-item-overlay {
    opacity: 1;
}

.masonry-item-category {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 122, 26, 0.9);
    backdrop-filter: blur(10px);
    color: #0C1E1F;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
}

/* Loading state */
.masonry-item.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Empty state */
.masonry-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: #B7C7C4;
}

.masonry-empty-icon {
    font-size: 3rem;
    color: #0F766E;
    margin-bottom: 1rem;
}

.masonry-empty-text {
    font-size: 1.2rem;
    color: #E6F0EF;
    margin-bottom: 0.5rem;
}

/* Responsive breakpoints */
@media (max-width: 1200px) {
    .masonry-gallery {
        column-count: 3;
    }
}

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

    .masonry-item {
        margin-bottom: 1rem;
    }

    .masonry-gallery-container {
        padding: 2rem 1rem;
    }
}

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

/* Filter buttons */
.masonry-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 3rem;
}

.masonry-filter-btn {
    padding: 0.75rem 1.5rem;
    background: rgba(18, 26, 27, 0.6);
    border: 1px solid rgba(15, 118, 110, 0.3);
    border-radius: 25px;
    color: #E6F0EF;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Space Grotesk', sans-serif;
}

.masonry-filter-btn:hover {
    background: rgba(15, 118, 110, 0.2);
    border-color: #0F766E;
    transform: translateY(-2px);
}

.masonry-filter-btn.active {
    background: linear-gradient(135deg, #0F766E 0%, #134E4A 100%);
    border-color: #0F766E;
    color: #E6F0EF;
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.4);
}

/* Lightbox/Modal */
.masonry-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(12, 30, 31, 0.95);
    backdrop-filter: blur(20px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.masonry-lightbox.active {
    display: flex;
}

.masonry-lightbox-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.masonry-lightbox img,
.masonry-lightbox video {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.masonry-lightbox-close {
    position: absolute;
    top: -3rem;
    right: 0;
    width: 40px;
    height: 40px;
    background: rgba(255, 122, 26, 0.9);
    border: none;
    border-radius: 50%;
    color: #0C1E1F;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.masonry-lightbox-close:hover {
    background: #FF7A1A;
    transform: rotate(90deg);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.masonry-item {
    animation: fadeInUp 0.6s ease-out backwards;
}

.masonry-item:nth-child(1) { animation-delay: 0.05s; }
.masonry-item:nth-child(2) { animation-delay: 0.1s; }
.masonry-item:nth-child(3) { animation-delay: 0.15s; }
.masonry-item:nth-child(4) { animation-delay: 0.2s; }
.masonry-item:nth-child(5) { animation-delay: 0.25s; }
.masonry-item:nth-child(6) { animation-delay: 0.3s; }
.masonry-item:nth-child(7) { animation-delay: 0.35s; }
.masonry-item:nth-child(8) { animation-delay: 0.4s; }
.masonry-item:nth-child(n+9) { animation-delay: 0.45s; }
