/*
 * NKVANTAGE — Newsletter & Subscribe System Styles
 *
 * This file is enqueued AFTER the main theme stylesheet so every rule
 * here can safely override theme defaults without !important abuse.
 *
 * Design principle: preserve the existing NKVANTAGE visual language.
 * New elements inherit the theme's CSS custom properties (--brand,
 * --surface, --ink, etc.) so they automatically match any colour
 * customizations the admin has made.
 */

/* =====================================================================
 * NATIVE NEWSLETTER FORM
 * The .nkvantage-nl-form replaces the old .newsletter-form everywhere.
 * ================================================================== */

.nkvantage-nl-form {
  width: 100%;
}

.nkvantage-nl-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}

/* Email field — matches the existing newsletter input style from style.css */
.nkvantage-nl-email {
  flex: 1 1 200px;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--border, #E6E3DC);
  border-radius: 4px;
  background: var(--surface, #fff);
  color: var(--ink, #14171C);
  font-family: var(--font-body, Inter, sans-serif);
  font-size: 14px;
  line-height: 1.4;
  appearance: none;
}

.nkvantage-nl-email:focus {
  outline: 2px solid var(--brand, #1B3A8C);
  outline-offset: 1px;
  border-color: var(--brand, #1B3A8C);
}

/* Submit button — matches existing theme .sub / newsletter button style */
.nkvantage-nl-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--brand, #1B3A8C);
  color: #fff;
  border: 1px solid var(--brand, #1B3A8C);
  border-radius: 4px;
  font-family: var(--font-body, Inter, sans-serif);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .03em;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}

.nkvantage-nl-btn:hover {
  background: var(--brand-ink, #0F2557);
  border-color: var(--brand-ink, #0F2557);
}

.nkvantage-nl-btn:focus-visible {
  outline: 2px solid var(--brand, #1B3A8C);
  outline-offset: 2px;
}

.nkvantage-nl-btn[aria-busy="true"] .nkvantage-nl-btn-text {
  opacity: 0;
}

.nkvantage-nl-btn[aria-busy="true"] .nkvantage-nl-spinner {
  display: block;
}

.nkvantage-nl-btn:disabled {
  opacity: .65;
  cursor: not-allowed;
}

/* Spinner */
.nkvantage-nl-spinner {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: nkvantage-spin .6s linear infinite;
}

@keyframes nkvantage-spin {
  to { transform: rotate(360deg); }
}

/* Status message */
.nkvantage-nl-message {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.4;
}

.nkvantage-nl-message--success {
  color: #1a7a41;
}

.nkvantage-nl-message--error {
  color: #c0392b;
}

/* Privacy text */
.nkvantage-nl-privacy {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--ink-faint, #8A8F96);
  line-height: 1.4;
}

/* Embed wrapper */
.nkvantage-nl-embed {
  width: 100%;
}

/* =====================================================================
 * NEWSLETTER POPUP
 * ================================================================== */

.nkvantage-popup {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  pointer-events: none;
  visibility: hidden;
}

.nkvantage-popup.is-open {
  pointer-events: auto;
  visibility: visible;
}

/* Overlay */
.nkvantage-popup__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  opacity: 0;
  transition: opacity .25s ease;
}

.nkvantage-popup.is-open .nkvantage-popup__overlay {
  opacity: 1;
}

/* Inner card */
.nkvantage-popup__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  background: var(--surface, #fff);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0,0,0,.22);
  padding: 40px 36px 32px;
  transform: translateY(20px) scale(.97);
  opacity: 0;
  transition: transform .25s ease, opacity .25s ease;
}

.nkvantage-popup.is-open .nkvantage-popup__inner {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Close button */
.nkvantage-popup__close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--ink-soft, #52585F);
  cursor: pointer;
  transition: background .15s, color .15s;
}

.nkvantage-popup__close:hover {
  background: var(--border, #E6E3DC);
  color: var(--ink, #14171C);
}

.nkvantage-popup__close:focus-visible {
  outline: 2px solid var(--brand, #1B3A8C);
  outline-offset: 2px;
}

/* Popup content */
.nkvantage-popup__title {
  font-family: var(--font-display, Fraunces, Georgia, serif);
  font-size: clamp(20px, 4vw, 26px);
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 10px;
  color: var(--ink, #14171C);
}

.nkvantage-popup__desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft, #52585F);
  margin: 0 0 20px;
}

/* Scroll lock when popup is open */
body.nkvantage-popup-open {
  overflow: hidden;
}

/* Responsive */
@media (max-width: 480px) {
  .nkvantage-popup__inner {
    padding: 32px 20px 24px;
    border-radius: 10px;
  }
}

/* =====================================================================
 * SIGN-IN DROPDOWN
 * ================================================================== */

.nkvantage-auth-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.nkvantage-auth-btn {
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  display: inline-flex;
  align-items: center;
}

.nkvantage-auth-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 140px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #E6E3DC);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 9999;
  overflow: hidden;
}

.nkvantage-auth-dropdown a {
  display: block;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--ink, #14171C);
  text-decoration: none;
  transition: background .12s;
}

.nkvantage-auth-dropdown a:hover {
  background: var(--border, #E6E3DC);
}

/* =====================================================================
 * MOBILE SUBSCRIBE BUTTON
 * ================================================================== */

.nkvantage-mobile-subscribe-btn {
  display: block;
  text-align: center;
  padding: 12px 20px;
  background: var(--brand, #1B3A8C);
  color: #fff !important;
  border-radius: 4px;
  font-weight: 700;
  font-size: 14px;
  transition: background .15s;
  text-decoration: none;
}

.nkvantage-mobile-subscribe-btn:hover {
  background: var(--brand-ink, #0F2557);
}

/* =====================================================================
 * NEWSLETTER SECTION — override only when admin changes colours
 * (the actual section layout lives in the theme's style.css)
 * ================================================================== */

/* The native form inside the newsletter section —
   mimics the original .newsletter-form layout: fixed width, flex-shrink:0.
   This prevents the form from expanding and crushing the text column. */
.newsletter .nkvantage-nl-form {
  flex-shrink: 0;
  width: 340px;
}

/* Text column takes remaining space and won't collapse */
.newsletter .wrap > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 520px;
}

/* Input fills the form width */
.newsletter .nkvantage-nl-input-wrap {
  flex-wrap: nowrap;
}

.newsletter .nkvantage-nl-email {
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
}

/* Mobile: stack and go full width */
@media (max-width: 800px) {
  .newsletter .nkvantage-nl-form {
    width: 100%;
  }
  .newsletter .wrap > div:first-child {
    max-width: 100%;
  }
  .newsletter .nkvantage-nl-input-wrap {
    flex-wrap: wrap;
  }
}

/* =====================================================================
 * ACCESSIBILITY UTILITIES
 * ================================================================== */

.screen-reader-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}



/* Brevo iframe embeds: preserve the existing newsletter layout and keep the provider form responsive. */
.newsletter .nkvantage-nl-embed {
  flex: 0 0 340px;
  width: 340px;
  max-width: 100%;
  min-width: 0;
}

.nkvantage-nl-embed {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.nkvantage-nl-embed iframe {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0;
  height: 620px !important;
  min-height: 620px;
  border: 0 !important;
  margin: 0;
}

/* Mobile: use the full newsletter width and enough height for Brevo's
   stacked fields, consent text and confirmation state. */
@media (max-width: 800px) {
  .newsletter .nkvantage-nl-embed {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
  }

  .nkvantage-nl-embed iframe {
    width: 100% !important;
    height: 720px !important;
    min-height: 720px;
  }
}

/* =====================================================================
 * WPFORMS LITE — middle "newsletter" section skin
 * Makes the [wpforms id="183" title="false"] form sit next to the
 * heading/text like the old built-in form did: fixed-width column on
 * desktop, full width stacked below the text on mobile. Covers both
 * WPForms' "classic" and "modern" markup, since we can't detect which
 * one your install renders from here.
 * ================================================================== */

.newsletter .wpforms-container,
.newsletter .wpforms-container-full {
  width: 100%;
  max-width: 340px;
  flex-shrink: 0;
  margin: 0 !important;
}

.newsletter form.wpforms-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin: 0 !important;
}

.newsletter .wpforms-field-container {
  flex: 1 1 200px;
  min-width: 0;
  margin: 0 !important;
}

.newsletter .wpforms-field {
  width: 100%;
  padding: 0 !important;
  margin: 0 !important;
}

/* The site's original form had no visible label — hide WPForms' label
   visually but keep it for screen readers. */
.newsletter .wpforms-field-label,
.newsletter .wpforms-field-sublabel,
.newsletter .wpforms-description {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.newsletter .wpforms-field input[type="email"],
.newsletter .wpforms-field input[type="text"] {
  width: 100% !important;
  height: 48px;
  padding: 0 16px;
  box-sizing: border-box;
  border: 1px solid #3A3F47 !important;
  background: #1E2127 !important;
  color: #fff !important;
  font-family: var(--font-body, Inter, sans-serif);
  font-size: 14px;
  border-radius: 4px;
}

.newsletter .wpforms-field input::placeholder {
  color: #7A7F87;
}

.newsletter .wpforms-submit-container {
  flex-shrink: 0;
  margin: 0 !important;
}

.newsletter button.wpforms-submit {
  height: 48px;
  padding: 0 22px;
  background: var(--brand) !important;
  color: #fff !important;
  border: 1px solid var(--brand) !important;
  border-radius: 4px;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.newsletter button.wpforms-submit:hover {
  background: #25409C !important;
}

/* Validation + confirmation messages need to be readable on the dark band */
.newsletter .wpforms-error {
  color: #FFB3B3 !important;
  font-size: 12.5px;
}

.newsletter .wpforms-confirmation-container-full {
  color: #fff !important;
  background: transparent !important;
  border: 1px solid #3A3F47 !important;
  border-radius: 4px;
  padding: 12px 16px;
}

/* Mobile: match the site's existing 800px breakpoint — stack full width */
@media (max-width: 800px) {
  .newsletter .wpforms-container,
  .newsletter .wpforms-container-full {
    max-width: 100%;
    width: 100%;
  }

  .newsletter .wpforms-field-container {
    flex: 1 1 100%;
    width: 100%;
  }

  .newsletter .wpforms-submit-container,
  .newsletter button.wpforms-submit {
    width: 100%;
  }
}

/* =====================================================================
 * WPFORMS LITE — GLOBAL SAFETY NET (all pages, not just the homepage
 * newsletter band). Prevents the form from ever being squeezed
 * narrower than its content — this is what caused the Name/Email
 * fields and Submit button to overflow/wrap on mobile.
 * ================================================================== */

.wpforms-container,
.wpforms-container-full {
  max-width: 100% !important;
  box-sizing: border-box;
}

.wpforms-container *,
.wpforms-container-full * {
  box-sizing: border-box;
}

.wpforms-field {
  max-width: 100%;
}

.wpforms-field input,
.wpforms-field textarea,
.wpforms-field select {
  max-width: 100%;
}

.wpforms-submit-container,
button.wpforms-submit {
  max-width: 100%;
  white-space: nowrap;
}

/* Name (First/Last) field — stack full width on narrow phones instead
   of splitting into two columns that can get squeezed. */
@media (max-width: 480px) {
  .wpforms-field-name .wpforms-field-row,
  .wpforms-field-name .wpforms-field-row-block {
    display: block !important;
    width: 100% !important;
    float: none !important;
    margin: 0 0 10px !important;
  }
}

/* =====================================================================
 * WPFORMS LITE — DESKTOP LAYOUT HARDFIX
 * The text column was collapsing to one-word-per-line on wide desktop
 * screens (its flex-grow wasn't being honored, so the leftover space
 * was being dumped as a huge gap before the form instead). Pinning
 * both columns to explicit, !important-backed sizes so this can't
 * happen regardless of what else is on the page.
 * ================================================================== */

.newsletter .wrap {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 40px !important;
}

.newsletter .wrap > div:first-child {
  flex: 1 1 380px !important;
  min-width: 280px !important;
  max-width: 520px !important;
}

.newsletter .wpforms-container,
.newsletter .wpforms-container-full {
  flex: 0 0 340px !important;
  width: 340px !important;
  max-width: 340px !important;
  margin-left: auto !important;
}

@media (max-width: 800px) {
  .newsletter .wrap > div:first-child {
    flex: 1 1 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .newsletter .wpforms-container,
  .newsletter .wpforms-container-full {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
  }
}
