/* Shared newsletter entry points and signup dialog. */
.newsletter-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.newsletter-trigger {
  margin-left: auto;
  margin-right: 4px;
}

.newsletter-trigger:hover {
  background: color-mix(in srgb, currentColor 8%, transparent);
  transform: translateY(-1px);
}

.newsletter-trigger:focus-visible,
.newsletter-signup button:focus-visible,
.newsletter-signup input:focus-visible,
.newsletter-dialog__close:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.newsletter-trigger__icon {
  display: block;
  width: 23px;
  height: 23px;
}

.newsletter-story-cta {
  margin: 28px 0 0;
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid var(--story-line, #deded7);
  border-radius: 24px;
  background: linear-gradient(135deg, var(--story-sage, #edf2e9), var(--story-paper, #fff));
  color: var(--story-ink, #20211e);
  box-shadow: 0 16px 42px rgba(35, 40, 31, 0.08);
  text-align: center;
}

.newsletter-story-cta__eyebrow {
  margin: 0 0 8px;
  color: var(--story-sage-strong, #60745e);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.newsletter-story-cta h2 {
  margin: 0;
  color: inherit;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 4vw, 2.4rem);
  font-weight: 500;
  letter-spacing: -0.025em;
}

.newsletter-story-cta > p:not(.newsletter-story-cta__eyebrow) {
  max-width: 570px;
  margin: 10px auto 20px;
  color: var(--story-muted, #676a63);
  line-height: 1.6;
}

.newsletter-signup {
  display: flex;
  gap: 10px;
  width: min(100%, 560px);
  margin: 0 auto;
}

.newsletter-signup .sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.newsletter-signup input {
  min-width: 0;
  flex: 1;
  height: 48px;
  padding: 0 15px;
  border: 1px solid var(--story-line, #d4d4d0);
  border-radius: 11px;
  background: var(--story-paper, #fff);
  color: var(--story-ink, #20211e);
  font: inherit;
}

.newsletter-signup button[type="submit"] {
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 11px;
  background: var(--story-ink, #20211e);
  color: var(--story-paper, #fff);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.newsletter-signup button[disabled] { cursor: wait; opacity: 0.68; }

.newsletter-signup__fine-print,
.newsletter-signup__status {
  width: min(100%, 560px);
  margin: 10px auto 0;
  color: var(--story-muted, #676a63);
  font-size: 0.75rem;
  line-height: 1.45;
}

.newsletter-signup__status { min-height: 1.1em; font-weight: 650; }
.newsletter-signup__status[data-state="success"] { color: var(--story-sage-strong, #557052); }
.newsletter-signup__status[data-state="error"] { color: #a83c32; }

.newsletter-dialog {
  position: fixed;
  inset: 0;
  width: min(520px, calc(100% - 28px));
  max-height: min(720px, calc(100% - 28px));
  margin: auto;
  padding: 0;
  border: 1px solid var(--story-line, #d4d4d0);
  border-radius: 22px;
  background: var(--story-paper, #fff);
  color: var(--story-ink, #20211e);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.28);
}

.newsletter-dialog::backdrop {
  background: rgba(10, 12, 10, 0.55);
  backdrop-filter: blur(5px);
}

.newsletter-dialog__content { position: relative; padding: 36px; text-align: center; }
.newsletter-dialog__icon { display: flex; justify-content: center; margin-bottom: 10px; line-height: 1; }
.newsletter-dialog__icon-mark { display: block; width: 44px; height: 44px; }
.newsletter-dialog h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 2rem; font-weight: 500; }
.newsletter-dialog__intro { margin: 10px auto 22px; color: var(--story-muted, #676a63); line-height: 1.55; }

.newsletter-dialog__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.newsletter-dialog__close:hover { background: color-mix(in srgb, currentColor 8%, transparent); }

:root[data-tldr-theme="dark"] .newsletter-dialog {
  --story-paper: #181a17;
  --story-ink: #f0f2ed;
  --story-muted: #aab1a5;
  --story-line: #3a4037;
  --story-sage-strong: #9ab197;
}

@media (max-width: 640px) {
  .newsletter-trigger { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
  .newsletter-signup { flex-direction: column; }
  .newsletter-signup button[type="submit"] { width: 100%; }
  .newsletter-dialog__content { padding: 34px 22px 26px; }
}
