/* ============================================================
   Subscribe CTA block
   All selectors are scta-* scoped so they never touch the
   Download CTA (.dcf-*) or exit intent (#exitIntentModal) popups.
   ============================================================ */

.subscribe-cta-block,
.scta-dialog {
    --scta-primary:     #282837;
    --scta-primary-400: #A9A9AF;
    --scta-primary-600: #7E7E87;
    --scta-primary-800: #53535F;
    --scta-secondary:   #a8ffb0;
    --scta-border:      #d4d4d7;
    --scta-light-grey:  #EEEEEF;
    --scta-error:       #c0392b;
}

.subscribe-cta-block {
    width: 100%;
    box-sizing: border-box;
    color: var(--scta-primary);
}

/* The theme gives every <p> a padding-bottom; spacing here is set by margins. */
.subscribe-cta-block p,
.scta-dialog p,
.scta-dialog h2 { padding: 0; }

/* ---- Background presets ---- */
.scta-bg-white      { background-color: #ffffff; }
.scta-bg-light-grey { background-color: var(--scta-light-grey); }
.scta-bg-charcoal   { background-color: var(--scta-primary); color: #ffffff; }
.scta-bg-mint       { background-color: var(--scta-secondary); }

/* ---- Padding presets ----
   Deliberately tighter than the 4rem/6rem used by full sections: this is a
   compact CTA banner that usually sits mid-article. */
.scta-pad-standard { padding-top: 2rem; padding-bottom: 2rem; }
.scta-pad-large    { padding-top: 3rem; padding-bottom: 3rem; }
@media (min-width: 768px) {
    .scta-pad-standard { padding-top: 2.25rem; padding-bottom: 2.25rem; }
    .scta-pad-large    { padding-top: 3.5rem; padding-bottom: 3.5rem; }
}

/* ---- Inner container ---- */
.scta-inner {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    box-sizing: border-box;
}

/* ---- Layout: contained ----
   On mobile the banner breaks out of the article's side padding and runs
   edge to edge (same 100vw technique as full-width), so the card isn't
   squeezed into a narrow column. Rounded corners only from 768px.

   The blog post template clips #post-content on mobile
   (css/transitional-post-style.css), which would cut the breakout off. On
   pages containing this block that clip moves out to #site, so wide content
   is still cropped (at the screen edge, not the column edge) and the page
   can't scroll sideways. overflow-x: clip rather than hidden so sticky
   elements keep working. Browsers without :has() or overflow clip keep the
   original behaviour: banner inside the column, original clipping intact. */
@media (max-width: 767px) {
    .scta-layout--contained {
        margin-top: 2rem;
        margin-bottom: 2rem;
    }
    @supports selector(:has(*)) and (overflow-x: clip) {
        #site:has(.scta-layout--contained),
        #site:has(.scta-layout--full-width) {
            overflow-x: clip;
        }
        #post-content:has(.scta-layout--contained),
        #post-content:has(.scta-layout--full-width) {
            overflow: visible;
        }
        .scta-layout--contained {
            width: 100vw;
            position: relative;
            left: 50%;
            transform: translateX(-50%);
        }
        .editor-styles-wrapper .scta-layout--contained {
            width: 100%;
            position: static;
            left: auto;
            transform: none;
        }
    }
}
@media (min-width: 768px) {
    .scta-layout--contained {
        border-radius: 1.5rem;
        margin-top: 3.5rem;
        margin-bottom: 3.5rem;
    }
}

/* ---- Layout: full-width breakout ---- */
.scta-layout--full-width {
    width: 100vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}
.scta-layout--full-width .scta-inner {
    max-width: 88rem;
    padding-left: 2rem;
    padding-right: 2rem;
}
.editor-styles-wrapper .scta-layout--full-width {
    width: 100%;
    position: static;
    left: auto;
    transform: none;
}

/* ============================================================
   Banner card
   ============================================================ */
.scta-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: center;
    text-align: left;
}

.scta-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(40, 40, 55, 0.08);
    color: var(--scta-primary);
}
.scta-bg-white .scta-icon,
.scta-bg-light-grey .scta-icon { background: rgba(168, 255, 176, 0.55); }
.scta-bg-charcoal .scta-icon   { background: rgba(255, 255, 255, 0.1); color: var(--scta-secondary); }

.scta-content { min-width: 0; }

