/*
Block Name: Video Grid
Description: A 3x3 grid of images that open YouTube videos in popups.
*/

.block-video-grid .video-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 4rem;
}

.block-video-grid .video-grid-item {
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 1rem;
    overflow: hidden;
    background: #fff;
}

.block-video-grid .video-grid-item:hover {
    transform: translateY(-5px);
}

.block-video-grid .video-grid-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.block-video-grid .video-grid-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.block-video-grid .video-grid-item:hover .video-grid-image img {
    transform: scale(1.05);
}

.block-video-grid .video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.block-video-grid .play-button {
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.block-video-grid .video-grid-item:hover .play-button {
    transform: scale(1);
}

.block-video-grid .video-grid-title {
    padding: 1.5rem;
    margin: 0;
    font-size: 1.6rem;
    color: var(--brand-2);
    text-align: center;
}

/* Video Popup Styles */
.video-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
}

.video-popup.active {
    display: flex;
}

.video-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.video-popup-content {
    position: relative;
    background: #fff;
    border-radius: 1rem;
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.video-popup-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 4rem;
    height: 4rem;
    background: var(--brand-1);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 2rem;
    font-weight: bold;
    z-index: 10;
    transition: background-color 0.3s ease;
}

.video-popup-close:hover {
    background: var(--brand-2);
}

.video-popup-header {
    padding: 2rem 2rem 1rem;
    border-bottom: 1px solid var(--brand-8);
}

.video-popup-header h3 {
    margin: 0 0 1rem;
    color: var(--brand-2);
    font-size: 2.4rem;
}

.video-popup-header p {
    margin: 0;
    color: var(--text-color);
    line-height: 1.6;
}

.video-popup-video {
    position: relative;
    padding: 2rem;
    padding-top: 0;
}

#video-iframe-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
}

#video-iframe-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0.5rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .block-video-grid .video-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-gap: 1.5rem;
    }
    
    .video-popup-content {
        width: 95vw;
        margin: 1rem;
    }
    
    .video-popup-header {
        padding: 1.5rem 1.5rem 1rem;
    }
    
    .video-popup-header h3 {
        font-size: 2rem;
    }
    
    .video-popup-video {
        padding: 1.5rem;
        padding-top: 0;
    }
}

@media (max-width: 480px) {
    .block-video-grid .video-grid {
        grid-template-columns: 1fr;
        grid-gap: 1rem;
    }
    
    .video-popup-close {
        width: 3rem;
        height: 3rem;
        font-size: 1.8rem;
    }
}