/**
 * HubSpot forms with consent gating ([ci_hubspot_form] shortcode).
 *
 * Placeholder styles and site styles for HubSpot legacy forms. The forms are created
 * with HubSpot's default theme removed, so everything below targets HubSpot's markup
 * (.hs-form, .hs-form-field, .hs-input, .hs-button, ...) inside .ci-hs-form only.
 */

.ci-hs-form {
  --ci-hs-primary: #0080c4;
  --ci-hs-error: #b22635;
  --ci-hs-text: #404040;
  --ci-hs-muted: #686868;
  --ci-hs-border: #c7c7c7;
  --ci-hs-bg-soft: #f3f6f8;
  --ci-hs-focus: #0080c4; /* same focus ring the Pardot forms show */
  --ci-hs-dark: #2c5a7a; /* scss: brand-color(primary, dark) / $accent-1 */
  --ci-hs-dark-hover: #163c5e; /* scss: $accent-2 */
  --ci-hs-button-font: 'Khand', sans-serif; /* scss: $primary-font-stack */
  --ci-hs-min-height: 260px;
  position: relative;
  /* Stay above section overlays (e.g. the landing banner's dark ::after layer). */
  z-index: 1;
  font-family: 'ProximaNova-Regular', 'Proxima Nova', sans-serif;
  color: var(--ci-hs-text);
  text-align: left;
}

/* ---------- Placeholder and states ----------
 * Default (no data-state): the message is shown. This is what a visitor sees if no script runs.
 * "pending" is set inline right after the markup and "rendering" after consent: spinner only,
 * so visitors who already consented never see the message flash before the form.
 * See assets/js/ci-hubspot-forms.js for the states.
 */

.ci-hs-form__placeholder {
  padding: 32px 24px;
  border: 1px dashed var(--ci-hs-border);
  background: var(--ci-hs-bg-soft);
  text-align: center;
}

.ci-hs-form[data-state="pending"] .ci-hs-form__placeholder,
.ci-hs-form[data-state="rendering"] .ci-hs-form__placeholder,
.ci-hs-form[data-state="rendered"] .ci-hs-form__placeholder {
  display: none;
}

.ci-hs-form[data-state="blocked"] .ci-hs-form__placeholder,
.ci-hs-form[data-state="error"] .ci-hs-form__placeholder {
  animation: ci-hs-fade-in .3s ease-out both;
}

/* The form is built hidden under the spinner, then fades in. */
.ci-hs-form:not([data-state="rendered"]) form,
.ci-hs-form:not([data-state="rendered"]) iframe {
  visibility: hidden;
  opacity: 0;
}

.ci-hs-form[data-state="rendered"] form,
.ci-hs-form[data-state="rendered"] iframe {
  animation: ci-hs-fade-in .3s ease-out both;
}

@keyframes ci-hs-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.ci-hs-form__placeholder p {
  margin: 0 0 16px;
  font-size: 16px;
  line-height: 1.5;
}

/* Keep the message readable where a section sets its own paragraph styles
   (e.g. white text in the landing banner). */
.ci-hs-form .ci-hs-form__placeholder p,
.ci-hs-form .ci-hs-form__noscript {
  color: var(--ci-hs-text);
  font-weight: 400;
}

.ci-hs-form__placeholder p:last-child {
  margin-bottom: 0;
}

.ci-hs-form__error {
  display: none;
}

.ci-hs-form[data-state="error"] .ci-hs-form__message {
  display: none;
}

.ci-hs-form[data-state="error"] .ci-hs-form__error {
  display: block;
}

/* Waiting for consent or loading the form: keep the space and show a spinner. */
.ci-hs-form[data-state="pending"],
.ci-hs-form[data-state="rendering"] {
  min-height: var(--ci-hs-min-height);
}

.ci-hs-form[data-state="pending"]::before,
.ci-hs-form[data-state="rendering"]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  border: 3px solid var(--ci-hs-border);
  border-top-color: var(--ci-hs-primary);
  border-radius: 50%;
  opacity: 0;
  animation: ci-hs-spin .8s linear infinite, ci-hs-spinner-in .3s ease-out forwards;
}

