/**
 * Video Section Block Styles
 * 
 * @package ACF Child Theme
 */

/* ===================================
   Video Section Container
   =================================== */

.video-section-block {
    width: 100%;
    padding: 60px 0;
    margin: 0;
    background-color: #f5f5f5;

}
/* Content container - WordPress layout width */
.video-section-container {
    max-width: var(--theme-normal-container-max-width, 1290px);
    width: var(--theme-container-width, 100%);
    margin: 0 auto;
    padding: 0 20px;
}

/* ===================================
   Video Wrapper
   =================================== */

.video-wrapper {
    position: relative;
    width: 70%;
    margin: 0 auto;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    background-color: #000;
}

/* Embedded videos (YouTube, Vimeo) */
.video-wrapper iframe,
.video-wrapper embed,
.video-wrapper object {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border: 0;
    display: block;
}

/* Fallback for browsers that don't support aspect-ratio */
@supports not (aspect-ratio: 16 / 9) {
    .video-wrapper:has(iframe),
    .video-wrapper:has(embed),
    .video-wrapper:has(object) {
        position: relative;
        padding-bottom: 56.25%; /* 16:9 aspect ratio */
        height: 0;
    }
    
    .video-wrapper iframe,
    .video-wrapper embed,
    .video-wrapper object {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}

/* HTML5 Video Player */
.video-player {
    width: 100%;
    height: auto;
    display: block;
}

/* ===================================
   Responsive Design
   =================================== */

/* Tablets and below */
@media screen and (max-width: 1024px) {
    .video-section-block {
        padding: 50px 0;
    }
    
    .video-section-container {
        padding: 0 15px;
    }
    
    .video-wrapper {
        width: 85%;
    }
}

/* Mobile devices */
@media screen and (max-width: 768px) {
    .video-section-block {
        padding: 40px 0;
    }
    
    .video-section-container {
        padding: 0 15px;
    }
    
    .video-wrapper {
        width: 95%;
    }
}

/* Small mobile devices */
@media screen and (max-width: 480px) {
    .video-section-block {
        padding: 30px 0;
    }
    
    .video-section-container {
        padding: 0 10px;
    }
    
    .video-wrapper {
        width: 100%;
    }
}

/* ===================================
   Gutenberg Editor Preview
   =================================== */

.acf-block-preview {
    padding: 40px 20px;
    background-color: #f5f5f5;
    text-align: center;
    border: 2px dashed #ddd;
    border-radius: 8px;
}

.acf-block-preview p {
    margin: 0;
    color: #666;
    font-size: 16px;
}

/* ===================================
   Video Controls Styling
   =================================== */

/* Ensure native controls are visible */
video::-webkit-media-controls-panel {
    background-color: rgba(0, 0, 0, 0.8);
}

video::-webkit-media-controls-play-button {
    cursor: pointer;
}

/* ===================================
   Alignment Options
   =================================== */

/* Wide alignment */
.video-section-block.alignwide {
    max-width: 1290px;
    margin-left: auto;
    margin-right: auto;
}

/* Full alignment */
.video-section-block.alignfull {
    max-width: none;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

/* ===================================
   Loading State
   =================================== */

.video-wrapper::before {
    content: '';
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid rgba(140, 71, 192, 0.2);
    border-top-color: #8c47c0;
    border-radius: 50%;
    animation: video-loading-spin 0.8s linear infinite;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

.video-wrapper.loading::before {
    opacity: 1;
}

@keyframes video-loading-spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ===================================
   Accessibility
   =================================== */

/* Focus styles for video controls */
video:focus {
    outline: 2px solid #8c47c0;
    outline-offset: 2px;
}

/* Skip to video button for screen readers */
.video-section-block .skip-to-video {
    position: absolute;
    left: -9999px;
    z-index: 999;
}

.video-section-block .skip-to-video:focus {
    position: relative;
    left: 0;
    background: #8c47c0;
    color: white;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 4px;
}
