/*
 * .field — white text input of site forms (registration, subscribe).
 * Figma: CTA form 337:9667 (74 px D), mobile 64 px.
 *
 * Markup:
 *   <div class="field">
 *     <label class="field__label" for="…">Your name</label>
 *     <input class="field__input" id="…" placeholder="Your name">
 *   </div>
 * The label stays for screen readers; the placeholder is the visible hint.
 */

.field {
  position: relative;
  width: 100%;
}

/* .field__label — visually hidden, read by screen readers */
.field__label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* .field__input */
.field__input {
  width: 100%;
  height: 4rem;
  padding: 0 1.25rem;
  border: 1px solid #f6f7f9;
  border-radius: var(--nv-radius-s);
  color: var(--nv-navy);
  font-size: 1.125rem;
  line-height: 1;
  letter-spacing: -0.02em;
  background-color: var(--nv-white);
  transition: border-color 0.3s ease;

  &::placeholder {
    color: var(--nv-blue);
    opacity: 1;
  }

  /* .field__input:focus-visible — the blue border alone marks the focused field, no second ring of the outline
     (Pavlo, 2026-10-14 for the popup; all forms since 2026-11-16) */
  &:focus-visible {
    outline: none;
    border-color: var(--nv-blue);
  }

  &[aria-invalid="true"] {
    border-color: #c53030;
  }

  /* @media (width >= 48em) .field__input */
  @media (width >= 48em) {
    height: 4.625rem;
    padding: 0 1.875rem;
    font-size: 1.25rem;
  }
}

/* .field__input:autofill — stays white (Pavlo, 2026-10-14): the browser's light blue autofill background
   hides the field on light sections. The browser does not let `background` override it, so an inset
   shadow covers it; the prefixed selector is a separate rule for older Safari */
.field__input:autofill {
  box-shadow: inset 0 0 0 100vmax var(--nv-white);
  -webkit-text-fill-color: var(--nv-navy);
}

/* .field__input:-webkit-autofill */
.field__input:-webkit-autofill {
  box-shadow: inset 0 0 0 100vmax var(--nv-white);
  -webkit-text-fill-color: var(--nv-navy);
}

/* .field__error — #c53030: 5.47:1 on white, 4.82:1 on --nv-ice (WCAG 1.4.3, step 11) */
.field__error {
  margin-top: 0.375rem;
  color: #c53030;
  font-size: 0.875rem;
  line-height: 1.2;
}

/* .field__input--area — textarea of the site forms: 128 → 158 px, text from the top left, no drag handle (Figma 18:43273);
   the text starts 4 px higher than a 30 px padding gives */
.field__input--area {
  display: block;
  height: 8rem;
  padding-block: 1.625rem 1.875rem;
  font-family: inherit;
  resize: none;

  /* @media (width >= 48em) .field__input--area */
  @media (width >= 48em) {
    height: 9.875rem;
  }
}

/* .field--select .field__input — native list with the chevron of Figma 18:44319 (77 px high on desktop): room on the right (30 px gap + 20 px arrow),
   the shown option is cut with an ellipsis; "no choice" reads like a placeholder */
.field--select .field__input {
  padding-right: 3.75rem;
  background: var(--nv-white) url("../../img/icons/select-chevron.svg") right 1.25rem center / 1.25rem 0.625rem no-repeat;
  font-family: inherit;
  text-overflow: ellipsis;
  cursor: pointer;
  appearance: none;

  /* .field--select .field__input:has(option[value=""]:checked) */
  &:has(option[value=""]:checked) {
    color: var(--nv-blue);
  }

  /* @media (width >= 48em) .field--select .field__input */
  @media (width >= 48em) {
    height: 4.8125rem;
    padding-right: 4.375rem;
    background-position: right 1.875rem center;
  }
}