@keyframes ci-hs-spinner-in {
  to {
    opacity: .6;
  }
}

@keyframes ci-hs-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ci-hs-form[data-state="pending"]::before,
  .ci-hs-form[data-state="rendering"]::before {
    animation: ci-hs-spinner-in .3s ease-out forwards;
  }

  .ci-hs-form[data-state="blocked"] .ci-hs-form__placeholder,
  .ci-hs-form[data-state="error"] .ci-hs-form__placeholder,
  .ci-hs-form[data-state="rendered"] form,
  .ci-hs-form[data-state="rendered"] iframe {
    animation: none;
  }
}

/* Without JavaScript the message is shown with this note. */
.ci-hs-form__noscript {
  margin: 0;
  padding: 32px 24px;
  border: 1px dashed var(--ci-hs-border);
  background: var(--ci-hs-bg-soft);
  text-align: center;
}

.ci-hs-form__settings {
  display: inline-block;
  margin: 0 0 16px;
  padding: 8px 24px;
  border: 2px solid var(--ci-hs-primary);
  background: transparent;
  color: var(--ci-hs-primary);
  font: inherit;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}

.ci-hs-form__settings:hover,
.ci-hs-form__settings:focus-visible {
  background: var(--ci-hs-primary);
  color: #fff;
}

.ci-hs-form__fallback {
  font-size: 14px;
  color: var(--ci-hs-muted);
}

.ci-hs-form__fallback a {
  color: var(--ci-hs-primary);
}

.ci-hs-form__notice {
  padding: 12px 16px;
  border-left: 4px solid var(--ci-hs-error);
  background: #fff5f5;
  color: var(--ci-hs-error);
}

/* ---------- HubSpot form ----------
 * The layout (columns, field order) is defined in HubSpot. These rules only apply the
 * theme's fonts and colors and a minimum field height.
 */

.ci-hs-form .hs-form-field {
  min-width: 0;
  margin: 0 0 16px;
}

/* Labels: hidden when HubSpot renders them empty (the form uses placeholders). */
.ci-hs-form .hs-form-field > label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--ci-hs-muted);
}

.ci-hs-form .hs-form-field > label:empty,
.ci-hs-form .hs-form-field > label:has(> span:only-child:empty) {
  display: none;
}

.ci-hs-form .hs-form-required {
  margin-left: 2px;
  color: var(--ci-hs-error);
}

.ci-hs-form .hs-field-desc {
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--ci-hs-muted);
}

.ci-hs-form .hs-form .hs-input:not([type="file"]):not([type="checkbox"]):not([type="radio"]) {
  box-sizing: border-box;
  display: block;
  width: 100% !important;
  margin: 0;
  padding: 10px 14px !important;
  border: 1px solid var(--ci-hs-border);
  border-radius: 4px;
  background-color: #fff !important;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ci-hs-text);
  transition: border-color .2s ease, box-shadow .2s ease;
}

/* Same 44px as the Pardot fields. */
.ci-hs-form .hs-form input.hs-input:not([type="checkbox"]):not([type="radio"]),
.ci-hs-form .hs-form select.hs-input {
  height: 44px !important;
  min-height: 44px;
}

/* The comments box starts at the same height; no !important so the visitor can still enlarge it. */
.ci-hs-form .hs-form textarea.hs-input {
  height: 44px;
  min-height: 44px;
  resize: vertical;
}

.ci-hs-form .hs-form .hs-input:focus {
  outline: none;
}

/* Marked blue ring on focus (fields always; the button and checkboxes only from the keyboard). */
.ci-hs-form .hs-form .hs-input:focus-visible,
.ci-hs-form .hs-form .hs-button:focus-visible {
  outline: 2px solid var(--ci-hs-focus);
  outline-offset: 0;
}

.ci-hs-form .hs-input::placeholder {
  color: #8a8c8f;
  opacity: 1;
}

