/**
 * Estilos del popup de ingreso al sitio.
 *
 * Autor: Juan Morel (jcmorelm@mvisual.cl)
 */

.sitio-popup {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.sitio-popup[hidden] {
    display: none !important;
}

.sitio-popup__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(18, 18, 18, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
}

.sitio-popup__dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 34rem;
    max-height: min(82vh, 42rem);
    overflow: auto;
    padding: 1.25rem 1.25rem 1rem;
    border-radius: 1.25rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.65),
        0 0.35rem 0.85rem rgba(0, 0, 0, 0.14),
        0 1.15rem 2.4rem rgba(0, 0, 0, 0.22);
    opacity: 0;
    transform: translateY(0.65rem) scale(0.98);
    transition: opacity 0.28s ease, transform 0.28s ease;
}

/* Ancho del modal = ancho de la imagen (con tope de viewport) */
.sitio-popup--con-foto .sitio-popup__dialog {
    width: fit-content;
    max-width: min(94vw, 40rem);
    padding: 0.85rem;
}

.sitio-popup.sitio-popup--visible .sitio-popup__dialog {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.sitio-popup.sitio-popup--saliendo .sitio-popup__dialog {
    opacity: 0;
    transform: translateY(0.4rem) scale(0.98);
}

.sitio-popup__cerrar {
    position: absolute;
    top: 0.35rem;
    right: 0.45rem;
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #444;
    font-size: 1.55rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}

.sitio-popup__cerrar:hover,
.sitio-popup__cerrar:focus-visible {
    background: rgba(0, 0, 0, 0.06);
    color: #111;
    outline: none;
}

.sitio-popup__foto-wrap {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    line-height: 0;
}

.sitio-popup--con-foto .sitio-popup__foto-wrap:not(:last-child) {
    margin-bottom: 0.75rem;
}

.sitio-popup__foto {
    display: block;
    width: auto;
    height: auto;
    max-width: min(90vw, 36rem);
    max-height: min(70vh, 32rem);
    object-fit: contain;
    object-position: center;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.06),
        0 0.45rem 1.1rem rgba(0, 0, 0, 0.18),
        0 0 1.5rem rgba(231, 17, 17, 0.12);
    transform: scale(0.97);
    opacity: 0.92;
    transition: transform 0.45s ease, opacity 0.45s ease, box-shadow 0.35s ease;
}

.sitio-popup.sitio-popup--visible .sitio-popup__foto {
    transform: scale(1);
    opacity: 1;
}

.sitio-popup__foto:hover {
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.08),
        0 0.65rem 1.4rem rgba(0, 0, 0, 0.22),
        0 0 1.85rem rgba(231, 17, 17, 0.18);
}

.sitio-popup__cuerpo {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #222;
    text-align: center;
}

.sitio-popup--con-foto .sitio-popup__cuerpo {
    max-width: 100%;
    box-sizing: border-box;
}

.sitio-popup__cuerpo p:last-child {
    margin-bottom: 0;
}

.sitio-popup__cuerpo img {
    max-width: 100%;
    height: auto;
}

@media (max-width: 575.98px) {
    .sitio-popup {
        padding: 0.75rem;
        align-items: flex-end;
    }

    .sitio-popup__dialog {
        max-width: 100%;
        max-height: 82vh;
        padding: 1rem 0.95rem 0.85rem;
        border-radius: 1.1rem;
    }

    .sitio-popup--con-foto .sitio-popup__dialog {
        width: fit-content;
        max-width: calc(100vw - 1.5rem);
        padding: 0.65rem;
    }

    .sitio-popup__foto {
        max-width: calc(100vw - 2.8rem);
        max-height: min(58vh, 22rem);
        border-radius: 0.85rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sitio-popup__dialog,
    .sitio-popup__foto {
        transition: none;
    }

    .sitio-popup__foto {
        transform: none;
        opacity: 1;
    }
}
