/*
  Modal for _components/formPopup.twig.

  Values are carried over 1:1 from the popup that used to live inline in
  sections/embed.twig, because those forms are load-bearing across the site. The header
  itself is styled by sectionEmbed.css via the `sectionEmbed__*` classes the markup keeps —
  only the popup-context overrides live here, exactly as they did before.
*/

.formPopup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* `display: flex` above would otherwise beat the UA's `[hidden] { display: none }`. */
.formPopup[hidden] {
  display: none;
}

.formPopup.is-open {
  opacity: 1;
}

.formPopup__backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
}

.formPopup__dialog {
  position: relative;
  width: 700px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  padding: 30px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.8);
  transition: transform 0.3s ease;
}

.formPopup.is-open .formPopup__dialog {
  transform: scale(1);
}

/* Width variants, from the `width` field on the Embed section. */

.formPopup--large .formPopup__dialog {
  width: 90vw;
  max-width: 1200px;
}

.formPopup--medium .formPopup__dialog,
.formPopup--small .formPopup__dialog {
  width: 100%;
  max-width: 900px;
}

.formPopup__close {
  position: absolute;
  top: 15px;
  right: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: #666;
  cursor: pointer;
  box-sizing: border-box;
  line-height: 1;
  z-index: 10;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.formPopup__close:hover {
  background-color: #f0f0f0;
  color: #333;
}

/* Header — styling comes from sectionEmbed.css; these are the popup-context overrides
   the inline version applied. */

.formPopup__dialog .sectionEmbed__header {
  margin-bottom: 20px;
}

.formPopup__dialog .sectionEmbed__heading {
  margin-top: 0;
}

.formPopup__dialog .sectionEmbed__help-text {
  margin-top: 15px;
  font-size: 14px;
  color: #666;
}

/*
  Google allows hiding the badge with visibility, but that keeps its box — and the row it
  sits in still picks up the 2.4rem bottom margin from `.hbspt-form form > div`
  (form.css:299-305), leaving a gap in the popup. Hide the badge, then collapse its row.
*/
.formPopup__body .grecaptcha-badge {
  visibility: hidden;
}

.formPopup__body .hbspt-form .hs_recaptcha,
.formPopup__body .hbspt-form form > div:has(.grecaptcha-badge) {
  margin: 0;
  height: 0;
  overflow: hidden;
}

/* Stands in for the hidden badge. Sized to `.hs-field-desc` (form.css:290) rather than the
   form's body copy — this is fine print. Scoped to the popup so the inline Embed section's
   own note, which carries its own inline styles, is untouched. */
.formPopup .popup-recaptcha-note {
  margin: 1.2rem 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: #666;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .formPopup__dialog {
    width: 95vw;
    max-height: 95vh;
    margin: 12px;
    padding: 40px 12px 16px;
  }

  .formPopup__dialog .sectionEmbed__header {
    margin-bottom: 12px;
  }

  .formPopup__close {
    top: 10px;
    right: 15px;
  }
}

body.formPopup-open {
  overflow: hidden;
}
