/**
 * Weekly Briefing Email Signup
 * Two variants share one form: .cct-signup--rail (inline, under the hook rail)
 * and .cct-signup--footer (full-width strip in the site footer). Uses the
 * dashboard's own surface/primary/border tokens so it reads as part of the UI.
 */

.cct-signup {
    box-sizing: border-box;
    font-family: inherit;
}
.cct-signup *,
.cct-signup *::before,
.cct-signup *::after {
    box-sizing: border-box;
}

/* ---- Rail variant: sits directly under the briefing band ---- */
.cct-signup--rail {
    max-width: 1320px;
    margin: 0 auto 20px;
    padding: 14px 20px;
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border, #e2e6ea);
    border-left: 3px solid var(--color-primary, #046BD2);
    border-radius: 12px;
}

.cct-signup__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
}

.cct-signup__copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.cct-signup__heading {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text, #1a1f24);
    line-height: 1.3;
}
.cct-signup__sub {
    font-size: 13px;
    color: var(--color-text-muted, #5a6570);
    line-height: 1.35;
}

/* ---- The form: one field + one button ---- */
.cct-signup__form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
    position: relative;
}
.cct-signup__email {
    flex: 1 1 200px;
    min-width: 0;
    height: 40px;
    padding: 0 12px;
    font-size: 15px;
    color: var(--color-text, #1a1f24);
    background: var(--color-surface-alt, #f4f7fa);
    border: 1px solid var(--color-border, #d5dbe1);
    border-radius: 8px;
    outline: none;
}
.cct-signup__email:focus {
    border-color: var(--color-primary, #046BD2);
    box-shadow: 0 0 0 2px rgba(4, 107, 210, 0.18);
}
.cct-signup__button {
    flex: 0 0 auto;
    height: 40px;
    padding: 0 18px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: var(--color-primary, #046BD2);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
    white-space: nowrap;
}
.cct-signup__button:hover { background: var(--color-primary-dark, #0357a8); }
.cct-signup__button:disabled { opacity: 0.6; cursor: default; }

/* Status line spans the full form width under the field/button row. */
.cct-signup__msg {
    flex: 1 0 100%;
    margin: 2px 0 0;
    font-size: 13px;
    line-height: 1.3;
    min-height: 0;
    color: var(--color-text-muted, #5a6570);
}
.cct-signup__msg:empty { display: none; }
.cct-signup__msg.is-error { color: #c0392b; }
.cct-signup__msg.is-success { color: #1e824c; font-weight: 600; }

/* After a successful signup, drop the input row, keep the confirmation. */
.cct-signup--done .cct-signup__email,
.cct-signup--done .cct-signup__button { display: none; }

/* ---- Footer variant: full-width strip ---- */
.cct-signup-footer-wrap {
    width: 100%;
    background: var(--color-surface-alt, #f4f7fa);
    border-top: 1px solid var(--color-border, #e2e6ea);
}
.cct-signup--footer {
    max-width: 900px;
    margin: 0 auto;
    padding: 22px 20px;
}
.cct-signup--footer .cct-signup__inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
}
.cct-signup--footer .cct-signup__copy { align-items: center; }
.cct-signup--footer .cct-signup__heading { font-size: 17px; }
.cct-signup--footer .cct-signup__form {
    width: 100%;
    max-width: 460px;
    justify-content: center;
}
.cct-signup--footer .cct-signup__msg { text-align: center; }

/* Accessible-hide label (theme may already define this, but be safe). */
.cct-signup .screen-reader-text {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

/* ---- Mobile ---- */
@media (max-width: 640px) {
    .cct-signup--rail {
        margin-left: 12px;
        margin-right: 12px;
        padding: 12px 14px;
    }
    .cct-signup__inner { flex-direction: column; align-items: stretch; }
    .cct-signup__form { width: 100%; }
    .cct-signup__email { flex: 1 1 100%; }
    .cct-signup__button { flex: 1 1 100%; }
}

/* ---- Dark theme ---- */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .cct-signup--rail {
        background: var(--color-surface, #1c2126);
        border-color: var(--color-border, #2c333a);
    }
    :root:not([data-theme="light"]) .cct-signup__email {
        background: var(--color-surface-alt, #252b31);
        color: var(--color-text, #e8ebee);
    }
    :root:not([data-theme="light"]) .cct-signup-footer-wrap {
        background: var(--color-surface-alt, #181d22);
        border-top-color: var(--color-border, #2c333a);
    }
}

/* ---- Honeypot ----
   Positioned off-screen rather than display:none — a naive form-filling bot
   skips display:none fields but happily fills a visible-to-the-DOM one. Also
   hidden from AT via aria-hidden + tabindex=-1 in the markup, so no real user
   can reach it by keyboard or screen reader. */
.cct-signup__hp {
    position: absolute !important;
    left: -9999px !important;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
