/**
 * Video embeds — headline player, pop-up trigger, and the pop-up itself.
 * Depends on the custom properties declared in style.css (--primary etc.),
 * so this sheet is enqueued after it — see smokedmeat_rye_video_assets().
 */

/* Responsive 16:9 player, used for headline mode and for an opened pop-up. */
.smr-video-embed {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.smr-video-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.smr-video-shortcode {
    margin: 20px 0;
}

/* Clickable thumbnail that opens the pop-up. */
.smr-video-popup-trigger {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: var(--bg-alt, #f8f8f8);
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

.smr-video-popup-trigger img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.smr-video-placeholder-text {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--white, #fff);
    background: var(--secondary, #1a1a2e);
    font-weight: 600;
    letter-spacing: .04em;
}

.smr-video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: var(--primary, #e85d04);
    color: var(--white, #fff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    /* Optically centres the play triangle inside the circle. */
    padding-left: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
    transition: var(--transition, all .3s ease);
}

.smr-video-popup-trigger:hover .smr-video-play-icon,
.smr-video-popup-trigger:focus-visible .smr-video-play-icon {
    background: var(--primary-dark, #d35400);
    transform: translate(-50%, -50%) scale(1.08);
}

/* The pop-up overlay itself. */
.smr-video-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

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

.smr-video-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 15, .88);
}

.smr-video-modal-frame {
    position: relative;
    width: min(920px, 100%);
    z-index: 1;
}

.smr-video-modal-close {
    position: absolute;
    top: -44px;
    right: 0;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    color: var(--white, #fff);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.smr-video-modal-close:hover,
.smr-video-modal-close:focus-visible {
    background: var(--primary, #e85d04);
}

body.smr-video-modal-open {
    overflow: hidden;
}

@media (max-width: 600px) {
    .smr-video-play-icon {
        width: 54px;
        height: 54px;
        font-size: 18px;
    }

    .smr-video-modal-close {
        top: -40px;
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
}
