/*
 * newsletter-popup.css — CSB "Get in the Current" signup popup
 * --------------------------------------------------------------
 * Centered modal card on a dimmed overlay. Hard edges (no border-radius
 * anywhere), cream card, terracotta CTA — all values pulled from tokens.css.
 *
 * Component-scoped under .csb-popup-* so it can't collide with the footer
 * .newsletter-* component (template-parts/newsletter.php) or any page CSS.
 *
 * Z-INDEX: .site-header sits at 200 (announcement bar at 250; base.css).
 * The popup must render above the header/nav on every page, so it uses
 * 9000 — comfortably above all in-page chrome, while staying below the
 * third-party cookie-consent modal (.cky-modal, 9999999) so a consent
 * prompt (if ever shown) is never trapped behind it.
 */

.csb-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(26, 26, 26, 0.45); /* --color-ink @ 0.45 */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.csb-popup-overlay[hidden] {
  display: none !important;
}

.csb-popup-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--color-bg);
  padding: var(--space-6) var(--space-5) var(--space-5);
  text-align: center;
  opacity: 0;
  transform: translateY(12px);
}

.csb-popup-overlay.is-open .csb-popup-card {
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--dur-medium) linear, transform var(--dur-medium) linear;
}

@media (prefers-reduced-motion: reduce) {
  .csb-popup-card {
    opacity: 1;
    transform: none;
  }
  .csb-popup-overlay.is-open .csb-popup-card {
    transition: none;
  }
}

/* ----- Close button ----- */
.csb-popup-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--color-muted);
  font-family: var(--font-body);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: color var(--dur-short) var(--ease-out);
}
.csb-popup-close:hover,
.csb-popup-close:focus-visible {
  color: var(--color-ink);
}

/* ----- Colophon mark ----- */
.csb-popup-mark {
  display: block;
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-4);
}

/* ----- Heading + copy ----- */
.csb-popup-heading {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 4vw, 36px);
  line-height: 1.05;
  letter-spacing: -0.015em;
  text-transform: uppercase;
  color: var(--color-ink);
  margin: 0 0 var(--space-3);
}
.csb-popup-heading .accent { color: var(--color-accent); }

.csb-popup-copy {
  font-family: var(--font-body);
  font-size: var(--fs-body-sm);
  line-height: 1.5;
  color: var(--color-muted);
  margin: 0 0 var(--space-5);
}

/* ----- Form ----- */
.csb-popup-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.csb-popup-input {
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  background: #FFFFFF;
  border: none;
  padding: var(--space-3);
  color: var(--color-ink);
  outline: none;
  box-sizing: border-box;
}
.csb-popup-input::placeholder { color: var(--color-support); }
.csb-popup-input:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.csb-popup-submit {
  width: 100%;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: var(--fs-body-sm);
  letter-spacing: var(--track-cta);
  text-transform: uppercase;
  padding: 16px var(--space-4);
  background: var(--color-accent);
  color: var(--color-bg);
  border: none;
  cursor: pointer;
  transition: background var(--dur-short) var(--ease-out);
}
.csb-popup-submit:hover { background: var(--color-accent-hover); }
.csb-popup-submit:disabled {
  cursor: default;
  opacity: 0.7;
}

.csb-popup-msg {
  font-family: var(--font-body);
  font-size: var(--fs-label);
  margin: 0;
}
.csb-popup-msg--error { color: var(--color-accent); }

/* ----- Dismiss link ----- */
.csb-popup-dismiss {
  display: inline-block;
  margin-top: var(--space-4);
  font-family: var(--font-body);
  font-size: var(--fs-label);
  color: var(--color-muted);
  text-decoration: underline;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.csb-popup-dismiss:hover,
.csb-popup-dismiss:focus-visible {
  color: var(--color-ink);
}

/* ----- Success state ----- */
.csb-popup-success {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  color: var(--color-ink);
  padding: var(--space-4) 0;
}

/* ----- Mobile ----- */
@media (max-width: 700px) {
  .csb-popup-card {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
    padding: var(--space-5) var(--space-4) var(--space-4);
  }
}