.ci-hs-form .hs-form .hs-input.invalid.error {
  border-color: var(--ci-hs-error);
}

.ci-hs-form .inputs-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ci-hs-form .inputs-list label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
}

.ci-hs-form .inputs-list .hs-input {
  margin-top: 3px;
}

.ci-hs-form .hs-form .hs-error-msgs {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.ci-hs-form .hs-form .hs-error-msgs li {
  margin: 0;
  padding: 0;
  line-height: 1.4;
}

.ci-hs-form .hs-error-msg {
  display: block;
  margin: 0;
}

/* "Please complete all required fields." is a form-level message, not the last field's error:
   keep the field's normal bottom margin before it. */
.ci-hs-form .hs-form .hs_error_rollup {
  margin: 0 0 12px;
}

.ci-hs-form .hs-form .hs_error_rollup .hs-error-msgs {
  margin: 0;
}

.ci-hs-form .hs-error-msg,
.ci-hs-form .hs-main-font-element {
  font-size: 12px;
  color: var(--ci-hs-error);
}

.ci-hs-form .legal-consent-container,
.ci-hs-form .hs-richtext {
  margin-bottom: 16px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ci-hs-muted);
}

.ci-hs-form .hs_recaptcha {
  margin-bottom: 16px;
}

.ci-hs-form .hs-submit .actions,
.ci-hs-form .hs_submit .actions {
  margin-top: 8px;
  text-align: center;
}

.ci-hs-form .hs-form .hs-button {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  max-width: 430px;
  height: 50px;
  padding: 0 24px;
  border: 1px solid var(--ci-hs-primary);
  border-radius: 4px;
  background: transparent;
  color: var(--ci-hs-primary);
  font-family: var(--ci-hs-button-font);
  font-size: 20px;
  font-weight: 400;
  line-height: 25px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}

.ci-hs-form .hs-form .hs-button:hover,
.ci-hs-form .hs-form .hs-button:focus-visible {
  background: var(--ci-hs-primary);
  color: #fff;
}

/* Containers sized for the old Pardot iframe (e.g. .contact-page-style, height: 420px) grow
   with the form, so validation messages don't push the button out of the box. */
.contact-page-style:has(.ci-hs-form) {
  height: auto;
}

/* ---------- Landing pages (form in the landing banner) ----------
 * Same look as the Pardot forms there: white card and a full-width dark blue button.
 */

.banner-landing .ci-hs-form .hs-form,
.banner-landing .ci-hs-form .submitted-message {
  padding: 10px;
  border-radius: 5px;
  background: #fff;
}

/* The banner sets white text on p, ul and li; keep it dark inside the card. */
.banner-landing .ci-hs-form .hs-form :is(p, ul, li),
.banner-landing .ci-hs-form .submitted-message,
.banner-landing .ci-hs-form .submitted-message p {
  color: var(--ci-hs-text);
}

.banner-landing .ci-hs-form .hs-form .hs-button {
  max-width: none;
  height: 44px;
  border-color: var(--ci-hs-primary);
  background: var(--ci-hs-primary);
  color: #fff;
}

.banner-landing .ci-hs-form .hs-form .hs-button:hover,
.banner-landing .ci-hs-form .hs-form .hs-button:focus-visible {
  border-color: var(--ci-hs-dark-hover);
  background: var(--ci-hs-dark-hover);
}

.ci-hs-form .submitted-message {
  padding: 24px;
  font-size: 18px;
  text-align: center;
}

/* Columns set in HubSpot (legacy forms group fields in fieldset.form-columns-N) */
.ci-hs-form .hs-form fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
  max-width: none !important;
  margin: 0;
  padding: 0;
  border: 0;
}

.ci-hs-form .hs-form fieldset > div {
  flex: 1 1 0;
  min-width: 0;
  width: auto !important;
  float: none !important;
}

@media (max-width: 767px) {
  .ci-hs-form .hs-form fieldset > div {
    flex-basis: 100%;
  }

  .ci-hs-form .hs-form .hs-button {
    max-width: none;
  }
}
