/* ========== FORMS ========== */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  max-width: 700px;
  margin: 0 auto;
}

.form-quick {
  max-width: 900px;
}

.form-quick .form-group label {
  font-size: var(--font-size-base);
}

.form-quick .form-group input,
.form-quick .form-group select {
  padding: var(--space-lg) var(--space-xl);
  font-size: var(--font-size-md);
  border-radius: var(--radius-md);
}

.form-quick button[type="submit"] {
  padding: var(--space-lg) 3rem;
  font-size: var(--font-size-md);
  min-width: 260px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-group label {
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--primary-color);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: var(--space-md) var(--space-lg);
  border: var(--border-width-thin) solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-base);
  font-family: inherit;
  width: 100%;
  background-color: var(--white);
  color: var(--text-color);
}

/* The border recolours and the tinted glow appears for any focus, mouse included.
   The outline is suppressed here and restored below only for :focus-visible, so a
   mouse click doesn't leave a ring but a Tab does. Without the split, the
   `outline: none` in this rule (specificity 0,2,1) would beat base.css's
   zero-specificity :where() ring and silently take the ring away again. */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-color-strong);
  box-shadow: var(--shadow-focus-ring);
}

.form-group input:focus-visible,
.form-group select:focus-visible,
.form-group textarea:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

.form-group.error input,
.form-group.error select,
.form-group.error textarea {
  border-color: var(--error-color);
}

.char-count {
  align-self: flex-end;
  font-size: var(--font-size-2xs);
  color: var(--muted-color);
}

.char-count.char-count-warning {
  color: var(--accent-color-strong);
  font-weight: 600;
}

.char-count.char-count-limit {
  color: var(--error-color);
  font-weight: 600;
}

/* Never display:none. Each .field-error is an aria-live region, and a live region
   has to already exist in the accessibility tree before its text changes for the
   change to be announced — revealing it and filling it in the same moment is
   unreliable across screen readers. So it stays rendered and simply holds no text
   until there's an error to show.
   The :empty rule cancels the .form-group flex gap while the slot is empty, so
   this keeps the exact same spacing the old display:none had. */
.field-error {
  font-size: 0.82rem;
  color: var(--error-color);
}

.field-error:empty {
  margin-top: calc(-1 * var(--space-xs));
}

.form button[type="submit"] {
  align-self: center;
  min-width: 200px;
}

.form-message {
  max-width: 700px;
  margin: var(--space-xl) auto 0;
  padding: 0;
  text-align: center;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.form-message.success {
  padding: var(--space-lg);
  background-color: var(--success-alpha-10);
  color: var(--success-color);
  border: var(--border-width-thin) solid var(--success-color);
}

.form-message.success p {
  color: var(--success-color);
  margin-bottom: 0.75rem;
}

.mailto-action-btn {
  display: inline-block;
}

.form-message.error {
  padding: var(--space-lg);
  background-color: var(--error-alpha-10);
  color: var(--error-color);
  border: var(--border-width-thin) solid var(--error-color);
}

/* ========== QUOTE SECTION ========== */
.form-quote {
  max-width: 700px;
}

.form-group-full {
  grid-column: 1 / -1;
}
