/* Keep the form heading below the fixed header and compact section menu. */
body[data-site-page] [data-header-form-target] { scroll-margin-top: 144px; }

body[data-site-page] main .cform .hs-form-field:not(.hs-fieldtype-booleancheckbox) > label {
  font-size: 1rem;
}

/* Use the label's actual text instead of the former generated-content badge. */
body[class][data-site-page] main .cform .hs-form-field :is(.hs-form-required, .hs-form-optional) {
  display: inline-block;
  flex: none;
  order: 0;
  margin: 0;
  padding: 2px 6px;
  border-radius: 0;
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
  line-height: 1.4;
  vertical-align: middle;
}
body[class][data-site-page] main .cform .hs-form-field .hs-form-required {
  color: #fff;
  background: #bf012d;
}
body[class][data-site-page] main .cform .hs-form-field .hs-form-optional {
  color: var(--form-optional-color, inherit);
  background: #e8eaed;
}
body[class][data-site-page] main .cform .hs-form-field .hs-form-required::before {
  content: none;
}
body.aitria-panel[data-site-page] #consult .cform :is(.hs-form-required, .hs-form-optional),
body.page-modernization[data-site-page] main #analysis-form.cform :is(.hs-form-required, .hs-form-optional) {
  margin-inline-start: 6px;
}

/* Keep the notice styled when link tracking appends a query string. */
body[data-site-page] main .cform .hs-richtext:has(a[href*="/agreement/contact/"]) {
  margin-block: 0 8px;
}
body[data-site-page] main .cform .hs-richtext:has(a[href*="/agreement/contact/"]) p {
  margin: 0;
  color: var(--site-black, #17191d);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.85;
}
body[data-site-page] main .cform .hs-richtext a[href*="/agreement/contact/"] {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: .2em;
}

body[data-site-page] main .cform :is(label.hs-form-booleancheckbox-display, .hs-form-booleancheckbox-display > label) {
  align-items: center;
  gap: 8px;
  min-block-size: 44px;
}
body[data-site-page] main .cform :is(label.hs-form-booleancheckbox-display, .hs-form-booleancheckbox-display > label) > span {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.85;
}
body[data-site-page] main .cform :is(label.hs-form-booleancheckbox-display, .hs-form-booleancheckbox-display > label) > input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  flex: none;
  width: 18px !important;
  height: 18px !important;
  margin: 0;
  padding: 0;
  border: 1px solid #8a8f95 !important;
  border-radius: 0;
  background-color: #fff;
  cursor: pointer;
}
body[data-site-page] main .cform :is(label.hs-form-booleancheckbox-display, .hs-form-booleancheckbox-display > label) > input[type="checkbox"]:checked {
  border-color: var(--accent, #bf012d) !important;
  background: var(--accent, #bf012d) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='white' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 6l2.5 2.5L10 3.5'/%3E%3C/svg%3E") center / 12px no-repeat;
}
body[data-site-page] main .cform :is(label.hs-form-booleancheckbox-display, .hs-form-booleancheckbox-display > label) > input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: .5;
}
@media (forced-colors: active) {
  body[data-site-page] main .cform :is(label.hs-form-booleancheckbox-display, .hs-form-booleancheckbox-display > label) > input[type="checkbox"] {
    appearance: auto;
    background: none !important;
  }
}
body[class][data-site-page] main .cform .hs-form-field .hs-form-booleancheckbox-display .hs-form-required {
  margin-inline-start: 6px;
}

body[data-site-page] main .cform .grecaptcha-badge {
  box-shadow: none !important;
}

.cform > .form-contact-note {
  margin: 12px 0 0;
  color: #535960;
  font-size: .875rem;
  line-height: 1.7;
}
.hero-form-panel .cform > .form-contact-note {
  flex-shrink: 0;
  margin-block: 0 16px;
}

:is([data-form-state], [data-form-status-contact], [data-hubspot-form-preview])[hidden] {
  display: none !important;
}

/* Form support links sit on light panels, even in otherwise dark sections. */
@layer form-link-contrast {
  body[data-site-page] main :is(.form-fallback, .form-contact-note) a:any-link {
    color:var(--site-black,#17191d) !important;
    text-decoration-line:underline !important;
    text-decoration-color:currentColor !important;
    text-underline-offset:.2em;
  }
}

/* Preserve button dimensions while removing the red edge on hover. */
body[class][data-site-page] main .cform :is(.hs-button, input[type="submit"], button[type="submit"]):hover {
  border-color: transparent !important;
}

/* Keep dropdowns identifiable after the page-specific input background resets.
   List boxes (multiple or size > 1) retain their native list presentation. */
body.editorial-site.service-panel[data-site-page] main :is(#diagnosis,#contact,#consult,#action,.hero-form-panel) .cform select.hs-input:not([multiple]):is(:not([size]),[size="1"]),
body.aitria-panel[data-site-page] main :is(#diagnosis,#contact,#consult,#action,.hero-form-panel) .cform select.hs-input:not([multiple]):is(:not([size]),[size="1"]) {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: 44px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='m5 7.5 5 5 5-5' stroke='%2317191d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 14px center !important;
  background-size: 20px 20px !important;
}

/* Immediate focus feedback with a slower fade as the field is left. */
body[class][data-site-page] main .cform .hs-input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]) {
  outline: 2px solid transparent;
  outline-offset: -2px !important;
  transition: border-color 180ms ease-out, outline-color 180ms ease-out,
    background-color 360ms cubic-bezier(.22, 1, .36, 1),
    box-shadow 480ms cubic-bezier(.22, 1, .36, 1);
}

body[class][data-site-page] main .cform .hs-input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):is(:focus, :open) {
  outline: 2px solid #bf012d !important;
  border-color: #bf012d !important;
  background-color: #fff !important;
  box-shadow: inset 0 0 0 1px rgb(191 1 45 / 12%), 0 0 0 3px rgb(191 1 45 / 8%) !important;
}

