/* ════════════════════════════════════════════════════
   AHQONE — Newsletter Lead Popup
   Option A: Left image | Right form (desktop)
   Mobile: bottom-sheet slide-up
════════════════════════════════════════════════════ */

/* ── Backdrop ── */
html.ahq-popup-open {
    overflow: hidden;
}

.ahq-popup-wrap {
    position: fixed;
    inset: 0;
    z-index: 9990;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .35s ease, visibility .35s ease;
}

.ahq-popup-wrap[hidden] {
    display: none !important;
}

.ahq-popup-wrap.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.ahq-popup-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 14, 6, 0.62);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    cursor: pointer;
}

/* ── Card ── */
.ahq-popup-card {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: min(860px, 94vw);
    max-height: min(560px, 90vh);
    border-radius: 6px;
    overflow: hidden;
    background: var(--ahq-surface, #faf8f5);
    box-shadow: 0 24px 80px rgba(0,0,0,.28), 0 4px 16px rgba(0,0,0,.14);
    transform: translateY(18px) scale(.97);
    transition: transform .38s cubic-bezier(.16,1,.3,1);
}

.ahq-popup-wrap.is-open .ahq-popup-card {
    transform: translateY(0) scale(1);
}

/* ── Left: image panel ── */
.ahq-popup-img-panel {
    position: relative;
    overflow: hidden;
    background: #2c1f14;
}

.ahq-popup-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 35%;
    transition: transform 6s ease;
}

.ahq-popup-wrap.is-open .ahq-popup-img {
    transform: scale(1.04);
}

.ahq-popup-img-placeholder {
    position: absolute;
    inset: 0;
    background: linear-gradient(155deg, #2c1f14 0%, #4a3220 40%, #c9a96e 100%);
}

.ahq-popup-img-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, rgba(0,0,0,.18) 0%, rgba(20,10,2,.55) 100%);
    display: flex;
    align-items: flex-end;
    padding: 2rem;
}

.ahq-popup-img-badge {
    font-family: var(--font-display, 'Bodoni Moda', serif);
    font-size: clamp(2.2rem, 4vw, 3rem);
    font-weight: 400;
    line-height: 1.1;
    color: #fff;
    letter-spacing: .02em;
    text-shadow: 0 2px 12px rgba(0,0,0,.4);
}

.ahq-popup-img-badge small {
    display: block;
    font-family: var(--font-body, 'DM Sans', sans-serif);
    font-size: .75rem;
    font-weight: 400;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: rgba(255,255,255,.75);
    margin-top: .25rem;
}

/* ── Right: form panel ── */
.ahq-popup-form-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(2rem, 4vw, 2.75rem) clamp(1.75rem, 3.5vw, 2.5rem);
    padding-top: clamp(2.5rem, 4.5vw, 3rem);
    overflow-y: auto;
    background: var(--ahq-surface, #faf8f5);
}

/* ── Close button ── */
.ahq-popup-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--ahq-border, #e8e0d5);
    border-radius: 50%;
    color: var(--ahq-text-muted, #9a8e84);
    cursor: pointer;
    transition: color .2s, border-color .2s, background .2s;
    flex-shrink: 0;
    z-index: 2;
}

