/**
 * Popup promocional — Promoción Principal
 * Diseño premium CRESA (según mockup)
 */

:root {
    --cresa-promo-gold: #d4af37;
    --cresa-promo-gold-light: #e0c068;
    --cresa-promo-gold-muted: #d4af37;
    --cresa-promo-black: #0d0d0d;
    --cresa-promo-black-soft: #1a1a1a;
    --cresa-promo-cream: #f6f2ed;
    --cresa-promo-cream-deep: #efe6d3;
    --cresa-promo-code-bg: #efe6d3;
    --cresa-promo-text-muted: #6b6b6b;
    --cresa-promo-duration: 0.3s;
    --cresa-promo-ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.cresa-promo-popup {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    pointer-events: none;
}

.cresa-promo-popup[hidden] {
    display: none !important;
}

.cresa-promo-popup.is-visible {
    pointer-events: auto;
}

.cresa-promo-popup__overlay {
    position: absolute;
    inset: 0;
    background: rgba(8, 8, 8, 0.68);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity var(--cresa-promo-duration) var(--cresa-promo-ease);
}

.cresa-promo-popup.is-visible .cresa-promo-popup__overlay {
    opacity: 1;
}

.cresa-promo-popup__card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    max-height: calc(100dvh - 2rem);
    background: transparent;
    border-radius: 20px;
    overflow: visible;
    filter: drop-shadow(0 28px 70px rgba(0, 0, 0, 0.32));
    opacity: 0;
    transform: scale(0.96);
    transition:
        opacity var(--cresa-promo-duration) var(--cresa-promo-ease),
        transform var(--cresa-promo-duration) var(--cresa-promo-ease);
}

.cresa-promo-popup.is-visible .cresa-promo-popup__card {
    opacity: 1;
    transform: scale(1);
}

/* Botón cerrar — fuera de la esquina superior derecha */
.cresa-promo-popup__close {
    position: absolute;
    top: -14px;
    right: -14px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1.5px solid rgba(255, 255, 255, 0.55);
    border-radius: 50%;
    background: var(--cresa-promo-black);
    color: #ffffff;
    cursor: pointer;
    box-shadow:
        0 4px 14px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.08);
    transition:
        background var(--cresa-promo-duration) ease,
        border-color var(--cresa-promo-duration) ease,
        transform var(--cresa-promo-duration) ease,
        box-shadow var(--cresa-promo-duration) ease;
}

.cresa-promo-popup__close svg {
    width: 1.05rem;
    height: 1.05rem;
}

.cresa-promo-popup__close:hover,
.cresa-promo-popup__close:focus-visible {
    background: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.85);
    transform: scale(1.06);
    box-shadow:
        0 8px 22px rgba(0, 0, 0, 0.5),
        0 0 0 2px rgba(212, 175, 55, 0.15);
    outline: none;
}

/* Cabecera premium */
.cresa-promo-popup__header {
    position: relative;
    padding: 1.85rem 1.5rem 1.65rem;
    background: var(--cresa-promo-black);
    color: #ffffff;
    text-align: center;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
}

.cresa-promo-popup__header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(212, 175, 55, 0.2) 25%,
        rgba(212, 175, 55, 0.5) 50%,
        rgba(212, 175, 55, 0.2) 75%,
        transparent 100%
    );
}

.cresa-promo-popup__eyebrow {
    position: relative;
    margin: 0 0 0.95rem;
    font-family: 'Poppins', sans-serif;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--cresa-promo-gold);
}

.cresa-promo-popup__headline {
    position: relative;
    margin: 0;
    padding: 0 0.35rem;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(1.15rem, 4.2vw, 1.45rem);
    font-weight: 500;
    line-height: 1.42;
    letter-spacing: 0.01em;
    color: #ffffff;
}

.cresa-promo-popup__headline-spark {
    display: inline-block;
    margin: 0 0.4rem;
    font-size: 0.55em;
    color: var(--cresa-promo-gold);
    vertical-align: middle;
    opacity: 0.9;
}

