/* Exit-intent popup (templates/exit-popup.php, js/exit-popup.js).

   Its own stylesheet on purpose: three of the ten themes (the Sage/Tailwind ones)
   never enqueue css/styles-mandatory.css, so rules placed there reach only part of
   the fleet — the popup rendered unstyled on design15 for exactly that reason. This
   file is enqueued next to the trigger script, so it loads wherever the popup does.

   Every rule that a theme might fight for is scoped through `dialog.cspl-exit-popup`
   (0,2,1). A bare class (0,1,0) loses to theme rules like `body.design11-theme h3`
   (0,1,2), which once left the title white on the white card. */

.cspl-exit-popup {
  /* <dialog> ships with a border and padding; both fight the card look. */
  border: 0;
  padding: 0;
  /* Tailwind preflight zeroes the UA `margin: auto` and `height: fit-content` that
     centre and size a modal dialog, dropping it in the top-left corner at full
     viewport height. Restate both rather than trusting the UA sheet. */
  position: fixed;
  inset: 0;
  margin: auto;
  height: fit-content;
  max-width: 460px;
  width: calc(100% - 32px);
  border-radius: 16px;
  /* Explicit surface AND text colour, never `inherit`: on the dark themes the page's
     light text colour landed on this white card and the whole popup was invisible
     except the button. A site can opt into a dark popup by setting the sticky-banner
     colours, which also rescues white brand logos on dark themes. */
  background: var(--cspl-exitpopup-bg, #fff);
  color: var(--cspl-exitpopup-color, #10233f);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.cspl-exit-popup::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

/* Close control. Sits outside the card link so it can be pressed without outlinking. */
dialog.cspl-exit-popup .cspl-exit-popup__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}
dialog.cspl-exit-popup .cspl-exit-popup__close:hover {
  color: #4b5563;
  background: #f3f4f6;
}

/* The whole card is one affiliate click. */
dialog.cspl-exit-popup .cspl-exit-popup__card,
dialog.cspl-exit-popup .cspl-exit-popup__card:hover {
  display: block;
  padding: 28px 28px 26px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

dialog.cspl-exit-popup .cspl-exit-popup__head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  white-space: nowrap;
  margin-bottom: 18px;
}
dialog.cspl-exit-popup .cspl-exit-popup__logo {
  height: 32px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  flex-shrink: 0;
}
dialog.cspl-exit-popup .cspl-exit-popup__rating {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
dialog.cspl-exit-popup .cspl-exit-popup__rating-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
dialog.cspl-exit-popup .cspl-exit-popup__rating-label {
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: var(--cspl-exitpopup-color, #10233f);
}
dialog.cspl-exit-popup .cspl-exit-popup__stars {
  display: flex;
  align-items: center;
  gap: 2px;
  line-height: 0;
}
dialog.cspl-exit-popup .cspl-exit-popup__stars .is-filled {
  fill: #facc15;
}
dialog.cspl-exit-popup .cspl-exit-popup__stars .is-empty {
  fill: #d1d5db;
}
dialog.cspl-exit-popup .cspl-exit-popup__score {
  font-size: 36px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -1.5px;
  color: var(--cspl-exitpopup-color, #10233f);
}

dialog.cspl-exit-popup .cspl-exit-popup__subtitle {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  color: #6b7280;
}
dialog.cspl-exit-popup .cspl-exit-popup__title {
  margin: 0 0 18px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--cspl-exitpopup-color, #10233f);
}

dialog.cspl-exit-popup .cspl-exit-popup__coupon {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 18px;
  padding: 7px 14px;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  color: var(--cspl-exitpopup-color, #10233f);
}
dialog.cspl-exit-popup .cspl-exit-popup__coupon-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
}
dialog.cspl-exit-popup .cspl-exit-popup__coupon-code {
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--cspl-exitpopup-color, #10233f);
}

/* Styled as a button but rendered as a span: it lives inside the card's own <a>, and a
   nested link would be invalid HTML. */
dialog.cspl-exit-popup .cspl-exit-popup__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: 0 0 12px;
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  background-color: var(--cspl-sticky-btn-bg, #1e73be);
  color: var(--cspl-sticky-btn-color, #fff);
  transition: background-color 0.15s ease;
}
dialog.cspl-exit-popup .cspl-exit-popup__card:hover .cspl-exit-popup__cta {
  filter: brightness(0.92);
}
dialog.cspl-exit-popup .cspl-exit-popup__visit {
  display: block;
  width: 100%;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  color: var(--cspl-sticky-btn-bg, #1e73be);
}

@media (max-width: 575px) {
  dialog.cspl-exit-popup .cspl-exit-popup__card {
    padding: 24px 20px 22px;
  }
  dialog.cspl-exit-popup .cspl-exit-popup__score {
    font-size: 30px;
  }
}
