/* css/sections/video.css */

/* --- Timelapse Video Section (on Specification page) --- */
.timelapse-video-container {
    display: none; /* Hidden by default, shown by JS if content exists */
    margin-top: 0;
    margin-bottom: 0;
}

.timelapse-video-container .section-description {
    text-align: center;
    color: var(--secondary-text);
    margin-top: 0.5rem;
    margin-bottom: 2rem;
    font-style: italic;
}

.timelapse-video-container .section-divider {
    border: none; /* Remove default border */
    height: 1px;
    background-color: var(--border-color); /* Subtle line */
    margin: 2.5rem auto; /* Spacing */
    width: 80%; /* Width of the line */
}

.timelapse-video-container h3 {
    margin-bottom: 1.5rem;
}

/* --- Video Previews Grid --- */
.timelapse-grid {
    display: grid;
    /* Adjusted for optimal number of columns based on image aspect ratio and desired size */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: 1.5rem; /* Increased gap for better visual separation */
    padding: 0 0.5rem; /* Slight horizontal padding */
    margin-left: auto; /* Center the grid container */
    margin-right: auto; /* Center the grid container */
    max-width: 960px; /* Max width for the grid content area */
    justify-content: center; /* Center grid items horizontally within the container */
    align-items: start; /* Align items to the start of their grid cell vertically */
}

.video-preview-wrapper {
    position: relative;
    display: flex; /* Use flex to easily center content within the wrapper */
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border-radius: 8px; /* Consistent rounded corners */
    cursor: pointer;
    aspect-ratio: 16 / 9; /* Standard video aspect ratio */
    background-color: var(--placeholder-bg);
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out, border-color 0.3s ease;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5); /* Stronger initial shadow for depth */
    border: 1px solid var(--border-color); /* Subtle border for definition */
    width: 100%; /* Ensure it fills its grid column */
    /* Performance optimizations */
    contain: layout paint;
    content-visibility: auto;
}

.video-preview-wrapper:hover {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.7); /* Even more pronounced shadow on hover */
    transform: translateY(-8px) scale(1.05); /* Noticeable lift and slight scale on hover */
    border-color: var(--accent-color); /* Highlight border with accent color on hover */
}

.video-preview-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures the image covers the entire wrapper area, cropping if necessary */
    object-position: center center;
    border-radius: 7px; /* Slightly less than wrapper to prevent image corners from showing outside */
    opacity: 0; /* Starts hidden, loaded via JS IntersectionObserver */
    transition: opacity 0.4s ease-in-out; /* Slower fade-in for smoother loading */
    vertical-align: middle; /* Remove any extra spacing below inline images */
}

.video-preview-image.video-image-loading {
    opacity: 0; /* Ensures it starts hidden */
}
/* When image is loaded, it should become visible */
.video-preview-wrapper.loaded .video-preview-image {
    opacity: 1;
}


/* NSFW Obscuring on Video Previews */
.video-preview-wrapper.nsfw-obscured .video-preview-image {
    filter: blur(var(--blur-intensity)) brightness(var(--brightness-intensity));
    transform: scale(1.05); /* Slight zoom when obscured */
}
.video-preview-wrapper.loaded.nsfw-obscured .video-preview-image {
    opacity: 1; /* Ensure obscured image is visible once loaded */
}


/* Play Icon Overlay */
.video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.75); /* More opaque background for better contrast */
    opacity: 1;
    transition: background-color 0.3s ease-in-out, opacity 0.3s ease-in-out;
    pointer-events: none; /* Allows clicks to pass through to the wrapper */
    z-index: 2; /* Above image, below NSFW overlay */
}

.video-preview-wrapper:hover .video-play-overlay {
    background-color: rgba(0, 0, 0, 0.9); /* Even darker on hover for focus */
}

.video-play-overlay i {
    color: #fff;
    font-size: 5em; /* Significantly larger play icon */
    text-shadow: 0 0 25px rgba(0, 0, 0, 1); /* Stronger, more dramatic shadow for prominence */
    transition: transform 0.2s ease, color 0.2s ease;
}
.video-preview-wrapper:hover .video-play-overlay i {
    transform: scale(1.4); /* More pronounced scale on hover */
    color: var(--accent-color); /* Play icon changes to accent color on hover */
}

/* Hide play overlay if NSFW obscured */
.video-preview-wrapper.nsfw-obscured .video-play-overlay {
    opacity: 0; /* Hide play button when NSFW is obscuring */
}


/* --- Full-screen Video Player within Modal --- */
/* These styles are primarily controlled by core.css for shared modal functionality */


/* Responsive adjustments */
@media (max-width: 900px) { /* Adjust grid for medium screens */
    .timelapse-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 1rem;
    }
    .video-play-overlay i {
        font-size: 4em; /* Adjust icon size */
    }
}

@media (max-width: 768px) { /* Adjust grid for tablets */
    .timelapse-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.8rem;
    }
    .video-play-overlay i {
        font-size: 3.5em;
    }
}

@media (max-width: 480px) { /* Adjust grid for mobile */
    .timelapse-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.6rem;
    }
    .video-play-overlay i {
        font-size: 3em;
    }
}