/* ================================================================
   WeatherVision Multi-Alert Indicators
   ================================================================ */


/* ================================================================
   VIDEO HOST
   ================================================================ */

.wv-alert-video-host {
    position: relative !important;
}


/* ================================================================
   ALERT STACK
   ================================================================ */

#wv-video-alerts {
    position: absolute;

    top: 12px;
    right: 12px;

    z-index: 2147480000;

    display: none;

    align-items: flex-end;

    flex-direction: column;

    gap: 8px;

    pointer-events: none;

    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}


#wv-video-alerts.wv-alerts-active {
    display: flex;
}


/* ================================================================
   INDIVIDUAL ALERT
   ================================================================ */

.wv-video-alert {
    position: relative;

    pointer-events: auto;
}


/* ================================================================
   TRIANGLE BUTTON
   ================================================================ */

.wv-alert-button {
    display: block;

    width: 48px;
    height: 44px;

    padding: 0;
    margin: 0;

    border: 0;

    background: transparent;

    cursor: pointer;

    filter:
        drop-shadow(
            0 2px 4px
            rgba(0,0,0,0.70)
        );

    transition:
        transform 120ms ease,
        filter 120ms ease;
}


.wv-alert-button:hover {
    transform: scale(1.08);

    filter:
        drop-shadow(
            0 3px 6px
            rgba(0,0,0,0.80)
        );
}


.wv-alert-button:focus-visible {
    border-radius: 6px;

    outline:
        3px solid
        rgba(255,255,255,0.95);

    outline-offset: 3px;
}


.wv-alert-button svg {
    display: block;

    width: 100%;
    height: 100%;
}


/* ================================================================
   SEVERITY COLORS
   ================================================================ */

/*
   NWS / CAP severity values:

   Extreme
   Severe
   Moderate
   Minor
   Unknown
*/


.wv-alert-extreme .wv-alert-triangle {
    fill: #8b0000;
}


.wv-alert-severe .wv-alert-triangle {
    fill: #e32619;
}


.wv-alert-moderate .wv-alert-triangle {
    fill: #f59e0b;
}


.wv-alert-minor .wv-alert-triangle {
    fill: #2563eb;
}


.wv-alert-unknown .wv-alert-triangle {
    fill: #6b7280;
}


/* ================================================================
   EXTREME ALERT PULSE
   ================================================================ */

.wv-alert-extreme .wv-alert-button {

    animation:
        wvExtremePulse
        1.5s
        ease-in-out
        infinite;
}


@keyframes wvExtremePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.12);
    }
}


/* ================================================================
   ALERT DETAIL PANEL
   ================================================================ */

.wv-alert-panel {
    position: absolute;

    top: 0;
    right: 57px;

    width:
        min(
            390px,
            calc(100vw - 100px)
        );

    max-height:
        min(
            480px,
            70vh
        );

    overflow-y: auto;

    box-sizing: border-box;

    padding: 15px 16px;

    border-radius: 10px;

    border:
        1px solid
        rgba(255,255,255,0.22);

    background:
        rgba(16,18,23,0.97);

    color: #ffffff;

    box-shadow:
        0 12px 34px
        rgba(0,0,0,0.52);

    opacity: 0;

    visibility: hidden;

    transform:
        translateX(7px);

    transition:
        opacity 140ms ease,
        transform 140ms ease,
        visibility 140ms ease;

    pointer-events: none;
}


/* ================================================================
   DESKTOP HOVER
   ================================================================ */

@media (hover: hover) and (pointer: fine) {

    .wv-video-alert:hover
    .wv-alert-panel,

    .wv-video-alert:focus-within
    .wv-alert-panel {

        opacity: 1;

        visibility: visible;

        transform:
            translateX(0);

        pointer-events: auto;
    }
}


/* ================================================================
   TAP / CLICK OPEN
   ================================================================ */

.wv-video-alert.wv-alert-open
.wv-alert-panel {

    opacity: 1;

    visibility: visible;

    transform:
        translateX(0);

    pointer-events: auto;
}


