/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f9f9fb;
    color: #1d1d1f;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

/* Gallery Grid */
.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.video-item {
    position: relative;
    cursor: pointer;
    /* Removed overflow: hidden so text can sit below the card */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* New wrapper to enforce image clip corners and contain the overlay */
.thumbnail-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 16 / 9;
}

.video-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.thumbnail {
    width: 100%;
    display: block;
    height: 100%;
    object-fit: cover;
}

/* Styles for the text caption */
.video-caption {
    margin-top: 10px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    color: #ffffff; /* White looks clean against your dark gradient background */
}

.thumbnail {
    width: 100%;
    display: block;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

/* Subtle Play Indicator on Hover */
.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-overlay::after {
    content: '';
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    clip-path: polygon(35% 25%, 75% 50%, 35% 75%);
}

.video-item:hover .play-overlay {
    opacity: 1;
}

/* Modal Window (Backdrop) */
.modal {
    display: none; 
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

/* Medium Sized Window Box */
.modal-content {
    width: 80%;
    max-width: 800px; /* Enforces the "medium size" constraint */
    aspect-ratio: 16 / 9;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}

#modalVideo {
    width: 100%;
    height: 100%;
    display: block;
}