/* ==========================================================================
   SUBPAGE HERO VIDEO (template-parts/modules/hero-video.php + js/hero-video.js)
   Viewfinder / duo / reel. Posters paint first; the muted YouTube loop fades in
   over them once it is playing (desktop only).
   ========================================================================== */

.mx-hv {
    position: relative;
    width: 100%;
}
.mx-hv__frame {
    position: relative;
    width: 100%;
    aspect-ratio: 682 / 437;
    max-height: calc(100vh - 170px);
    overflow: hidden;
    border-radius: 30px;
    background: #0f172a;
    box-shadow: 0 24px 60px rgba(2, 34, 90, 0.22);
    isolation: isolate;
}
/* Fold-fit caps hero images/iframes; these fill their frame instead */
#inner-hero .mx-hv img,
#inner-hero .mx-hv iframe {
    max-height: none;
}

.mx-hv__poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.7s ease;
    z-index: 1;
}
.mx-hv__poster.is-on {
    opacity: 1;
}
.mx-hv__player {
    position: absolute;
    inset: 0;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.9s ease;
    pointer-events: none;
}
.mx-hv.is-playing .mx-hv__frame > .mx-hv__player {
    opacity: 1;
}
/* While the reel switches tours, the next poster covers the player */
.mx-hv.is-switching .mx-hv__frame > .mx-hv__player {
    opacity: 0;
}
.mx-hv__player iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border: 0;
    /* fills the frame and pushes YouTube's own chrome out of view */
    transform: translate(-50%, -50%) scale(1.36);
    pointer-events: none;
}

/* Legibility scrims for the overlay */
.mx-hv__frame::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background:
        linear-gradient(to bottom, rgba(0, 18, 39, 0.45), transparent 26%),
        linear-gradient(to top, rgba(0, 18, 39, 0.6), transparent 34%);
}

