/* ========================================
   Black Stock Art - Masonry Grid Layout
   CSS-only masonry with aspect ratio support
   ======================================== */

.masonry-grid {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    columns: 4;
    column-gap: 16px;
}

.masonry-item {
    break-inside: avoid;
    margin-bottom: 16px;
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    background: var(--bg-card);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.masonry-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

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

.masonry-item:hover img {
    transform: scale(1.03);
}

/* Overlay on hover */
.masonry-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 40%,
        rgba(0, 0, 0, 0.7) 100%
    );
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 16px;
}

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

.masonry-title {
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.masonry-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
}

.masonry-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.masonry-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transform: translateY(-4px);
    transition: all 0.2s ease;
}

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

.masonry-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.masonry-action-btn:hover {
    background: var(--accent-blue);
}

/* Category badge on image */
.masonry-category {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    opacity: 0;
    transition: opacity 0.2s ease;
}

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

/* Placeholder/skeleton for loading */
.masonry-skeleton {
    break-inside: avoid;
    margin-bottom: 16px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { opacity: 0.5; }
    50% { opacity: 0.8; }
    100% { opacity: 0.5; }
}

/* Responsive columns */
@media (max-width: 1200px) {
    .masonry-grid {
        columns: 3;
    }
}

@media (max-width: 768px) {
    .masonry-grid {
        columns: 2;
        column-gap: 10px;
        padding: 0 16px;
    }
    .masonry-item {
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .masonry-grid {
        columns: 1;
    }
}
