/**
 * HayatCMS Video Integration Stylesheet
 *
 * Lightweight, zero-dependency, accessible, 16:9 responsive video component.
 * Ensures zero Cumulative Layout Shift (CLS) and smooth user interactions.
 */

:root {
    --hcms-green-dark: #204941;
    --hcms-green-primary: #337367;
    --hcms-green-light: #e8f3f1;
}

/* 1. Video Container & Ratio */
.hcms-video-container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.hcms-video-player-box {
    background-color: #0d1e1b;
    border-color: rgba(51, 115, 103, 0.15) !important;
    position: relative;
    width: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hcms-video-player-box:hover {
    box-shadow: 0 14px 34px -10px rgba(32, 73, 65, 0.18) !important;
}

/* 16:9 Aspect Ratio Lock */
.hcms-video-ratio {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
}

@supports not (aspect-ratio: 16 / 9) {
    .hcms-video-ratio {
        padding-top: 56.25%;
        height: 0;
    }
}

/* 2. Poster Layer & Image */
.hcms-video-poster {
    cursor: pointer;
    z-index: 2;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.hcms-video-poster.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.hcms-poster-img {
    object-fit: cover;
    object-position: center center;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.hcms-video-player-box:hover .hcms-poster-img {
    transform: scale(1.02);
}

/* Subtle Gradient Overlay */
.hcms-video-overlay {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.05) 0%, rgba(32, 73, 65, 0.25) 100%);
    pointer-events: none;
    transition: background 0.3s ease;
}

.hcms-video-player-box:hover .hcms-video-overlay {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.02) 0%, rgba(32, 73, 65, 0.35) 100%);
}

/* 3. Accessible Play Button */
.hcms-video-play-btn {
    width: 68px;
    height: 68px;
    background: rgba(32, 73, 65, 0.92);
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    z-index: 3;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.25s ease, box-shadow 0.25s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.hcms-video-play-btn:hover {
    background: #337367;
    color: #ffffff;
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 12px 30px rgba(51, 115, 103, 0.45);
}

.hcms-video-play-btn:focus-visible {
    outline: 3px solid #337367;
    outline-offset: 4px;
}

.hcms-play-icon {
    margin-left: 3px; /* Optically center triangle */
    transition: transform 0.2s ease;
}

.hcms-video-play-btn:hover .hcms-play-icon {
    transform: scale(1.08);
}

/* Animated Pulse Effect */
.hcms-play-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    animation: hcms-pulse-anim 2.5s infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes hcms-pulse-anim {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }
    70% {
        transform: scale(1.45);
        opacity: 0;
    }
    100% {
        transform: scale(1.45);
        opacity: 0;
    }
}

/* 4. YouTube Iframe Slot */
.hcms-video-iframe-slot {
    z-index: 1;
    background-color: #000000;
}

.hcms-video-iframe-slot iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* 5. Hero Video Controls */
.hcms-hero-controls {
    z-index: 4;
}

.hcms-sound-toggle-btn,
.hcms-pause-toggle-btn {
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.hcms-sound-toggle-btn:hover,
.hcms-pause-toggle-btn:hover {
    background-color: var(--hcms-green-dark) !important;
    color: #ffffff !important;
}

.hcms-sound-toggle-btn:focus-visible,
.hcms-pause-toggle-btn:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* 6. Section Showcase Styles */
.hcms-video-showcase-section {
    position: relative;
    background: #ffffff;
}

.hcms-video-badge {
    background-color: rgba(51, 115, 103, 0.12);
    color: var(--hcms-green-primary);
    font-size: 13px;
    letter-spacing: 0.5px;
}

.hcms-video-section-title {
    color: var(--hcms-green-dark);
    font-size: calc(1.5rem + 0.7vw);
    line-height: 1.25;
}

.hcms-video-section-desc {
    color: #4a5568;
    font-size: 15.5px;
    line-height: 1.65;
}

/* 7. Contact Us Video Integration */
.hcms-contact-video-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

/* 8. Reduced Motion Preferences */
@media (prefers-reduced-motion: reduce) {
    .hcms-play-pulse {
        animation: none !important;
        display: none !important;
    }
    .hcms-poster-img,
    .hcms-video-play-btn,
    .hcms-play-icon {
        transition: none !important;
    }
}

/* 9. Mobile Responsive Tweaks */
@media (max-width: 576px) {
    .hcms-video-play-btn {
        width: 56px;
        height: 56px;
    }
    .hcms-video-play-btn svg {
        width: 22px;
        height: 22px;
    }
}
