/* ============================================================
 * NEWSLETTER — "The journey is just beginning."
 * A night playmat (same stitching as the community board) with
 * real cards slipping out of a paper envelope. Tokens, .h2,
 * .btn and reveals come from styles.css / home.css.
 * ============================================================ */

.nl { padding-top: calc(var(--section-y) * .35); }
/* the site has no global [hidden] rule; the states below set display */
[data-newsletter] [hidden] { display: none !important; }

.nl-board {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: center;
  gap: clamp(28px, 5vw, 72px);
  padding: clamp(36px, 5vw, 64px) clamp(28px, 5vw, 72px);
  background:
    radial-gradient(ellipse 70% 90% at 12% 0%, rgba(91, 54, 176, .55), transparent 62%),
    radial-gradient(ellipse 60% 70% at 100% 100%, rgba(18, 165, 238, .16), transparent 60%),
    var(--night);
  border: 4px solid var(--card-black);
  border-radius: 22px;
  box-shadow: 0 10px 0 var(--card-black), 0 30px 60px rgba(0, 0, 0, .45);
  color: var(--paper);
  isolation: isolate;
}
/* dashed stitching, as on the community board */
.nl-board::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 2px dashed rgba(255, 246, 227, .16);
  border-radius: 14px;
  pointer-events: none;
  z-index: -1;
}

/* ---------- art: cards in an envelope ---------- */

.nl-art {
  --card-w: clamp(118px, 12vw, 158px);
  position: relative;
  height: calc(var(--card-w) * 2.35);
  max-width: 400px;
  width: 100%;
  justify-self: center;
}
.nl-env-back,
.nl-env-front {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(100%, calc(var(--card-w) * 2.55));
  translate: -50% 0;
}
.nl-env-back { z-index: 1; }
.nl-env-front { z-index: 3; filter: drop-shadow(0 8px 0 rgba(0, 0, 0, .35)); }
.nl-env-back svg,
.nl-env-front svg { display: block; width: 100%; height: auto; overflow: visible; }

.nl-seal {
  position: absolute;
  left: 50%;
  top: 64%;
  z-index: 4;
  display: grid;
  place-items: center;
  width: calc(var(--card-w) * .42);
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff1b0 0 16%, var(--gold) 48%, var(--gold-deep) 100%);
  box-shadow: inset 0 0 0 3px #b47a06, 0 3px 0 var(--card-black), 0 0 0 3px var(--card-black);
}
.nl-seal img { width: 62%; height: auto; }

.nl-fan {
  position: absolute;
  left: 50%;
  bottom: calc(var(--card-w) * .38);
  z-index: 2;
  width: 0;
  height: 0;
}
.nl-card {
  position: absolute;
  left: calc(var(--card-w) * -.5);
  bottom: 0;
  width: var(--card-w);
  max-width: none; /* the fan itself is 0 px wide */
  height: auto;
  border-radius: calc(var(--card-w) * .06);
  background: var(--night-2); /* card back while the image loads */
  box-shadow: 0 0 0 3px var(--card-black), 0 10px 18px rgba(0, 0, 0, .45);
  transform-origin: 50% 100%;
  translate: var(--x) var(--y, 0);
  rotate: var(--r);
}
.nl-card--1 { --x: calc(var(--card-w) * -.52); --r: -13deg; --y: -4px; }
.nl-card--2 { --x: 0px; --r: 0deg; --y: calc(var(--card-w) * -.12); z-index: 1; }
.nl-card--3 { --x: calc(var(--card-w) * .52); --r: 12deg; --y: -2px; }

.motion-ok .nl-card { transition: translate 420ms var(--ease-deal), rotate 420ms var(--ease-deal); }
.motion-ok .nl-card--2 { transition-delay: 40ms; }
.motion-ok .nl-card--3 { transition-delay: 80ms; }
@media (hover: hover) {
  .nl-board:hover .nl-card--1 { --y: -14px; --r: -16deg; }
  .nl-board:hover .nl-card--2 { --y: calc(var(--card-w) * -.12 - 12px); }
  .nl-board:hover .nl-card--3 { --y: -12px; --r: 15deg; }
}
/* signed up: the cards are on their way */
.nl-board.is-done .nl-card--1 { --y: calc(var(--card-w) * -.28); --r: -18deg; }
.nl-board.is-done .nl-card--2 { --y: calc(var(--card-w) * -.42); }
.nl-board.is-done .nl-card--3 { --y: calc(var(--card-w) * -.26); --r: 17deg; }

/* ---------- copy ---------- */

.nl-body { min-width: 0; }

.nl-kicker {
  display: inline-block;
  margin: 0 0 var(--s-4);
  padding: 8px 14px 5px;
  background: var(--gold);
  color: #1d1300;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: .04em;
  text-transform: uppercase;
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 100%, 0 100%);
}
.nl-title { max-width: 14ch; }
.nl-lead { max-width: 44ch; }

/* ---------- form ---------- */

