/*
 * Overrides Marketo's default inline styles so the embedded form matches
 * the look of the legacy native contact/demo form (card + Statsig form
 * controls). Marketo injects many `style="..."` attributes on its rows,
 * field wraps, labels, gutters and inputs, so most overrides need to use
 * !important to win against those.
 */

.mktoForm {
  width: 100% !important;
  max-width: 100% !important;
  font-family: var(--font-family-body) !important;
  font-size: var(--font-size-body) !important;
  color: var(--color-text-primary);
}

.mktoForm * {
  box-sizing: border-box;
}

.mktoForm .mktoFormRow,
.mktoForm .mktoFormCol,
.mktoForm .mktoFieldWrap {
  width: 100% !important;
  float: none !important;
  clear: both;
}

.mktoForm .mktoFormCol {
  margin-bottom: 20px !important;
  min-height: 0 !important;
}

.mktoForm .mktoFormCol:last-child {
  margin-bottom: 0 !important;
}

.mktoForm .mktoOffset,
.mktoForm .mktoGutter {
  display: none !important;
  width: 0 !important;
}

.mktoForm .mktoLabel {
  width: auto !important;
  float: none !important;
  display: inline-block;
  font-family: var(--font-family-headings);
  font-size: var(--font-size-smaller);
  font-weight: 600;
  line-height: var(--line-height-smaller);
  color: var(--color-text-primary);
  margin-bottom: 6px;
  padding-top: 0 !important;
}

.mktoForm .mktoAsterix {
  display: none !important;
}

/*
 * Some Marketo fields (like the email row) have no descriptive label —
 * only an asterisk node. Pure CSS can't distinguish "asterisk-only" from
 * "asterisk + text" since text nodes don't participate in :only-child,
 * so a JS pass in marketo-contact-form.ejs tags those labels with
 * .mktoLabelEmpty and we collapse them here.
 */
.mktoForm .mktoLabel.mktoLabelEmpty {
  display: none !important;
}

/*
 * Links inside labels (e.g. "Privacy Policy" in the consent text)
 * otherwise pick up the site's anchor rule (16px / 600), making them
 * visually larger than the surrounding label text. Force them to match
 * the label's size + weight and use an underline for affordance.
 */
.mktoForm .mktoLabel a,
.mktoForm .mktoHtmlText a {
  font-size: inherit;
  font-weight: inherit;
  font-family: inherit;
  line-height: inherit;
  color: var(--color-text-primary);
  text-decoration: underline;
}

.mktoForm .mktoRequiredField label.mktoLabel {
  font-weight: 600;
}

.mktoForm input[type='text'],
.mktoForm input[type='email'],
.mktoForm input[type='url'],
.mktoForm input[type='tel'],
.mktoForm input[type='number'],
.mktoForm input[type='date'],
.mktoForm textarea.mktoField,
.mktoForm select.mktoField {
  width: 100% !important;
  min-height: 0 !important;
  height: auto !important;
  float: none !important;
  border: 1px solid var(--color-input-border) !important;
  border-radius: var(--border-sharp-radius) !important;
  padding: 12px !important;
  font-family: var(--font-family-headings);
  font-size: var(--font-size-body);
  line-height: 125%;
  color: var(--color-text-primary);
  background-color: var(--color-white);
  box-shadow: none !important;
}

.mktoForm textarea.mktoField {
  min-height: 96px !important;
  resize: vertical;
}

.mktoForm select.mktoField {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: none !important;
  background: var(--color-soft-white) url('/images/symbols/arrow-down.svg') no-repeat;
  background-size: 12px 8px;
  background-position: right 12px top 50%;
  padding-right: 36px !important;
}

.mktoForm input[type='text']:focus,
.mktoForm input[type='email']:focus,
.mktoForm input[type='url']:focus,
.mktoForm input[type='tel']:focus,
.mktoForm input[type='number']:focus,
.mktoForm input[type='date']:focus,
.mktoForm textarea.mktoField:focus,
.mktoForm select.mktoField:focus {
  outline: none;
  border-color: var(--color-text-primary) !important;
}

/*
 * The select has `border: none` (the chevron background replaces the
 * border visually), so the shared focus rule above does nothing for it.
 * Use an inset box-shadow to render a focus ring that matches the
 * input focus border thickness and color.
 */
.mktoForm select.mktoField:focus {
  box-shadow: inset 0 0 0 1px var(--color-text-primary) !important;
}

.mktoForm input[type='checkbox'],
.mktoForm input[type='radio'] {
  accent-color: var(--color-text-primary);
  width: auto !important;
  height: auto !important;
  margin: 0 8px 0 0 !important;
  flex-shrink: 0;
}

/*
 * Checkbox / radio rows: Marketo renders these as
 *   <label class="mktoLabel">text</label>
 *   <div class="mktoCheckboxList"><input type="checkbox"/><label/></div>
 * which stacks label-above-input. Flip the wrap into a flex row so the
 * input sits inline next to the descriptive label, and downsize the
 * label to body copy (not bold heading style) so consent text reads
 * naturally.
 */