/* ================================================================
   PANEL HEADER
   ================================================================ */

.wv-alert-heading {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 12px;

    margin-bottom: 10px;

    padding-bottom: 10px;

    border-bottom:
        1px solid
        rgba(255,255,255,0.15);
}


.wv-alert-event {
    min-width: 0;

    font-size: 16px;

    font-weight: 800;

    line-height: 1.3;
}


.wv-alert-severity {
    flex: 0 0 auto;

    padding:
        3px 7px;

    border-radius: 999px;

    font-size: 10px;

    font-weight: 800;

    text-transform: uppercase;

    letter-spacing: 0.04em;
}


/* ================================================================
   SEVERITY BADGES
   ================================================================ */

.wv-alert-extreme .wv-alert-severity {
    background: #8b0000;
    color: #ffffff;
}


.wv-alert-severe .wv-alert-severity {
    background: #e32619;
    color: #ffffff;
}


.wv-alert-moderate .wv-alert-severity {
    background: #f59e0b;
    color: #111827;
}


.wv-alert-minor .wv-alert-severity {
    background: #2563eb;
    color: #ffffff;
}


.wv-alert-unknown .wv-alert-severity {
    background: #6b7280;
    color: #ffffff;
}


/* ================================================================
   PANEL CONTENT
   ================================================================ */

.wv-alert-meta {

    margin-bottom: 9px;

    color:
        rgba(255,255,255,0.73);

    font-size: 12px;

    line-height: 1.45;
}


.wv-alert-message {

    color:
        rgba(255,255,255,0.95);

    font-size: 13px;

    line-height: 1.52;

    white-space: normal;
}


.wv-alert-headline {

    margin-top: 10px;

    color:
        rgba(255,255,255,0.70);

    font-size: 11px;

    line-height: 1.45;
}


.wv-alert-source {

    margin-top: 12px;

    padding-top: 9px;

    border-top:
        1px solid
        rgba(255,255,255,0.12);

    color:
        rgba(255,255,255,0.55);

    font-size: 10px;
}


/* ================================================================
   ALERT NUMBER
   ================================================================ */

.wv-alert-number {

    position: absolute;

    top: -3px;
    right: -4px;

    min-width: 18px;
    height: 18px;

    padding:
        0 4px;

    box-sizing: border-box;

    display: flex;

    align-items: center;

    justify-content: center;

    border-radius: 9px;

    background: #111827;

    color: white;

    border:
        2px solid white;

    font-size: 9px;

    font-weight: 800;

    line-height: 1;
}


/* only show numbers if multiple alerts */

#wv-video-alerts:not(.wv-multiple-alerts)
.wv-alert-number {

    display: none;
}


/* ================================================================
   MOBILE
   ================================================================ */

@media (max-width: 700px) {

    #wv-video-alerts {
        top: 8px;
        right: 8px;

        gap: 6px;
    }


    .wv-alert-button {
        width: 43px;
        height: 39px;
    }


    .wv-alert-panel {

        /*
         * Mobile popup opens below/right-side alert stack
         * without overflowing the screen.
         */

        position: fixed;

        top: auto;

        right: 12px;

        left: 12px;

        bottom: 14px;

        width: auto;

        max-height: 60%;

        transform:
            translateY(8px);
    }


    .wv-video-alert.wv-alert-open
    .wv-alert-panel {

        transform:
            translateY(0);
    }
}


/* ================================================================
   REDUCED MOTION
   ================================================================ */

@media (prefers-reduced-motion: reduce) {

    .wv-alert-button,
    .wv-alert-panel,
    .wv-alert-extreme .wv-alert-button {

        animation: none;

        transition: none;
    }
}


/* ================================================================
   WeatherVision Video-Frame Position Fix
   Desktop + Mobile
   ================================================================ */


/*
 * The alert layer is positioned by JavaScript directly over the
 * actual video rectangle. It must therefore NOT inherit positioning
 * from the weather card, temperature area, or surrounding layout.
 */