.nl-form { margin-top: var(--s-6); }
.nl-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.nl-input {
  flex: 1;
  min-width: 0;
  height: 62px;
  padding: 4px 18px 0;
  background: var(--paper);
  border: 3px solid var(--card-black);
  border-radius: 6px;
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, .12), 0 5px 0 var(--card-black);
  font-family: var(--font-hand);
  font-size: 22px;
  color: #16110a;
}
.nl-input::placeholder {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--placeholder);
  opacity: 1;
}
.nl-input:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.nl-input[aria-invalid="true"] { border-color: var(--red); box-shadow: inset 0 3px 0 rgba(0, 0, 0, .12), 0 5px 0 var(--red); }
.nl-input[readonly] { color: #5d5344; }
.nl-submit { flex: none; }
.nl-submit[disabled] { cursor: progress; }
.nl-submit[disabled] .btn__face { filter: saturate(.7); }
.nl-spinner {
  display: inline-block;
  width: .8em;
  height: .8em;
  margin-right: .45em;
  vertical-align: -.05em;
  border: .14em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: nl-spin .7s linear infinite;
}
@keyframes nl-spin { to { rotate: 360deg; } }

/* consent: a chunky card-style checkbox */
.nl-consent {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 44px;
  margin-top: var(--s-5);
  padding-block: 4px;
  font-size: 18px;
  line-height: 1.35;
  color: var(--paper-dim);
  cursor: pointer;
}
.nl-consent input {
  position: absolute;
  left: 0;
  top: 4px;
  width: 30px;
  height: 30px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.nl-box {
  position: relative;
  flex: none;
  width: 30px;
  height: 30px;
  background: var(--paper);
  border: 3px solid var(--card-black);
  border-radius: 5px;
  box-shadow: 0 3px 0 var(--card-black);
}
.nl-box::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 2px;
  width: 8px;
  height: 15px;
  border: solid #1d1300;
  border-width: 0 4px 4px 0;
  rotate: 45deg;
  scale: 0;
}
.nl-consent input:checked + .nl-box { background: var(--gold); }
.nl-consent input:checked + .nl-box::after { scale: 1; }
.motion-ok .nl-box::after { transition: scale 160ms var(--ease-deal); }
.nl-consent input:focus-visible + .nl-box { outline: 3px solid var(--gold); outline-offset: 3px; }
.nl-consent input[aria-invalid="true"] + .nl-box { border-color: var(--red); box-shadow: 0 3px 0 var(--red); }
.nl-consent a { color: var(--paper); text-underline-offset: 3px; }
.nl-consent a:hover { color: var(--gold); }

.nl-fine {
  margin: var(--s-3) 0 0 42px;
  font-size: 16px;
  color: #a9a292;
}

/* bots only */
.nl-honey {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* messages: never colour alone — a badge and words carry the meaning */
.nl-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: var(--s-4) 0 0;
  padding: 10px 14px 9px;
  border: 2px solid var(--gold);
  border-radius: 8px;
  background: rgba(255, 198, 41, .1);
  font-size: 18px;
  line-height: 1.35;
  color: var(--paper);
}
.nl-msg:empty { display: none; }
.nl-msg::before {
  content: "i";
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--gold);
  color: #1d1300;
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1;
}
.nl-msg.is-error { border-color: var(--red); background: rgba(240, 64, 47, .14); color: #ffe1dc; }
.nl-msg.is-error::before { content: "!"; background: var(--red); color: #fff; }
.nl-msg strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 17px;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--paper);
}
.motion-ok .nl-msg:not(:empty) { animation: nl-nudge 260ms var(--ease-deal); }
@keyframes nl-nudge { from { translate: 0 -6px; opacity: 0; } }

/* ---------- done ---------- */

.nl-done {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: var(--s-6);
  padding: 20px 22px;
  background: var(--paper);
  border: 3px solid var(--card-black);
  border-radius: 10px;
  box-shadow: 0 6px 0 var(--card-black);
  color: #16110a;
}
.nl-done:focus { outline: none; }
.nl-done:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.nl-stamp {
  flex: none;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff1b0 0 16%, var(--gold) 48%, var(--gold-deep) 100%);
  box-shadow: inset 0 0 0 3px #b47a06, 0 3px 0 var(--card-black), 0 0 0 3px var(--card-black);
}
.nl-stamp svg { width: 28px; height: 28px; }
.nl-done[data-kind="pending"] .nl-stamp-check { display: none; }
.nl-done:not([data-kind="pending"]) .nl-stamp-mail { display: none; }
.nl-done-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(24px, 2.4vw, 32px);
  line-height: 1;
  text-transform: uppercase;
}
.nl-done-text { margin: 6px 0 0; font-size: 19px; line-height: 1.35; color: #3a3226; }
.motion-ok .nl-done:not([hidden]) { animation: nl-deal 460ms var(--ease-deal); }
@keyframes nl-deal { from { opacity: 0; translate: 0 18px; rotate: -1.5deg; } }

.nl-dev {
  display: inline-block;
  margin: var(--s-4) 0 0;
  padding: 3px 10px 2px;
  border: 2px dashed var(--glitch-magenta);
  border-radius: 6px;
  font-size: 15px;
  color: #ffc2de;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .nl-board {
    grid-template-columns: 1fr;
    gap: var(--s-5);
    padding: 30px 22px 30px;
  }
  .nl-art { --card-w: clamp(92px, 24vw, 128px); }
  .nl-title { max-width: none; }
}

@media (max-width: 560px) {
  .nl-row { flex-direction: column; align-items: stretch; }
  .nl-submit { width: 100%; }
  .nl-input { flex: none; height: 58px; }
  .nl-consent { font-size: 17px; }
  .nl-fine { margin-left: 0; }
  .nl-done { align-items: flex-start; padding: 16px; gap: 14px; }
  .nl-stamp { width: 48px; height: 48px; }
}

@media (max-width: 360px) {
  .nl-board { padding: 26px 16px; border-radius: 18px; }
  .nl-board::before { inset: 8px; }
}
