/* "Save $25" newsletter popup (#exit-popup), live copy. Markup: assets/partials/save25-popup.php (dev: save25-popup-dev.*).
   Built from components the site already uses, with their measurements copied:
   - card, chip, title, lead, fields, consent, coral pill: the signup card on affiliates.php and /pr-templates/
     (affiliates-v9.css .bp-aff-join-card / .bp-aff-field / .bp-aff-btn--primary, pr-templates.css head + consent);
   - checkbox: homepage-v9.css body.bp-index7 input[type=checkbox];
   - tick under the button: the homepage CTA's .cta-guarantee-list;
   - close button: the homepage modals' round close (.modal-inline-close).
   Everything is scoped to #exit-popup.bp-s25 and set explicitly: lity moves the popup out of #wrap when it opens, and
   the popup also runs on pages without the homepage stylesheets (/about-us/). Never set display on #exit-popup
   itself: .lity-hide (display: none) must keep it hidden in the page. */

#exit-popup.bp-s25 {
  --s25-ink: #1d1d1d;
  --s25-body: #5f6773;          /* 5.7:1 on white */
  --s25-muted: #737373;
  --s25-link: #006fc9;          /* focus ring, as the signup card */
  --s25-blue: #0287ed;          /* chip + checked box */
  --s25-green: #70a986;         /* homepage CTA tick */
  --s25-coral: #fe506c;
  --s25-orange: #fc6a2a;
  --s25-gutter: 16px;
  position: relative;
  width: min(880px, calc(100vw - 2 * var(--s25-gutter))) !important;
  max-width: none !important;
  margin: 0 auto !important;
  padding: 0 !important;
  border-radius: 16px !important;
  overflow: visible !important;
  background: transparent !important;
  font-family: inherit;
  text-align: left;
  -webkit-font-smoothing: antialiased;
}
#exit-popup.bp-s25 *,
#exit-popup.bp-s25 *::before,
#exit-popup.bp-s25 *::after {
  box-sizing: border-box;
}

/* card: one column; from 768px the photo joins on the right. Never taller than the window: the text column scrolls. */
#exit-popup.bp-s25 .bp-s25-card {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 2 * var(--s25-gutter));
  max-height: calc(100dvh - 2 * var(--s25-gutter));
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 30px 60px rgba(8, 24, 48, 0.35);
  color: var(--s25-body);
}
#exit-popup.bp-s25 .bp-s25-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 36px 40px 28px;
}
#exit-popup.bp-s25 .bp-s25-photo {
  display: none;
}

/* close: the video modals' close button (.video-modal-close, homepage-v9.css): 44px, transparent until hovered or
   focused, then the dark #1d1d1d circle with a white x, a soft shadow and a 1.06 scale (none while pressed), an Arial x,
   10px from the corner, a 60px tap target. The video's x is white because it sits on video; here it is the ink colour so
   it shows on the white card and on the photo, and it turns white on the dark circle as the video's does. */
#exit-popup.bp-s25 .bp-s25-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  color: var(--s25-ink);
  font-family: Arial, sans-serif;
  font-size: 30px;
  font-weight: 500;
  line-height: 1;
  text-shadow: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 140ms cubic-bezier(0.23, 1, 0.32, 1), background-color 160ms ease, color 160ms ease;
}
#exit-popup.bp-s25 .bp-s25-close span {
  display: block;
  margin: 0;
  pointer-events: none;
}
#exit-popup.bp-s25 .bp-s25-close::after {   /* 60px tap target */
  content: "";
  position: absolute;
  inset: -8px;
}
#exit-popup.bp-s25 .bp-s25-close:hover,
#exit-popup.bp-s25 .bp-s25-close:focus-visible {
  border-color: rgba(255, 255, 255, 0.16);
  background: #1d1d1d;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  color: #fff;
  outline: none;
  transform: scale(1.06);
}
#exit-popup.bp-s25 .bp-s25-close:active {
  transform: none;
}

/* head: chip and title on one line, the lead full width below */
#exit-popup.bp-s25 .bp-s25-head {
  margin: 0 0 28px;
}
#exit-popup.bp-s25 .bp-s25-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 32px;          /* room for the close button when it sits over the text column */
}
#exit-popup.bp-s25 .bp-s25-chip {
  display: inline-flex;
  flex: 0 0 42px;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(2, 135, 237, 0.08);
  color: var(--s25-blue);
}
#exit-popup.bp-s25 .bp-s25-chip svg {
  display: block;
  width: 16px;
  height: 16px;
}
#exit-popup.bp-s25 .bp-s25-title {
  margin: 0 !important;
  padding: 0 !important;
  background: none !important;
  color: var(--s25-ink) !important;
  -webkit-text-fill-color: currentColor;
  font-family: inherit !important;
  font-size: 26px !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  letter-spacing: -0.015em !important;
  text-transform: none !important;
  text-wrap: balance;
}
#exit-popup.bp-s25 .bp-s25-lead {
  margin: 12px 0 0;
  padding: 0;
  color: var(--s25-body);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
}

