/* =====================================================================
   HVB MAILER — NEWSLETTER STYLES (v2.1 "Gilded Frame", theme-hardened)
   Enqueued by HVB_Mailer_Frontend::enqueue_assets() as
   assets/hvb-frontend.css, versioned with HVB_MAILER_VERSION so the
   ?ver query string busts LiteSpeed/browser caches on every release.

   v2.1: All popup rules are prefixed with #hvb-popup. REQUIRED — the
   Garuda theme's global button selector (style.css ~line 314,
   `button:not(...):not(...)...` with ~12 :not() classes) has higher
   specificity than any class-only selector and was overriding the
   close button (position, padding, radius) and submit button. The ID
   prefix out-ranks it without !important. Explicit resets are included
   for every property that global rule sets. The theme's global
   `input:focus-visible { outline: 3px gold }` is also neutralized on
   the email input (the gold border + ring remain as the visible
   keyboard focus state).

   Requires the two decorative elements in the popup markup emitted by
   HVB_Mailer_Frontend::render_popup(). All class hooks used by
   hvb-frontend.js and the AJAX handler are unchanged.
   ===================================================================== */

/* ── Shared form styles (shortcode card + popup) — unchanged from v1 ── */
.hvb-signup-card {
    background: linear-gradient(135deg, var(--cream, #fff9e6) 0%, var(--cream-dark, #fff3cd) 100%);
    border: 2px solid var(--forest-mid, #2a5d3a);
    border-radius: var(--radius-lg, 20px);
    padding: 36px 28px;
    box-shadow: var(--shadow-md, 0 8px 24px rgba(0, 0, 0, 0.12));
    text-align: center;
    max-width: 520px;
    margin: 0 auto;
}

.hvb-signup-heading {
    font-family: var(--font-serif, 'Cinzel', Georgia, serif);
    color: var(--forest, #1a3a2e);
    font-size: 28px;
    margin: 0 0 12px;
    font-weight: 700;
}

.hvb-signup-subtitle {
    font-family: var(--font-sans, 'Montserrat', Arial, sans-serif);
    color: var(--text-muted, #555);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 24px;
}

.hvb-signup-form-inner {
    display: flex;
    gap: 10px;
    max-width: 480px;
    margin: 0 auto;
}

.hvb-signup-field {
    flex: 1;
    min-width: 0;
}

.hvb-signup-input {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid var(--forest-mid, #2a5d3a);
    border-radius: var(--radius-full, 100px);
    font-family: var(--font-sans, 'Montserrat', Arial, sans-serif);
    font-size: 0.95rem;
    color: var(--text-dark, #1a1a1a);
    background: var(--white, #fff);
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

.hvb-signup-input:focus {
    border-color: var(--gold, #d4af37);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

.hvb-signup-input::placeholder {
    color: var(--text-light, #737373);
}

.hvb-signup-submit {
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--forest-mid, #2a5d3a), var(--forest, #1a3a2e));
    color: var(--white, #fff);
    border: none;
    border-radius: var(--radius-full, 100px);
    font-family: var(--font-sans, 'Montserrat', Arial, sans-serif);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.hvb-signup-submit:hover,
.hvb-signup-submit:focus-visible {
    background: linear-gradient(135deg, var(--forest, #1a3a2e), #0f2a1f);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 58, 46, 0.3);
}

.hvb-signup-submit:active {
    transform: translateY(0);
}

.hvb-signup-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.hvb-signup-message {
    margin-top: 12px;
    font-family: var(--font-sans, 'Montserrat', Arial, sans-serif);
    font-size: 0.9rem;
    line-height: 1.5;
    min-height: 1.5em;
}

.hvb-signup-message--success {
    color: var(--forest-mid, #2a5d3a);
    font-weight: 600;
}

.hvb-signup-message--error {
    color: #c0392b;
    font-weight: 600;
}

.hvb-signup-message--info {
    color: var(--gold-dark, #b8960c);
    font-weight: 600;
}

.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Popup: overlay ──────────────────────────────────────────────── */
/* Visibility model unchanged: inline style="display:none" until JS
   shows it, then .hvb-popup--visible drives the entrance. */
#hvb-popup.hvb-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(10, 24, 17, 0.62);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.55s ease;
}

#hvb-popup.hvb-popup--visible {
    opacity: 1;
}

/* ── Popup: modal card (gilded double frame) ─────────────────────── */
#hvb-popup .hvb-popup-modal {
    position: relative;
    width: 100%;
    max-width: 440px;
    background: linear-gradient(180deg, #fffefb 0%, var(--cream, #fff9e6) 100%);
    border: 1px solid var(--gold, #d4af37);
    border-radius: var(--radius-lg, 20px);
    padding: 46px 40px 38px;
    text-align: center;
    box-shadow: 0 28px 72px rgba(0, 0, 0, 0.38), 0 0 0 7px rgba(212, 175, 55, 0.09);
    transform: translateY(30px) scale(0.965);
    transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

#hvb-popup.hvb-popup--visible .hvb-popup-modal {
    transform: none;
}

/* Inner engraved hairline frame */
#hvb-popup .hvb-popup-modal::before {
    content: "";
    position: absolute;
    inset: 9px;
    border: 1px solid rgba(212, 175, 55, 0.45);
    border-radius: 13px;
    pointer-events: none;
}

/* Staggered entrance of card contents */
#hvb-popup .hvb-popup-modal > * {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

#hvb-popup.hvb-popup--visible .hvb-popup-modal > * {
    opacity: 1;
    transform: none;
}

#hvb-popup.hvb-popup--visible .hvb-popup-modal > *:nth-child(2) { transition-delay: 0.18s; }
#hvb-popup.hvb-popup--visible .hvb-popup-modal > *:nth-child(3) { transition-delay: 0.26s; }
#hvb-popup.hvb-popup--visible .hvb-popup-modal > *:nth-child(4) { transition-delay: 0.34s; }
#hvb-popup.hvb-popup--visible .hvb-popup-modal > *:nth-child(5) { transition-delay: 0.42s; }
#hvb-popup.hvb-popup--visible .hvb-popup-modal > *:nth-child(6) { transition-delay: 0.5s; }
#hvb-popup.hvb-popup--visible .hvb-popup-modal > *:nth-child(7) { transition-delay: 0.58s; }

/* ── Popup: gold ornament + eyebrow (new decorative elements) ────── */
#hvb-popup .hvb-popup-ornament {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0 0 16px;
}

#hvb-popup .hvb-popup-ornament::before,
#hvb-popup .hvb-popup-ornament::after {
    content: "";
    height: 1px;
    width: 52px;
}

#hvb-popup .hvb-popup-ornament::before {
    background: linear-gradient(90deg, transparent, var(--gold, #d4af37));
}

#hvb-popup .hvb-popup-ornament::after {
    background: linear-gradient(270deg, transparent, var(--gold, #d4af37));
}

#hvb-popup .hvb-popup-ornament span {
    display: block;
    width: 7px;
    height: 7px;
    background: var(--gold, #d4af37);
    transform: rotate(45deg);
}

#hvb-popup .hvb-popup-eyebrow {
    margin: 0 0 12px;
    font-family: var(--font-sans, 'Montserrat', Arial, sans-serif);
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.34em;
    text-transform: uppercase;
    color: var(--gold-dark, #b8960c);
}

/* ── Popup: typography overrides ─────────────────────────────────── */
#hvb-popup .hvb-signup-heading {
    margin: 0 0 12px;
    font-family: var(--font-serif, 'Cinzel', Georgia, serif);
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.03em;
    color: var(--forest, #1a3a2e);
}

#hvb-popup .hvb-signup-subtitle {
    margin: 0 auto 28px;
    max-width: 320px;
    font-size: 14.5px;
    line-height: 1.65;
}

/* ── Popup: stacked form, refined input + submit ─────────────────── */
#hvb-popup .hvb-signup-form-inner {
    flex-direction: column;
    gap: 12px;
    max-width: none;
}

#hvb-popup .hvb-signup-field {
    flex: none;
}

#hvb-popup .hvb-signup-input {
    padding: 15px 22px;
    border: 1.5px solid rgba(42, 93, 58, 0.35);
    border-radius: var(--radius-full, 100px);
    font-size: 14px;
    font-weight: 500;
    box-shadow: inset 0 1px 3px rgba(26, 58, 46, 0.06);
}

#hvb-popup .hvb-signup-input:focus {
    border-color: var(--gold, #d4af37);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.28), inset 0 1px 3px rgba(26, 58, 46, 0.05);
}

/* Neutralize the theme's global `input:focus-visible` 3px gold outline
   (style.css ~line 4431) — it doubled up with the ring above. The gold
   border + 3px ring remain the visible keyboard focus state. */
#hvb-popup .hvb-signup-input:focus-visible {
    outline: none;
}

/* Explicit resets defend against the theme's global button rule
   (display/padding/font-size/border/overflow/position/gap). */
#hvb-popup .hvb-signup-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: var(--radius-full, 100px);
    background: linear-gradient(135deg, var(--forest-mid, #2a5d3a) 0%, var(--forest-deep, #0f2a1f) 100%);
    color: var(--gold-light, #f4e061);
    font-family: var(--font-sans, 'Montserrat', Arial, sans-serif);
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: visible;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(15, 42, 31, 0.35), inset 0 0 0 1px rgba(244, 224, 97, 0.22);
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

#hvb-popup .hvb-signup-submit:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, var(--forest-light, #3a6d4a) 0%, var(--forest, #1a3a2e) 100%);
    color: var(--gold-light, #f4e061);
    box-shadow: 0 12px 28px rgba(15, 42, 31, 0.42), inset 0 0 0 1px rgba(244, 224, 97, 0.35);
}

#hvb-popup .hvb-signup-submit:focus-visible {
    outline: 3px solid var(--gold, #d4af37);
    outline-offset: 3px;
}

#hvb-popup .hvb-signup-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ── Popup: close button ─────────────────────────────────────────── */
/* Same defensive resets — the theme rule was making this an inline
   pill (position: relative + padding + radius-full). */
#hvb-popup .hvb-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 2;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    margin: 0;
    border: 1px solid rgba(212, 175, 55, 0.6);
    border-radius: 50%;
    background: var(--white, #fff);
    color: var(--forest, #1a3a2e);
    font-family: var(--font-sans, 'Montserrat', Arial, sans-serif);
    font-size: 19px;
    font-weight: 400;
    line-height: 1;
    overflow: visible;
    box-shadow: none;
    opacity: 1;
    cursor: pointer;
    transition: background 0.25s ease, color 0.25s ease, transform 0.3s ease;
}

#hvb-popup .hvb-popup-close:hover {
    background: var(--gold, #d4af37);
    color: var(--forest-deep, #0f2a1f);
    transform: rotate(90deg);
    box-shadow: none;
}

#hvb-popup .hvb-popup-close:focus-visible {
    outline: 3px solid var(--gold, #d4af37);
    outline-offset: 2px;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .hvb-signup-card {
        padding: 28px 20px;
    }

    .hvb-signup-form-inner {
        flex-direction: column;
    }

    .hvb-signup-submit {
        width: 100%;
    }

    /* Centered mini-modal on mobile */
    #hvb-popup.hvb-popup-overlay {
        padding: 16px;
    }

    #hvb-popup .hvb-popup-modal {
        max-width: 340px;
        border-radius: 16px;
        padding: 34px 22px 28px;
        transform: translateY(20px) scale(0.95);
    }

    #hvb-popup.hvb-popup--visible .hvb-popup-modal {
        transform: none;
    }

    #hvb-popup .hvb-popup-modal::before {
        inset: 7px;
        border-radius: 10px;
    }

    #hvb-popup .hvb-popup-ornament::before,
    #hvb-popup .hvb-popup-ornament::after {
        width: 36px;
    }

    #hvb-popup .hvb-signup-heading {
        font-size: 21px;
    }

    #hvb-popup .hvb-signup-subtitle {
        font-size: 13.5px;
        margin-bottom: 22px;
    }

    #hvb-popup .hvb-signup-input {
        padding: 13px 18px;
        font-size: 13.5px;
    }

    #hvb-popup .hvb-signup-submit {
        padding: 14px 20px;
        font-size: 11.5px;
    }

    #hvb-popup .hvb-popup-close {
        top: 10px;
        right: 10px;
        width: 30px;
        height: 30px;
        min-width: 30px;
        min-height: 30px;
        font-size: 17px;
    }
}

/* ── Reduced motion ──────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    #hvb-popup.hvb-popup-overlay,
    #hvb-popup .hvb-popup-modal,
    #hvb-popup .hvb-popup-modal > * {
        transition: none !important;
        transform: none !important;
    }
}
