/*
 * Popup video beranda.
 * Dialog native dipakai supaya focus trap, ESC, dan lapisan backdrop ditangani
 * browser. Tata letak dua kolom di desktop, menumpuk di layar sempit.
 */

html.vp-open {
    overflow: hidden;
}

.vp {
    width: min(1000px, calc(100vw - 32px));
    max-width: 1000px;
    max-height: calc(100dvh - 32px);
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 20px;
    background: var(--cd);
    color: var(--tx);
    box-shadow: 0 24px 70px rgba(5, 20, 38, .42);
    overflow: hidden;
}

.vp[open] {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
    position: relative;
}

.vp::backdrop {
    background: rgba(6, 20, 36, .7);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

/* ------------------------------------------------------------- thumbnail */

.vp-media {
    position: relative;
    min-height: 240px;
    background: #041426;
    overflow: hidden;
}

.vp-play {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: #041426;
    cursor: pointer;
}

.vp-play[hidden] {
    display: none;
}

.vp-play img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.vp-play::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(4, 20, 38, .04) 35%, rgba(4, 20, 38, .5));
}

.vp-icon {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 2;
    width: 74px;
    height: 74px;
    margin: -37px 0 0 -37px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 8px 28px rgba(0, 0, 0, .38);
    transition: transform .18s ease;
}

.vp-play:hover .vp-icon,
.vp-play:focus-visible .vp-icon {
    transform: scale(1.07);
}

.vp-icon svg {
    width: 30px;
    height: 30px;
    margin-left: 3px;
    fill: #0b4c8a;
}

.vp-caption {
    position: absolute;
    left: 16px;
    bottom: 14px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(5, 20, 38, .68);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .01em;
}

.vp-media iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
}

/* ------------------------------------------------------------------ copy */

.vp-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    padding: 56px 32px 26px;
    min-width: 0;
}

.vp-body h2 {
    margin: 0;
    font-size: clamp(20px, 2.4vw, 27px);
    line-height: 1.22;
}

.vp-body p {
    margin: 0;
    color: var(--mt);
    font-size: 14px;
    line-height: 1.62;
}

.vp-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

/* ---------------------------------------------------------------- close */

.vp-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .94);
    color: #0b2a4a;
    box-shadow: 0 2px 10px rgba(4, 20, 38, .28);
    cursor: pointer;
}

.vp-close:hover {
    background: #fff;
}

.vp-close svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 820px) {
    .vp {
        width: calc(100vw - 20px);
        max-height: calc(100dvh - 20px);
        overflow: hidden;
    }

    .vp[open] {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
    }

    .vp-media {
        min-height: 0;
        aspect-ratio: 16 / 9;
    }

    .vp-body {
        min-height: 0;
        overflow: auto;
        overscroll-behavior: contain;
        padding: 22px 20px 24px;
        gap: 10px;
    }

    .vp-body h2 {
        padding-right: 0;
        font-size: clamp(19px, 5.4vw, 24px);
    }
}

@media (prefers-reduced-motion: no-preference) {
    .vp[open] {
        animation: vp-in .24s ease-out;
    }

    .vp[open]::backdrop {
        animation: vp-fade .24s ease-out;
    }

    @keyframes vp-in {
        from {
            opacity: 0;
            transform: translateY(12px) scale(.985);
        }
        to {
            opacity: 1;
            transform: none;
        }
    }

    @keyframes vp-fade {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }
}

@media (prefers-reduced-motion: reduce) {
    .vp-icon {
        transition: none;
    }
}
