/* Form controls -see docs/strategy/design-system/15-form-controls.md */

.form-group {
  display: block;
}

.form-group label {
  display: block;
  font-size: var(--font-size-micro);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-label);
  margin-bottom: var(--space-1);
  font-weight: 700;
}

.form-control {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  font-family: var(--font);
  font-size: var(--font-size-body);
  color: var(--text);
  box-sizing: border-box;
}

.form-control:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
  border-color: var(--primary);
}

.form-control.money {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.form-control.uppercase {
  text-transform: uppercase;
}

.form-control.invalid,
.form-control[aria-invalid="true"] {
  border-color: var(--error);
}

.form-errors {
  margin-top: var(--space-1);
  color: var(--error);
  font-size: var(--font-size-small);
  font-weight: 500;
}

.form-help {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--font-size-small);
  font-weight: 500;
  color: var(--muted);
}

/* Generic small-muted-text utility used across templates (form help
 * notes, list footnotes, image captions, secondary status lines,
 * inline count badges). Sibling of ``.form-help`` but does NOT force
 * block display or top margin -so it composes inside both ``<p>``
 * (block context) and ``<span>`` (inline within a label/heading)
 * without breaking layout.
 *
 * Owners of feature CSS may add extra rules scoped to their parent
 * (e.g. ``.recipe-create-form .form-group .caption { margin: 0 }``)
 * but should never restate the base size/color here.
 */
.caption {
  font-size: var(--font-size-small);
  font-weight: 500;
  color: var(--muted);
  line-height: 1.4;
}

select.form-control {
  appearance: auto;
}
