/* Sapience newsletter — running strip, subscribe dialog and inline banner.
   Uses the site tokens (--bg, --text …) so it follows the dark/light theme. */

:root { --strip-h: 0px; }
:root.has-strip { --strip-h: 40px; }
/* reserve the strip's space from the first paint so inserting it later causes no layout shift */
html.has-strip:not(.strip-ready) body::before { content: ''; display: block; flex: none; height: 40px; }

/* ── Running strip ─────────────────────────────────────────── */
.nl-strip {
    position: relative;
    z-index: 70;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 40px;
    padding: 0 8px 0 0;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(90deg, #b8136f 0%, #7d2192 52%, #1f5fa8 100%);
    font-family: var(--font-body, 'DM Sans', system-ui, sans-serif);
    font-size: 13px;
    flex: none;
}
.nl-strip[hidden] { display: none; }
.nl-strip__viewport {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
}
.nl-strip__track {
    display: flex;
    width: max-content;
    animation: nl-run 46s linear infinite;
    will-change: transform;
}
.nl-strip:hover .nl-strip__track, .nl-strip:focus-within .nl-strip__track { animation-play-state: paused; }
.nl-strip__set { display: flex; align-items: center; flex: none; }
.nl-strip__item { display: inline-flex; align-items: center; gap: 10px; padding-right: 28px; white-space: nowrap; letter-spacing: 0.01em; }
.nl-strip__item b { font-weight: 700; }
.nl-strip__item::after { content: ''; width: 5px; height: 5px; margin-left: 18px; border-radius: 50%; background: rgba(255, 255, 255, 0.6); }
.nl-strip__tag { font-family: var(--font-mono, monospace); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.18); }
@keyframes nl-run { to { transform: translateX(-50%); } }

