/* ==========================================================================
   CUPA newsletter: footer sign-up band, landing page, status pages, archive
   and the polite pop-up. Uses the tokens from site.css. Everything works
   without JavaScript; newsletter.js only enhances the forms and runs the
   pop-up.
   ========================================================================== */

.nl-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.nl-eyebrow {
  display: inline-flex; align-items: center; gap: 0.5em;
  margin-bottom: 0.7rem;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent-soft);
}
.nl-eyebrow svg { flex-shrink: 0; }
.nl-eyebrow-dark { color: var(--accent-dark); }
.nl-optional { font-weight: 400; letter-spacing: 0; text-transform: none; opacity: 0.85; }

/* ------------------------------------------------------------ Form (shared) */

.nl-form { position: relative; }
.nl-row { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) auto; gap: 0.75rem; align-items: end; }
.nl-field label {
  display: block; margin-bottom: 0.4em;
  font-size: 0.7rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase;
}
.nl-field input, .nl-form textarea {
  width: 100%; min-height: 46px; padding: 0.7em 0.85em;
  font: 1rem var(--font); color: var(--text);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
}
.nl-field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.nl-field input[aria-invalid="true"] { border-color: var(--danger); }
.nl-error { margin: 0.35em 0 0; font-size: 0.85rem; color: var(--danger); }

.nl-submit {
  min-height: 46px; padding: 0.7em 1.5em;
  font: 600 0.95rem var(--font); letter-spacing: 0.01em; color: #fff;
  background: var(--accent); border: 1px solid var(--accent); border-radius: var(--radius);
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s ease;
}
.nl-submit:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.nl-submit:focus-visible { outline: 2px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 4px var(--accent); }
.nl-submit[disabled] { opacity: 0.7; cursor: progress; }