.subscribe-cta-block .scta-eyebrow {
    margin: 0 0 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--scta-primary-800);
}
.scta-bg-charcoal .scta-eyebrow { color: var(--scta-secondary); }

.subscribe-cta-block .scta-heading {
    margin: 0;
    padding: 0;
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.015em;
    color: inherit;
}

.subscribe-cta-block .scta-text {
    margin: 0.375rem 0 0;
    font-size: 0.9375rem;
    line-height: 1.5;
    max-width: 40rem;
    color: var(--scta-primary-800);
}
.scta-bg-charcoal .scta-text { color: rgba(255, 255, 255, 0.78); }

.subscribe-cta-block .scta-points {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem 1rem;
    margin: 0.75rem 0 0;
    padding: 0;
    list-style: none;
}
.subscribe-cta-block .scta-points li {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    font-size: 0.875rem;
    font-weight: 500;
}
.scta-points svg { flex-shrink: 0; }
.scta-bg-charcoal .scta-points svg { color: var(--scta-secondary); }

.scta-action {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
}

.subscribe-cta-block .scta-note {
    margin: 0;
    font-size: 0.8125rem;
    text-align: center;
    color: var(--scta-primary-800);
}
.scta-bg-charcoal .scta-note { color: rgba(255, 255, 255, 0.7); }

/* ---- Button (banner + dialog "Done") ---- */
.scta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 46px;
    padding: 0.625rem 1.375rem;
    border: 0;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    background: var(--scta-primary);
    color: #ffffff;
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}
.scta-btn:hover { background: #3a3a4d; }
.scta-btn:active { transform: translateY(1px); }
.scta-btn:focus { outline: none; }
.scta-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px #ffffff, 0 0 0 5px var(--scta-primary);
}
.scta-btn svg { transition: transform 0.2s ease; }
.scta-btn:hover svg { transform: translateX(3px); }

.scta-bg-charcoal .scta-btn {
    background: var(--scta-secondary);
    color: var(--scta-primary);
}
.scta-bg-charcoal .scta-btn:hover { background: #c4ffca; }
.scta-bg-charcoal .scta-btn:focus-visible {
    box-shadow: 0 0 0 3px var(--scta-primary), 0 0 0 5px var(--scta-secondary);
}

.scta-btn--block { width: 100%; }

/* ---- Tablet / desktop ---- */
@media (min-width: 768px) {
    .scta-card {
        grid-template-columns: auto 1fr auto;
        gap: 1.5rem;
    }
    .scta-icon {
        width: 52px;
        height: 52px;
        border-radius: 14px;
        align-self: start;
    }
    .scta-layout--contained .scta-inner {
        padding-left: 2.25rem;
        padding-right: 2.25rem;
    }
    .subscribe-cta-block .scta-heading { font-size: 1.625rem; }
    .scta-action { min-width: 12rem; }
}

/* ============================================================
   Dialog (native <dialog>, rendered in the top layer)
   ============================================================ */
html.scta-dialog-open { overflow: hidden; }

.scta-dialog {
    box-sizing: border-box;
    width: min(480px, calc(100% - 2rem));
    max-width: 480px;
    max-height: calc(100dvh - 2rem);
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 1rem;
    overflow: hidden;
    background: #ffffff;
    color: var(--scta-primary);
    box-shadow: 0 32px 64px -12px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.04);
}
.scta-dialog[open] {
    display: flex;
    flex-direction: column;
    animation: scta-dialog-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.scta-dialog::backdrop {
    background: rgba(30, 32, 42, 0.7);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

/* Fallback for browsers without showModal() */
.scta-dialog.scta-dialog--fallback[open] {
    position: fixed;
    inset: 0;
    z-index: 100000;
    box-shadow: 0 0 0 100vmax rgba(30, 32, 42, 0.7);
}

@keyframes scta-dialog-in {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.scta-dialog-accent {
    flex-shrink: 0;
    height: 4px;
    background: var(--scta-secondary);
}

.scta-dialog-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: var(--scta-light-grey);
    color: var(--scta-primary-800);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.scta-dialog-close:hover { background: #e2e2e5; color: var(--scta-primary); }
.scta-dialog-close:focus { outline: none; }
.scta-dialog-close:focus-visible { box-shadow: 0 0 0 3px var(--scta-primary); }

.scta-dialog-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 2rem 1.75rem 1.75rem;
}

.scta-panel[hidden] { display: none; }

.scta-dialog-icon,
.scta-success-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(168, 255, 176, 0.55);
    color: var(--scta-primary);
}
.scta-success-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--scta-secondary);
}