/* Cuerpo — degradado beige */
.cresa-promo-popup__body {
    padding: 1.85rem 1.5rem 1.15rem;
    background: linear-gradient(180deg, var(--cresa-promo-cream) 0%, var(--cresa-promo-cream-deep) 100%);
    text-align: center;
}

.cresa-promo-popup__hero {
    margin-bottom: 1.65rem;
}

.cresa-promo-popup__percent {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    line-height: 0.82;
    margin: 0 0 0.85rem;
}

.cresa-promo-popup__percent-value {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(5.25rem, 24vw, 6.75rem);
    font-weight: 700;
    color: var(--cresa-promo-black);
    letter-spacing: -0.04em;
}

.cresa-promo-popup__percent-symbol {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(2.75rem, 12vw, 3.5rem);
    font-weight: 700;
    color: var(--cresa-promo-black);
    letter-spacing: -0.03em;
    margin-bottom: 0.15rem;
}

.cresa-promo-popup__percent-off {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(1.1rem, 4vw, 1.35rem);
    font-weight: 600;
    color: var(--cresa-promo-black);
    margin-bottom: 0.55rem;
    margin-left: 0.2rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.cresa-promo-popup__hero-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    width: 100%;
}

.cresa-promo-popup__hero-line {
    flex: 1;
    height: 1px;
    background: var(--cresa-promo-gold);
    opacity: 0.75;
}

.cresa-promo-popup__hero-tag {
    font-family: 'Poppins', sans-serif;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--cresa-promo-gold);
    white-space: nowrap;
}

/* Código promocional */
.cresa-promo-popup__code-wrap {
    margin-bottom: 0.35rem;
}

.cresa-promo-popup__code-label {
    display: block;
    margin-bottom: 0.6rem;
    font-family: 'Poppins', sans-serif;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--cresa-promo-black);
}

.cresa-promo-popup__code-box {
    display: flex;
    align-items: stretch;
    gap: 0;
    border: none;
    border-radius: 14px;
    background: var(--cresa-promo-code-bg);
    box-shadow:
        inset 0 0 0 1px rgba(212, 175, 55, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.cresa-promo-popup__code {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 0.95rem 0.85rem;
    font-family: 'Poppins', ui-monospace, monospace;
    font-size: clamp(1.05rem, 3.8vw, 1.3rem);
    font-weight: 700;
    letter-spacing: 0.14em;
    color: var(--cresa-promo-black);
    background: transparent;
    word-break: break-all;
}

.cresa-promo-popup__copy {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
    padding: 0 1.05rem;
    border: none;
    border-left: 1px solid rgba(212, 175, 55, 0.35);
    background: var(--cresa-promo-gold);
    color: var(--cresa-promo-black);
    font-family: 'Poppins', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--cresa-promo-duration) ease, color var(--cresa-promo-duration) ease;
}

.cresa-promo-popup__copy:hover,
.cresa-promo-popup__copy:focus-visible {
    background: var(--cresa-promo-gold-light);
    outline: none;
}

.cresa-promo-popup__copy.is-copied {
    background: #d4ead6;
    color: #2e7d32;
}

.cresa-promo-popup__copy-feedback {
    min-height: 1.1rem;
    margin: 0.35rem 0 0;
    font-size: 0.8rem;
    font-weight: 500;
    color: #2e7d32;
}

.cresa-promo-popup__expiry {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    margin: 0.65rem 0 0;
    font-family: 'Poppins', sans-serif;
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--cresa-promo-text-muted);
}

.cresa-promo-popup__expiry-icon {
    font-size: 0.8rem;
    line-height: 1;
    opacity: 0.85;
}

/* Footer */
.cresa-promo-popup__actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    padding: 1.35rem 1.5rem 1.75rem;
    background: var(--cresa-promo-black);
    border-radius: 0 0 20px 20px;
}

.cresa-promo-popup__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    min-height: 3.1rem;
    padding: 0.85rem 1.25rem;
    border-radius: 999px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition:
        background var(--cresa-promo-duration) ease,
        color var(--cresa-promo-duration) ease,
        transform var(--cresa-promo-duration) ease,
        box-shadow var(--cresa-promo-duration) ease;
}

