/* Zapped product films: pop-up player, silent loops and the "watch" trigger. Loaded by the marketing, app and help
   wrappers through views/partials/zapped_film_assets.php. Every selector is namespaced zfilm. */

html.zfilm-lock,
html.zfilm-lock body {
    overflow: hidden;
}

.zfilm-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: grid;
    place-items: center;
    padding: clamp(12px, 3vw, 40px);
}

.zfilm-modal[hidden] {
    display: none;
}

.zfilm-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(9, 6, 18, .82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity .2s ease;
}

.zfilm-modal__panel {
    position: relative;
    width: min(1200px, 100%);
    aspect-ratio: 16 / 9;
    max-height: calc(100vh - 2 * clamp(12px, 3vw, 40px));
    border-radius: 18px;
    background: #05030a;
    box-shadow: 0 40px 120px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .08);
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px) scale(.985);
    transition: opacity .2s ease, transform .25s cubic-bezier(.2, .8, .2, 1);
}

.zfilm-modal.is-tall .zfilm-modal__panel {
    width: min(100%, calc((100vh - 2 * clamp(12px, 3vw, 40px)) * 9 / 16));
    height: auto;
    aspect-ratio: 9 / 16;
}

.zfilm-modal.is-open .zfilm-modal__backdrop,
.zfilm-modal.is-open .zfilm-modal__panel {
    opacity: 1;
}

.zfilm-modal.is-open .zfilm-modal__panel {
    transform: none;
}

.zfilm-modal__video {
    display: block;
    width: 100%;
    height: 100%;
    background: #05030a;
    object-fit: contain;
}

.zfilm-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    cursor: pointer;
    transition: background .15s ease;
}

.zfilm-modal__close:hover,
.zfilm-modal__close:focus-visible {
    background: rgba(255, 255, 255, .28);
    outline: none;
}

.zfilm-modal__video::cue {
    font-family: "Inter", system-ui, sans-serif;
    font-size: clamp(15px, 1.6vw, 22px);
    background: rgba(5, 3, 10, .72);
    color: #fff;
}

/* silent loops fill whatever frame they sit in */
video.zfilm-loop {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #0b0912;
}

/* a loop laid over its own poster image fades in once it really plays, so there is never a black flash */
video.zfilm-loop--over {
    opacity: 0;
    transition: opacity .6s ease;
}

video.zfilm-loop--over.is-playing {
    opacity: 1;
}

/* the play trigger used on posters and frames */
.zfilm-play {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: #151124;
    padding: 10px 18px 10px 10px;
    font: 700 15px/1 "Inter", system-ui, sans-serif;
    box-shadow: 0 18px 50px rgba(9, 6, 18, .35);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
}

.zfilm-play:hover,
.zfilm-play:focus-visible {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 22px 60px rgba(9, 6, 18, .45);
    outline: none;
}

.zfilm-play__icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: linear-gradient(135deg, #9920e4, #d946ef);
    color: #fff;
}

.zfilm-play__meta {
    color: #6b6577;
    font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
    .zfilm-modal__backdrop,
    .zfilm-modal__panel,
    .zfilm-play {
        transition: none;
    }
}
