/* Book a conversation form, shared by both contact versions. Square, hairline, token-coloured browser surfaces. */

.form h2 {
  font-size: clamp(1.5rem, 2.3vw, 2.125rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.form__head p {
  max-width: 40ch;
  margin-top: 12px;
  color: var(--ink-2);
}

.form__fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 20px;
  margin-top: 36px;
}

.field {
  display: grid;
  align-content: start;
  gap: 8px;
  grid-column: 1 / -1;
}

.field--half {
  grid-column: auto;
}

.field > label {
  font-size: 0.9375rem;
  font-weight: 600;
}

.field input:not([type="checkbox"]),
.field select,
.field textarea {
  width: 100%;
  min-height: 50px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--ink-3);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  caret-color: var(--accent);
  appearance: none;
  scroll-margin-top: calc(var(--bar-h) + 96px);
  transition: border-color 0.2s ease-out;
}

.field textarea {
  min-height: 140px;
  line-height: 1.5;
  resize: vertical;
}

.field input:not([type="checkbox"]):hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--ink-2);
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

.field [aria-invalid="true"] {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.field ::placeholder {
  color: var(--ink-3);
  opacity: 1;
}

.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  box-shadow: inset 0 0 0 100px var(--paper);
}

.select {
  position: relative;
}

.select::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 19px;
  width: 8px;
  height: 8px;
  border-right: 1.6px solid var(--ink);
  border-bottom: 1.6px solid var(--ink);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.field select {
  padding-right: 48px;
  cursor: pointer;
}

.field select:invalid {
  color: var(--ink-3);
}

.field option {
  background: var(--paper);
  color: var(--ink);
}

.field--check {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
}

.field--check > label {
  font-weight: 500;
}

.field--check .field__err {
  grid-column: 1 / -1;
}

.field input[type="checkbox"] {
  display: grid;
  place-content: center;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 1px solid var(--ink-3);
  border-radius: 0;
  background: var(--paper);
  appearance: none;
  cursor: pointer;
  scroll-margin-top: calc(var(--bar-h) + 96px);
  transition:
    background-color 0.15s ease-out,
    border-color 0.15s ease-out;
}

.field input[type="checkbox"]::before {
  content: "";
  width: 12px;
  height: 12px;
  background: var(--btn-fg);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  transform: scale(0);
  transition: transform 0.15s ease-out;
}

.field input[type="checkbox"]:hover {
  border-color: var(--ink-2);
}

.field input[type="checkbox"]:checked {
  border-color: var(--btn-bg);
  background: var(--btn-bg);
}

.field input[type="checkbox"]:checked::before {
  transform: scale(1);
}

.field input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Errors carry an icon and text, never colour alone: the palette has no red */
.field__err,
.form__fail {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
}

.field__err::before,
.form__fail::before {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6'%3E%3Ccircle cx='8' cy='8' r='7'/%3E%3Cpath d='M8 4.2v4.6M8 10.6v1.4'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6'%3E%3Ccircle cx='8' cy='8' r='7'/%3E%3Cpath d='M8 4.2v4.6M8 10.6v1.4'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.form__send {
  grid-column: 1 / -1;
  justify-self: start;
  margin-top: 6px;
}

.form__send:disabled {
  opacity: 0.6;
  cursor: progress;
}

.form__fail {
  margin-top: 18px;
}

.form__done {
  margin-top: 36px;
  padding-top: 26px;
  border-top: 1px solid var(--rule-ink);
}

.form__done:focus {
  outline: none;
}

.form__done p {
  max-width: 22ch;
  font-size: clamp(1.375rem, 2vw, 1.75rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.form__done .arrow-link {
  margin-top: 16px;
}

@media (max-width: 599px) {
  .field--half {
    grid-column: 1 / -1;
  }
}
