/* Exit intent design tokens (self-contained fallback to VitePress theme colors) */
:root {
  --exit-intent-overlay: rgba(6, 8, 12, 0.4);
  --exit-intent-surface: color-mix(in srgb, var(--vp-c-bg-soft, #f6f6f7) 90%, #ffffff 10%);
  --exit-intent-border: color-mix(in srgb, var(--vp-c-border, #e5e7eb) 60%, transparent);
  --exit-intent-muted: var(--vp-c-text-3, #94a3b8);
  --exit-intent-handle: color-mix(in srgb, var(--vp-c-bg, #ffffff) 82%, var(--vp-c-text-1, #1f2937) 18%);
}

.dark {
  --exit-intent-overlay: rgba(2, 3, 6, 0.4);
  --exit-intent-surface: color-mix(in srgb, var(--vp-c-bg-soft, #1f1f1f) 80%, #05060a 20%);
  --exit-intent-border: color-mix(in srgb, var(--vp-c-border, #2a2a2a) 70%, transparent);
  --exit-intent-muted: color-mix(in srgb, var(--vp-c-text-2, #e2e8f0) 70%, var(--vp-c-text-3, #cbd5e1) 30%);
  --exit-intent-handle: color-mix(in srgb, var(--vp-c-bg, #0c0c0c) 65%, var(--vp-c-text-1, #ffffff) 35%);
}

html.exit-intent-active,
html.exit-intent-active body {
  overflow: hidden;
}

.exit-intent-overlay {
  position: fixed;
  inset: 0;
  background: var(--exit-intent-overlay);
  z-index: 1000;
  opacity: 1;
  backdrop-filter: blur(4px);
  transition: opacity 0.2s ease;
  pointer-events: auto;
}

.exit-intent-container {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: min(640px, calc(100vw - 2.5rem));
  max-height: min(85vh, 720px);
  overflow: hidden;
  background: var(--exit-intent-surface);
  color: var(--vp-c-text-1);
  border: 1px solid var(--exit-intent-border);
  border-radius: 12px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem 1.75rem;
  z-index: 1001;
  text-align: center;
  align-items: center;
}

.exit-intent-container.is-mobile {
  bottom: max(env(safe-area-inset-bottom), 16px);
  top: auto;
  transform: translate(-50%, 0);
  width: min(520px, calc(100vw - 1.5rem));
  max-height: 70vh;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  padding: 1.5rem 1.5rem calc(1.5rem + env(safe-area-inset-bottom));
}

.exit-intent-button-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  width: 100%;
  margin-inline: auto;
}

.exit-intent-container:focus {
  outline: 2px solid var(--vp-c-brand-1);
  outline-offset: 3px;
}

.exit-intent-close {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  border: none;
  background: transparent;
  color: var(--vp-c-text-2);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
}

.exit-intent-close:hover,
.exit-intent-close:focus-visible {
  color: var(--vp-c-brand-1);
  transform: scale(1.05);
}

.exit-intent-header {
  display: flex;
  flex-direction: column;
  gap: clamp(0.55rem, 0.45rem + 0.25vw, 0.85rem);
  align-items: center;
  text-align: center;
  width: 100%;
}

.exit-intent-heading {
  margin: 0;
  font-size: clamp(1.55rem, 1.35rem + 0.55vw, 1.95rem);
  font-weight: 700;
  color: var(--vp-c-text-1);
  line-height: 1.18;
  max-width: 32ch;
}

.exit-intent-title {
  margin: 0;
  font-size: clamp(1.18rem, 1.05rem + 0.38vw, 1.42rem);
  font-weight: 500;
  color: var(--vp-c-text-2);
  line-height: 1.35;
  max-width: 36ch;
}

.exit-intent-body {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.4rem;
  width: 100%;
  margin-top: 0.35rem;
}

.exit-intent-goal-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0;
  margin: 0;
  width: 100%;
  align-items: stretch;
}

.exit-intent-goal-pill {
  width: 100%;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  border-radius: 999px;
  border: 1px solid var(--exit-intent-border);
  background: var(--vp-c-bg-soft);
  color: var(--vp-c-text-1);
  font-size: 0.98rem;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.exit-intent-goal-pill:hover,
.exit-intent-goal-pill:focus-visible {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--vp-c-brand-1) 60%, var(--exit-intent-border) 40%);
  background: color-mix(in srgb, var(--vp-c-brand-1) 18%, var(--exit-intent-surface) 82%);
}

.exit-intent-goal-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.exit-intent-goal-copy strong {
  display: inline;
  font-weight: 600;
  color: var(--vp-c-text-1);
}

.exit-intent-goal-copy {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-width: 0;
  font-size: 0.98rem;
}

.exit-intent-need-grid {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
  align-items: stretch;
}

.exit-intent-need-card {
  position: relative;
  border: 1px solid var(--exit-intent-border);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  display: inline-flex;
  flex-direction: row;
  gap: 0.85rem;
  align-items: center;
  justify-content: center;
  font-size: 0.98rem;
  cursor: pointer;
  background: var(--vp-c-bg-soft);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  text-align: center;
  width: 100%;
}

.exit-intent-need-card input[type='radio'] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.exit-intent-need-card[data-selected='true'] {
  border-color: color-mix(in srgb, var(--vp-c-brand-1) 65%, var(--exit-intent-border) 35%);
  background: color-mix(in srgb, var(--vp-c-brand-1) 22%, var(--exit-intent-surface) 78%);
  transform: translateY(-2px);
  box-shadow: var(--vp-shadow-2);
}

.exit-intent-need-card:hover {
  border-color: color-mix(in srgb, var(--vp-c-brand-1) 55%, var(--exit-intent-border) 45%);
}

.exit-intent-need-icon {
  font-size: 1.3rem;
  margin-top: 0;
  flex-shrink: 0;
}

.exit-intent-need-copy strong {
  display: inline;
  font-weight: 600;
  color: var(--vp-c-text-1);
}

.exit-intent-need-copy {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-width: 0;
  font-size: 0.98rem;
}

.exit-intent-actions {
  margin-top: 1.25rem;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  align-items: stretch;
  flex-wrap: wrap;
  width: 100%;
}

.exit-intent-actions .exit-intent-button-wrap {
  min-width: 100%;
  max-width: none;
}

.exit-intent-primary,
.exit-intent-secondary {
  border-radius: 999px;
  padding: 0.75rem 1.4rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  width: 100%;
}

.exit-intent-primary {
  border: 1px solid var(--vp-button-brand-border);
  color: var(--vp-button-brand-text);
  background: var(--vp-button-brand-bg);
  box-shadow: var(--vp-shadow-1);
}

.exit-intent-primary:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

.exit-intent-primary:not(:disabled):hover,
.exit-intent-primary:not(:disabled):focus-visible {
  background: var(--vp-button-brand-hover-bg);
  transform: translateY(-1px);
}

.exit-intent-primary--cta {
  width: 100%;
  justify-content: center;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  padding: 0.9rem 1.4rem;
}

.exit-intent-secondary {
  border: 1px solid var(--exit-intent-border);
  background: transparent;
  color: var(--vp-c-text-2);
}

.exit-intent-secondary:hover,
.exit-intent-secondary:focus-visible {
  color: var(--vp-c-text-1);
  border-color: color-mix(in srgb, var(--vp-c-brand-1) 55%, var(--exit-intent-border) 45%);
}

.exit-intent-offer {
  display: grid;
  gap: 1.4rem;
}

.exit-intent-offer-card {
  padding: 1.5rem;
  border-radius: 18px;
  border: 1px solid var(--exit-intent-border);
  background: color-mix(in srgb, var(--vp-c-bg-soft) 80%, var(--vp-c-bg) 20%);
  box-shadow: var(--vp-shadow-2);
  display: grid;
  gap: 1.4rem;
}

.exit-intent-offer-copy h3 {
  margin: 0;
  font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.6rem);
  color: var(--vp-c-text-1);
  font-weight: 600;
}

.exit-intent-offer-detail {
  margin: 0.75rem auto 0;
  max-width: 32ch;
  color: var(--vp-c-text-2);
  font-size: 0.95rem;
  line-height: 1.5;
}

.exit-intent-offer-ctas {
  display: grid;
  gap: 0.85rem;
  justify-items: center;
}

.exit-intent-social-proof {
  margin: 0.5rem auto 0;
  font-size: 0.85rem;
  color: var(--exit-intent-muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.exit-intent-container.is-mobile::before {
  content: '';
  position: absolute;
  top: 0.55rem;
  left: 50%;
  transform: translateX(-50%);
  width: 54px;
  height: 4px;
  border-radius: 999px;
  background: var(--exit-intent-handle);
}

/* Transitions */
.exit-intent-fade-enter-active,
.exit-intent-fade-leave-active {
  transition: opacity 0.25s ease;
}

.exit-intent-fade-enter-from,
.exit-intent-fade-leave-to {
  opacity: 0;
}

.exit-intent-fade-enter-to,
.exit-intent-fade-leave-from {
  opacity: 1;
}

.exit-modal-scale-enter-from {
  opacity: 0;
  transform: translate(-50%, -55%) scale(0.96);
}

.exit-modal-scale-enter-active,
.exit-modal-scale-leave-active {
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.exit-modal-scale-enter-to {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.exit-modal-scale-leave-to {
  opacity: 0;
  transform: translate(-50%, -45%) scale(0.96);
}

.exit-sheet-slide-enter-from {
  opacity: 0;
  transform: translate(-50%, 25%);
}

.exit-sheet-slide-enter-active,
.exit-sheet-slide-leave-active {
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.exit-sheet-slide-enter-to {
  opacity: 1;
  transform: translate(-50%, 0);
}

.exit-sheet-slide-leave-to {
  opacity: 0;
  transform: translate(-50%, 20%);
}

@media (max-width: 720px) {
  .exit-intent-container {
    width: calc(100vw - 1.5rem);
  }

  .exit-intent-goal-list {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }

  .exit-intent-need-grid {
    grid-template-columns: 1fr;
  }

  .exit-intent-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }
}