/* ---- Drone-camera viewfinder ---- */
.mx-hv__hud {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    color: #ffffff;
    font: 600 12px/1 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    letter-spacing: 0.12em;
}
.mx-hv__corner {
    position: absolute;
    width: 26px;
    height: 26px;
    border: 0 solid rgba(255, 255, 255, 0.85);
}
.mx-hv__corner--tl { top: 18px; left: 18px; border-top-width: 2px; border-left-width: 2px; border-top-left-radius: 6px; }
.mx-hv__corner--tr { top: 18px; right: 18px; border-top-width: 2px; border-right-width: 2px; border-top-right-radius: 6px; }
.mx-hv__corner--bl { bottom: 18px; left: 18px; border-bottom-width: 2px; border-left-width: 2px; border-bottom-left-radius: 6px; }
.mx-hv__corner--br { bottom: 18px; right: 18px; border-bottom-width: 2px; border-right-width: 2px; border-bottom-right-radius: 6px; }
.mx-hv__rec {
    position: absolute;
    top: 26px;
    left: 54px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.mx-hv__rec i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff4d4d;
    box-shadow: 0 0 8px rgba(255, 77, 77, 0.8);
}
.mx-hv__tc {
    position: absolute;
    top: 26px;
    right: 54px;
    font-variant-numeric: tabular-nums;
    opacity: 0.9;
}
.mx-hv__cross {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    opacity: 0.35;
    background:
        linear-gradient(#fff, #fff) 50% 0 / 1px 9px no-repeat,
        linear-gradient(#fff, #fff) 50% 100% / 1px 9px no-repeat,
        linear-gradient(#fff, #fff) 0 50% / 9px 1px no-repeat,
        linear-gradient(#fff, #fff) 100% 50% / 9px 1px no-repeat;
}
@media (prefers-reduced-motion: no-preference) {
    .mx-hv.is-playing .mx-hv__rec i {
        animation: mx-rec 1.2s steps(1, end) infinite;
    }
}
@keyframes mx-rec {
    50% { opacity: 0.15; }
}

/* ---- Caption chip + "Watch with sound" ---- */
.mx-hv__meta {
    position: absolute;
    left: 22px;
    right: 22px;
    bottom: 22px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.mx-hv__chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(0, 18, 39, 0.55);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    transition: background 0.3s ease, border-color 0.3s ease;
}
a.mx-hv__chip:hover {
    background: rgba(0, 18, 39, 0.8);
    border-color: #d4af37;
}
.mx-hv__chip-dot {
    width: 7px;
    height: 7px;
    flex: none;
    border-radius: 50%;
    background: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.25);
}
.mx-hv__chip-label {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.mx-hv__sound {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 999px;
    background: #d4af37;
    color: #02225a; /* navy on gold (Kristin) */
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.3s ease, translate 0.3s ease;
}
.mx-hv__sound:hover,
.mx-hv__sound:focus-visible {
    background: #e2bf5c;
    translate: 0 -1px;
}

/* ---- Reel: story-style progress bars ---- */
.mx-hv__bars {
    position: absolute;
    top: 58px;
    left: 54px;
    right: 54px;
    z-index: 5;
    display: flex;
    gap: 6px;
}
.mx-hv__bar {
    flex: 1;
    height: 14px;
    padding: 5px 0;
    background: none;
    border: 0;
    cursor: pointer;
}
.mx-hv__bar span {
    display: block;
    height: 3px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.3);
    overflow: hidden;
    position: relative;
}
.mx-hv__bar span::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #d4af37;
    transform-origin: 0 50%;
    scale: 0 1;
}
.mx-hv__bar.is-done span::after {
    scale: 1 1;
}
.mx-hv__bar.is-active span::after {
    animation: mx-bar var(--mx-hv-step, 10s) linear forwards;
}
.mx-hv.is-paused .mx-hv__bar.is-active span::after {
    animation-play-state: paused;
}
@keyframes mx-bar {
    from { scale: 0 1; }
    to { scale: 1 1; }
}

/* ---- Duo: phone frame with the vertical cut ---- */
.mx-hv--duo {
    padding-right: 12%;
}
.mx-hv__phone {
    position: absolute;
    right: 0;
    bottom: -8%;
    z-index: 6;
    width: 27%;
    aspect-ratio: 9 / 19;
    padding: 7px;
    border-radius: 30px;
    background: #0b1220;
    box-shadow: 0 30px 60px rgba(2, 34, 90, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.mx-hv__phone::before {
    content: "";
    position: absolute;
    top: 13px;
    left: 50%;
    z-index: 3;
    width: 34%;
    height: 14px;
    margin-left: -17%;
    border-radius: 10px;
    background: #0b1220;
}
.mx-hv__phone-screen {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 24px;
    background: #0f172a;
}
.mx-hv__player--v iframe {
    transform: translate(-50%, -50%) scale(1.18);
}
.mx-hv__phone.is-playing .mx-hv__player--v {
    opacity: 1;
}
@media (prefers-reduced-motion: no-preference) {
    .mx-hv__phone {
        animation: mx-phone-float 6s ease-in-out infinite alternate;
    }
}
@keyframes mx-phone-float {
    from { translate: 0 0; }
    to { translate: 0 -10px; }
}
/* The phone covers the frame's right edge: keep the overlay clear of it */
.mx-hv--duo .mx-hv__meta {
    right: calc(18% + 14px);
}
.mx-hv--duo .mx-hv__tc {
    right: calc(18% + 34px);
}
.mx-hv--duo .mx-hv__corner--tr,
.mx-hv--duo .mx-hv__corner--br {
    display: none;
}

/* ---- Phones / no autoplay: posters with a clear play action ---- */
@media (max-width: 767px) {
    .mx-hv__frame { border-radius: 22px; }
    .mx-hv__rec, .mx-hv__tc, .mx-hv__cross { display: none; }
    .mx-hv__bars { top: 16px; left: 18px; right: 18px; }
    .mx-hv__meta { left: 14px; right: 14px; bottom: 14px; }
    .mx-hv__chip { font-size: 12px; padding: 7px 12px; }
    .mx-hv--duo { padding-right: 16%; }
    .mx-hv__phone { width: 32%; border-radius: 22px; padding: 5px; }
    .mx-hv--duo .mx-hv__meta { right: calc(20% + 10px); }
    .mx-hv__phone-screen { border-radius: 18px; }
}
