/* =========================================================
   Centrix Home Video Section
   Sits directly under the trust bar on the home page.
   Behaviour: assets/js/hero-video.js
   ========================================================= */

.cx-hvid {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #0B1526;
    isolation: isolate;
    --cx-hvid-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* Landscape viewports are wide enough to fill the screen without the video
   feeling stretched — same rationale as the showreel carousel's stage
   (assets/css/showreel.css). Portrait phones keep the native 16:9 instead:
   cropping a wide clip to fill a tall screen would butcher the framing. */
@media (orientation: landscape) {
    .cx-hvid {
        aspect-ratio: auto;
        height: 100vh;
        height: 100svh;
    }
}

.cx-hvid__poster,
.cx-hvid__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.cx-hvid__poster {
    z-index: 1;
    transition: opacity 600ms var(--cx-hvid-ease);
}

.cx-hvid__video {
    z-index: 0;
    opacity: 0;
    transition: opacity 600ms var(--cx-hvid-ease);
}

/* Once playback has genuinely started, crossfade poster out / video in. */
.cx-hvid.cx-hvid--active .cx-hvid__poster {
    opacity: 0;
    pointer-events: none;
}

.cx-hvid.cx-hvid--active .cx-hvid__video {
    opacity: 1;
    z-index: 1;
}

/* No poster supplied (server-rendered flag, not a :has() lookup, so this
   still works in older browsers): the video element is the only visual
   layer, so it must be visible from the start rather than waiting on the
   active state. */
.cx-hvid--no-poster .cx-hvid__video {
    opacity: 1;
}

.cx-hvid__veil {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(to top, rgba(11, 21, 38, 0.55) 0%, rgba(11, 21, 38, 0) 40%);
}

.cx-hvid__caption {
    position: absolute;
    left: 20px;
    bottom: 18px;
    z-index: 3;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
    margin: 0;
}

@media (min-width: 640px) {
    .cx-hvid__caption {
        left: 40px;
        bottom: 24px;
        font-size: 15px;
    }
}

@media (min-width: 1024px) {
    .cx-hvid__caption {
        left: 80px;
        bottom: 28px;
    }
}

/* Big centered play button — the primary call to action before playback
   starts, and the way to resume after an explicit pause. */
.cx-hvid__playbtn {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 4;
    transform: translate(-50%, -50%) scale(1);
    width: 72px;
    height: 72px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #10254D;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    opacity: 1;
    transition: opacity 400ms var(--cx-hvid-ease), transform 250ms var(--cx-hvid-ease), background 250ms ease;
}

.cx-hvid__playbtn .material-symbols-outlined {
    font-size: 32px;
    /* optical centering: a play triangle reads slightly left-heavy */
    margin-left: 4px;
}

.cx-hvid__playbtn:hover {
    background: #fff;
    transform: translate(-50%, -50%) scale(1.06);
}

.cx-hvid__playbtn:active {
    transform: translate(-50%, -50%) scale(0.96);
}

.cx-hvid__playbtn:focus-visible {
    outline: 2px solid #FF5F06;
    outline-offset: 4px;
}

@media (min-width: 640px) {
    .cx-hvid__playbtn {
        width: 88px;
        height: 88px;
    }

    .cx-hvid__playbtn .material-symbols-outlined {
        font-size: 40px;
    }
}

/* Hidden once the video is actually playing; reappears on pause. */
.cx-hvid.cx-hvid--playing .cx-hvid__playbtn {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.85);
}

/* Bottom-right mini control (pause/play) */
.cx-hvid__controls {
    position: absolute;
    right: 16px;
    bottom: 16px;
    z-index: 4;
    display: flex;
    gap: 8px;
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    transition: opacity 300ms ease, transform 300ms var(--cx-hvid-ease);
}

/* Only worth showing once there is something to control. */
.cx-hvid.cx-hvid--active .cx-hvid__controls {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

@media (min-width: 640px) {
    .cx-hvid__controls {
        right: 24px;
        bottom: 22px;
    }
}

@media (min-width: 1024px) {
    .cx-hvid__controls {
        right: 40px;
        bottom: 26px;
    }
}

.cx-hvid__btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    cursor: pointer;
    transition: background 250ms ease, border-color 250ms ease, transform 200ms var(--cx-hvid-ease);
}

.cx-hvid__btn:hover {
    background: #FF5F06;
    border-color: #FF5F06;
}

.cx-hvid__btn:active {
    transform: scale(0.92);
}

.cx-hvid__btn:focus-visible {
    outline: 2px solid #FF5F06;
    outline-offset: 3px;
}

.cx-hvid__btn .material-symbols-outlined {
    font-size: 18px;
}

/* The toggle button holds both icons and shows one via the wrapper's state,
   so no JS DOM swap is needed — only a class toggle. */
.cx-hvid__icon-play {
    display: none;
}

.cx-hvid.cx-hvid--playing .cx-hvid__icon-pause,
.cx-hvid:not(.cx-hvid--playing) .cx-hvid__icon-play {
    display: inline-flex;
}

.cx-hvid:not(.cx-hvid--playing) .cx-hvid__icon-pause,
.cx-hvid.cx-hvid--playing .cx-hvid__icon-play {
    display: none;
}

/* Reduced motion: never autoplay. The poster (or first frame once the user
   presses play) is the resting state, and playback is entirely opt-in. */
@media (prefers-reduced-motion: reduce) {
    .cx-hvid__poster {
        transition: none;
    }

    .cx-hvid__video {
        transition: none;
    }
}