#wv-video-alerts {
    position: absolute !important;

    top: 10px !important;
    right: 10px !important;

    left: auto !important;
    bottom: auto !important;

    margin: 0 !important;

    z-index: 2147483000 !important;
}


/*
 * The dedicated wrapper contains ONLY the video/player.
 */

.wv-video-alert-frame {
    position: relative !important;

    display: block;

    width: 100%;

    line-height: 0;
}


/*
 * Restore normal line-height inside alert popup.
 */

.wv-video-alert-frame
.wv-alert-panel {
    line-height: normal;
}


/* ================================================================
   MOBILE
   ================================================================ */

@media (max-width: 700px) {

    #wv-video-alerts {
        position: absolute !important;

        top: 8px !important;
        right: 8px !important;

        left: auto !important;
        bottom: auto !important;

        transform: none !important;
    }


    .wv-alert-button {
        width: 42px;
        height: 38px;
    }


    /*
     * The triangle stays in the top-right of the VIDEO.
     *
     * Only the detail panel is allowed to expand away from the
     * triangle.
     */

    .wv-alert-panel {

        position: absolute !important;

        top: 44px !important;
        right: 0 !important;

        left: auto !important;
        bottom: auto !important;

        width:
            min(
                330px,
                calc(100vw - 28px)
            );

        max-height: 55vh;

        transform:
            translateY(-5px);
    }


    .wv-video-alert.wv-alert-open
    .wv-alert-panel {

        transform:
            translateY(0);
    }
}


/* ================================================================
   VERY SMALL PHONES
   ================================================================ */

@media (max-width: 420px) {

    #wv-video-alerts {
        top: 6px !important;
        right: 6px !important;
    }


    .wv-alert-button {
        width: 38px;
        height: 35px;
    }


    .wv-alert-panel {
        top: 41px !important;

        width:
            min(
                300px,
                calc(100vw - 20px)
            );
    }
}


/* ================================================================
   WeatherVision Definitive Player Alert Position
   ================================================================ */


/*
 * The real WeatherVision player container.
 */

.player-wrap {
    position: relative !important;
}


/*
 * Alert stack lives INSIDE .player-wrap.
 */

.player-wrap > #wv-video-alerts {

    position: absolute !important;

    top: 10px !important;
    right: 10px !important;

    bottom: auto !important;
    left: auto !important;

    width: auto !important;
    height: auto !important;

    margin: 0 !important;
    padding: 0 !important;

    transform: none !important;

    z-index: 2147483640 !important;

    pointer-events: none;
}


/*
 * Individual triangles remain interactive.
 */

.player-wrap
.wv-video-alert {

    pointer-events: auto;
}


/* ================================================================
   MOBILE
   ================================================================ */

@media screen and (max-width: 700px) {

    .player-wrap > #wv-video-alerts {

        position: absolute !important;

        top: 7px !important;
        right: 7px !important;

        bottom: auto !important;
        left: auto !important;

        margin: 0 !important;

        transform: none !important;

        z-index: 2147483640 !important;
    }


    .player-wrap
    .wv-alert-button {

        width: 40px !important;
        height: 37px !important;
    }


    /*
     * Detail box opens underneath the selected triangle.
     * Triangle itself never leaves top-right of video.
     */

    .player-wrap
    .wv-alert-panel {

        position: absolute !important;

        top: 43px !important;
        right: 0 !important;

        bottom: auto !important;
        left: auto !important;

        width:
            min(
                330px,
                calc(100vw - 28px)
            ) !important;

        max-height: 55vh;

        margin: 0 !important;
    }
}


/* ================================================================
   SMALL MOBILE
   ================================================================ */

@media screen and (max-width: 420px) {

    .player-wrap > #wv-video-alerts {

        top: 6px !important;
        right: 6px !important;
    }


    .player-wrap
    .wv-alert-button {

        width: 38px !important;
        height: 35px !important;
    }


    .player-wrap
    .wv-alert-panel {

        top: 40px !important;

        width:
            min(
                300px,
                calc(100vw - 20px)
            ) !important;
    }
}
