/* ============================================
   Dial800 promo video player — Pages/Shared/_PromoVideo.cshtml + js/promo-video.js
   Self-contained (no site.css tokens) so campaign landing pages, which do not load site.css, can
   use it too. Theme it from any ancestor with the custom properties below; the defaults are the
   site's brand values. Where it sits on a page is up to the page (site.css / landing.css).
     --pv-accent, --pv-accent-hover   play button and primary end-screen button
     --pv-navy                        frame background, play pill
     --pv-border                      frame edge (set a grey one on light backgrounds)
     --pv-radius, --pv-btn-radius     frame and button rounding
     --pv-focus                       keyboard focus ring
   ============================================ */

.promo-video {
    margin: 0;
    width: 100%;
}

.promo-video-frame {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    isolation: isolate;
    border-radius: var(--pv-radius, 16px);
    background: var(--pv-navy, #092239);
    border: 1px solid var(--pv-border, rgba(255, 255, 255, 0.14));
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    /* The small-player rules below follow the player's own width, not the screen's: on campaign pages a desktop
       column can be as narrow as a phone. */
    container-type: inline-size;
}

    .promo-video-frame video:focus-visible {
        outline: 3px solid var(--pv-focus, #F5AB22);
        outline-offset: -3px;
    }

    /* contain, not cover: inline the frame is already 16:9, and in fullscreen an author "cover" would beat the
       browser's own "contain" and crop the picture on any screen that isn't 16:9. */
    .promo-video-frame video {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: contain;
        background: #000;
    }

/* --- Poster button (only once the script runs; until then the native controls are the player) --- */
.promo-video-play {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: inherit;
    background: transparent;
    color: #ffffff;
    transition: background-color 0.2s ease;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.promo-video.is-ready .promo-video-play {
    display: block;
}

.promo-video.is-started .promo-video-play {
    display: none;
}

.promo-video-play:hover {
    background: rgba(2, 20, 38, 0.06);
}

.promo-video-play:focus-visible {
    outline: 3px solid var(--pv-focus, #F5AB22);
    outline-offset: -3px;
}

.promo-video-pill {
    position: absolute;
    left: 20px;
    bottom: 20px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 7px 18px 7px 7px;
    border-radius: var(--pv-btn-radius, 9999px);
    background: rgba(9, 34, 57, 0.94);
    box-shadow: 0 10px 28px rgba(2, 20, 38, 0.35);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.promo-video-pill-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--pv-accent, #E9563A);
    color: #ffffff;
    transition: background-color 0.2s ease;
}

    .promo-video-pill-icon svg {
        margin-left: 3px;
    }

.promo-video-pill-time {
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    opacity: 0.85;
}

.promo-video-play:hover .promo-video-pill,
.promo-video-play:focus-visible .promo-video-pill {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(2, 20, 38, 0.45);
}

    .promo-video-play:hover .promo-video-pill-icon,
    .promo-video-play:focus-visible .promo-video-pill-icon {
        background: var(--pv-accent-hover, #d44a30);
    }

/* --- End screen --- */
.promo-video-end {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(6, 22, 38, 0.9);
    color: #ffffff;
    text-align: center;
}

    .promo-video-end[hidden] {
        display: none;
    }

.promo-video-end-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 560px;
}

.promo-video-end-title {
    font-size: clamp(1rem, 2.2vw, 1.45rem);
    font-weight: 700;
    line-height: 1.25;
    color: #ffffff;
}

.promo-video-end-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.promo-video-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 22px;
    border: 2px solid rgba(255, 255, 255, 0.55);
    border-radius: var(--pv-btn-radius, 9999px);
    background: transparent;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

    .promo-video-btn:hover {
        background: rgba(255, 255, 255, 0.12);
        border-color: #ffffff;
        color: #ffffff;
    }

.promo-video-btn--primary {
    background: var(--pv-accent, #E9563A);
    border-color: var(--pv-accent, #E9563A);
}

    .promo-video-btn--primary:hover {
        background: var(--pv-accent-hover, #d44a30);
        border-color: var(--pv-accent-hover, #d44a30);
    }

.promo-video-replay {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 6px 14px;
    border: 0;
    border-radius: var(--pv-btn-radius, 9999px);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

    .promo-video-replay:hover {
        background: rgba(255, 255, 255, 0.2);
    }

.promo-video-btn:focus-visible,
.promo-video-replay:focus-visible {
    outline: 3px solid var(--pv-focus, #F5AB22);
    outline-offset: 2px;
}

/* --- Caption line under the player (inherits the surrounding text colour) --- */
.promo-video-caption {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 4px 14px;
    margin-top: 14px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.promo-video-caption-title {
    font-weight: 600;
}

.promo-video-caption-meta {
    opacity: 0.8;
}

.promo-video-caption a {
    padding-block: 10px;
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--pv-accent, #E9563A);
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

    .promo-video-caption a:hover {
        text-decoration-color: currentColor;
    }

/* --- Small players (phones, narrow columns): sized by the player's width --- */
@media (max-width: 600px) {
    .promo-video-frame {
        border-radius: min(var(--pv-radius, 16px), 12px);
    }
}

@container (max-width: 520px) {
    /* Small enough to sit below the poster's tagline. */
    .promo-video-pill {
        left: 10px;
        bottom: 10px;
        gap: 8px;
        padding: 4px 12px 4px 4px;
        font-size: 0.8rem;
    }

    .promo-video-pill-icon {
        width: 30px;
        height: 30px;
    }

        .promo-video-pill-icon svg {
            width: 14px;
            height: 14px;
        }

    .promo-video-pill-time {
        padding-left: 9px;
    }

    .promo-video-end {
        padding: 12px;
    }

    .promo-video-end-inner {
        gap: 10px;
    }

    .promo-video-end-title {
        font-size: 0.95rem;
    }

    .promo-video-end-actions {
        gap: 8px;
    }

    .promo-video-btn {
        min-height: 38px;
        padding: 7px 16px;
        font-size: 0.85rem;
    }

    .promo-video-replay {
        top: 6px;
        right: 6px;
        min-height: 34px;
        padding: 4px 10px;
        font-size: 0.8rem;
    }
}

/* The narrowest players (320-375 px phones): the pill shrinks to its play icon so it clears the centred tagline, and
   the end screen drops its heading so Replay cannot sit on it; the buttons speak for themselves. The button keeps its
   full accessible name. */
@container (max-width: 345px) {
    .promo-video-pill {
        padding: 4px;
    }

    .promo-video-pill-text,
    .promo-video-pill-time {
        display: none;
    }

    .promo-video-end-title {
        display: none;
    }

    .promo-video-btn {
        min-height: 36px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .promo-video-pill,
    .promo-video-pill-icon,
    .promo-video-btn {
        transition: none;
    }

    .promo-video-play:hover .promo-video-pill,
    .promo-video-play:focus-visible .promo-video-pill {
        transform: none;
    }
}
