/* ============================================================
   Exit-Intent Popup
   ============================================================ */

.ei-popup {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
  pointer-events: none;
}

.ei-popup.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Backdrop */
.ei-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(44, 36, 32, .72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

/* Dialog shell */
.ei-popup__dialog {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  max-width: 820px;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(44, 36, 32, .28);
  transform: scale(0.94) translateY(12px);
  transition: transform .3s cubic-bezier(.22, 1, .36, 1);
}

.ei-popup.is-open .ei-popup__dialog {
  transform: scale(1) translateY(0);
}

/* Close button */
.ei-popup__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  transition: background .15s;
}

.ei-popup__close:hover {
  background: rgba(255, 255, 255, .32);
}

/* ── Left photo panel ── */
.ei-popup__photo {
  position: relative;
  min-height: 420px;
  background-image: url('/assets/website-graphics/emotional-bg.webp');
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 32px 28px;
}

/* Dark gradient overlay so text is legible */
.ei-popup__photo::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(44, 36, 32, .30) 0%,
    rgba(44, 36, 32, .72) 60%,
    rgba(44, 36, 32, .88) 100%
  );
}

.ei-popup__photo-content {
  position: relative;
  z-index: 1;
}

.ei-popup__photo-eyebrow {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .75);
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 10px;
}

.ei-popup__photo-headline {
  font-family: 'Bebas Neue', 'Impact', sans-serif;
  font-size: 2.4rem;
  line-height: 1.05;
  color: #fff;
  margin: 0 0 8px;
  letter-spacing: .02em;
}

.ei-popup__photo-sub {
  font-size: .88rem;
  color: rgba(255, 255, 255, .78);
  margin: 0;
  line-height: 1.5;
}

/* ── Right form panel ── */
.ei-popup__form-panel {
  background: #F4EEE2;
  padding: 40px 36px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ei-popup__headline {
  font-family: 'Bebas Neue', 'Impact', sans-serif;
  font-size: 2rem;
  line-height: 1.05;
  color: #2C2420;
  margin: 0 0 8px;
  letter-spacing: .02em;
}

.ei-popup__subtext {
  font-size: .9rem;
  color: #6B5E54;
  line-height: 1.55;
  margin: 0 0 24px;
}

/* Form states */
.ei-popup__form-body {
  display: block;
}

.ei-popup__success {
  display: none;
}

.ei-popup.is-success .ei-popup__form-body {
  display: none;
}

.ei-popup.is-success .ei-popup__success {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

/* Email input */
.ei-popup__input-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.ei-popup__input {
  width: 100%;
  border: 1.5px solid #DDD5C8;
  border-radius: 999px;
  padding: 13px 18px;
  font-size: .92rem;
  font-family: 'Manrope', Inter, sans-serif;
  background: #fff;
  color: #2C2420;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}

.ei-popup__input::placeholder {
  color: #8A7D72;
}

.ei-popup__input:focus {
  outline: none;
  border-color: #504237;
  box-shadow: 0 0 0 3px rgba(80, 66, 55, .12);
}

/* CTA button */
.ei-popup__cta {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 14px 20px;
  background: #504237;
  color: #F4EEE2;
  font-size: .92rem;
  font-weight: 700;
  font-family: 'Manrope', Inter, sans-serif;
  cursor: pointer;
  transition: background .18s, transform .12s;
  letter-spacing: .01em;
}

.ei-popup__cta:hover {
  background: #3D3129;
}

.ei-popup__cta:active {
  transform: scale(0.98);
}

.ei-popup__cta:disabled {
  opacity: .65;
  cursor: not-allowed;
}

/* Error message */
.ei-popup__error {
  display: none;
  font-size: .82rem;
  color: #9B3B3B;
  background: rgba(155, 59, 59, .08);
  border: 1px solid rgba(155, 59, 59, .2);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
}

.ei-popup__error.is-visible {
  display: block;
}

/* Trust line */
.ei-popup__trust {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: .76rem;
  color: #8A7D72;
}

.ei-popup__trust svg {
  flex-shrink: 0;
  color: #6B8E5A;
}

/* Dismiss link */
.ei-popup__dismiss {
  display: block;
  margin-top: 16px;
  font-size: .78rem;
  color: #8A7D72;
  text-align: center;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  background: none;
  border: none;
  font-family: inherit;
  padding: 0;
  transition: color .15s;
}

.ei-popup__dismiss:hover {
  color: #504237;
}

/* ── Success state ── */
.ei-popup__success-icon {
  width: 48px;
  height: 48px;
  background: #EAF0E6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6B8E5A;
  flex-shrink: 0;
  margin-bottom: 4px;
}

.ei-popup__success-title {
  font-family: 'Bebas Neue', 'Impact', sans-serif;
  font-size: 1.6rem;
  color: #2C2420;
  margin: 0;
  letter-spacing: .02em;
}

.ei-popup__success-body {
  font-size: .88rem;
  color: #6B5E54;
  line-height: 1.55;
  margin: 0;
}

.ei-popup__success-close {
  margin-top: 8px;
  border: 1.5px solid #DDD5C8;
  border-radius: 999px;
  padding: 10px 20px;
  background: transparent;
  color: #504237;
  font-size: .84rem;
  font-weight: 700;
  font-family: 'Manrope', Inter, sans-serif;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.ei-popup__success-close:hover {
  background: rgba(80, 66, 55, .07);
  border-color: #504237;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 640px) {
  .ei-popup {
    padding: 0;
    align-items: flex-end;
  }

  .ei-popup__dialog {
    grid-template-columns: 1fr;
    border-radius: 22px 22px 0 0;
    max-width: 100%;
    transform: translateY(40px);
  }

  .ei-popup.is-open .ei-popup__dialog {
    transform: translateY(0);
  }

  /* Hide photo panel on small screens — keep it lean */
  .ei-popup__photo {
    display: none;
  }

  .ei-popup__form-panel {
    padding: 32px 24px 28px;
    border-radius: 22px 22px 0 0;
  }

  .ei-popup__close {
    background: rgba(80, 66, 55, .12);
    color: #2C2420;
  }

  .ei-popup__close:hover {
    background: rgba(80, 66, 55, .2);
  }
}

@media (max-width: 820px) and (min-width: 641px) {
  .ei-popup__dialog {
    grid-template-columns: 1fr 1.2fr;
  }

  .ei-popup__photo {
    min-height: 360px;
  }

  .ei-popup__photo-headline {
    font-size: 2rem;
  }

  .ei-popup__form-panel {
    padding: 32px 28px;
  }
}
