/* Newsletter signup: the row after #3 in each ranking and the /newsletter/ pages.
   Loaded only when the site is built with NEWSLETTER=1. Uses the variables from styles.css. */

/* ---------- the row: same grid, padding and dividers as a ranking row ---------- */

.list--cont { margin-top: 0; }
:root[data-nl="1"] .signup { display: none; }
:root[data-nl="1"] .list--cont > .row:first-child .row__card::before {
  content: ""; position: absolute; top: 0; left: 14px; right: 14px; height: 1px; background: var(--line);
}
.signup { margin: 0 -14px; }
.signup__card {
  position: relative;
  display: grid; grid-template-columns: 28px 48px minmax(0, 1fr); align-items: start; column-gap: 16px;
  padding: 20px 14px; border-radius: 16px;
}
.signup__card::before, .signup__card::after {
  content: ""; position: absolute; left: 14px; right: 14px; height: 1px; background: var(--line);
}
.signup__card::before { top: 0; }
.signup__card::after { bottom: 0; }
.signup__icon {
  grid-column: 2;
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 13%, var(--bg)); color: var(--accent-ink);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}
.signup__body { min-width: 0; padding-top: 1px; }
.signup__title { font-size: 16.5px; line-height: 1.35; font-weight: 650; letter-spacing: -0.005em; }
.signup__desc { margin-top: 3px; color: var(--muted); font-size: 15px; line-height: 1.5; }

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

.nl { margin-top: 12px; }
.freq {
  display: inline-flex; gap: 2px; margin: 0; padding: 3px; border: 0; border-radius: 999px;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
}
.freq__opt { position: relative; display: block; }
.freq__opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.freq__opt span {
  display: block; padding: 5px 13px; border-radius: 999px;
  color: var(--muted); font-size: 14px; font-weight: 550; line-height: 1.4; white-space: nowrap;
}
.freq__opt:hover span { color: var(--ink); }
.freq__opt input:checked + span {
  background: var(--bg); color: var(--ink); font-weight: 650;
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgb(0 0 0 / 0.06);
}
.freq__opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

.nl__field { display: flex; gap: 8px; max-width: 470px; margin-top: 10px; }
.nl__input {
  flex: 1; min-width: 0; height: 42px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink);
  font: inherit; font-size: 15px;
}
.nl__input::placeholder { color: var(--faint); }
.nl__input:focus {
  outline: none; border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.nl__btn {
  height: 42px; padding: 0 16px; border: 0; border-radius: 12px;
  background: var(--ink); color: var(--bg); font: inherit; font-size: 14.5px; font-weight: 650;
  white-space: nowrap; cursor: pointer;
}
.nl__btn:hover { background: var(--ink-2); }
.nl__btn[disabled] { opacity: 0.6; cursor: progress; }
.nl__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.nl__ts { margin-top: 10px; }
.nl__ts:empty { display: none; }
.nl__note { margin-top: 8px; color: var(--faint); font-size: 13px; line-height: 1.5; }
.nl__note a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
.nl__note a:hover { color: var(--ink); }
.nl__note[data-state="error"] { color: #c0262d; }
:root[data-theme="dark"] .nl__note[data-state="error"] { color: #ff8f8f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .nl__note[data-state="error"] { color: #ff8f8f; } }
.nl__done {
  margin-top: 12px; padding: 12px 14px; border-radius: 12px;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-2); font-size: 15px; line-height: 1.5;
}
.nl__done strong { color: var(--ink); }

/* ---------- /newsletter/ pages ---------- */

.nlpage { margin-top: 22px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; }
.nlpage .nl { margin-top: 0; }
.doc .nl__note, .doc .nl__done { margin-top: 8px; font-size: 13px; line-height: 1.5; color: var(--faint); }
.doc .nl__done { font-size: 15px; color: var(--ink-2); }
.doc .nl__note a { color: inherit; text-decoration-color: var(--line); }
.nlpage__form { margin-top: 22px; }
.nlpage__label { color: var(--ink) !important; font-weight: 650; margin-bottom: 10px; }
.doc .nlpage__list { margin: 14px 0 20px; }
.doc .nlpage__list li { font-size: 15px; }
.doc .nlpage__small { color: var(--faint); font-size: 14px; }
.doc .nlpage__notice { padding: 10px 14px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.nlpage__form .btn, .btn--quiet { border: 0; font: inherit; font-size: 14.5px; font-weight: 650; cursor: pointer; }
.btn--quiet { background: none; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn--quiet:hover { background: var(--surface); }

/* ---------- small screens: match .row__card's mobile grid ---------- */

@media (max-width: 600px) {
  :root[data-nl="1"] .list--cont > .row:first-child .row__card::before { left: 10px; right: 10px; }
  .signup { margin: 0 -10px; }
  .signup__card { grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; padding: 18px 10px; }
  .signup__card::before, .signup__card::after { left: 10px; right: 10px; }
  .signup__icon { grid-column: 1; width: 40px; height: 40px; border-radius: 10px; }
  .signup__title { font-size: 16px; }
  .signup__desc { font-size: 14.5px; }
  .freq__opt span { padding: 5px 11px; font-size: 13.5px; }
}
