/* ═══════════════════════════════════════════════════
   Lead Magnet Popup
   ═══════════════════════════════════════════════════ */

.lead-popup {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* ─── Backdrop ─── */
.lead-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: leadPopupFadeIn 0.3s ease;
}

/* ─── Card ─── */
.lead-popup-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--surface, #111111);
  border: 1px solid var(--border-gold, rgba(212, 168, 67, 0.2));
  border-radius: var(--radius-lg, 24px);
  padding: 48px 40px;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.6),
    0 0 60px rgba(212, 168, 67, 0.08);
  animation: leadPopupSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
}

/* ─── Close button ─── */
.lead-popup-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.06));
  border-radius: 50%;
  color: var(--text-tertiary, rgba(255, 255, 255, 0.45));
  cursor: pointer;
  transition:
    color 0.2s,
    border-color 0.2s,
    background 0.2s;
}

.lead-popup-close:hover {
  color: var(--text, #fff);
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
}

.lead-popup-close .material-symbols-outlined {
  font-size: 20px;
}

/* ─── Cover image variant ─── */
.lead-popup-card.has-cover {
  max-width: 520px;
  padding: 0;
  overflow: hidden;
}

.lead-popup-card.has-cover .lead-popup-body {
  padding: 32px 40px 40px;
}

.lead-popup-card.has-cover .lead-popup-close {
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-color: rgba(255, 255, 255, 0.1);
  color: #fff;
  z-index: 2;
}

.lead-popup-card.has-cover .lead-popup-close:hover {
  background: rgba(0, 0, 0, 0.7);
  border-color: rgba(255, 255, 255, 0.2);
}

/* The cover art is a 2:3 PORTRAIT guide cover. The old landscape art was let run at
   `width:100%; height:auto` inside a 340px-tall band, which on a portrait image shows only
   the top third and cuts the title and chart off. Stacked (narrow) layout therefore
   CONTAINS the whole cover in a fixed band; the wide layout below puts it in its own
   column at its native ratio. */
.lead-popup-cover {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lead-popup-cover-img {
  width: auto;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  display: block;
}

.lead-popup-cover-fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: linear-gradient(to bottom, transparent, var(--surface, #111111));
  pointer-events: none;
}

/* Wide layout: the portrait cover gets its own column next to the form, so the whole
   guide cover is visible at its native 2:3 without cropping. Below this width the card
   falls back to the stacked band above (the body column would get too narrow). */
@media (min-width: 641px) {
  .lead-popup-card.has-cover {
    max-width: 740px;
    display: grid;
    grid-template-columns: 300px 1fr;
    align-items: stretch;
  }

  .lead-popup-cover {
    height: auto;
    aspect-ratio: 2 / 3;
    display: block;
    /* Divider between two adjacent columns, not an accent bar on a card edge. */
    border-right: 1px solid var(--border, rgba(255, 255, 255, 0.06));
  }

  .lead-popup-cover-img {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    /* Column and art share the 2:3 ratio so nothing is cropped; if a longer headline ever
       makes the body column taller, the branding and title survive rather than the chart. */
    object-position: center top;
  }

  /* Bottom fade belongs to the stacked layout, where the cover sits above the copy. */
  .lead-popup-cover-fade {
    display: none;
  }

  .lead-popup-card.has-cover .lead-popup-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px;
  }

  /* The close button now sits over the body panel, not over the artwork, so it goes back
     to the default treatment (and drops a backdrop-filter layer). */
  .lead-popup-card.has-cover .lead-popup-close {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-color: var(--border, rgba(255, 255, 255, 0.06));
    color: var(--text-tertiary, rgba(255, 255, 255, 0.45));
  }

  .lead-popup-card.has-cover .lead-popup-close:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text, #fff);
  }
}

/* ─── Icon ─── */
.lead-popup-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(212, 168, 67, 0.1);
  border: 1px solid rgba(212, 168, 67, 0.2);
  border-radius: 50%;
}

.lead-popup-icon .material-symbols-outlined {
  font-size: 28px;
  color: var(--gold, #d4a843);
}

.lead-popup-icon--success .material-symbols-outlined {
  color: var(--green, #22c55e);
}

.lead-popup-icon--success {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.2);
}

/* ─── Typography ─── */
.lead-popup-title {
  font-family: 'Sora', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text, #fff);
  margin: 0 0 12px;
  line-height: 1.3;
}

.lead-popup-desc {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
  line-height: 1.6;
  margin: 0 0 28px;
}

/* ─── Form ─── */
.lead-popup-form {
  margin: 0 0 16px;
}

.lead-popup-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lead-popup-input {
  width: 100%;
  height: 52px;
  padding: 0 18px;
  background: var(--bg, #050505);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.06));
  border-radius: var(--radius-sm, 10px);
  color: var(--text, #fff);
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  outline: none;
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease;
  box-sizing: border-box;
}

.lead-popup-input::placeholder {
  color: var(--text-tertiary, rgba(255, 255, 255, 0.45));
}

.lead-popup-input:focus {
  border-color: var(--gold, #d4a843);
  box-shadow: 0 0 20px rgba(212, 168, 67, 0.1);
}

.lead-popup-input.has-error {
  border-color: var(--red, #ef4444);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.1);
}

/* ─── Submit button ─── */
.lead-popup-submit {
  width: 100%;
  height: 52px;
  padding: 0 32px;
  background: linear-gradient(135deg, var(--gold-light, #f0cd26), var(--gold, #d4a843));
  border: none;
  border-radius: 100px;
  color: #000;
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  box-shadow: 0 4px 24px rgba(212, 168, 67, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.lead-popup-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 40px rgba(212, 168, 67, 0.35);
}

.lead-popup-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* ─── Spinner ─── */
@keyframes leadPopupSpin {
  to {
    transform: rotate(360deg);
  }
}

.lead-popup-spin {
  font-size: 20px;
  animation: leadPopupSpin 0.8s linear infinite;
}

/* ─── Error ─── */
.lead-popup-error {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  color: var(--red, #ef4444);
  margin: 8px 0 0;
  min-height: 0;
}

.lead-popup-error:empty {
  display: none;
}

/* ─── Privacy note ─── */
.lead-popup-privacy {
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  color: var(--text-tertiary, rgba(255, 255, 255, 0.45));
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* ─── Done button (success state) ─── */
.lead-popup-done {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 36px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 100px;
  color: var(--text, #fff);
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.2s,
    background 0.2s;
}

.lead-popup-done:hover {
  border-color: var(--gold, #d4a843);
  background: rgba(212, 168, 67, 0.05);
}

/* ─── Animations ─── */
@keyframes leadPopupFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes leadPopupSlideUp {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ─── Responsive ─── */
@media (max-width: 540px) {
  .lead-popup {
    padding: 16px;
    align-items: flex-end;
  }

  .lead-popup-card {
    padding: 36px 24px 32px;
    border-radius: 20px 20px 0 0;
    max-width: none;
  }

  .lead-popup-title {
    font-size: 20px;
  }

  .lead-popup-desc {
    font-size: 14px;
    margin-bottom: 24px;
  }

  .lead-popup-icon {
    width: 56px;
    height: 56px;
  }

  .lead-popup-icon .material-symbols-outlined {
    font-size: 24px;
  }

  /* Cover variant mobile */
  .lead-popup-card.has-cover {
    border-radius: 20px 20px 0 0;
  }

  .lead-popup-card.has-cover .lead-popup-body {
    padding: 24px 24px 32px;
  }
}
