/*
 * Text fields across the site (Daniel, 2026-10-19): a focused field shows a step in its own grey, never a coloured
 * ring ("the focus blue looks like trash on the field ... darker or lighter grey depending on what is around").
 * A translucent mid-grey goes over the field's own background, so the same rule lightens a dark field (#111 to about
 * #272727) and darkens a light one (#F8F8F8 to about #E0E0E0) wherever it sits. It replaces every focus ring on
 * fields (the theme's, the contact form's, the calculator's); checkboxes, radios and buttons keep their own focus.
 * The transparent outline still draws in Windows' forced colours.
 */
input:not([type]):focus,
input:is([type="text"], [type="email"], [type="tel"], [type="url"], [type="number"], [type="search"], [type="password"], [type="date"], [type="time"]):focus,
textarea:focus {
  outline: 2px solid transparent !important;
  outline-offset: 0 !important;
  box-shadow: none !important;
  background-image: linear-gradient(rgba(128, 128, 128, 0.18), rgba(128, 128, 128, 0.18)) !important;
}

/* a select's own background image is its arrow: the grey goes on top of it instead */
select:focus {
  outline: 2px solid transparent !important;
  outline-offset: 0 !important;
  box-shadow: inset 0 0 0 100vmax rgba(128, 128, 128, 0.18) !important;
}

input[readonly]:focus,
textarea[readonly]:focus {
  background-image: none !important;
}

/* a text field shows the text cursor, not the theme's hand (theme.css gives every text input cursor: pointer; QA 2026-11-27) */
input:not([type]),
input:is([type="text"], [type="email"], [type="tel"], [type="url"], [type="number"], [type="search"], [type="password"]) {
  cursor: text;
}

/*
 * Errors on the site's forms (Daniel, 2026-10-19), inside the fields since 2026-11-05 ("put the error messages inside
 * the fields"). A text field's message takes the place of its text, in the field's own type, and its border turns the
 * error colour, so nothing under it moves. Empty, the field shows the message where its placeholder was (the caret
 * before it once tapped, as with a placeholder); with text in it, the message until the visitor goes back into it,
 * then their text to fix. The error colour is the AI automation red, #E34343, on dark and light forms alike (Daniel,
 * 2026-11-05: "use the red color from our ai automation color, make sure all error colors everywhere are like that";
 * it was orange #ED7B28, and #B25512 on light forms): borders, and text on black (5.2:1). Text takes the same red a step
 * lighter inside the dark fields, #EC5F5F (4.6:1 on #262626, where #E34343 is 3.7:1), and a step deeper on light forms,
 * #C93232 (5:1 on #F8F8F8, where it is 3.8:1), so it reads (Daniel: "yes make text to pass"). A message that belongs to
 * no text field (a choice, a file) sits
 * under it in the type of the form's descriptions ("same as description"): the job form's below, the popups' in
 * contact-steps.css.
 */
.wpcf7 .wpcf7-not-valid-tip {
  display: block !important;
  margin-top: 8px;
  color: #C93232;
}

.wpcf7 input[aria-invalid="true"],
.wpcf7 textarea[aria-invalid="true"] {
  color: inherit !important;
  border-color: #E34343 !important;
}

.popup--apply .wpcf7 input[aria-invalid="true"],
.popup--apply .wpcf7 textarea[aria-invalid="true"] {
  color: #000 !important;
}

.popup__form.dark .wpcf7 .wpcf7-not-valid-tip {
  color: #E34343;
}

.popup__form.dark .wpcf7 input[aria-invalid="true"],
.popup__form.dark .wpcf7 textarea[aria-invalid="true"] {
  color: #fff !important;
  border-color: #E34343 !important;
}

/* the job form's descriptions (.h4.fs-20) */
.popup--apply .wpcf7-not-valid-tip {
  font-size: 20px;
  line-height: 30px;
  letter-spacing: -0.8px;
}

/* in the field: the field's box, padding and type (the theme's .fs-20 steps), over the text it stands in for */
.wpcf7-form-control-wrap:has(> input:not([type="file"])) {
  display: block;
  position: relative;
}

.wpcf7-form-control-wrap > input:not([type="file"]) ~ .wpcf7-not-valid-tip {
  position: absolute;
  inset: 0 0 auto;
  display: block !important;
  margin: 0;
  padding: 15px 20px;
  border: 1px solid transparent;
  font-size: 20px;
  line-height: 30px;
  letter-spacing: -0.8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.wpcf7-form-control-wrap:has(> .wpcf7-not-valid-tip) > input:not([type="file"])::placeholder {
  color: transparent !important;
  opacity: 0 !important;
}

.wpcf7-form-control-wrap:has(> .wpcf7-not-valid-tip):not(:focus-within) > input:not([type="file"]) {
  -webkit-text-fill-color: transparent !important;
}

/* inside a dark field (the contact and calculator forms) */
.popup__form.dark .wpcf7-form-control-wrap > input:not([type="file"]) ~ .wpcf7-not-valid-tip {
  color: #EC5F5F;
}

/* back in a field with text: the text again, to fix, while the border keeps the error colour */
.wpcf7-form-control-wrap:focus-within > input:not([type="file"], :placeholder-shown) ~ .wpcf7-not-valid-tip {
  visibility: hidden;
}

@media (min-width: 782px) and (max-width: 1279px) {
  .popup--apply .wpcf7-not-valid-tip,
  .wpcf7-form-control-wrap > input:not([type="file"]) ~ .wpcf7-not-valid-tip {
    font-size: clamp(16px, 1.5625vw, 20px);
    line-height: 1.5em;
    letter-spacing: -0.03984375em;
  }
}

@media (max-width: 781px) {
  .popup--apply .wpcf7-not-valid-tip {
    font-size: 17px;
    line-height: 22px;
    letter-spacing: -0.6px;
  }

  .wpcf7-form-control-wrap > input:not([type="file"]) ~ .wpcf7-not-valid-tip {
    font-size: 16px;
    line-height: 22px;
    letter-spacing: -0.6px;
  }
}