.nl-topics { margin: 1rem 0 0; padding: 0; border: 0; min-width: 0; }
.nl-topics legend { padding: 0; margin-bottom: 0.55rem; font-size: 0.7rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.nl-topics-hint { margin: 0 0 0.55rem; font-size: 0.82rem; color: var(--muted); }
.nl-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.nl-chip { position: relative; display: inline-flex; cursor: pointer; }
.nl-chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.nl-chip span {
  display: inline-flex; align-items: center; gap: 0.4em;
  padding: 0.38em 0.8em;
  font-size: 0.82rem; line-height: 1.3;
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink); background: var(--paper);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.nl-chip span::before {
  content: ""; width: 0.75em; height: 0.75em; flex-shrink: 0;
  border: 1.5px solid currentColor; border-radius: 50%; opacity: 0.55;
}
.nl-chip:hover span { border-color: var(--accent); }
.nl-chip input:checked + span { background: #EFEAF5; border-color: var(--accent); color: var(--accent-dark); }
.nl-chip input:checked + span::before {
  opacity: 1; border: 0; border-radius: 50%;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 6.2l2 2 4-4.4' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
}
.nl-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.nl-fineprint { margin: 0.9rem 0 0; font-size: 0.78rem; line-height: 1.5; color: var(--muted); }
.nl-fineprint a { text-decoration: underline; text-underline-offset: 2px; }
.nl-status:empty { display: none; }
.nl-status { margin: 0.8rem 0 0; padding: 0.6em 0.85em; font-size: 0.9rem; border-radius: var(--radius); border-left: 3px solid var(--danger); background: #F7E9E9; color: var(--danger); }

/* Success panel that replaces a form after an enhanced (JS) submission. */
.nl-done { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.9rem; align-items: start; padding: 1.1rem 1.2rem; border-radius: var(--radius); background: #EFEAF5; border-left: 3px solid var(--accent); color: var(--text); }
.nl-done:focus { outline: none; }
.nl-done-icon { grid-row: span 2; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; }
.nl-done h3 { margin: 0.15rem 0 0; font-size: 1.05rem; color: var(--ink); }
.nl-done p { margin: 0; font-size: 0.92rem; color: var(--muted); }
.nl-done.is-warn { border-left-color: #A3741A; background: #FBF3DF; }
.nl-done.is-warn .nl-done-icon { background: #A3741A; }

/* ------------------------------------------------------------ Footer band */

.nl-band {
  display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: var(--s-4) var(--s-5);
  align-items: start;
  padding: var(--s-1) 0 var(--s-4); margin-bottom: var(--s-4);
  border-bottom: 1px solid var(--line-dark);
}
.nl-band-title { margin: 0 0 0.5rem; font-family: var(--font-serif); font-size: clamp(1.7rem, 2.6vw, 2.2rem); font-weight: 500; letter-spacing: -0.01em; color: #fff; }
.nl-band-intro p { max-width: 46ch; margin-bottom: 0.8rem; font-size: 0.95rem; color: var(--on-ink); }
.site-footer .nl-band-link { font-size: 0.88rem; color: var(--accent-soft); text-decoration: underline; text-underline-offset: 3px; }
.site-footer .nl-band-link:hover { color: #fff; }

.nl-form-band .nl-field label, .nl-form-band .nl-topics legend { color: var(--on-ink-muted); }
.nl-form-band .nl-field input {
  color: #fff; background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.24);
}
.nl-form-band .nl-field input::placeholder { color: var(--on-ink-muted); opacity: 0.8; }
.nl-form-band .nl-field input:focus { outline-color: var(--accent-soft); border-color: var(--accent-soft); background: rgba(255, 255, 255, 0.1); }
.nl-form-band .nl-chip span { color: var(--on-ink); background: transparent; border-color: rgba(255, 255, 255, 0.24); }
.nl-form-band .nl-chip:hover span { border-color: var(--accent-soft); color: #fff; }
.nl-form-band .nl-chip input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.nl-form-band .nl-chip input:checked + span::before { background-color: #fff; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 6.2l2 2 4-4.4' fill='none' stroke='%236E42A6' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.nl-form-band .nl-chip input:focus-visible + span { outline-color: var(--accent-soft); }
.nl-form-band .nl-fineprint { color: var(--on-ink-muted); }
.site-footer .nl-form-band .nl-fineprint a { color: var(--on-ink); }
.nl-form-band .nl-status { background: rgba(139, 58, 58, 0.25); color: #F5D9D9; border-left-color: #E8A0A0; }
.nl-form-band .nl-error { color: #F2B8B8; }
.nl-form-band .nl-field input[aria-invalid="true"] { border-color: #E8A0A0; }
.site-footer .nl-done { background: rgba(255, 255, 255, 0.07); border-left-color: var(--accent-soft); }
.site-footer .nl-done h3 { color: #fff; }
.site-footer .nl-done p { color: var(--on-ink); }

/* The footer band is a warm newsprint card, so the newsletter stands apart
   from the purple footer around it. Overrides the dark-band values above. */
.nl-band {
  --nl-paper: #F6F1E7; --nl-rule: #DDD4C2; --nl-mute: #6B6558;
  background: var(--nl-paper); color: var(--text);
  padding: var(--s-4); border: 0; border-radius: 6px;
  box-shadow: 0 18px 40px rgba(8, 4, 20, 0.28);
}
.nl-band .nl-eyebrow { color: var(--accent-dark); }
.nl-band-title { color: var(--ink); }
.nl-band-intro p { color: #4A463E; }
.site-footer .nl-band-link { color: var(--accent-dark); }
.site-footer .nl-band-link:hover { color: var(--ink); }
.nl-form-band .nl-field label, .nl-form-band .nl-topics legend { color: var(--nl-mute); }
.nl-form-band .nl-field input { color: var(--text); background: #fff; border-color: var(--nl-rule); }
.nl-form-band .nl-field input::placeholder { color: #9A9486; opacity: 1; }
.nl-form-band .nl-field input:focus { outline-color: var(--accent); border-color: var(--accent); background: #fff; }
.nl-form-band .nl-chip span { color: var(--text); background: #fff; border-color: var(--nl-rule); }
.nl-form-band .nl-chip:hover span { border-color: var(--accent); color: var(--ink); }
.nl-form-band .nl-chip input:focus-visible + span { outline-color: var(--accent); }
.nl-form-band .nl-fineprint { color: var(--nl-mute); }
.site-footer .nl-form-band .nl-fineprint a { color: var(--ink); }
.nl-form-band .nl-status { background: #FBECEC; color: #7A2E2E; border-left-color: #B85050; }
.nl-form-band .nl-error { color: #8B3A3A; }
.nl-form-band .nl-field input[aria-invalid="true"] { border-color: #B85050; }
.site-footer .nl-band .nl-done { background: #fff; border-left-color: var(--accent); }
.site-footer .nl-band .nl-done h3 { color: var(--ink); }
.site-footer .nl-band .nl-done p { color: #4A463E; }

@media (max-width: 960px) {
  .nl-band { grid-template-columns: 1fr; gap: var(--s-3); }
}
@media (max-width: 640px) {
  .nl-band { padding: var(--s-3) var(--s-2); border-radius: 4px; }
}
@media (max-width: 640px) {
  .nl-row { grid-template-columns: 1fr; }
  .nl-submit { width: 100%; }
}

/* ------------------------------------------------------------ Landing page */

.nl-landing-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.9fr); gap: var(--s-5); align-items: start; }
.nl-landing-aside { position: sticky; top: calc(var(--header-h) + var(--s-3)); }
.nl-section-title { margin: var(--s-4) 0 var(--s-2); font-size: 1.35rem; }
.nl-landing-main > .nl-section-title:first-child { margin-top: 0; }

.nl-benefits { counter-reset: nl; list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.nl-benefits li { counter-increment: nl; display: grid; grid-template-columns: 52px 1fr; gap: 0 var(--s-2); padding: var(--s-2) 0; border-bottom: 1px solid var(--line); }
.nl-benefits li::before { grid-row: 1 / span 2; content: counter(nl, decimal-leading-zero); font-family: var(--font-serif); font-size: 1.5rem; line-height: 1.1; color: var(--accent); }
.nl-benefits h3, .nl-benefits p { grid-column: 2; }
.nl-benefits h3 { margin: 0.1em 0 0.25em; font-size: 1.05rem; }
.nl-benefits p { margin: 0; font-size: 0.95rem; color: var(--muted); }

.nl-signup-card { padding: var(--s-4) var(--s-3) var(--s-3); background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: var(--radius); box-shadow: 0 18px 40px -28px rgba(42, 27, 69, 0.45); }
.nl-signup-card h2 { margin-bottom: var(--s-3); font-family: var(--font-serif); font-size: 1.75rem; font-weight: 500; letter-spacing: -0.01em; }
.nl-signup-card .nl-row { grid-template-columns: 1fr; }
.nl-signup-card .nl-submit { width: 100%; order: 3; }
.nl-form-card .nl-field label, .nl-form-card .nl-topics legend, .nl-form-popup .nl-field label { color: var(--muted); }

.nl-issues { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.nl-issue { padding: var(--s-2) 0 var(--s-2); border-bottom: 1px solid var(--line); }
.nl-issue time { display: block; margin-bottom: 0.25em; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-dark); }
.nl-issue h3 { margin: 0 0 0.3em; font-family: var(--font-serif); font-size: 1.3rem; font-weight: 500; letter-spacing: -0.005em; }
.nl-issue h3 a:hover { color: var(--accent-dark); }
.nl-issue p { margin: 0; font-size: 0.95rem; color: var(--muted); }
.nl-more { display: inline-block; margin-top: var(--s-2); font-size: 0.9rem; font-weight: 500; color: var(--accent-dark); }
.nl-empty { padding: var(--s-3); border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); background: var(--paper); }
.nl-empty p { margin: 0; }

.nl-privacy { list-style: none; margin: 0; padding: 0; }
.nl-privacy li { position: relative; padding: 0 0 0.8em 1.9em; font-size: 0.96rem; color: var(--muted); }
.nl-privacy li::before {
  content: ""; position: absolute; left: 0; top: 0.3em; width: 1.1em; height: 1.1em; border-radius: 50%;
  background: #EFEAF5 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 6.2l2 2 4-4.4' fill='none' stroke='%235A3689' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 80% no-repeat;
}
.nl-privacy strong { color: var(--ink); font-weight: 600; }
.nl-privacy a { color: var(--accent-dark); text-decoration: underline; }

@media (max-width: 900px) {
  .nl-landing-grid { grid-template-columns: 1fr; gap: var(--s-4); }
  .nl-landing-aside { position: static; order: -1; }
}

/* ------------------------------------------------------------ Status pages */

.nl-status-page { padding: var(--s-5) 0; }
.nl-status-card {
  max-width: 640px; margin: 0 auto; padding: var(--s-4) var(--s-4) var(--s-3);
  background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: var(--radius);
  text-align: center;
  box-shadow: 0 24px 48px -36px rgba(42, 27, 69, 0.5);
}
.nl-status-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; margin-bottom: var(--s-2); border-radius: 50%; background: #EFEAF5; color: var(--accent-dark); }
.nl-status-card .nl-eyebrow { display: flex; justify-content: center; }
.nl-status-card h1 { margin-bottom: 0.6rem; font-family: var(--font-serif); font-size: clamp(1.9rem, 3.4vw, 2.5rem); font-weight: 500; letter-spacing: -0.015em; }
.nl-status-body { max-width: 52ch; margin: 0 auto; color: var(--muted); }
.nl-status-body p { margin-bottom: 0.8rem; }
.nl-status-body strong { color: var(--ink); overflow-wrap: anywhere; }
.nl-status-card button.btn { line-height: 1.65; }
.nl-status-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.75rem; margin-top: var(--s-3); }
.nl-tone-success { border-top-color: #2F6B47; }
.nl-tone-success .nl-status-icon { background: #EAF4EE; color: #2F6B47; }
.nl-tone-warn { border-top-color: #A3741A; }
.nl-tone-warn .nl-status-icon { background: #FBF3DF; color: #7A5A12; }
.nl-inline-form { display: inline-block; margin-top: var(--s-2); }
.nl-text-link { font-size: 0.92rem; color: var(--accent-dark); text-decoration: underline; text-underline-offset: 2px; }

.nl-unsub-form, .nl-prefs-form { margin-top: var(--s-3); text-align: left; }
.nl-reasons { margin: 0; padding: var(--s-2) var(--s-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--mist); }
.nl-reasons legend { padding: 0 0.4em; font-size: 0.9rem; font-weight: 600; color: var(--ink); }
.nl-radio { display: flex; align-items: center; gap: 0.6em; padding: 0.35em 0; font-size: 0.95rem; cursor: pointer; }
.nl-radio input { width: 1.1em; height: 1.1em; margin: 0; accent-color: var(--accent); }
.nl-reasons textarea { min-height: 70px; margin-top: 0.5rem; padding: 0.6em 0.8em; font: 0.95rem var(--font); border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); width: 100%; resize: vertical; }
.nl-prefs-form .nl-field { margin-bottom: var(--s-2); }
.nl-prefs-form .nl-field label, .nl-prefs-form .nl-topics legend { color: var(--muted); }
.nl-prefs-form .nl-status-actions, .nl-unsub-form .nl-status-actions { justify-content: flex-start; }

.nl-status-extra { max-width: 640px; margin: var(--s-4) auto 0; }
.nl-status-extra .nl-section-title { margin-top: 0; font-size: 1.1rem; }

@media (max-width: 640px) {
  .nl-status-page { padding: var(--s-3) 0; }
  .nl-status-card { padding: var(--s-3) var(--s-2) var(--s-2); }
  .nl-reasons { padding: var(--s-2); }
}

/* ------------------------------------------------------------- Archive */

.nl-archive { max-width: 780px; }
.nl-archive-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2); margin-top: var(--s-4); padding: var(--s-3); background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); }
.nl-archive-cta p { flex: 1 1 320px; margin: 0; color: var(--muted); }
.nl-archive-cta strong { color: var(--ink); }

.nl-issue-hero { padding: var(--s-5) 0 var(--s-4); background: var(--ink); color: #fff; }
.nl-issue-hero .container { max-width: calc(68ch + 2 * var(--s-3)); }
.nl-issue-hero .dateline { color: var(--accent-soft); }
.nl-issue-hero h1 { color: #fff; font-family: var(--font-serif); font-size: clamp(2rem, 4vw, 3.1rem); font-weight: 500; letter-spacing: -0.015em; }
.nl-issue-hero .lede { color: var(--on-ink); }
.nl-issue-back { display: inline-block; margin-bottom: var(--s-3); font-size: 0.85rem; color: var(--on-ink); }
.nl-issue-back:hover { color: #fff; }
.nl-issue-body { max-width: 68ch; margin: 0 auto; font-family: var(--font-serif); font-size: 1.2rem; line-height: 1.7; }
.nl-issue-body h2, .nl-issue-body h3 { font-family: var(--font); }
.nl-issue-cta { max-width: 68ch; margin: var(--s-4) auto 0; padding: var(--s-3); text-align: center; background: var(--mist); border-top: 3px solid var(--accent); border-radius: var(--radius); }
.nl-issue-cta h2 { font-family: var(--font-serif); font-weight: 500; font-size: 1.6rem; }
.nl-issue-cta p { max-width: 52ch; margin: 0 auto var(--s-2); color: var(--muted); }

/* --------------------------------------------------------------- Pop-up */

html.nl-popup-open { overflow: hidden; }
.nl-popup {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center; padding: var(--s-2);
  background: rgba(8, 20, 38, 0.55);
  animation: nl-fade 0.25s ease-out;
}
.nl-popup-card {
  position: relative; width: 100%; max-width: 540px; max-height: calc(100vh - 2rem); overflow-y: auto;
  padding: var(--s-4) var(--s-4) var(--s-3);
  background: var(--paper); border-top: 4px solid var(--accent); border-radius: 4px;
  box-shadow: 0 30px 80px -20px rgba(8, 20, 38, 0.55);
  animation: nl-rise 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.nl-popup-close {
  position: absolute; top: 0.6rem; right: 0.6rem;
  display: grid; place-items: center; width: 40px; height: 40px;
  color: var(--muted); background: none; border: 0; border-radius: 50%; cursor: pointer;
}
.nl-popup-close:hover { color: var(--ink); background: var(--mist); }
.nl-popup-head { padding-right: 2rem; }
.nl-popup-title { margin: 0 0 0.5rem; font-family: var(--font-serif); font-size: clamp(1.6rem, 4vw, 2rem); font-weight: 500; letter-spacing: -0.01em; line-height: 1.15; }
.nl-popup-head p { margin-bottom: var(--s-3); font-size: 0.95rem; color: var(--muted); }
.nl-form-popup .nl-row { grid-template-columns: 1fr 1fr; }
.nl-form-popup .nl-submit { grid-column: 1 / -1; width: 100%; }
.nl-topics-more { margin-top: 0.9rem; }
.nl-topics-more summary { display: inline-flex; align-items: center; gap: 0.4em; font-size: 0.88rem; font-weight: 500; color: var(--accent-dark); cursor: pointer; }
.nl-topics-more summary::marker { color: var(--accent); }
.nl-topics-more .nl-topics { margin-top: 0.6rem; }
.nl-topics-more summary { list-style: none; }
.nl-topics-more summary::-webkit-details-marker { display: none; }
.nl-topics-more summary::after {
  content: ""; width: 0.45em; height: 0.45em; margin-left: 0.15em;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.15em) rotate(45deg); transition: transform 0.2s ease;
}
.nl-topics-more[open] summary::after { transform: translateY(0.1em) rotate(-135deg); }
@media (prefers-reduced-motion: reduce) { .nl-topics-more summary::after { transition: none; } }
.nl-form-band .nl-topics-more summary { color: var(--accent-dark); }
.nl-form-band .nl-topics-more summary:hover { color: var(--ink); }
.nl-form-band .nl-topics-hint { color: #6B6558; }
.nl-form-band .nl-topics-more summary::marker { color: var(--accent); }
.nl-popup-later {
  display: block; margin: var(--s-2) auto 0; padding: 0.5em 1em;
  font: 0.85rem var(--font); color: var(--muted); text-decoration: underline; text-underline-offset: 3px;
  background: none; border: 0; cursor: pointer;
}
.nl-popup-later:hover { color: var(--ink); }
.nl-popup :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@keyframes nl-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes nl-rise { from { opacity: 0; transform: translateY(16px) scale(0.985); } to { opacity: 1; transform: none; } }

@media (max-width: 600px) {
  .nl-popup { place-items: end center; padding: 0; }
  .nl-popup-card { max-width: none; max-height: 92vh; padding: var(--s-3) var(--s-2) var(--s-2); border-radius: 12px 12px 0 0; animation-name: nl-sheet; }
  .nl-form-popup .nl-row { grid-template-columns: 1fr; }
}
@keyframes nl-sheet { from { transform: translateY(100%); } to { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .nl-popup, .nl-popup-card { animation: none; }
  .nl-chip span, .nl-submit { transition: none; }
}
