/* Contact form. Loaded only on the contact pages. */

/* Back to the portal (or home): an outlined button, matching the phone
   Menu button, so it reads as a way out but not as the main action. */
.back-button {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.5rem 1rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--text-muted);
  border-radius: var(--radius, 6px);
}

.back-button:hover {
  color: var(--text);
  border-color: var(--accent-2);
}

.back-button:focus-visible {
  outline: 3px solid var(--accent-2);
  outline-offset: 2px;
}

.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
  padding-top: 1rem;
}

.contact-form {
  padding: 2rem;
  background: var(--surface);
  border-radius: var(--radius, 6px);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem 1.5rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field-wide {
  grid-column: 1 / -1;
}

.field label,
.field legend {
  font-weight: 600;
}

.field legend {
  margin-bottom: 0.35rem;
  padding: 0;
}

.optional,
.field-help {
  font-weight: 400;
  color: var(--text-muted);
}

.field-help {
  margin: 0;
  font-size: 0.9rem;
}

.field input:not([type="radio"]),
.field select,
.field textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--text-muted);
  border-radius: var(--radius, 6px);
}

.field textarea {
  resize: vertical;
}

/* Radio buttons (preferred contact) sit in a row and wrap on phones. */
.field > div[id] {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.field > div[id] label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
  cursor: pointer;
}

.field input[type="radio"] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--accent);
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible,
.contact-form .button:focus-visible {
  outline: 3px solid var(--accent-2);
  outline-offset: 2px;
}

/* Errors: the theme's --error color plus a written message, never color
   alone. The theme defines --error with at least 4.5:1 contrast. */
.has-error input:not([type="radio"]),
.has-error select,
.has-error textarea {
  border-color: var(--error);
  border-width: 2px;
}

.field-error {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--error);
}

.field-error p {
  margin: 0;
}

.form-errors {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--bg);
  border-left: 4px solid var(--error);
  border-radius: var(--radius, 6px);
}

.form-errors p {
  margin: 0;
  font-weight: 600;
}

.privacy-note {
  margin: 1.5rem 0 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.contact-form .button {
  border: 0;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* Honeypot: off-screen for people, still in the page for bots. */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.contact-direct h2 {
  margin-top: 0;
  font-size: 1.25rem;
}

.contact-direct p {
  margin: 0.5rem 0;
}

@media (max-width: 800px) {
  .contact-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

@media (max-width: 560px) {
  .contact-form {
    padding: 1.25rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}
