/* ===========================================================================
   How To Bachelor — Newsletter signup ([h2b-signup] + popup + post CTA)
   Palette: Dark Charcoal #2d3748 · Warm Tan #c17943 · Deep Slate #1a202c
   Styles:  card (default) | inline | popup
   =========================================================================== */

.h2b-ns,
.h2b-ns *,
.h2b-ns *::before,
.h2b-ns *::after {
    box-sizing: border-box;
}

.h2b-ns {
    --h2b-charcoal:  #2d3748;
    --h2b-slate:     #1a202c;
    --h2b-tan:       #c17943;
    --h2b-tan-2:     #a86435;
    --h2b-border:    #e2e8f0;
    --h2b-gray:      #718096;
    --h2b-bg:        #ffffff;

    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--h2b-charcoal);
    line-height: 1.5;
    margin: 2rem 0;
}

.h2b-ns h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    color: var(--h2b-charcoal);
    line-height: 1.2;
    margin: 0;
    letter-spacing: -0.01em;
}

/* ---------- CARD (end-of-post CTA — matches screenshot exactly) ---------- */
.h2b-ns--card {
    max-width: 700px;
    margin: 3rem auto;
    padding: 2rem 1.5rem;
    text-align: center;
    background: transparent;
    border-left: 4px solid var(--h2b-tan);
    padding-left: 1.75rem;
}

.h2b-ns--card .h2b-ns__title {
    font-size: 1.75rem;
    margin: 0 0 0.5rem 0;
}

.h2b-ns--card .h2b-ns__sub {
    color: var(--h2b-gray);
    margin: 0 0 1.25rem 0;
    font-size: 1rem;
}

/* End-of-post wrapper: gives the CTA breathing room after the article */
.h2b-post-end-cta {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--h2b-border);
}
.h2b-post-end-cta .h2b-ns--card {
    margin-top: 0;
}

/* ---------- INLINE (compact) ---------- */
.h2b-ns--inline {
    margin: 1rem 0;
}

/* ---------- FORM ---------- */
.h2b-ns__form {
    display: flex;
    gap: 0.5rem;
    max-width: 520px;
    margin: 0 auto;
}

.h2b-ns__email {
    flex: 1 1 auto;
    min-width: 0;
    font-family: inherit;
    font-size: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--h2b-border);
    border-radius: 6px;
    background: #f7fafc;
    color: var(--h2b-charcoal);
    transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.h2b-ns__email::placeholder {
    color: #a0aec0;
}

.h2b-ns__email:focus {
    outline: none;
    border-color: var(--h2b-tan);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(193, 121, 67, 0.18);
}

.h2b-ns__btn {
    flex: 0 0 auto;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    background: var(--h2b-charcoal);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: background 150ms ease, transform 120ms ease;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.h2b-ns__btn:hover {
    background: var(--h2b-slate);
    transform: translateY(-1px);
}

.h2b-ns__btn:focus-visible {
    outline: 3px solid rgba(45, 55, 72, 0.35);
    outline-offset: 2px;
}

.h2b-ns__btn[disabled] {
    opacity: 0.6;
    cursor: progress;
    transform: none;
}

.h2b-ns__msg {
    margin: 0.75rem 0 0 0;
    min-height: 1.25rem;
    font-size: 0.88rem;
    color: var(--h2b-tan-2);
    text-align: center;
}

.h2b-ns__msg.is-success {
    color: #2f6f3a;
}

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

@media (max-width: 560px) {
    .h2b-ns__form {
        flex-direction: column;
    }
    .h2b-ns__btn {
        width: 100%;
    }
    .h2b-ns--card {
        padding-left: 1.25rem;
    }
    .h2b-ns--card .h2b-ns__title {
        font-size: 1.4rem;
    }
}

/* ===========================================================================
   POPUP
   Dark charcoal panel with tan accent — cleaner take on the reference screenshot.
   =========================================================================== */
.h2b-popup {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

.h2b-popup.is-open {
    display: flex;
    animation: h2bPopupFade 260ms ease-out;
}

@keyframes h2bPopupFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.h2b-popup__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 32, 44, 0.72);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    cursor: pointer;
}

.h2b-popup__panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    background: #2d3748;
    color: #f7fafc;
    border-radius: 14px;
    padding: 1.75rem 1.75rem 1.1rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    animation: h2bPopupRise 320ms cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

@keyframes h2bPopupRise {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.h2b-popup__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #f7fafc;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms ease, transform 150ms ease;
}

.h2b-popup__close:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: rotate(90deg);
}

.h2b-popup__close:focus-visible {
    outline: 2px solid #c17943;
    outline-offset: 2px;
}

.h2b-popup__mark {
    width: 84px;
    height: 84px;
    margin: 0 auto 0.65rem;
}

.h2b-popup__mark img,
.h2b-popup__mark svg {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.h2b-popup__title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: #ffffff;
    margin: 0 0 0.4rem 0;
    text-wrap: balance;
}

.h2b-popup__sub {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #cbd5e0;
    margin: 0 auto 1rem;
    max-width: 320px;
    text-wrap: balance;
}

/* Popup-specific form overrides */
.h2b-ns--popup {
    margin: 0;
    color: #f7fafc;
}

.h2b-ns--popup .h2b-ns__form {
    flex-direction: column;
    gap: 0.5rem;
    max-width: none;
}

.h2b-ns--popup .h2b-ns__email {
    background: rgba(255, 255, 255, 0.94);
    border-color: transparent;
    color: #2d3748;
    padding: 0.7rem 1rem;
    border-radius: 999px;
    font-size: 0.95rem;
}

.h2b-ns--popup .h2b-ns__email:focus {
    background: #fff;
    box-shadow: 0 0 0 3px rgba(193, 121, 67, 0.5);
}

.h2b-ns--popup .h2b-ns__btn {
    background: #c17943;
    color: #2d3748;
    padding: 0.7rem 1.25rem;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 700;
    width: 100%;
}

.h2b-ns--popup .h2b-ns__btn:hover {
    background: #d18a54;
    transform: translateY(-1px);
}

.h2b-ns--popup .h2b-ns__msg {
    color: #f6c58f;
}

.h2b-ns--popup .h2b-ns__msg.is-success {
    color: #9ae6b4;
}

.h2b-popup__legal {
    margin: 0.9rem -1.75rem -1.1rem;
    padding: 0.6rem 1.75rem;
    font-size: 0.72rem;
    color: #a0aec0;
    background: #1a202c;
    border-radius: 0 0 14px 14px;
    font-style: italic;
}

.h2b-popup__legal a {
    color: #c17943;
    text-decoration: none;
}

.h2b-popup__legal a:hover {
    color: #d18a54;
    text-decoration: underline;
}

/* Prevent body scroll when popup open */
html.h2b-popup-open,
body.h2b-popup-open {
    overflow: hidden;
}

@media (max-width: 480px) {
    .h2b-popup__panel {
        padding: 1.5rem 1.25rem 0.9rem;
        border-radius: 12px;
    }
    .h2b-popup__title {
        font-size: 1.2rem;
    }
    .h2b-popup__mark {
        width: 72px;
        height: 72px;
    }
    .h2b-popup__legal {
        margin: 0.8rem -1.25rem -0.9rem;
        padding: 0.55rem 1.25rem;
        border-radius: 0 0 12px 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .h2b-popup.is-open,
    .h2b-popup__panel {
        animation: none;
    }
    .h2b-popup__close:hover {
        transform: none;
    }
}
