/* ==========================================================================
   Newsletter (design.md §6.9)

   Previously sat on `var(--u-accent-tint)` — a tint token deleted when the
   Comic Pop retheme removed the pastel-tint system, so the card silently had
   no background at all (transparent, blending into the page) and its title
   carried `.u-script`, a class pointing at `--font-script`, a token that no
   longer exists since Pacifico was dropped. The invalid var() made the title
   inherit the body font instead of the intended Archivo Black — hence
   "typography feels off". Rebuilt as a solid poster panel matching the rest
   of the Comic Pop language rather than patched in place.
   ========================================================================== */

.newsletter__card {
  position: relative;
  display: grid;
  gap: clamp(1.5rem, 3vw, 3rem);
  align-items: center;
  padding: clamp(1.75rem, 4vw, 3.25rem);
  /* NOT overflow:hidden on this element — .newsletter__badge deliberately
     bleeds past the top-right corner, and clipping here cut it off. The dot
     texture that needs clipping lives on .newsletter__deco instead, which
     confines itself with border-radius:inherit — see the note on that rule. */
  background: var(--u-secondary);
  color: var(--on-secondary);
}

@media (min-width: 860px) {
  .newsletter__card { grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr); }
}

/* Dot texture + a couple of confetti chips, echoing the hero stage so this
   section doesn't read as a plain, empty panel. */
.newsletter__deco {
  position: absolute;
  inset: 0;
  /* A background paint is clipped to its own border-radius by default, so
     this alone keeps the dot pattern inside the card's rounded corners —
     without the card itself needing overflow:hidden, which would also clip
     .newsletter__badge (deliberately positioned to bleed past the corner). */
  border-radius: inherit;
  background-image: radial-gradient(circle at center, var(--u-paper) 1.6px, transparent 1.7px);
  background-size: 15px 15px;
  opacity: 0.14;
  pointer-events: none;
}

.newsletter__chip {
  position: absolute;
  border: var(--ink-w) solid var(--u-ink);
  border-radius: 50%;
  pointer-events: none;
}
/* The top-right corner belongs to .newsletter__badge, which bleeds past it —
   at 8% this chip landed entirely inside the badge's bounding box and was
   never visible at any viewport width. Moved inboard, clear of both the badge
   and the form column. */
.newsletter__chip--1 { top: 9%;   right: 30%; width: 22px; height: 22px; background: var(--u-accent); }
.newsletter__chip--2 { bottom: 14%; right: 20%; width: 14px; height: 14px; background: var(--u-fresh); }
.newsletter__chip--3 { top: 18%;  left: 46%;  width: 12px; height: 12px; background: var(--u-danger); }

@media (max-width: 640px) { .newsletter__chip { display: none; } }

/* Sticker corner badge, same die-cut language as the story splash's
   starburst. */
.newsletter__badge {
  position: absolute;
  top: -16px;
  right: clamp(1rem, 4vw, 2.5rem);
  z-index: 2;
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  padding: 0.6rem;
  background: var(--u-accent);
  color: var(--on-accent);
  border: var(--ink-w) solid var(--u-ink);
  font-family: var(--font-display);
  font-size: 0.7rem;
  line-height: 1.15;
  text-align: center;
  /* NOT --track-display: that token pulls display type in (-0.02em) because
     Archivo Black is very wide at heading sizes. At 11px uppercase the same
     negative tracking jams the letterforms together, so this reverses it —
     the same positive-tracking treatment .u-badge uses at its size. */
  letter-spacing: 0.04em;
  text-transform: uppercase;
  rotate: 10deg;
  clip-path: polygon(
    50% 0%, 60% 16%, 76% 8%, 78% 26%, 95% 25%, 88% 41%, 100% 50%,
    88% 59%, 95% 75%, 78% 74%, 76% 92%, 60% 84%, 50% 100%, 40% 84%,
    24% 92%, 22% 74%, 5% 75%, 12% 59%, 0% 50%, 12% 41%, 5% 25%,
    22% 26%, 24% 8%, 40% 16%
  );
}