.cresa-promo-popup__btn--primary {
    border: none;
    background: var(--cresa-promo-gold);
    color: var(--cresa-promo-black);
    box-shadow: 0 4px 18px rgba(212, 175, 55, 0.38);
}

.cresa-promo-popup__btn--primary:hover,
.cresa-promo-popup__btn--primary:focus-visible {
    background: var(--cresa-promo-gold-light);
    color: var(--cresa-promo-black);
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(212, 175, 55, 0.45);
    outline: none;
}

.cresa-promo-popup__btn-icon {
    flex-shrink: 0;
    margin-left: 0.15rem;
}

.cresa-promo-popup__home-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.2rem 0.5rem;
    font-family: 'Poppins', sans-serif;
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    transition: color var(--cresa-promo-duration) ease;
}

.cresa-promo-popup__home-link:hover,
.cresa-promo-popup__home-link:focus-visible {
    color: rgba(255, 255, 255, 0.95);
    outline: none;
}

.cresa-promo-popup__home-icon {
    flex-shrink: 0;
    opacity: 0.85;
}

.cresa-promo-popup__sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body.cresa-promo-popup-open {
    overflow: hidden;
}

/* Desktop — ~25% más grande */
@media (min-width: 769px) {
    .cresa-promo-popup {
        padding: 1.5rem;
    }

    .cresa-promo-popup__card {
        max-width: 520px;
    }

    .cresa-promo-popup__header {
        padding: 2.35rem 2.25rem 1.95rem;
    }

    .cresa-promo-popup__body {
        padding: 2.35rem 2.25rem 1.5rem;
    }

    .cresa-promo-popup__hero {
        margin-bottom: 2rem;
    }

    .cresa-promo-popup__percent-value {
        font-size: 7.5rem;
    }

    .cresa-promo-popup__percent-symbol {
        font-size: 3.75rem;
        margin-bottom: 0.25rem;
    }

    .cresa-promo-popup__percent-off {
        font-size: 1.45rem;
        margin-bottom: 0.75rem;
    }

    .cresa-promo-popup__headline {
        font-size: 1.55rem;
    }

    .cresa-promo-popup__actions {
        padding: 1.5rem 2.25rem 2rem;
        gap: 0.95rem;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .cresa-promo-popup {
        align-items: center;
        justify-content: center;
        padding: 1.25rem;
    }

    .cresa-promo-popup__card {
        max-width: min(100%, 400px);
        max-height: calc(100dvh - 2.5rem);
    }

    .cresa-promo-popup__close {
        top: -12px;
        right: -10px;
    }
}

@media (max-width: 430px) {
    .cresa-promo-popup {
        padding: 1rem 1.125rem;
    }

    .cresa-promo-popup__header {
        padding: 1.5rem 1.25rem 1.35rem;
    }

    .cresa-promo-popup__body {
        padding: 1.5rem 1.25rem 1rem;
    }

    .cresa-promo-popup__actions {
        padding: 1.15rem 1.25rem 1.5rem;
    }

    .cresa-promo-popup__headline-spark {
        display: none;
    }
}

@media (max-width: 390px) {
    .cresa-promo-popup__percent-value {
        font-size: clamp(4.5rem, 21vw, 5.25rem);
    }

    .cresa-promo-popup__percent-symbol {
        font-size: clamp(2.25rem, 10vw, 2.75rem);
    }

    .cresa-promo-popup__percent-off {
        font-size: 0.95rem;
        margin-bottom: 0.45rem;
    }

    .cresa-promo-popup__code {
        font-size: 0.95rem;
        letter-spacing: 0.1em;
        padding: 0.8rem 0.55rem;
    }

    .cresa-promo-popup__copy {
        padding: 0 0.75rem;
    }
}

@media (max-width: 375px) {
    .cresa-promo-popup__copy-text {
        display: none;
    }

    .cresa-promo-popup__hero {
        margin-bottom: 1.35rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cresa-promo-popup__overlay,
    .cresa-promo-popup__card,
    .cresa-promo-popup__close,
    .cresa-promo-popup__btn,
    .cresa-promo-popup__copy,
    .cresa-promo-popup__home-link {
        transition: none !important;
    }

    .cresa-promo-popup__card {
        transform: none !important;
    }
}
