/**
 * Ventana emergente del descuento de bienvenida.
 *
 * Rediseño de agosto de 2026 sobre la referencia que mandó la tienda:
 * columna de texto sobre fondo crema a la izquierda, foto a sangre a la
 * derecha, casilla de email, botón principal en píldora y, debajo, un botón
 * discreto para rechazar el descuento.
 *
 * Colores de la casa: crema #FBF4EF de fondo, rosa de marca #E590A0 en el
 * botón, rosa profundo #C0697C en el titular (el #E590A0 sobre crema se
 * queda en 2,4:1 de contraste y un titular grande necesita 3:1) y #FFCAD4
 * en el filete, el mismo que separa los títulos de sección de la portada.
 */

.samaruc-popup {
    --sp-crema: #FBF4EF;
    --sp-rosa: #FFCAD4;
    --sp-rosa-fuerte: #E590A0;
    --sp-rosa-oscuro: #C0697C;
    --sp-rosa-suave: #FFF7F9;
    --sp-texto: #3D3D3D;
    --sp-tenue: #8A8A8A;
    --sp-borde: #E5D9D1;

    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    font-family: var(--samaruc-fuente-principal, "Roboto", sans-serif);
    opacity: 0;
    transition: opacity .3s ease;
}
.samaruc-popup.is-open {
    opacity: 1;
}
.samaruc-popup[hidden] {
    display: none !important;
}

/* Bloquea el desplazamiento del fondo mientras la ventana está abierta. */
html.samaruc-popup-abierto,
html.samaruc-popup-abierto body {
    overflow: hidden;
}

.samaruc-popup__fondo {
    position: absolute;
    inset: 0;
    background: rgba(24, 20, 21, .5);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    cursor: pointer;
}

/* ---------- La caja ---------- */

.samaruc-popup__caja {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    overflow: hidden;
    background: var(--sp-crema);
    border-radius: 6px;
    box-shadow: 0 28px 70px rgba(0, 0, 0, .3);
    transform: translateY(18px) scale(.97);
    transition: transform .45s cubic-bezier(.2, .8, .3, 1);
}
.samaruc-popup.is-open .samaruc-popup__caja {
    transform: none;
}

.samaruc-popup__cerrar {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: var(--sp-texto);
    cursor: pointer;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.samaruc-popup__cerrar:hover,
.samaruc-popup__cerrar:focus-visible {
    background: #FFFFFF;
    border-color: var(--sp-rosa);
    color: var(--sp-rosa-fuerte);
}
.samaruc-popup__cerrar:focus-visible {
    outline: 2px solid var(--sp-rosa-fuerte);
    outline-offset: 2px;
}

/* ---------- Imagen ---------- */

.samaruc-popup__media {
    position: relative;
    flex: 0 0 auto;
    max-height: 30vh;
    overflow: hidden;
    background: var(--sp-rosa-suave);
}
.samaruc-popup__imagen {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 30vh;
    object-fit: cover;
    object-position: center;
}

/* ---------- Contenido ---------- */

.samaruc-popup__cuerpo {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 30px 28px 32px;
    text-align: center;
}

.samaruc-popup__antetitulo {
    margin: 0 0 12px;
    font-size: 10px;
    line-height: 1.4;
    font-weight: 500;
    letter-spacing: .28em;
    text-transform: uppercase;
    color: var(--sp-tenue);
}

.samaruc-popup__titulo {
    margin: 0;
    font-family: var(--samaruc-fuente-secundaria, "Roboto Slab", serif);
    font-size: 32px;
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: .01em;
    text-wrap: balance;
    color: var(--sp-rosa-oscuro);
}

.samaruc-popup__texto {
    margin: 10px 0 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--sp-texto);
}

/* El mismo filete rosa que separa los títulos de sección de la portada. */
.samaruc-popup__filete {
    display: block;
    width: 46px;
    height: 0;
    margin: 18px auto 20px;
    border-top: 2.5px solid var(--sp-rosa);
}

/* ---------- Cupón (solo si la tienda lo activa) ---------- */

.samaruc-popup__cupon {
    margin: 0 0 20px;
}
.samaruc-popup__cupon-etiqueta {
    display: block;
    margin-bottom: 8px;
    font-size: 10px;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--sp-tenue);
}
.samaruc-popup__codigo {
    display: inline-block;
    padding: 11px 24px;
    border: 1px dashed var(--sp-rosa-fuerte);
    background: var(--sp-rosa-suave);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .16em;
    color: var(--sp-texto);
}

