/* ============================================================
   CALENDLY DEMO MODAL (pattern from ecarehealth.com)
   The booking form is an inline Calendly widget inside this modal.
   js/calendly-modal.js boots it on the visitor's first interaction,
   so clicking a [data-cta="demo"] button only has to reveal it.
   ============================================================ */
.cta-modal {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: none;
}

.cta-modal.open {
  display: block;
}

.cta-modal-bg {
  position: absolute;
  inset: 0;
  background: rgba(9, 25, 41, .62);
  backdrop-filter: blur(6px);
  cursor: pointer;
}

.cta-modal-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, 92vw);
  max-height: 92vh;
  overflow-y: auto;
  padding: 32px 28px 24px;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 42, 71, .30);
  font-family: 'Manrope', sans-serif;
}

.cta-modal-card-wide {
  width: min(1200.98px, 96vw);
}

.cta-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #F4F8FB;
  color: #5A7388;
  font-family: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: all .2s;
}

.cta-modal-close:hover {
  background: #1F578F;
  color: #ffffff;
}

.cta-modal-title {
  margin: 0 0 6px;
  padding-right: 40px;
  color: #1F578F;
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.01em;
}

.cta-modal-sub {
  margin: 0 0 18px;
  color: #5A7388;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

/* page scroll lock while the modal is open */
html.cal-modal-open,
html.cal-modal-open body {
  overflow: hidden !important;
}

/* ---- pre-render layer: only while preloading and NOT open ----
   Chrome does not render an iframe inside a display:none subtree, so a
   frame parked in a closed modal would never boot. While preloading, keep
   the modal in the render tree but fully transparent, behind the page and
   click-through. Every rule is scoped :not(.open) so the real open state
   always wins. */
#calendlyModal.calendly-preloading:not(.open) {
  display: flex !important;
  opacity: 0 !important;
  pointer-events: none !important;
  z-index: -1 !important;
  overflow: hidden !important;
}

#calendlyModal.calendly-preloading:not(.open) .cta-modal-bg,
#calendlyModal.calendly-preloading:not(.open) .cta-modal-close {
  display: none !important;
}

@media (max-width: 575.98px) {
  .cta-modal-card {
    padding: 24px 14px 16px;
  }
}
