/* Newsletter, German and English (../newsletter/ and ../en/newsletter/): their words beside their Brevo signup, then the
   archive of past letters. Loaded after ../site.css and ../pages.css. The signup is a real form posting to their Brevo
   address (see form.js); the feedback follows the site's form rule: a ring in the button while it sends, a green drawn
   check on success, the whole card shakes on an error. Media rules at the END. */

:root { --ok: #2f7a4d; --err: #8a2f2f; }
@media (prefers-color-scheme: dark) { :root { --ok: #7cc79a; --err: #f0a5a5; } }

.nl { padding-block: clamp(28px, 4vw, 56px) clamp(56px, 7vw, 96px); }
.nl__in { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
.nl__text { display: grid; gap: 18px; justify-items: start; }
.nl__text h1 { font-size: clamp(2.2rem, 1.5rem + 3vw, 3.6rem); }
.nl__text .lede { text-wrap: pretty; }

/* the signup card */
.nl__card { position: relative; display: grid; gap: 18px; padding: clamp(22px, 3vw, 36px); border-radius: var(--r); background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.nl__card.is-shaking { animation: nl-shake 420ms var(--ease); }
@keyframes nl-shake { 0%, 100% { translate: 0 0; } 18% { translate: -9px 0; } 38% { translate: 8px 0; } 58% { translate: -5px 0; } 78% { translate: 3px 0; } }
.nl__note { color: var(--ink-2); text-wrap: pretty; }
.nl__form { display: grid; gap: 16px; }
.nl__names { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.nl__field { display: grid; gap: 6px; }
.nl__field label, .nl__legend { font-size: 0.92rem; font-weight: 500; color: var(--ink); }
.nl__field input { width: 100%; height: 48px; padding: 0 14px; border: 0; border-radius: var(--r); background: var(--paper); color: var(--ink); font: 400 1rem/1 var(--text); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow 160ms var(--ease); }
.nl__field input:hover { box-shadow: inset 0 0 0 1px var(--olive); }
.nl__field input:focus { outline: 0; box-shadow: inset 0 0 0 2px var(--accent); }
.nl__field input[aria-invalid='true'] { box-shadow: inset 0 0 0 2px var(--err); }
.nl__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* gender: three pills, one chosen */
.nl__choice { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.nl__legend { padding: 0; }
.nl__opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { position: relative; }
.opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.opt span { display: inline-flex; align-items: center; height: 40px; padding: 0 18px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); font-size: 0.95rem; transition: background 180ms var(--ease), color 180ms var(--ease), box-shadow 180ms var(--ease); }
.opt:hover span { box-shadow: inset 0 0 0 1px var(--olive); }
.opt input:checked + span { background: var(--accent); color: var(--on-accent); box-shadow: inset 0 0 0 1px var(--accent); }
.opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }

.nl__captcha { min-height: 78px; transform-origin: 0 0; }
.nl__captcha[aria-invalid='true'] { outline: 2px solid var(--err); outline-offset: 2px; border-radius: 4px; width: fit-content; }
.nl__send { justify-self: start; position: relative; }
.nl__send .nl__ring { display: none; width: 18px; height: 18px; }
.nl__send .nl__ring .mark { width: 18px; height: 18px; animation: nl-spin 800ms linear infinite; }
@keyframes nl-spin { to { rotate: 360deg; } }
.nl__send[aria-busy='true'] { pointer-events: none; }
.nl__send[aria-busy='true'] .nl__ring { display: inline-flex; }
.nl__msg { min-height: 0; font-size: 0.95rem; color: var(--err); }
.nl__msg:empty { display: none; }

/* thanks: a green check drawn in, then their words */
.nl__done { display: grid; justify-items: start; gap: 14px; padding-block: 8px; }
.nl__done[hidden] { display: none; }
.nl__check { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 999px; background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.nl__check .mark { width: 28px; height: 28px; stroke-width: 2.2; }
.nl__check .mark path { stroke-dasharray: 26; stroke-dashoffset: 26; animation: nl-draw 520ms 120ms var(--ease) forwards; }
@keyframes nl-draw { to { stroke-dashoffset: 0; } }
.nl__done p { font: 300 clamp(1.3rem, 1.15rem + 0.6vw, 1.6rem)/1.4 var(--head); color: var(--head-ink); text-wrap: balance; }

/* the archive: past letters, by year */
.arch__in { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(28px, 5vw, 72px); }
.arch__year { display: grid; gap: 6px; align-content: start; }
.arch__year h3 { font-size: clamp(1.5rem, 1.3rem + 0.8vw, 1.9rem); margin-bottom: 10px; }
.arch__list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.arch__list li { padding: 16px 0; border-bottom: 1px solid var(--line); }
.arch__list a { text-wrap: pretty; }

/* ═══════════ Media rules ═══════════ */
@media (max-width: 900px) {
  .nl__in { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .nl__names, .arch__in { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 380px) {
  .nl__captcha { scale: 0.88; margin-bottom: -9px; } /* the checkbox is 304px wide */
}
@media (prefers-reduced-motion: reduce) {
  .nl__card.is-shaking { animation: none; }
  .nl__send .nl__ring .mark { animation-duration: 1800ms; }
}