body[class][data-site-page] main .cform .hs-input:is([type="checkbox"], [type="radio"]) {
  transition: background-color 240ms ease-out, border-color 180ms ease-out,
    box-shadow 420ms cubic-bezier(.22, 1, .36, 1);
}

body[class][data-site-page] main .cform .hs-input:is([type="checkbox"], [type="radio"]):focus-visible {
  outline: 2px solid #bf012d;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgb(191 1 45 / 8%);
}

/* Keep the native select, its keyboard behavior and provider validation.
   Browsers with customizable pickers animate the list in the top layer. */
@supports (appearance: base-select) and selector(select::picker(select)) {
  body.editorial-site.service-panel[data-site-page] main :is(#diagnosis,#contact,#consult,#action,.hero-form-panel) .cform select.hs-input:not([multiple]):is(:not([size]), [size="1"]),
  body.aitria-panel[data-site-page] main :is(#diagnosis,#contact,#consult,#action,.hero-form-panel) .cform select.hs-input:not([multiple]):is(:not([size]), [size="1"]) {
    appearance: base-select !important;
    -webkit-appearance: base-select !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-right: 14px !important;
    background-image: none !important;
  }

  body[data-site-page] .cform select.hs-input:not([multiple]):is(:not([size]), [size="1"])::picker-icon {
    content: "";
    flex: none;
    width: 20px;
    height: 20px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='m5 7.5 5 5 5-5' stroke='%2317191d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 20px 20px no-repeat;
    transform: rotate(0deg);
    transition: transform 420ms cubic-bezier(.22, 1, .36, 1);
  }

  body[data-site-page] .cform select.hs-input:not([multiple]):is(:not([size]), [size="1"]):open::picker-icon {
    transform: rotate(180deg);
  }

  body[data-site-page] .cform select.hs-input:not([multiple]):is(:not([size]), [size="1"])::picker(select) {
    appearance: base-select;
    min-width: anchor-size(width);
    max-height: min(320px, 50vh);
    overflow-y: auto;
    overscroll-behavior: contain;
    margin-block: 6px;
    padding: 4px;
    border: 1px solid #b7bdc2;
    border-radius: 2px;
    background: #fff;
    color: #17191d;
    font: inherit;
    box-shadow: 0 12px 30px rgb(23 25 29 / 14%);
    opacity: 0;
    transform: translateY(-6px) scale(.99);
    transform-origin: center top;
    pointer-events: none;
    transition: opacity 240ms ease-out,
      transform 420ms cubic-bezier(.22, 1, .36, 1),
      display 420ms allow-discrete, overlay 420ms allow-discrete;
  }

  body[data-site-page] .cform select.hs-input:not([multiple]):is(:not([size]), [size="1"]):open::picker(select) {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  @starting-style {
    body[data-site-page] .cform select.hs-input:not([multiple]):is(:not([size]), [size="1"]):open::picker(select) {
      opacity: 0;
      transform: translateY(-6px) scale(.99);
    }
  }

  body[data-site-page] .cform select.hs-input:not([multiple]):is(:not([size]), [size="1"]) option {
    min-height: 40px;
    padding: 10px 12px;
    border-radius: 1px;
    background-color: #fff !important;
    color: #17191d !important;
    font: inherit;
    line-height: 1.5;
    transition: background-color 240ms cubic-bezier(.22, 1, .36, 1);
  }

  body[data-site-page] .cform select.hs-input:not([multiple]):is(:not([size]), [size="1"]) option:is(:hover, :focus, :checked) {
    background-color: #f0f1f2 !important;
  }

  body[data-site-page] .cform select.hs-input option::checkmark {
    color: #bf012d;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[class][data-site-page] main .cform .hs-input,
  body[data-site-page] .cform select.hs-input::picker-icon,
  body[data-site-page] .cform select.hs-input::picker(select),
  body[data-site-page] .cform select.hs-input option {
    transition: none !important;
  }
}

/* Native controls supply a visible indicator in forced-colour modes. */
@media (forced-colors: active) {
  body.editorial-site.service-panel[data-site-page] main :is(#diagnosis,#contact,#consult,#action,.hero-form-panel) .cform select.hs-input:not([multiple]):is(:not([size]),[size="1"]),
  body.aitria-panel[data-site-page] main :is(#diagnosis,#contact,#consult,#action,.hero-form-panel) .cform select.hs-input:not([multiple]):is(:not([size]),[size="1"]) {
    appearance: auto !important;
    -webkit-appearance: auto !important;
    background-image: none !important;
  }
}
