/*
 * The shared contact block and its form (card 22): Landing, Solution, About, Contact.
 * Figma V12: desktop "V8 · 11 Final call to action" 3596:8416, states "V9 · Contact" 3596:17401,
 * mobile 3596:31328 and 3596:33141. Mobile and tablet: heading, form, steps (as drawn on mobile;
 * tablet since card 23). Desktop: heading and steps left (456), form right (680). Every value
 * from tokens.css.
 */

.contact-block {
  padding: var(--space-64) 0;
  background: var(--color-white);
}

.contact-block__grid {
  display: grid;
  grid-template-areas:
    "heading"
    "form"
    "next";
  gap: var(--space-40);
}

.contact-block__heading {
  grid-area: heading;
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

.contact-block__heading .t-h2 {
  color: var(--color-petrol-900);
}

.contact-block__lead {
  color: var(--color-slate-500);
}

.contact-block__next {
  grid-area: next;
  display: flex;
  flex-direction: column;
  gap: 56px;
}

.contact-block__next-title {
  color: var(--color-petrol-900);
  font-size: var(--text-h2-size);
  line-height: var(--text-h2-line);
  font-weight: var(--weight-bold);
}

.contact-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-32);
}

.contact-step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-20);
}

.contact-step__icon {
  position: relative;
  flex: none;
  width: 48px;
  height: 48px;
}

.contact-step__number {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-petrol-900);
  font-size: var(--text-input-size);
  font-weight: var(--weight-bold);
}

.contact-step__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.contact-step__title {
  color: var(--color-petrol-900);
  font-size: var(--text-h3-size);
  line-height: var(--text-h3-line);
  font-weight: var(--weight-semibold);
}

.contact-step__line {
  color: var(--color-slate-500);
}

/* --- The form card ------------------------------------------------------------------------- */

.contact-card {
  grid-area: form;
  padding: var(--space-24);
  border-radius: var(--space-16);
  background: var(--color-grey-100);
  box-shadow: var(--shadow-form);
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-20);
}

.contact-form__title {
  color: var(--color-petrol-900);
  font-size: var(--text-h3-size);
  line-height: var(--text-h3-line);
  font-weight: var(--weight-semibold);
}

.contact-form__row {
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

.field {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-8);
  min-width: 0;
}

.field__label {
  color: var(--color-petrol-900);
  font-size: var(--text-label-size);
  line-height: var(--text-label-line);
  font-weight: var(--weight-medium);
}

.field__input {
  width: 100%;
  height: var(--button-height);
  padding: 0 var(--space-16);
  border: 1px solid var(--color-slate-400);
  border-radius: 6px;
  background: var(--color-white);
  color: var(--color-petrol-900);
  font-size: var(--text-input-size);
  line-height: var(--text-input-line);
}

.field__input::placeholder {
  color: var(--color-slate-500);
  opacity: 1;
}

.field__input--area {
  height: 206px;
  padding-top: var(--space-14);
  resize: vertical;
}

.field__input[aria-invalid="true"] {
  border: 2px solid var(--color-error-500);
  padding: 0 calc(var(--space-16) - 1px);
}

.field__error {
  color: var(--color-error-500);
  font-size: var(--text-body-sm-size);
  line-height: var(--text-body-sm-line);
}

.contact-form__alert {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-12) var(--space-16);
  border: 1px solid var(--color-error-border);
  border-radius: var(--space-12);
  background: var(--color-error-tint);
  color: var(--color-error-500);
  font-size: var(--text-body-size);
  line-height: var(--text-body-sm-line);
  font-weight: var(--weight-semibold);
}

.contact-form__alert--failed {
  padding: var(--space-14) var(--space-16);
}

.contact-form__alert-text {
  color: var(--color-navy-900);
  font-size: 14px;
  line-height: 18px;
  font-weight: var(--weight-regular);
}

.contact-form__alert-text a {
  text-decoration: underline;
}

.contact-form__send {
  width: 100%;
}

.contact-form__spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-navy-900);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.contact-form.is-sending .contact-form__spinner {
  display: inline-block;
}

/* Sending (card 29, Figma 3596:17586 and 3596:33209): the four fields, label and box, at 60 %
   while the form sends, at every width; the title, the button and the consent line unchanged. */
.contact-form.is-sending .field {
  opacity: 0.6;
}

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

.contact-form__consent {
  color: var(--color-slate-500);
  font-size: var(--text-body-sm-size);
  line-height: var(--text-body-sm-line);
}

.contact-form__consent a,
.contact-form__alert-text a {
  /* A 44 px tall touch area around a link inside a sentence, without moving the line. */
  display: inline-block;
  margin: -12px 0;
  padding: 12px 0;
  text-decoration: underline;
}

/* --- Sent ------------------------------------------------------------------------------------ */

.contact-sent {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-20);
  text-align: center;
}

.contact-sent__title {
  color: var(--color-petrol-900);
  font-size: var(--text-h3-size);
  line-height: var(--text-h3-line);
  font-weight: var(--weight-semibold);
}

.contact-sent__text {
  max-width: 390px;
  color: var(--color-navy-65);
  font-size: var(--text-body-lg-size);
  line-height: 26px;
}

.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--button-height);
  padding: 0 var(--space-24);
  border: 1px solid var(--color-navy-900);
  border-radius: var(--radius-pill);
  background: var(--color-white);
  color: var(--color-petrol-900);
  font-size: var(--text-button-size);
  line-height: var(--text-button-line);
  font-weight: var(--weight-semibold);
}

/* --- Tablet: the mobile order (heading, form, steps), full width (card 23) ------------------- */

@media (min-width: 768px) {
  .contact-block {
    padding: var(--space-80) 0;
  }

  .contact-card {
    padding: var(--space-40);
  }

  .contact-form__row {
    flex-direction: row;
  }
}

/* --- Desktop: as drawn at 1512 -------------------------------------------------------------- */

@media (min-width: 1280px) {
  .contact-block {
    padding: 120px 0;
  }

  .contact-block__grid {
    grid-template-columns: 456px 680px;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "heading form"
      "next form";
    column-gap: 64px;
    row-gap: 56px;
    align-items: start;
  }

  .contact-block__next-title {
    font-size: var(--text-h3-size);
    line-height: var(--text-h3-line);
    font-weight: var(--weight-semibold);
  }
}

@media (prefers-reduced-motion: reduce) {
  .contact-form__spinner {
    animation: none;
  }
}

/* Card 46, Field (482:80): on hover the stroke --color-border-input-hover; not on a field in
   error, nor while the form sends (its fields read-only). Hover only where the device hovers;
   150 ms, ease. */
@media (prefers-reduced-motion: no-preference) {
  :root[data-states-ready] .field__input {
    transition: border-color var(--state-duration) var(--state-easing);
  }
}

@media (hover: hover) {
  .field__input:not([aria-invalid="true"], :read-only):hover {
    border-color: var(--color-border-input-hover);
  }
}