.scta-dialog .scta-dialog-title {
    margin: 0 3rem 0.4rem 0;
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.015em;
    color: var(--scta-primary);
}
.scta-dialog .scta-dialog-desc {
    margin: 0 0 1.25rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--scta-primary-800);
}
.scta-panel--success { text-align: center; }
.scta-panel--success:focus { outline: none; }
.scta-panel--success .scta-success-icon { margin: 0.5rem auto 1rem; }
.scta-panel--success .scta-dialog-title { margin-right: 0; }

.scta-privacy {
    margin: 1rem 0 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--scta-primary-600);
}
.scta-privacy a {
    color: var(--scta-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ---- Mobile: bottom sheet ---- */
@media (max-width: 639px) {
    .scta-dialog {
        width: 100%;
        max-width: 100%;
        max-height: 90dvh;
        margin: auto 0 0;
        border-radius: 1.25rem 1.25rem 0 0;
    }
    .scta-dialog[open] { animation-name: scta-sheet-in; }
    .scta-dialog-body {
        padding: 1.75rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom));
    }
}
@keyframes scta-sheet-in {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .scta-dialog[open] { animation: none; }
    .scta-btn,
    .scta-btn svg { transition: none; }
    .scta-btn:hover svg { transform: none; }
}

/* ============================================================
   Contact Form 7 inside the dialog
   Targets element types rather than per-form classes, so the
   form looks right whatever markup is in the CF7 admin.
   ============================================================ */
/* One consistent vertical rhythm: the form is a flex column with a gap, and
   CF7's auto-inserted <p>/<br> wrappers carry no spacing of their own. */
.scta-form .wpcf7-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.scta-form .wpcf7-form p { margin: 0; padding: 0; } /* theme adds p padding-bottom */
.scta-form .wpcf7-form br { display: none; }

/* Non-visual wrappers must not take a gap slot: CF7's hidden-field fieldset,
   the hidden UTM/tracking block, and the honeypot's <p> (its field is hidden
   by the honeypot plugin, but the <p> around it isn't). */
.scta-form .wpcf7-form > fieldset.hidden-fields-container,
.scta-form .wpcf7-form > [hidden],
.scta-form .wpcf7-form > p:has(> span[id^="wpcf7-"][id$="-wrapper"]) {
    display: none;
}
.scta-form .wpcf7-form > .wpcf7-response-output:empty { display: none; }

.scta-form label,
.scta-form .scta-cf7-label {
    display: block;
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--scta-primary);
}

.scta-form .wpcf7-form-control-wrap { display: block; }
.scta-form label > .wpcf7-form-control-wrap { margin-top: 0.375rem; }

/* First / last name side by side (wrap them in <div class="scta-cf7-row"> in the
   CF7 form). CF7 may wrap both labels in a single <p>, so that <p> is flattened
   with display: contents and the labels become the grid items. Stacks on
   narrow phones. */
.scta-form .scta-cf7-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem 0.75rem;
}
.scta-form .scta-cf7-row > p { display: contents; }
@media (min-width: 340px) {
    .scta-form .scta-cf7-row { grid-template-columns: 1fr 1fr; }
}
.scta-form .scta-cf7-row label { min-width: 0; }

.scta-form input[type="email"],
.scta-form input[type="text"] {
    box-sizing: border-box;
    width: 100%;
    min-height: 48px;
    margin: 0;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--scta-border);
    border-radius: 0.5rem;
    background: #ffffff;
    color: var(--scta-primary);
    font-size: 16px; /* 16px stops iOS zooming on focus */
    line-height: 1.4;
    box-shadow: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.scta-form input[type="email"]::placeholder,
.scta-form input[type="text"]::placeholder { color: var(--scta-primary-400); }
.scta-form input[type="email"]:focus,
.scta-form input[type="text"]:focus {
    outline: none;
    border-color: var(--scta-primary);
    box-shadow: 0 0 0 3px rgba(168, 255, 176, 0.7);
}
.scta-form .wpcf7-not-valid {
    border-color: var(--scta-error) !important; /* beats CF7's own rule */
}
.scta-form .wpcf7-not-valid-tip {
    margin-top: 0.35rem;
    font-size: 0.8125rem;
    color: var(--scta-error);
}

