/*
 * Masonry Grid Layout CSS - Inspired by Rexiew Tube
 * Modern CSS Grid-based masonry layout for thumbnails
 */

/* Main gallery container - CSS Column Masonry Layout (Rexiew Style) */
#gallery-wrap {
    column-width: 250px;
    column-gap: 0;
}

/* Individual gallery items */
.gallery-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 99;
}

/* Gallery images */
/* .gallery-image {
} */

.gallery-image:hover {
    transform: scale(1.02);
}

/* Overlay elements styling improvements */
.time-since-upload {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    z-index: 20;
    pointer-events: none;
    backdrop-filter: blur(2px);
    transition: opacity 0.3s ease;
}

.view-count {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(139, 69, 19, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    z-index: 20;
    pointer-events: none;
    backdrop-filter: blur(2px);
    transition: opacity 0.3s ease;
}

/* Hide overlays on hover for cleaner look */
.gallery-item:hover .time-since-upload,
.gallery-item:hover .view-count,
.gallery-item:hover .video-duration {
    opacity: 0.7;
}

/* Advertisement styling */
.gallery-ad .thing-link {
    display: block;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.gallery-ad .thing-badge {
    position: absolute;
    top: 0;
    text-shadow: 1px 1px 0 black;
    right: 5px;
    color: #fff;
    font-size: 11px;
    z-index: 20;
}

.loaded .gallery-ad .thing-image {
    transition: scale 0.25s ease;
}

.gallery-ad:hover .thing-image {
    transform: scale(1.02);
}

@media (max-width: 750px) {
    .gallery-item[data-media-type="video"]::before {
        font-size: 20px;
        width: 40px;
        height: 40px;
    }
}

/* Remove the old column-based layout */
.gallery-column {
    display: none !important;
}

/* Enhanced hover effects */
.gallery-item {
    position: relative;
}

/* Grid animation on load */
@keyframes galleryFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-item {
    animation: galleryFadeIn 0.6s ease forwards;
    animation-delay: calc(var(--item-index, 0) * 0.1s);
}

/* Improved focus states for accessibility */
.gallery-item:focus-within {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .gallery-item {
        border: 1px solid #fff;
    }
    
    .time-since-upload,
    .view-count,
    .video-duration {
        background: #000;
        border: 1px solid #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .gallery-item,
    .gallery-image,
    .gallery-item[data-media-type="video"]::before {
        transition: none;
        animation: none;
    }
    
    .gallery-item:hover {
        transform: none;
    }
}