.mktoForm .mktoFieldWrap:has(.mktoCheckboxList),
.mktoForm .mktoFieldWrap:has(.mktoRadioList) {
  display: flex;
  flex-direction: row-reverse;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

/*
 * In the checkbox/radio flex row, the .mktoError would otherwise join
 * the row as a flex item next to the checkbox. Force it to a full-width
 * row below the checkbox + label, and put it last in visual order.
 */
.mktoForm .mktoFieldWrap:has(.mktoCheckboxList) > .mktoError,
.mktoForm .mktoFieldWrap:has(.mktoRadioList) > .mktoError {
  flex: 0 0 100%;
  order: 99;
  width: 100%;
  margin: 4px 0 0 !important;
}

.mktoForm .mktoFieldWrap:has(.mktoCheckboxList) > .mktoLabel,
.mktoForm .mktoFieldWrap:has(.mktoRadioList) > .mktoLabel {
  flex: 1;
  font-family: var(--font-family-body);
  font-weight: 400;
  font-size: var(--font-size-smaller);
  line-height: var(--line-height-smaller, 1.5);
  margin-bottom: 0;
  padding-top: 1px;
}

.mktoForm .mktoCheckboxList,
.mktoForm .mktoRadioList {
  width: auto !important;
  float: none !important;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.mktoForm .mktoCheckboxList > label,
.mktoForm .mktoRadioList > label {
  font-family: var(--font-family-body);
  font-weight: 400;
  font-size: var(--font-size-smaller);
  margin: 0;
}

.mktoForm .mktoHtmlText {
  width: 100% !important;
  float: none !important;
  font-size: var(--font-size-smaller);
  color: var(--color-text-secondary);
  line-height: var(--line-height-smaller);
}

/*
 * Marketo's stylesheet loads dynamically after this file and uses the
 * same `.mktoForm .mktoError` selector with `position: absolute`, which
 * wins the cascade tiebreaker. Bump specificity with .mktoFieldWrap so
 * our rules win, and explicitly null out the inline right/bottom
 * positioning Marketo's JS sets on the element (e.g. style="right:
 * 270.25px; bottom: 0px;"), which otherwise keeps the error overlapping
 * the input.
 */
.mktoForm .mktoFieldWrap .mktoError {
  position: static !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  display: block !important;
  float: none !important;
  clear: both !important;
  z-index: auto !important;
  margin: 4px 0 0 !important;
  padding: 0 !important;
}

.mktoForm .mktoError .mktoErrorMsg {
  background: none !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #c0392b;
  font-size: var(--font-size-smaller);
  line-height: 1.4;
  padding: 0 !important;
  margin: 0 !important;
  text-shadow: none !important;
}

/*
 * Marketo splits the error message and its example/detail text into
 * separate block elements (.mktoErrorDetail, or `<br>`-separated spans),
 * which Marketo's defaults render with a full line of extra spacing.
 * Flatten that so multi-line errors stay tightly grouped.
 */
.mktoForm .mktoError .mktoErrorDetail,
.mktoForm .mktoError .mktoErrorMsg > * {
  display: inline;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.4;
}

.mktoForm .mktoError .mktoErrorDetail::before {
  content: ' ';
}

.mktoForm .mktoError .mktoErrorArrowWrap {
  display: none !important;
}

.mktoForm .mktoInvalid {
  border-color: #c0392b !important;
}

.mktoForm .mktoButtonRow {
  display: block;
  width: 100%;
  margin-top: 20px;
}

.mktoForm .mktoButtonWrap {
  margin-left: 0 !important;
  display: block;
  width: 100%;
}

.mktoForm .mktoButtonWrap .mktoButton,
.mktoForm button.mktoButton {
  width: 100%;
  background-color: var(--color-black) !important;
  background-image: none !important;
  border: none !important;
  border-radius: var(--border-button-radius) !important;
  color: var(--color-white) !important;
  cursor: pointer;
  font-family: var(--font-family-headings) !important;
  font-size: var(--font-size-body) !important;
  font-weight: var(--font-weight-button) !important;
  padding: 12px 20px !important;
  text-align: center;
  text-shadow: none !important;
  box-shadow: none !important;
  white-space: nowrap;
}

.mktoForm .mktoButtonWrap .mktoButton:hover,
.mktoForm button.mktoButton:hover {
  background-color: var(--color-dark-gray) !important;
}

.mktoForm .mktoButtonWrap .mktoButton:disabled,
.mktoForm button.mktoButton:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.mktoForm .mktoClear {
  clear: both;
}

/*
 * Skeleton shown while the Marketo script downloads and renders the
 * form. Inputs are rendered as gray bars with a shimmer animation, plus
 * a pill-shaped button to match the real submit. JS in
 * marketo-contact-form.ejs hides this once form.onReady fires.
 */
.marketoFormHidden {
  display: none !important;
}

.marketoFormSkeleton {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.marketoFormSkeletonInput,
.marketoFormSkeletonButton {
  border-radius: var(--border-sharp-radius);
  background: linear-gradient(
    90deg,
    var(--color-soft-white) 0%,
    #f5f5f5 50%,
    var(--color-soft-white) 100%
  );
  background-size: 200% 100%;
  animation: marketoFormSkeletonShimmer 1.4s ease-in-out infinite;
}

.marketoFormSkeletonInput {
  height: 46px;
}

.marketoFormSkeletonInputTall {
  height: 96px;
}

.marketoFormSkeletonButton {
  height: 46px;
  border-radius: var(--border-button-radius);
  margin-top: 4px;
}

@keyframes marketoFormSkeletonShimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .marketoFormSkeletonInput,
  .marketoFormSkeletonButton {
    animation: none;
  }
}