/* fields */
#exit-popup.bp-s25 .bp-s25-form {
  margin: 0;
  padding: 0;
}
#exit-popup.bp-s25 .bp-s25-field {
  margin: 0 0 16px;
}
#exit-popup.bp-s25 .bp-s25-field label {
  display: block;
  margin: 0 0 6px;
  padding: 0;
  color: var(--s25-ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
#exit-popup.bp-s25 .bp-s25-field input {
  display: block;
  width: 100%;
  height: 52px;
  margin: 0;
  padding: 0 16px;
  border: 1px solid #d5d9e0;
  border-radius: 8px !important;
  background: #f9fafb;
  box-shadow: none;
  color: var(--s25-ink);
  font-family: inherit;
  font-size: 16px;            /* 16px: iPhone Safari does not zoom in on focus */
  font-weight: 400;
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
#exit-popup.bp-s25 .bp-s25-field input::placeholder {
  color: #858c98;
  opacity: 1;
}
#exit-popup.bp-s25 .bp-s25-field input:hover {
  border-color: #b9bfc9;
}
#exit-popup.bp-s25 .bp-s25-field input:focus {
  outline: none;
  border-color: var(--s25-link);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 111, 201, 0.18);
}

/* consent: the signup card's small text with the site's checkbox */
#exit-popup.bp-s25 .bp-s25-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 0;
  padding: 0;
  color: var(--s25-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  cursor: pointer;
}
#exit-popup.bp-s25 .bp-s25-consent .gdpr_checkbox {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 20px;
  float: none;
  width: 20px !important;
  height: 20px !important;
  margin: 0 !important;
  padding: 0;
  border: 1.5px solid #c4c8d0;
  border-radius: 8px !important;
  background: #fff center / 14px 14px no-repeat;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
#exit-popup.bp-s25 .bp-s25-consent .gdpr_checkbox:hover {
  border-color: #9aa1ad;
}
#exit-popup.bp-s25 .bp-s25-consent .gdpr_checkbox:checked {
  border-color: var(--s25-blue);
  background-color: var(--s25-blue);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E");
}
#exit-popup.bp-s25 .bp-s25-consent .gdpr_checkbox:focus-visible {
  outline: 2px solid var(--s25-link);
  outline-offset: 2px;
}

/* the coral pill (homepage hero CTA): reversed gradient on hover, a small press */
#exit-popup.bp-s25 .bp-s25-btn {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  margin: 22px 0 0;
  padding: 0 29.6px;
  border: 0;
  border-radius: 9999px;
  background: linear-gradient(to right, var(--s25-coral) 0, var(--s25-orange) 100%);
  box-shadow: none;
  color: #fff;
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-align: center;
  text-transform: none;
  white-space: normal;
  cursor: pointer;
  transition: transform 140ms cubic-bezier(0.23, 1, 0.32, 1);
}
#exit-popup.bp-s25 .bp-s25-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(to right, var(--s25-orange) 0, var(--s25-coral) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}
#exit-popup.bp-s25 .bp-s25-btn:hover::before,
#exit-popup.bp-s25 .bp-s25-btn:focus-visible::before {
  opacity: 1;
}
#exit-popup.bp-s25 .bp-s25-btn:active {
  transform: scale(0.98);
}
#exit-popup.bp-s25 .bp-s25-btn:focus-visible {
  outline: 2px solid var(--s25-link);
  outline-offset: 3px;
}
#exit-popup.bp-s25 .bp-s25-btn[disabled] {
  cursor: progress;
  opacity: 0.85;
}

/* error nudge: the order form's Next buttons (order/index.php .bp-nudge: 500ms, 6/5/3/1px damped), added by the
   partial's script when the form has a validation error */
@keyframes bp-s25-nudge {
  0% { transform: translateX(0); }
  15% { transform: translateX(-6px); }
  35% { transform: translateX(5px); }
  55% { transform: translateX(-3px); }
  75% { transform: translateX(1px); }
  100% { transform: translateX(0); }
}
#exit-popup.bp-s25 .bp-s25-btn.bp-s25-nudge {
  animation: bp-s25-nudge 500ms cubic-bezier(.36, .07, .19, .97) both;
}

