/*
 * Video modal player (Figma: Resources page, video modal open).
 *
 * Restyles the existing .video__modal: green page tint, white player with
 * the gradient control bar built by assets/js/video-player.js, and the
 * round close button above its top-right corner.
 */

.video__modal {
    background-color: var(--lupkynis-overlay, rgba(2, 48, 56, 0.9));
    padding: 1.25rem;
}

.video__modal .video__src {
    max-width: none;
}

/*
 * The close button sits 68px above the frame, but the frame is centred in
 * the modal (overflow: hidden), so on short viewports (1366x657) it rose
 * past the top edge and was cut off. Reserve its row above the frame and
 * size the frame to what is left, so the button is always on screen.
 */
.video__modal.vp-enhanced {
    --vp-close-space: 68px;
    --vp-bar-height: 46px;
}

.video__modal.vp-enhanced .video__src {
    padding-top: var(--vp-close-space);
}

/* Close button: 47px #dbf7f6 circle with a 20px #023038 cross. */
.video__modal .dialog-close {
    width: 47px;
    height: 47px;
    border-radius: 50%;
    background:
        url("../images/video-player/close.svg") center / 20px 20px no-repeat,
        url("../images/video-player/close-oval.svg") center / 47px 47px no-repeat;
    color: transparent;
    font-size: 0;
    z-index: 2;
}

.video__modal .dialog-close:hover {
    background-color: transparent;
    filter: brightness(1.04);
}

.video__modal .dialog-close:focus-visible,
.vp-btn:focus-visible,
.vp-bar input[type="range"]:focus-visible,
.video__thumbnail:focus-visible {
    outline: 3px solid #00a5ad;
    outline-offset: 3px;
}

.video__modal .dialog-close:focus-visible,
.vp-btn:focus-visible,
.vp-bar input[type="range"]:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
    box-shadow: none;
}

/* Player frame: 16:9 video + 46px bar, 1100px wide at 1440, fits the viewport height. */
.vp-frame {
    position: relative;
    /* 16:9 video height = viewport - modal padding - close row - control bar. */
    width: min(1100px, 100%, calc((100vh - 2.5rem - var(--vp-close-space, 68px) - var(--vp-bar-height, 46px)) * 16 / 9));
    width: min(1100px, 100%, calc((100dvh - 2.5rem - var(--vp-close-space, 68px) - var(--vp-bar-height, 46px)) * 16 / 9));
    margin: 0 auto;
    background: #fff;
}

.vp-frame > .dialog-close {
    top: -68px;
    right: -3px;
}

.vp-frame .video__aspectRatio {
    background: #fff;
    cursor: pointer;
}

/* Clicks land on .video__aspectRatio (play/pause) so focus never enters the iframe. */
.vp-frame .video__aspectRatio iframe,
.vp-frame .video__aspectRatio video {
    background: #fff;
    pointer-events: none;
}

.vp-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 46px;
    padding: 0 0.75rem 0 1rem;
    background: linear-gradient(180deg, #00a5ad 0%, #023038 100%);
    color: #fff;
}

.vp-btn {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.vp-btn img {
    display: block;
}

/* Play: the design's triangle turned to point right. */
.vp-play .vp-icon-play {
    transform: rotate(90deg);
}

.vp-play .vp-icon-pause {
    display: none;
    width: 18px;
    height: 21px;
    border-left: 6px solid #fff;
    border-right: 6px solid #fff;
}

.vp-playing .vp-play .vp-icon-play {
    display: none;
}

.vp-playing .vp-play .vp-icon-pause {
    display: block;
}

.vp-time {
    flex: none;
    min-width: 3.5rem;
    font-family: "Mulish", sans-serif;
    font-size: 19px;
    line-height: 1;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

/* Seek and volume: 3px white track at 65%, solid white played part, 18px glowing knob. */
.vp-bar input[type="range"] {
    --vp-progress: 0%;
    appearance: none;
    -webkit-appearance: none;
    height: 18px;
    margin: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

.vp-seek {
    flex: 1 1 auto;
    min-width: 0;
}

.vp-bar input[type="range"]::-webkit-slider-runnable-track {
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, #fff var(--vp-progress), rgba(255, 255, 255, 0.65) var(--vp-progress));
}

.vp-bar input[type="range"]::-moz-range-track {
    height: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.65);
}

.vp-bar input[type="range"]::-moz-range-progress {
    height: 3px;
    border-radius: 2px;
    background: #fff;
}

.vp-bar input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -7.5px;
    border: 0;
    border-radius: 50%;
    /* The thumb clips its background, so the knob's blur is redrawn as a shadow. */
    background: url("../images/video-player/knob.svg") center / 28.87px 28.87px no-repeat;
    box-shadow: 0 0 5px 1px rgba(255, 255, 255, 0.8);
}

.vp-bar input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: 0;
    border-radius: 50%;
    background: url("../images/video-player/knob.svg") center / 28.87px 28.87px no-repeat;
    box-shadow: 0 0 5px 1px rgba(255, 255, 255, 0.8);
}

.vp-volume {
    display: inline-flex;
    flex: none;
    align-items: center;
}

/* Volume slider opens next to the speaker on hover or keyboard focus. */
.vp-vol {
    width: 0;
    opacity: 0;
    transition: width 0.2s ease, opacity 0.2s ease;
}

.vp-volume:hover .vp-vol,
.vp-volume:focus-within .vp-vol {
    width: 80px;
    opacity: 1;
}

.vp-mute {
    position: relative;
}

/* Captions: outlined "CC" badge, filled while captions are on. */
.vp-cc[hidden] {
    display: none;
}

.vp-icon-cc {
    padding: 2px 4px;
    border: 2px solid #fff;
    border-radius: 4px;
    font-family: "Mulish", sans-serif;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    color: #fff;
}

.vp-cc[aria-pressed="true"] .vp-icon-cc {
    background: #fff;
    color: #023038;
}

.vp-muted .vp-mute::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 2px;
    background: #fff;
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* Fullscreen: the frame fills the screen, video centred above the bar. */
.vp-frame:fullscreen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    background: #000;
}

.vp-frame:fullscreen .video__aspectRatio {
    flex: 1 1 auto;
    padding-top: 0;
    height: auto;
}

.vp-frame:fullscreen > .dialog-close {
    display: none;
}

@media (max-width: 575.98px) {
    .video__modal.vp-enhanced {
        --vp-close-space: 60px;
    }

    .vp-bar {
        gap: 0.25rem;
        padding: 0 0.5rem;
    }

    .vp-time {
        min-width: 2.75rem;
        font-size: 15px;
    }

    .vp-frame > .dialog-close {
        top: -60px;
        right: 0;
    }

    .vp-volume:hover .vp-vol,
    .vp-volume:focus-within .vp-vol {
        width: 56px;
    }
}
