:root {
    --mrwp-primary: #003f7d;
    --mrwp-primary-hover: #002f5f;
    --mrwp-accent: #d71920;
    --mrwp-accent-2: #f2c94c;
    --mrwp-white: #ffffff;
    --mrwp-black: #1f2933;
    --mrwp-muted: #64748b;
    --mrwp-border: #d9e2ec;
    --mrwp-radius: 8px;
    --mrwp-shadow: 0 24px 70px rgba(0, 31, 63, 0.28);
}

.mrwp-wrapper {
    display: inline;
}

/* ---------------------------------------------------------------------------
   Botón de apertura (base común a todos los estilos)
--------------------------------------------------------------------------- */
.mrwp-open {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 46px;
    padding: 12px 20px;
    border: 1px solid var(--mrwp-primary);
    border-radius: 4px;
    background: var(--mrwp-primary);
    color: var(--mrwp-white) !important;
    font: inherit;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0;
    text-decoration: none !important;
    cursor: pointer;
    box-shadow: inset 4px 0 0 var(--mrwp-accent), 0 6px 14px rgba(0, 63, 125, 0.18);
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.22s ease, color 0.18s ease;
}

.mrwp-open > * {
    position: relative;
    z-index: 1;
}

.mrwp-open:focus-visible {
    outline: 3px solid rgba(215, 25, 32, 0.38);
    outline-offset: 2px;
}

/* Destello que barre el botón en hover */
.mrwp-open::before {
    content: "";
    position: absolute;
    top: 0;
    left: -130%;
    width: 55%;
    height: 100%;
    background: linear-gradient(115deg, transparent 0%, rgba(255, 255, 255, 0.28) 50%, transparent 100%);
    transform: skewX(-18deg);
    transition: left 0.6s ease;
    pointer-events: none;
    z-index: 0;
}

.mrwp-open:hover::before,
.mrwp-open:focus-visible::before {
    left: 135%;
}

.mrwp-open-icono {
    font-size: 1.15em;
    line-height: 1;
}

.mrwp-open-flecha {
    font-size: 1.05em;
    line-height: 1;
    transition: transform 0.18s ease;
}

.mrwp-open:hover .mrwp-open-flecha,
.mrwp-open:focus-visible .mrwp-open-flecha {
    transform: translateX(5px);
}

/* --- Estilo: sólido (compatibilidad con el diseño original) --- */
.mrwp-estilo-solido {
    background: var(--mrwp-btn-color, var(--mrwp-primary));
    border-color: var(--mrwp-btn-color, var(--mrwp-primary));
    box-shadow: inset 4px 0 0 var(--mrwp-btn-color2, var(--mrwp-accent)), 0 6px 14px rgba(0, 63, 125, 0.18);
}

.mrwp-estilo-solido:hover,
.mrwp-estilo-solido:focus-visible {
    background: var(--mrwp-primary-hover);
    border-color: var(--mrwp-primary-hover);
    transform: translateY(-2px);
    box-shadow: inset 4px 0 0 var(--mrwp-btn-color2, var(--mrwp-accent)), 0 12px 24px rgba(0, 47, 95, 0.24);
}

/* --- Estilo: gradiente (por defecto) --- */
.mrwp-estilo-gradiente {
    background: linear-gradient(135deg, var(--mrwp-btn-color, var(--mrwp-primary)), var(--mrwp-btn-color2, var(--mrwp-accent)));
    background-size: 140% 140%;
    background-position: 0% 0%;
    border-color: transparent;
    box-shadow: 0 8px 18px rgba(0, 63, 125, 0.22);
    transition: transform 0.18s ease, box-shadow 0.22s ease, background-position 0.6s ease;
}

.mrwp-estilo-gradiente:hover,
.mrwp-estilo-gradiente:focus-visible {
    background-position: 100% 100%;
    transform: translateY(-2px);
    box-shadow: 0 14px 26px rgba(0, 47, 95, 0.28);
}