.nl-strip__cta {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: #5a1670;
    font: 700 12.5px/1 var(--font-body, 'DM Sans', sans-serif);
    cursor: pointer;
    transition: transform 0.25s, box-shadow 0.25s;
}
.nl-strip__cta:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.5); }
.nl-strip__x {
    flex: none;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
}
.nl-strip__x:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }
.nl-strip :focus-visible, .nl-dialog :focus-visible, .nl-banner :focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.nl-banner :focus-visible, .nl-dialog :focus-visible { outline-color: #e91e8c; }

/* ── Dialog ────────────────────────────────────────────────── */
.nl-dialog {
    width: min(460px, calc(100vw - 32px));
    padding: 0;
    border: 1px solid var(--border2, rgba(255, 255, 255, 0.14));
    border-radius: 24px;
    background: var(--bg2, #0d0d10);
    color: var(--text, #ededf0);
    box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.7);
    font-family: var(--font-body, 'DM Sans', sans-serif);
}
.nl-dialog::backdrop { background: rgba(4, 3, 10, 0.66); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.nl-dialog[open] { animation: nl-pop 0.45s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes nl-pop { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
.nl-dialog__inner { position: relative; padding: 34px 30px 28px; }
.nl-dialog__close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
    border-radius: 50%;
    background: transparent;
    color: var(--text2, rgba(237, 237, 240, 0.7));
    cursor: pointer;
}
.nl-dialog__close:hover { color: var(--text, #fff); border-color: var(--border2, rgba(255, 255, 255, 0.2)); }
.nl-kicker { margin: 0 0 12px; font-family: var(--font-mono, monospace); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: #e91e8c; }
.nl-title { margin: 0 0 10px; font-family: var(--font-display, 'Instrument Serif', serif); font-weight: 400; font-size: clamp(1.9rem, 5vw, 2.4rem); line-height: 1.05; letter-spacing: -0.02em; }
.nl-title em { font-style: italic; background: linear-gradient(90deg, #e91e8c, #9b2fad, #2d7dd2); -webkit-background-clip: text; background-clip: text; color: transparent; padding-right: 0.06em; }
.nl-sub { margin: 0 0 20px; font-size: 0.95rem; line-height: 1.6; color: var(--text2, rgba(237, 237, 240, 0.7)); }

/* ── Form (shared by dialog + banner) ──────────────────────── */
.nl-form { display: flex; flex-direction: column; gap: 10px; }
.nl-field { display: flex; align-items: center; gap: 6px; padding: 5px; border: 1px solid var(--border2, rgba(255, 255, 255, 0.14)); border-radius: 999px; background: var(--bg, #060608); transition: border-color 0.25s, box-shadow 0.25s; }
.nl-field:focus-within { border-color: #e91e8c; box-shadow: 0 0 0 4px rgba(233, 30, 140, 0.16); }
.nl-field input { flex: 1 1 auto; min-width: 0; padding: 0 8px 0 18px; border: 0; outline: 0; background: transparent; color: var(--text, #ededf0); font: 400 16px/1.2 var(--font-body, 'DM Sans', sans-serif); height: 44px; }
.nl-field input::placeholder { color: var(--text3, rgba(237, 237, 240, 0.5)); }
.nl-btn {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 22px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #e91e8c, #9b2fad, #2d7dd2);
    color: #fff;
    font: 700 0.95rem/1 var(--font-body, 'DM Sans', sans-serif);
    cursor: pointer;
    box-shadow: 0 12px 28px -12px rgba(233, 30, 140, 0.7);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), filter 0.2s;
}
.nl-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.nl-btn:disabled { opacity: 0.7; cursor: progress; transform: none; }
.nl-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.nl-note { margin: 4px 2px 0; font-size: 12px; line-height: 1.5; color: var(--text3, rgba(237, 237, 240, 0.5)); }
.nl-msg { margin: 0; min-height: 0; font-size: 13px; line-height: 1.45; color: var(--text2, #bbb); }
.nl-msg.is-err { color: #ff6b8e; }
[data-theme="light"] .nl-msg.is-err { color: #c0204b; }
.nl-success { text-align: center; padding: 8px 0 4px; }
.nl-success svg { width: 52px; height: 52px; margin: 0 auto 14px; display: block; }
.nl-success h3 { margin: 0 0 8px; font-family: var(--font-display, serif); font-weight: 400; font-size: 1.9rem; letter-spacing: -0.02em; }
.nl-success p { margin: 0; color: var(--text2, #bbb); font-size: 0.95rem; line-height: 1.6; }

/* ── Inline banner ─────────────────────────────────────────── */
.nl-banner { position: relative; max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 32px); }
.nl-banner__card {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: clamp(24px, 4vw, 56px);
    align-items: center;
    padding: clamp(28px, 4.5vw, 52px);
    border: 1px solid var(--border2, rgba(255, 255, 255, 0.12));
    border-radius: 28px;
    overflow: hidden;
    background:
        radial-gradient(60% 120% at 0% 0%, rgba(233, 30, 140, 0.2), transparent 60%),
        radial-gradient(60% 120% at 100% 100%, rgba(45, 125, 210, 0.22), transparent 60%),
        var(--bg2, #0d0d10);
}
[data-theme="light"] .nl-banner__card {
    background:
        radial-gradient(60% 120% at 0% 0%, rgba(233, 30, 140, 0.14), transparent 60%),
        radial-gradient(60% 120% at 100% 100%, rgba(45, 125, 210, 0.16), transparent 60%),
        var(--bg2, #fff);
}
.nl-banner .nl-title { font-size: clamp(2rem, 4.2vw, 3.2rem); }
.nl-banner .nl-sub { margin-bottom: 0; max-width: 46ch; }
.nl-perks { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 18px 0 0; padding: 0; list-style: none; font-family: var(--font-mono, monospace); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text2, #bbb); }
.nl-perks li::before { content: '✓'; margin-right: 7px; color: #e91e8c; }
@media (max-width: 820px) {
    .nl-banner__card { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
    .nl-strip__cta { padding: 0 11px; }
    .nl-field { flex-direction: column; align-items: stretch; border-radius: 22px; padding: 6px; gap: 6px; }
    .nl-field input { padding: 0 14px; }
    .nl-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .nl-strip__track { animation: none; width: auto; }
    .nl-strip__set[aria-hidden="true"] { display: none; }
    .nl-strip__viewport { -webkit-mask-image: none; mask-image: none; }
    .nl-dialog[open] { animation: none; }
}