/* under the button: the homepage CTA's green tick line */
#exit-popup.bp-s25 .bp-s25-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6.4px;
  margin: 16px 0 0;
  padding: 0;
  color: var(--s25-muted);
  font-size: 14.45px;
  font-weight: 400;
  line-height: 1.4;
}
#exit-popup.bp-s25 .bp-s25-note svg {
  flex: 0 0 auto;
  width: 16.6px;
  height: 16.6px;
  color: var(--s25-green);
}

/* SendFox's own messages (form.js appends p.sendfox-message.success / .error to the form) */
#exit-popup.bp-s25 .sendfox-message {
  margin: 16px 0 0;
  padding: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}
#exit-popup.bp-s25 .sendfox-message.error {
  color: #b42318;
}
#exit-popup.bp-s25 .sendfox-message.success {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--s25-ink);
  font-size: 17px;
  font-weight: 600;
}
#exit-popup.bp-s25 .sendfox-message.success::before {
  content: "";
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath fill='%2370a986' d='M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* after a successful signup only the confirmation stays: fields, consent, button and the tick line go */
#exit-popup.bp-s25 .bp-s25-done {
  display: none;
  margin: 8px 0 0;
  padding: 0 0 0 28px;
  color: var(--s25-body);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
}
#exit-popup.bp-s25 .bp-s25-form:has(.sendfox-message.success) > :not(.sendfox-message),
#exit-popup.bp-s25 .bp-s25-body:has(.sendfox-message.success) .bp-s25-note {
  display: none;
}
#exit-popup.bp-s25 .bp-s25-body:has(.sendfox-message.success) .bp-s25-done {
  display: block;
}

/* lity's own close button is replaced by the card's */
.lity-content:has(#exit-popup.bp-s25) + .lity-close {
  display: none !important;
}
/* the theme makes lity's container a fixed 750px from 768px (vendors_theme_mobile.css): the popup sets its own width */
.lity-container:has(#exit-popup.bp-s25) {
  width: auto !important;
  max-width: 100% !important;
}

/* 768px and up (and at least 541px tall): the photo fills a side panel on the right; the close button sits on the photo */
@media (min-width: 768px) and (min-height: 541px) {
  #exit-popup.bp-s25 .bp-s25-card {
    flex-direction: row;
  }
  #exit-popup.bp-s25 .bp-s25-body {
    flex: 1 1 0;
  }
  #exit-popup.bp-s25 .bp-s25-title-row {
    padding-right: 0;
  }
  #exit-popup.bp-s25 .bp-s25-photo {
    position: relative;
    display: block;
    flex: 0 0 45%;
    overflow: hidden;
    background: #c9c3f0;
  }
  #exit-popup.bp-s25 .bp-s25-photo img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    max-width: none;
    height: 100%;
    margin: 0;
    border-radius: 0;
    object-fit: cover;
    object-position: 50% 30%;
  }
}

/* 768-991px: at most the theme's 750px lity container, so browsers without :has() centre it too */
@media (min-width: 768px) and (max-width: 991px) {
  #exit-popup.bp-s25 {
    width: min(750px, calc(100vw - 2 * var(--s25-gutter))) !important;
  }
}

/* below 768px: one column, the signup card's width */
@media (max-width: 767px) {
  #exit-popup.bp-s25 {
    width: min(480px, calc(100vw - 2 * var(--s25-gutter))) !important;
  }
}

/* short windows (landscape phones): one column at the signup card's width, no photo (the side panel needs 541px) */
@media (max-height: 540px) {
  #exit-popup.bp-s25 {
    width: min(480px, calc(100vw - 2 * var(--s25-gutter))) !important;
  }
}

/* phones: the signup card's phone padding and title size */
@media (max-width: 575px) {
  #exit-popup.bp-s25 .bp-s25-body {
    padding: 24px 20px 22px;
  }
  #exit-popup.bp-s25 .bp-s25-head {
    margin-bottom: 24px;
  }
  #exit-popup.bp-s25 .bp-s25-title-row {
    padding-right: 36px;
  }
  #exit-popup.bp-s25 .bp-s25-title {
    font-size: 21px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  #exit-popup.bp-s25 .bp-s25-btn.bp-s25-nudge {
    animation: none;
  }
  #exit-popup.bp-s25 .bp-s25-btn,
  #exit-popup.bp-s25 .bp-s25-btn::before,
  #exit-popup.bp-s25 .bp-s25-close,
  #exit-popup.bp-s25 .bp-s25-field input {
    transition: none;
  }
}