/* Acceptance / consent checkbox */
.scta-form .wpcf7-acceptance .wpcf7-list-item {
    display: block;
    margin: 0;
}
.scta-form .wpcf7-acceptance label {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin: 0;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.45;
    color: var(--scta-primary-800);
    cursor: pointer;
}
.scta-form .wpcf7-acceptance input[type="checkbox"] {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin: 0.1rem 0 0;
    accent-color: var(--scta-primary);
    cursor: pointer;
}

/* Submit */
.scta-form .wpcf7-submit,
.scta-form input[type="submit"] {
    display: block;
    width: 100%;
    min-height: 48px;
    margin: 0.25rem 0 0; /* plus the form gap: a touch more air above the CTA */
    padding: 0.75rem 1.5rem;
    border: 0;
    border-radius: 0.5rem;
    background: var(--scta-primary);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}
.scta-form .wpcf7-submit:hover { background: #3a3a4d; }
.scta-form .wpcf7-submit:focus { outline: none; }
.scta-form .wpcf7-submit:focus-visible { box-shadow: 0 0 0 3px #ffffff, 0 0 0 5px var(--scta-primary); }
.scta-form .wpcf7-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.scta-form .wpcf7-form.submitting .wpcf7-submit { opacity: 0.7; cursor: progress; }

.scta-form .wpcf7-spinner {
    display: block;
    margin: 0.75rem auto 0;
}
.scta-form .wpcf7-form:not(.submitting) .wpcf7-spinner { display: none; }

.scta-form .wpcf7 form .wpcf7-response-output {
    margin: 1rem 0 0;
    padding: 0.75rem 1rem;
    border-width: 1px;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.45;
}
/* The success panel replaces CF7's generic "sent" message */
.scta-form .wpcf7 form.sent .wpcf7-response-output { display: none; }

/* ============================================================
   Top bar announcement "Sign up" button
   (template-parts/header/site-header.php). Small pill CTA that
   sits on the same line as the announcement copy.
   Mint pill by default; charcoal pill when the bar itself is mint.
   ============================================================ */
.sf-topbar-subscribe-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin: 0 0 0 0.625rem;
    padding: 0.25rem 0.75rem;
    border: 0;
    border-radius: 999px;
    background: #a8ffb0;
    color: #282837;
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.sf-topbar-subscribe-btn:hover { background: #8ef598; }
.sf-topbar-subscribe-btn svg { flex-shrink: 0; transition: transform 0.2s ease; }
.sf-topbar-subscribe-btn:hover svg { transform: translateX(2px); }
.sf-topbar-subscribe-btn:focus { outline: none; }
.sf-topbar-subscribe-btn:focus-visible {
    outline: 2px solid #282837;
    outline-offset: 2px;
}
#top-bar-announcement[data-sf-topbar-bg="mint"] .sf-topbar-subscribe-btn {
    background: #282837;
    color: #ffffff;
}
#top-bar-announcement[data-sf-topbar-bg="mint"] .sf-topbar-subscribe-btn:hover { background: #3a3a4d; }
#top-bar-announcement[data-sf-topbar-bg="charcoal"] .sf-topbar-subscribe-btn:focus-visible,
#top-bar-announcement[data-sf-topbar-bg="purple"] .sf-topbar-subscribe-btn:focus-visible {
    outline-color: #ffffff;
}
@media (prefers-reduced-motion: reduce) {
    .sf-topbar-subscribe-btn,
    .sf-topbar-subscribe-btn svg { transition: none; }
    .sf-topbar-subscribe-btn:hover svg { transform: none; }
}

/* The announcement WYSIWYG content is wrapped in <p>s; when the button is shown,
   let them flow inline so the button sits on the same line as the copy, in
   regular weight (the template wraps it in <strong>). The wrapper's pt-4 offsets
   the theme's <p> padding-bottom, so drop both together to keep the copy
   vertically centred in a slim bar. */
#top-bar-announcement:has(.sf-topbar-subscribe-btn) {
    height: auto;
    min-height: 3rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    font-size: 0.9375rem;
    line-height: 1.6;
}
#top-bar-announcement .wrapper:has(.sf-topbar-subscribe-btn) { padding-top: 0; }
#top-bar-announcement strong:has(.sf-topbar-subscribe-btn) { font-weight: 400; }
#top-bar-announcement strong:has(.sf-topbar-subscribe-btn) > p {
    display: inline;
    margin: 0;
    padding: 0;
}