/* ---------- Email + botones ---------- */

.samaruc-popup__form {
    margin: 0;
}

.samaruc-popup__email {
    display: block;
    /* El tema no fuerza border-box en los input: sin esto el campo se pasa de
       ancho y no cuadra con los botones. */
    box-sizing: border-box;
    width: 100%;
    height: 46px;
    margin: 0 0 12px;
    padding: 0 16px;
    border: 1px solid var(--sp-borde);
    border-radius: 3px;
    background: #FFFFFF;
    box-shadow: none;
    font-family: inherit;
    font-size: 15px;
    line-height: 46px;
    color: var(--sp-texto);
}
.samaruc-popup__email::placeholder {
    color: #B3A79F;
    opacity: 1;
}
.samaruc-popup__email:focus {
    border-color: var(--sp-rosa-fuerte);
    outline: 2px solid rgba(229, 144, 160, .35);
    outline-offset: 0;
}

.samaruc-popup__boton {
    display: block;
    box-sizing: border-box;
    width: 100%;
    padding: 15px 24px;
    border: 1px solid var(--sp-rosa-fuerte);
    border-radius: 999px;
    background: var(--sp-rosa-fuerte);
    color: #FFFFFF;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .14em;
    line-height: 1;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: background .25s ease, border-color .25s ease;
}
.samaruc-popup__boton:hover,
.samaruc-popup__boton:focus-visible {
    background: #D47C8D;
    border-color: #D47C8D;
    color: #FFFFFF;
    text-decoration: none;
}
.samaruc-popup__boton:focus-visible {
    outline: 2px solid var(--sp-rosa-oscuro);
    outline-offset: 3px;
}

/* Rechazar: mismo tamaño y forma, sin peso visual. */
.samaruc-popup__no {
    display: block;
    box-sizing: border-box;
    width: 100%;
    margin: 10px 0 0;
    padding: 12px 20px;
    border: 1px solid var(--sp-borde);
    border-radius: 999px;
    background: transparent;
    color: var(--sp-tenue);
    font-family: inherit;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    transition: border-color .2s ease, color .2s ease;
}
.samaruc-popup__no:hover,
.samaruc-popup__no:focus-visible {
    border-color: #CDBFB6;
    color: var(--sp-texto);
}
.samaruc-popup__no:focus-visible {
    outline: 2px solid var(--sp-rosa-fuerte);
    outline-offset: 2px;
}

.samaruc-popup__nota {
    margin: 16px 0 0;
    font-size: 11px;
    line-height: 1.5;
    color: var(--sp-tenue);
}

/* ---------- Escritorio: texto a la izquierda, foto a la derecha ---------- */

@media (min-width: 760px) {
    /* row-reverse y no reordenar el HTML: así en móvil la foto sigue
       saliendo ARRIBA, que es donde tiene sentido en vertical. */
    .samaruc-popup__caja {
        flex-direction: row-reverse;
        max-width: 800px;
        min-height: 440px;
        max-height: calc(100vh - 80px);
        max-height: calc(100dvh - 80px);
    }
    /* La imagen se posiciona en absoluto: así el alto de la caja lo marca solo
       la columna de texto y no queda hueco debajo. */
    .samaruc-popup__media {
        flex: 0 0 45%;
        max-height: none;
    }
    .samaruc-popup__imagen {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        max-height: none;
    }
    .samaruc-popup__cuerpo {
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 48px 46px;
    }
    .samaruc-popup__titulo {
        font-size: 38px;
    }
    /* Sin imagen, la caja se queda estrecha y centrada. */
    .samaruc-popup--sin-imagen .samaruc-popup__caja {
        max-width: 460px;
        min-height: 0;
    }
}

/* ---------- Móvil ---------- */

@media (max-width: 480px) {
    .samaruc-popup {
        padding: 16px;
    }
    .samaruc-popup__caja {
        max-height: calc(100vh - 32px);
        max-height: calc(100dvh - 32px);
    }
    .samaruc-popup__media,
    .samaruc-popup__imagen {
        max-height: 24vh;
    }
    .samaruc-popup__imagen {
        object-position: center 30%;
    }
    .samaruc-popup__cuerpo {
        padding: 24px 20px 28px;
    }
    .samaruc-popup__titulo {
        font-size: 27px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .samaruc-popup,
    .samaruc-popup__caja {
        transition: none;
    }
}
