/* ============================================================================
   K4C Exit-intent modal (#1001260)

   Fires sitewide on exit-intent EXCEPT safety_level: elevated pages.
   z-index 1799 — below quick-exit tab (2000) so the safety feature always shows.
   ============================================================================ */

/* ---- Overlay -------------------------------------------------------------- */
.kfc-exit {
  position: fixed;
  inset: 0;
  z-index: 1799;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--k4c-space-5);
  background: rgba(28, 14, 46, 0.86);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.kfc-exit.is-open {
  opacity: 1;
  visibility: visible;
}

@media (prefers-reduced-motion: reduce) {
  .kfc-exit,
  .kfc-exit__panel {
    transition: none !important;
    transform: none !important;
  }
}

/* ---- Panel ---------------------------------------------------------------- */
.kfc-exit__panel {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 880px;
  width: 100%;
  max-height: calc(100svh - 4rem);
  border-radius: var(--k4c-radius-lg);
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(17, 17, 17, 0.55);
  transform: translateY(24px) scale(0.98);
  transition: transform 0.38s cubic-bezier(0.34, 1.18, 0.64, 1);
}

.kfc-exit.is-open .kfc-exit__panel {
  transform: translateY(0) scale(1);
}

/* ---- Left: brand visual -------------------------------------------------- */
.kfc-exit__visual {
  position: relative;
  background: var(--k4c-purple-900);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 420px;
}

.kfc-exit__visual::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 55% at 50% 10%, rgba(121, 96, 160, 0.5) 0%, transparent 70%),
    radial-gradient(ellipse 60% 70% at 70% 100%, rgba(255, 199, 41, 0.14) 0%, transparent 60%),
    linear-gradient(160deg, var(--k4c-purple) 0%, var(--k4c-purple-900) 100%);
  z-index: 0;
}

.kfc-exit__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  mix-blend-mode: luminosity;
  opacity: 0.5;
}

.kfc-exit__visual-copy {
  position: relative;
  z-index: 1;
  padding: var(--k4c-space-6);
  color: var(--k4c-white);
  background: linear-gradient(to top, rgba(28, 14, 46, 0.85) 0%, transparent 100%);
  padding-top: var(--k4c-space-9);
}

.kfc-exit__tagline {
  font-family: var(--k4c-font-heading);
  font-size: clamp(1.05rem, 0.9rem + 0.6vw, 1.3rem);
  font-weight: var(--k4c-fw-bold);
  line-height: var(--k4c-lh-heading);
  margin: 0 0 var(--k4c-space-2);
}

.kfc-exit__sub {
  font-size: var(--k4c-fs-sm);
  opacity: 0.72;
  line-height: var(--k4c-lh-body);
  margin: 0;
}

/* ---- Right: choices ------------------------------------------------------- */
.kfc-exit__choices {
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--k4c-space-8) var(--k4c-space-6);
  overflow-y: auto;
}

.kfc-exit__eyebrow {
  font-family: var(--k4c-font-heading);
  font-size: var(--k4c-fs-xs);
  font-weight: var(--k4c-fw-bold);
  letter-spacing: var(--k4c-tracking-caps);
  text-transform: uppercase;
  color: var(--k4c-purple);
  margin: 0 0 var(--k4c-space-2);
}

.kfc-exit__heading {
  font-family: var(--k4c-font-heading);
  font-size: var(--k4c-fs-xl);
  font-weight: var(--k4c-fw-extrabold);
  line-height: var(--k4c-lh-heading);
  color: var(--k4c-grey);
  margin: 0 0 var(--k4c-space-3);
}

.kfc-exit__heading span {
  color: var(--k4c-purple);
}

.kfc-exit__intro {
  font-size: var(--k4c-fs-base);
  color: var(--k4c-grey-600);
  line-height: var(--k4c-lh-body);
  margin: 0 0 var(--k4c-space-6);
}

/* ---- Choice cards --------------------------------------------------------- */
.kfc-exit__cards {
  display: flex;
  flex-direction: column;
  gap: var(--k4c-space-3);
  margin-bottom: var(--k4c-space-5);
}

