/**
 * Modal de mídia — CSS próprio
 * Centralizado na viewport, compacto e responsivo.
 */

.media-modal {
    /* dialog nativo: força centro em vez do canto superior-esquerdo */
    position: fixed;
    inset: 0;
    margin: 0;
    padding: 1rem;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border: 0;
    background: transparent;
    color: var(--text, #2a211c);
    display: none;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    z-index: 2000;
}

.media-modal[open] {
    display: flex !important;
}

.media-modal.is-open {
    display: flex !important;
}

.media-modal::backdrop {
    background: rgba(12, 8, 6, 0.78);
    backdrop-filter: blur(5px);
}

.media-modal__panel {
    position: relative;
    width: min(520px, 100%);
    max-height: min(82vh, 640px);
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    background: #fffdfb;
    border: 1px solid rgba(58, 36, 23, 0.12);
    box-shadow: 0 22px 60px rgba(10, 6, 4, 0.45);
    overflow: hidden;
}

.media-modal__close {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    z-index: 3;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 999px;
    background: rgba(26, 18, 13, 0.88);
    color: #fff;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.media-modal__close:hover {
    background: #9a6a2e;
    transform: scale(1.04);
}

.media-modal__stage {
    flex: 0 1 auto;
    background: #100c09;
    display: grid;
    place-items: center;
    min-height: 180px;
    max-height: min(52vh, 380px);
}

.media-modal__video,
.media-modal__image {
    display: block;
    width: 100%;
    height: 100%;
    max-height: min(52vh, 380px);
    object-fit: contain;
    background: #100c09;
}

.media-modal__meta {
    flex: 0 0 auto;
    padding: 0.9rem 1.1rem 1.15rem;
    background: #fffdfb;
}

.media-modal__title {
    margin: 0 0 0.3rem;
    font-family: var(--font-display, "Bricolage Grotesque", Georgia, serif);
    font-size: 1.15rem;
    line-height: 1.25;
    color: var(--ink, #1a120d);
}

.media-modal__desc {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--muted, #6b5a4c);
}

body.media-modal-open {
    overflow: hidden;
}

@media (max-width: 560px) {
    .media-modal {
        padding: 0.65rem;
        align-items: flex-end;
    }

    .media-modal__panel {
        width: 100%;
        max-height: 88vh;
        border-radius: 16px 16px 12px 12px;
    }

    .media-modal__stage {
        max-height: min(48vh, 320px);
    }

    .media-modal__video,
    .media-modal__image {
        max-height: min(48vh, 320px);
    }
}