@media (max-width: 480px) { .newsletter__badge { display: none; } }

/* --- Copy ------------------------------------------------------------------
   Positioned relative so it stacks above the .newsletter__deco texture. */

.newsletter__copy { position: relative; }

.newsletter__copy h2 {
  margin-bottom: 0.6rem;
  /* Was a bespoke clamp() topping out at 2.9rem — 46px against the 41.6px
     every other section h2 renders at, so this one heading sat off the type
     scale. --fs-h2 puts it back on it. */
  font-size: var(--fs-h2);
  /* The card declares `color: var(--on-secondary)` precisely so its contents
     don't have to name a surface colour; --u-paper here was a second, slightly
     warmer white competing with it. */
  color: var(--on-secondary);
  /* "New drops, first dibs" otherwise broke as "NEW DROPS, FIRST / DIBS",
     leaving a one-word orphan line under a full one. balance evens the two
     lines out where it wraps and is inert where the title fits on one, so it
     needs no max-width propping it up at narrow widths. */
  text-wrap: balance;
}

/* The markup also carries .u-eyebrow, so the shared 12px / 700 / uppercase /
   0.22em micro-type comes from there and this rule only adds the pill. It used
   to style the pill alone: the text inside rendered at body size, sentence
   case and untracked — the one eyebrow on the page that didn't match the
   other six. Only the properties the pill actually needs are overridden. */
.newsletter__eyebrow {
  margin-bottom: 1rem;
  padding: 0.5rem 0.9rem;
  border: 2px solid var(--u-ink);
  border-radius: var(--r-pill);
  background: var(--u-accent);
  color: var(--on-accent);
  /* .u-eyebrow inherits the 1.6 body line-height, which padded the pill to
     42px tall and pushed the text off its optical centre. */
  line-height: 1;
  /* The trailing letter-space of the last character is real width inside a
     centred pill, so without this the text reads shunted left. */
  padding-right: calc(0.9rem - var(--tracking-eyebrow));
  box-shadow: var(--shadow-sticker-sm);
}

/* The eyebrow is also a <p>, so without :not() this selector's specificity
   (0,1,1: one class + the tag) beats .newsletter__eyebrow's (0,1,0) — source
   order doesn't matter once specificity differs. That let this rule's pale
   paper-on-transparent silently overwrite the eyebrow's ink-on-accent,
   reading as low-contrast ghost text. */
.newsletter__copy p:not(.newsletter__eyebrow) {
  max-width: 40ch;
  color: var(--on-secondary);
  /* Warm paper at 0.85 measured 4.41:1 over the violet — under AA for body
     copy. On-token white at 0.92 measures 5.17:1 and still reads a step
     quieter than the heading. */
  opacity: 0.92;
}

/* --- Form ------------------------------------------------------------------ */

.newsletter__form {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.newsletter__input {
  flex: 1 1 240px;
  min-width: 0;
  padding: 0.95rem 1.25rem;
  border: var(--ink-border);
  border-radius: var(--r-pill);
  background: var(--u-white);
  color: var(--u-ink);
  box-shadow: var(--shadow-sticker-sm);
  transition: box-shadow var(--t-fast), translate var(--t-fast);
}
.newsletter__input::placeholder { color: var(--u-ink-soft); opacity: 0.7; }
.newsletter__input:focus-visible { translate: -2px -2px; box-shadow: var(--shadow-sticker); }
.newsletter__input[aria-invalid='true'] { border-color: var(--u-danger); }

.newsletter__msg {
  flex: 1 0 100%;
  min-height: 1.4em;
  font-size: var(--fs-small);
  font-weight: 700;
  color: var(--u-paper);
}
.newsletter__msg[data-state='ok']    { color: var(--u-fresh); }
.newsletter__msg[data-state='error'] { color: #FF9A8F; }
