Form contains invalid input

Style the parent <form> based on invalid <input required>

      
form:has(input:focus:invalid) {
  border-color: red;
}