/* --- Estilo: neón (glow de color) --- */
.mrwp-estilo-neon {
    background: var(--mrwp-btn-color, var(--mrwp-primary));
    border-color: var(--mrwp-btn-color, var(--mrwp-primary));
    box-shadow: inset 4px 0 0 var(--mrwp-btn-color2, var(--mrwp-accent)), 0 0 18px rgba(0, 63, 125, 0.32);
}

.mrwp-estilo-neon:hover,
.mrwp-estilo-neon:focus-visible {
    transform: translateY(-2px);
    box-shadow: inset 4px 0 0 var(--mrwp-btn-color2, var(--mrwp-accent)), 0 0 28px rgba(0, 63, 125, 0.42);
}

/* --- Estilo: contorno que se rellena en hover --- */
.mrwp-estilo-contorno {
    background: transparent;
    color: var(--mrwp-btn-color, var(--mrwp-primary)) !important;
    border-color: var(--mrwp-btn-color, var(--mrwp-primary));
    box-shadow: inset 4px 0 0 var(--mrwp-btn-color2, var(--mrwp-accent));
}

.mrwp-estilo-contorno:hover,
.mrwp-estilo-contorno:focus-visible {
    color: var(--mrwp-white) !important;
    background: var(--mrwp-btn-color, var(--mrwp-primary));
    box-shadow: inset 4px 0 0 var(--mrwp-btn-color2, var(--mrwp-accent)), 0 12px 24px rgba(0, 63, 125, 0.22);
    transform: translateY(-2px);
}

/* --- Animación de atención: pulso --- */
.mrwp-anim-pulso {
    animation: mrwpPulso 2s ease-out infinite;
}

@keyframes mrwpPulso {
    0% {
        box-shadow: inset 4px 0 0 var(--mrwp-btn-color2, var(--mrwp-accent)), 0 8px 18px rgba(0, 63, 125, 0.22), 0 0 0 0 rgba(215, 25, 32, 0.45);
    }

    70% {
        box-shadow: inset 4px 0 0 var(--mrwp-btn-color2, var(--mrwp-accent)), 0 8px 18px rgba(0, 63, 125, 0.22), 0 0 0 14px rgba(215, 25, 32, 0);
    }

    100% {
        box-shadow: inset 4px 0 0 var(--mrwp-btn-color2, var(--mrwp-accent)), 0 8px 18px rgba(0, 63, 125, 0.22), 0 0 0 0 rgba(215, 25, 32, 0);
    }
}

/* ---------------------------------------------------------------------------
   Modal
--------------------------------------------------------------------------- */
.mrwp-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.mrwp-modal.is-active {
    display: flex;
}

.mrwp-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 31, 63, 0.76);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.mrwp-dialog {
    --mrwp-pad: 28px;
    position: relative;
    z-index: 2;
    width: min(100%, var(--mrwp-modal-width, 620px));
    max-height: calc(100vh - 48px);
    overflow: auto;
    padding: var(--mrwp-pad);
    border-radius: var(--mrwp-radius);
    background: var(--mrwp-white);
    color: var(--mrwp-black);
    box-shadow: var(--mrwp-shadow);
    animation: mrwpFadeUp 0.22s ease both;
}

.mrwp-has-image {
    width: min(100%, max(var(--mrwp-modal-width, 620px), 760px));
}

.mrwp-title {
    margin: 0 42px 16px 0;
    color: var(--mrwp-primary);
    font-size: clamp(22px, 3vw, 30px);
    line-height: 1.15;
}

.mrwp-body {
    color: inherit;
    font-size: 16px;
    line-height: 1.65;
}

.mrwp-body > *:first-child {
    margin-top: 0;
}

.mrwp-body > *:last-child {
    margin-bottom: 0;
}

/* Imágenes dentro del contenido del modal */
.mrwp-body img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

.mrwp-body figure {
    margin: 0 0 16px;
}

