/* Video Modal — Classic Kid Lit
   Used by alice.html, andersen.html, grimms.html, oz.html, pinocchio.html.
   Opens a YouTube iframe without leaving the site. */

.video-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.video-modal.open {
    display: flex;
    opacity: 1;
}

.video-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 960px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    transform: scale(0.97);
    transition: transform 0.2s ease;
}

.video-modal.open .video-modal__dialog {
    transform: scale(1);
}

.video-modal__frame-wrap {
    position: relative;
    padding-top: 56.25%; /* 16:9 */
    background: #000;
}

.video-modal__frame-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.video-modal__close {
    position: absolute;
    top: -46px;
    right: 0;
    background: transparent;
    color: #fff;
    border: 0;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 12px;
    font-weight: 700;
    opacity: 0.85;
    transition: opacity 0.15s ease;
}

.video-modal__close:hover,
.video-modal__close:focus-visible {
    opacity: 1;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.video-modal__title {
    position: absolute;
    top: -42px;
    left: 4px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    opacity: 0.9;
    max-width: calc(100% - 60px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.video-modal-open {
    overflow: hidden;
}

@media (max-width: 720px) {
    .video-modal {
        padding: 0;
    }
    .video-modal__dialog {
        border-radius: 0;
        max-width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    .video-modal__close {
        top: 8px;
        right: 8px;
        background: rgba(0, 0, 0, 0.6);
        border-radius: 999px;
        width: 40px;
        height: 40px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 2;
    }
    .video-modal__title {
        display: none;
    }
}
