/* --- Contact form --- */

.contact-intro {
  text-align: center;
  font-size: 112.5%;
  max-width: 36rem;
  margin: 0 auto 2.5rem;
}

.contact-form {
  max-width: 40rem;
  margin: 0 auto;
}

.form-row {
  display: flex;
  gap: 1.5rem;
}

.form-field {
  flex: 1;
  margin-bottom: 1.5rem;
}

label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--heading-color);
  font-size: 0.95rem;
}

.required {
  color: hsl(0, 65%, 50%);
}

input[type="text"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid hsl(from var(--primary-color) h 20 80);
  border-radius: 0.3rem;
  font-family: inherit;
  font-size: var(--base-font-size);
  font-weight: 325;
  color: var(--text-color);
  background-color: white;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px hsl(from var(--primary-color) h s l / 0.15);
}

/* Validation feedback for fields the user has interacted with */
input:user-invalid,
select:user-invalid,
textarea:user-invalid {
  border-color: hsl(0, 65%, 55%);
}

input:user-invalid:focus,
select:user-invalid:focus,
textarea:user-invalid:focus {
  box-shadow: 0 0 0 2px hsl(0, 65%, 55%, 0.15);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23555' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

textarea {
  resize: vertical;
  min-height: 8rem;
}

.form-actions {
  text-align: center;
  margin-top: 0.5rem;
}

button[type="submit"] {
  background-color: var(--primary-color);
  border: none;
  border-radius: 0.4rem;
  box-shadow: 0 0 2rem hsl(from var(--primary-color) h s l / 0.2);
  color: white;
  cursor: pointer;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 500;
  padding: 0.6rem 2.5rem;
  transition: box-shadow 0.2s, opacity 0.2s;
}

button[type="submit"]:hover:not(:disabled) {
  box-shadow: 0 0 2rem hsl(from var(--primary-color) h s l / 0.4);
}

button[type="submit"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-note {
  font-size: 0.85rem;
  color: #888;
  margin-top: 0.75rem;
}

/* Status messages after submission */
.form-status {
  text-align: center;
  margin-top: 1.5rem;
  font-weight: 500;
}

.form-status.success {
  color: hsl(145, 50%, 35%);
}

.form-status.error {
  color: hsl(0, 65%, 45%);
}

/* Sending spinner */
button[type="submit"].sending {
  position: relative;
  color: transparent;
  pointer-events: none;
}

button[type="submit"].sending::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid white;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

@media (max-width: 600px) {
  .form-row {
    flex-direction: column;
    gap: 0;
  }
}