.mrwp-body figcaption {
    margin-top: 6px;
    font-size: 14px;
    color: var(--mrwp-muted);
}

/* ---------------------------------------------------------------------------
   Imagen "hero" del modal
--------------------------------------------------------------------------- */
.mrwp-hero {
    overflow: hidden;
    background: #f8fafc;
}

.mrwp-hero-img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: calc(100vh - 220px);
    margin: 0 auto;
    object-fit: contain;
}

/* Imagen arriba, a ancho completo */
.mrwp-img-arriba .mrwp-hero {
    margin: calc(var(--mrwp-pad) * -1) calc(var(--mrwp-pad) * -1) 22px;
    border-radius: var(--mrwp-radius) var(--mrwp-radius) 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    padding: 0;
}

.mrwp-img-arriba .mrwp-hero-img {
    max-height: calc(100vh - 220px);
    object-fit: contain;
}

/* Botón de cierre más legible cuando se superpone a una imagen */
.mrwp-has-image .mrwp-close {
    z-index: 3;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}

/* Imagen al lado (en escritorio) */
@media (min-width: 641px) {
    .mrwp-img-lado {
        display: flex;
        gap: 26px;
        align-items: stretch;
    }

    .mrwp-img-lado .mrwp-hero {
        flex: 0 0 42%;
        margin: calc(var(--mrwp-pad) * -1) 0 calc(var(--mrwp-pad) * -1) calc(var(--mrwp-pad) * -1);
        border-radius: var(--mrwp-radius) 0 0 var(--mrwp-radius);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mrwp-img-lado .mrwp-hero-img {
        width: auto;
        max-width: 100%;
        height: auto;
        max-height: calc(100vh - 96px);
        object-fit: contain;
    }

    .mrwp-img-lado .mrwp-content {
        flex: 1 1 auto;
        min-width: 0;
    }
}

.mrwp-close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--mrwp-border);
    border-radius: 999px;
    background: #f9fafb;
    color: var(--mrwp-primary);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease;
}

.mrwp-close:hover,
.mrwp-close:focus-visible {
    background: #eef4fb;
    transform: rotate(90deg);
    outline: none;
}

.mrwp-theme-oscuro .mrwp-dialog {
    background: #002f5f;
    color: #ffffff;
}

.mrwp-theme-oscuro .mrwp-title {
    color: #ffffff;
}

.mrwp-theme-oscuro .mrwp-close {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.mrwp-theme-oscuro .mrwp-close:hover,
.mrwp-theme-oscuro .mrwp-close:focus-visible {
    background: rgba(255, 255, 255, 0.16);
}

.mrwp-theme-oscuro .mrwp-body figcaption {
    color: rgba(255, 255, 255, 0.7);
}

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

@keyframes mrwpFadeUp {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 640px) {
    .mrwp-modal {
        padding: 14px;
        align-items: flex-end;
    }

    .mrwp-dialog {
        --mrwp-pad: 20px;
        width: 100%;
        max-height: calc(100vh - 28px);
        border-radius: 8px 8px 6px 6px;
    }

    .mrwp-title {
        margin-right: 44px;
        font-size: 22px;
    }

    /* En móvil, la imagen "al lado" se apila arriba */
    .mrwp-img-lado .mrwp-hero {
        margin: calc(var(--mrwp-pad) * -1) calc(var(--mrwp-pad) * -1) 20px;
        border-radius: 8px 8px 0 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mrwp-img-lado .mrwp-hero-img,
    .mrwp-img-arriba .mrwp-hero-img {
        max-height: calc(100vh - 210px);
        object-fit: contain;
    }
}

/* Respeta la preferencia de menos movimiento */
@media (prefers-reduced-motion: reduce) {
    .mrwp-open,
    .mrwp-open-flecha,
    .mrwp-close {
        transition: none;
    }

    .mrwp-open::before {
        display: none;
    }

    .mrwp-anim-pulso {
        animation: none;
    }

    .mrwp-dialog {
        animation: none;
    }
}
