/* ── Lead capture modal ──────────────────────────────────────────────────
   One interruption per session: desktop exit intent, or a 20s dwell on any
   device. Everything is scoped under .lead-modal so the component drops onto
   any page without reaching into that page's own styles.

   The sand canvas is the one value that is not already in the palette — it
   sits between --c-bone-light and --c-bone-mid — so it is declared here as a
   component token rather than pushed into :root for a single consumer. */

.lead-modal {
    --modal-canvas: #ece8e1;
    --modal-width: 480px;
    --modal-avatar: 48px;

    position: fixed;
    inset: 0;
    /* Over --z-header (100); the bar must not float on top of the dialog. */
    z-index: 200;
    display: grid;
    place-items: center;
    padding: var(--s-5);
    background: rgba(2, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s;
}

.lead-modal.is-open {
    opacity: 1;
    visibility: visible;
}

/* An author `display` beats the UA rule behind the hidden attribute, so the
   attribute has to be honoured explicitly or the dialog ships visible. */
.lead-modal[hidden] {
    display: none;
}

/* While the dialog is up the page behind it must not scroll under the
   backdrop. JS sets this on <body> rather than toggling overflow inline. */
body.lead-modal-open {
    overflow: hidden;
}

/* ── Dialog ──────────────────────────────────────────────────────────── */

.lead-modal__dialog {
    position: relative;
    width: 100%;
    max-width: var(--modal-width);
    /* Clips the lime ribbon into the top corner radius. */
    overflow: hidden;
    border-radius: var(--r-lg);
    background: var(--modal-canvas);
    box-shadow: 0 24px 60px rgba(2, 0, 0, 0.34);
    transform: translateY(12px) scale(0.985);
    transition: transform 0.28s ease;
}

.lead-modal.is-open .lead-modal__dialog {
    transform: none;
}

/* ── Top ribbon ──────────────────────────────────────────────────────── */
/* The phrase pair is printed four times — two identical halves — so one pass
   of translateX(-50%) returns the track to its starting frame with no seam,
   the same trick the client logo strip uses. */

.lead-modal__ribbon {
    overflow: hidden;
    background: var(--c-lime);
    border-bottom: 1px solid rgba(2, 0, 0, 0.12);
}

.lead-modal__ticker {
    display: flex;
    width: max-content;
    margin: 0;
    padding: 0;
    list-style: none;
    animation: lead-ticker 18s linear infinite;
}

.lead-modal__ticker li {
    flex: 0 0 auto;
    padding-block: 9px;
    font-size: var(--t-xs);
    font-weight: var(--w-medium);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--c-ink);
    white-space: nowrap;
}

/* The bullet is decoration between phrases, so it carries the spacing and
   stays out of the accessible name. */
.lead-modal__ticker li::after {
    content: "•";
    padding-inline: var(--s-3);
    opacity: 0.55;
}

@keyframes lead-ticker {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

/* ── Body ────────────────────────────────────────────────────────────── */

.lead-modal__body {
    position: relative;
    padding: var(--s-7) var(--s-6) var(--s-6);
    text-align: center;
}

.lead-modal__close {
    position: absolute;
    top: var(--s-4);
    right: var(--s-4);
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-round);
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: var(--t-lg);
    line-height: 1;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.lead-modal__close:hover {
    background: var(--c-bone-mid);
    border-color: var(--border-strong);
}

/* ── Avatar cluster ──────────────────────────────────────────────────── */
/* Real portraits, overlapped into a row. The ring is drawn in the canvas
   colour so each face reads as cut out of the card. */

.lead-modal__avatars {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: var(--s-5);
}

.lead-modal__avatars img,
.lead-modal__avatars span {
    flex: 0 0 auto;
    width: var(--modal-avatar);
    height: var(--modal-avatar);
    border-radius: var(--r-round);
    border: 3px solid var(--modal-canvas);
    margin-inline-start: -14px;
    object-fit: cover;
}

.lead-modal__avatars > :first-child {
    margin-inline-start: 0;
}

.lead-modal__avatars span {
    display: grid;
    place-items: center;
    background: var(--c-ink);
    color: var(--c-text-invert);
    font-size: var(--t-xs);
    font-weight: var(--w-medium);
}

/* ── Copy ────────────────────────────────────────────────────────────── */

.lead-modal__title {
    margin: 0 0 var(--s-3);
    font-family: var(--font-display);
    font-size: var(--t-2xl);
    font-weight: var(--w-regular);
    line-height: var(--lh-tight);
    color: var(--text-primary);
}

.lead-modal__lead {
    margin: 0 0 var(--s-5);
    font-size: var(--t-base);
    line-height: var(--lh-body);
    color: var(--text-secondary);
}

/* ── Form ────────────────────────────────────────────────────────────── */

.lead-modal__form {
    display: flex;
    gap: var(--s-2);
}

/* min-width:0 is what keeps a flex input from forcing the dialog wider than
   its track on a narrow screen. */
.lead-modal__input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 11px var(--s-4);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    background: var(--c-white);
    font-family: var(--font-ui);
    font-size: var(--t-base);
    color: var(--text-primary);
}

.lead-modal__input::placeholder {
    color: var(--text-muted);
}

.lead-modal__input:focus-visible {
    outline: 2px solid var(--c-ink);
    outline-offset: 1px;
}

.lead-modal__submit {
    flex: 0 0 auto;
    border: 0;
    cursor: pointer;
    font-family: var(--font-ui);
}

.lead-modal__submit[disabled] {
    opacity: 0.6;
    cursor: default;
}

.lead-modal__submit .pill__slash {
    color: var(--c-lime);
}

/* Off-screen, never focusable by pointer: a bot that fills it is rejected
   before the request is sent. */
.lead-modal__honey {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ── Status line ─────────────────────────────────────────────────────── */
/* Height is not reserved: the line only exists once there is something to
   announce, so the resting card keeps its proportions. */

.lead-modal__status {
    margin: var(--s-3) 0 0;
    font-size: var(--t-sm);
    line-height: var(--lh-snug);
}

.lead-modal__status:empty {
    display: none;
}

.lead-modal__status[data-state="ok"] {
    color: var(--c-ink-warm);
}

.lead-modal__status[data-state="error"] {
    color: #9a2b1e;
}

.lead-modal__fineprint {
    margin: var(--s-4) 0 0;
    font-size: var(--t-xs);
    color: var(--text-muted);
}

/* ── Narrow screens ──────────────────────────────────────────────────── */
/* At 390px and under the input and button cannot share a row and still hold
   a readable email, so the form stacks and the button goes full width. */

@media (max-width: 420px) {
    .lead-modal {
        --modal-avatar: 40px;
        padding: var(--s-4);
    }

    .lead-modal__body {
        padding: var(--s-6) var(--s-5) var(--s-5);
    }

    .lead-modal__title {
        font-size: var(--t-xl);
    }

    .lead-modal__form {
        flex-direction: column;
    }

    .lead-modal__submit {
        justify-content: center;
    }
}

/* ── Reduced motion ──────────────────────────────────────────────────── */
/* The ticker still reads, it just sits; the dialog appears without travel. */

@media (prefers-reduced-motion: reduce) {
    .lead-modal,
    .lead-modal__dialog {
        transition: none;
    }

    .lead-modal__ticker {
        animation: none;
    }

    .lead-modal__dialog {
        transform: none;
    }
}