.ahq-popup-close:hover {
    color: var(--ahq-text, #2c2420);
    border-color: var(--ahq-text, #2c2420);
    background: var(--ahq-surface-alt, #f2ede4);
}

/* ── State wrapper ── */
.ahq-popup-state {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.ahq-popup-state[hidden] { display: none; }

/* ── Typography ── */
.ahq-popup-eyebrow {
    font-family: var(--font-body, 'DM Sans', sans-serif);
    font-size: .65rem;
    font-weight: 600;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--ahq-gold, #c9a96e);
    margin: 0;
}

.ahq-popup-title {
    font-family: var(--font-display, 'Bodoni Moda', serif);
    font-size: clamp(1.6rem, 2.8vw, 2.1rem);
    font-weight: 400;
    line-height: 1.15;
    color: var(--ahq-text, #2c2420);
    margin: .1rem 0 0;
}

.ahq-popup-title em {
    font-style: italic;
    color: var(--ahq-gold, #c9a96e);
}

.ahq-popup-sub {
    font-family: var(--font-body, 'DM Sans', sans-serif);
    font-size: .8375rem;
    color: var(--ahq-text-secondary, #6b5f56);
    line-height: 1.6;
    margin: .1rem 0 .5rem;
}

/* ── Form ── */
.ahq-popup-form {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin-top: .15rem;
}

.ahq-popup-field-wrap {
    position: relative;
    margin-top: 0;
}

.ahq-popup-input {
    width: 100%;
    box-sizing: border-box;
    padding: .875rem 1.1rem;
    font-family: var(--font-body, 'DM Sans', sans-serif);
    font-size: .875rem;
    color: var(--ahq-text, #2c2420);
    background: #fff;
    border: 1px solid var(--ahq-border, #e0d8cf);
    border-radius: 3px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.ahq-popup-input::placeholder {
    color: var(--ahq-text-muted, #b0a49c);
}

.ahq-popup-input:focus {
    border-color: var(--ahq-gold, #c9a96e);
    box-shadow: 0 0 0 3px rgba(201,169,110,.14);
}

/* ── Error ── */
.ahq-popup-error {
    font-family: var(--font-body, 'DM Sans', sans-serif);
    font-size: .775rem;
    color: #b84040;
    margin: 0;
    padding: 0;
    line-height: 1.45;
    min-height: 0;
}

.ahq-popup-error:not([hidden]) {
    min-height: 1.25em;
}

/* ── Submit button ── */
.ahq-popup-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    margin-top: .1rem;
    padding: .95rem 1.5rem;
    background: var(--ahq-gold, #c9a96e);
    color: #fff;
    font-family: var(--font-body, 'DM Sans', sans-serif);
    font-size: .775rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background .2s, transform .15s;
    position: relative;
    overflow: hidden;
}

.ahq-popup-submit:hover:not(:disabled) {
    background: var(--ahq-gold-dark, #a8854a);
}

.ahq-popup-submit:active { transform: scale(.98); }

.ahq-popup-submit:disabled {
    opacity: .7;
    cursor: wait;
}

.ahq-popup-submit-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ahq-popup-spin .7s linear infinite;
    flex-shrink: 0;
}

.ahq-popup-submit.is-loading .ahq-popup-submit-label { opacity: .5; }
.ahq-popup-submit.is-loading .ahq-popup-submit-spinner { display: block; }

@keyframes ahq-popup-spin {
    to { transform: rotate(360deg); }
}

/* ── Note / Privacy ── */
.ahq-popup-note {
    font-family: var(--font-body, 'DM Sans', sans-serif);
    font-size: .7rem;
    color: var(--ahq-text-muted, #9a8e84);
    line-height: 1.5;
    margin: 0;
}

.ahq-popup-note a {
    color: var(--ahq-gold, #c9a96e);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ── Success state ── */
.ahq-popup-success-icon {
    color: var(--ahq-gold, #c9a96e);
    margin-bottom: .25rem;
}

.ahq-popup-coupon-wrap {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: var(--ahq-surface-alt, #f5f0e8);
    border: 1.5px dashed var(--ahq-gold, #c9a96e);
    border-radius: 4px;
    padding: .875rem 1.1rem;
    margin: .25rem 0;
}

.ahq-popup-coupon-code {
    font-family: var(--font-body, 'DM Sans', sans-serif);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: .18em;
    color: var(--ahq-text, #2c2420);
    flex: 1;
    user-select: all;
}

.ahq-popup-coupon-copy {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: var(--ahq-gold, #c9a96e);
    color: #fff;
    font-family: var(--font-body, 'DM Sans', sans-serif);
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background .2s;
    flex-shrink: 0;
}

.ahq-popup-coupon-copy:hover { background: var(--ahq-gold-dark, #a8854a); }
.ahq-popup-coupon-copy.is-copied { background: #5a8a5a; }

.ahq-popup-shop-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: .875rem 1.5rem;
    background: var(--ahq-text, #2c2420);
    color: #fff;
    font-family: var(--font-body, 'DM Sans', sans-serif);
    font-size: .775rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 3px;
    transition: background .2s;
}

.ahq-popup-shop-btn:hover { background: var(--ahq-gold, #c9a96e); }

/* ════════════════════════════════════════
   RESPONSIVE — Tablet (≤ 768px)
════════════════════════════════════════ */
@media (max-width: 768px) {
    .ahq-popup-card {
        grid-template-columns: 1fr;
        max-height: 90vh;
        width: min(480px, 95vw);
    }

    .ahq-popup-img-panel {
        height: 180px;
        min-height: 0;
    }

    .ahq-popup-img-badge {
        font-size: 2rem;
    }
}

/* ════════════════════════════════════════
   RESPONSIVE — Mobile (≤ 560px): Bottom Sheet
════════════════════════════════════════ */
@media (max-width: 560px) {
    .ahq-popup-wrap {
        align-items: flex-end;
        padding: 0;
    }

    .ahq-popup-card {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        transition: transform .4s cubic-bezier(.16,1,.3,1);
    }

    .ahq-popup-wrap.is-open .ahq-popup-card {
        transform: translateY(0);
    }

    /* Mobile: hide image, show only form */
    .ahq-popup-img-panel {
        display: none;
    }

    .ahq-popup-form-panel {
        padding: 2rem 1.5rem 2.5rem;
        padding-bottom: calc(2.5rem + env(safe-area-inset-bottom, 0px));
    }

    /* Drag handle indicator */
    .ahq-popup-form-panel::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: var(--ahq-border, #e0d8cf);
        border-radius: 2px;
        margin: 0 auto .75rem;
        flex-shrink: 0;
    }

    .ahq-popup-title {
        font-size: 1.65rem;
    }
}

/* ── Dark mode overrides ── */
.ahq-mode-dark .ahq-popup-form-panel {
    background: #1a1410;
}

.ahq-mode-dark .ahq-popup-title {
    color: #e8ddd4;
}

.ahq-mode-dark .ahq-popup-sub {
    color: rgba(255,255,255,.55);
}

.ahq-mode-dark .ahq-popup-input {
    background: #251e18;
    border-color: #3a3330;
    color: #e8ddd4;
}

.ahq-mode-dark .ahq-popup-coupon-wrap {
    background: #251e18;
}

.ahq-mode-dark .ahq-popup-coupon-code {
    color: #e8ddd4;
}

.ahq-mode-dark .ahq-popup-close {
    border-color: #3a3330;
    color: rgba(255,255,255,.45);
}

.ahq-mode-dark .ahq-popup-close:hover {
    color: #fff;
    background: #2c2420;
    border-color: #5a5250;
}