.kfc-exit__card {
  display: flex;
  align-items: flex-start;
  gap: var(--k4c-space-4);
  padding: var(--k4c-space-4) var(--k4c-space-5);
  border: 2px solid var(--k4c-purple-100);
  border-radius: var(--k4c-radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease,
              box-shadow 0.15s ease;
}

.kfc-exit__card:hover,
.kfc-exit__card:focus-visible {
  border-color: var(--k4c-purple);
  background: var(--k4c-purple-50);
  transform: translateY(-2px);
  box-shadow: var(--k4c-shadow);
  outline: none;
}

/* <button> cards (brochure) — undo the theme's global button fill (purple bg,
   centred text, font) so it matches the outlined <a> cards. #1001399 */
button.kfc-exit__card {
  width: 100%;
  margin: 0;
  background: #fff;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

button.kfc-exit__card:hover,
button.kfc-exit__card:focus-visible {
  background: var(--k4c-purple-50);
  color: inherit;
}

/* Primary card — purple fill */
.kfc-exit__card--primary {
  background: var(--k4c-purple);
  border-color: var(--k4c-purple);
  color: #fff;
}

.kfc-exit__card--primary:hover,
.kfc-exit__card--primary:focus-visible {
  background: var(--k4c-purple-dark);
  border-color: var(--k4c-purple-dark);
  box-shadow: 0 6px 20px rgba(81, 45, 127, 0.35);
}

/* Icon chip */
.kfc-exit__card-ico {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: var(--k4c-radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kfc-exit__card--primary .kfc-exit__card-ico {
  background: rgba(255, 255, 255, 0.15);
  color: var(--k4c-yellow);
}

.kfc-exit__card:not(.kfc-exit__card--primary) .kfc-exit__card-ico {
  background: var(--k4c-purple-100);
  color: var(--k4c-purple);
}

/* Card text */
.kfc-exit__card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kfc-exit__card-title {
  font-family: var(--k4c-font-heading);
  font-size: var(--k4c-fs-base);
  font-weight: var(--k4c-fw-bold);
  line-height: var(--k4c-lh-heading);
}

.kfc-exit__card-desc {
  font-size: var(--k4c-fs-sm);
  line-height: 1.45;
  opacity: 0.82;
}

/* ---- GHL form pane -------------------------------------------------------- */
.kfc-exit__form-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  margin-bottom: var(--k4c-space-5);
  animation: kfc-exit-slide-in 0.28s cubic-bezier(0.34, 1.18, 0.64, 1) both;
}

@keyframes kfc-exit-slide-in {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0);    }
}

.kfc-exit__form-pane[hidden] {
  display: none;
}

.kfc-exit__form-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--k4c-fs-sm);
  color: var(--k4c-purple);
  font-weight: var(--k4c-fw-semibold);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 0 var(--k4c-space-3);
  transition: color 0.15s ease;
  text-decoration: underline;
  text-decoration-color: transparent;
}

.kfc-exit__form-back:hover,
.kfc-exit__form-back:focus-visible {
  color: var(--k4c-purple-dark);
  text-decoration-color: currentColor;
  outline: none;
}

.kfc-exit__form-heading {
  font-family: var(--k4c-font-heading);
  font-size: var(--k4c-fs-base);
  font-weight: var(--k4c-fw-bold);
  color: var(--k4c-grey);
  margin: 0 0 var(--k4c-space-3);
}

.kfc-exit__ghl-frame {
  width: 100%;
  flex: 1;
  min-height: 300px;
  border: 1px solid var(--k4c-purple-100);
  border-radius: var(--k4c-radius);
}

/* When the form pane is visible, push the dismiss button down naturally */
.kfc-exit__choices:has(.kfc-exit__form-pane:not([hidden])) .kfc-exit__dismiss {
  margin-top: var(--k4c-space-3);
}

/* ---- Dismiss link --------------------------------------------------------- */
.kfc-exit__dismiss {
  display: block;
  width: 100%;
  text-align: center;
  font-size: var(--k4c-fs-sm);
  color: var(--k4c-grey-400);
  cursor: pointer;
  background: none;
  border: none;
  padding: var(--k4c-space-2) 0;
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.kfc-exit__dismiss:hover,
.kfc-exit__dismiss:focus-visible {
  color: var(--k4c-grey-600);
  text-decoration-color: currentColor;
  outline: none;
}

/* ---- Close × button ------------------------------------------------------- */
.kfc-exit__close {
  position: absolute;
  top: var(--k4c-space-4);
  right: var(--k4c-space-4);
  z-index: 3;
  width: 36px;
  height: 36px;
  border-radius: var(--k4c-radius-pill);
  background: rgba(17, 17, 17, 0.45);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.kfc-exit__close:hover,
.kfc-exit__close:focus-visible {
  background: rgba(17, 17, 17, 0.75);
  outline: 2px solid var(--k4c-yellow);
  outline-offset: 2px;
}

/* ---- Body scroll lock ----------------------------------------------------- */
body.kfc-exit-open {
  overflow: hidden;
}

/* ---- Mobile --------------------------------------------------------------- */
@media (max-width: 640px) {
  .kfc-exit {
    padding: var(--k4c-space-3);
    align-items: flex-end;   /* sheet rises from bottom on mobile */
  }

  .kfc-exit__panel {
    grid-template-columns: 1fr;
    max-height: calc(100svh - 2rem);
    border-radius: var(--k4c-radius-lg) var(--k4c-radius-lg) 0 0;
    transform: translateY(100%);
  }

  .kfc-exit.is-open .kfc-exit__panel {
    transform: translateY(0);
  }

  .kfc-exit__visual {
    min-height: 160px;
    max-height: 200px;
  }

  .kfc-exit__photo {
    object-position: 50% 15%;
  }

  .kfc-exit__visual-copy {
    padding: var(--k4c-space-4) var(--k4c-space-5) var(--k4c-space-4);
    padding-top: var(--k4c-space-7);
  }

  .kfc-exit__tagline {
    font-size: var(--k4c-fs-base);
  }

  .kfc-exit__choices {
    padding: var(--k4c-space-5) var(--k4c-space-5) var(--k4c-space-6);
    justify-content: flex-start;
  }

  .kfc-exit__heading {
    font-size: var(--k4c-fs-lg);
    margin-bottom: var(--k4c-space-2);
  }

  .kfc-exit__intro {
    font-size: var(--k4c-fs-sm);
    margin-bottom: var(--k4c-space-4);
  }
}

/* #1001743 — the global `p` colour (#242424) beat the inherited white on the
   dark photo panel; pin the copy white explicitly. */
.kfc-exit__visual-copy p.kfc-exit__tagline,
.kfc-exit__visual-copy p.kfc-exit__sub {
  color: var(--k4c-white, #fff);
}
