/* atoms/b-input — one class per element (BEM, component-scoped).
   Variants are attributes, same pattern as the button. */
.field { display: flex; flex-direction: column; gap: var(--space-1); flex: 1; }
.field__label { font-size: var(--text-sm); color: var(--color-muted); }
.field__input {
  padding: var(--space-2) var(--space-3);
  font-family: var(--type-font); font-size: var(--text-base);
  color: var(--ink); background: transparent;
  border: var(--border); border-radius: var(--radius-sm);   /* hard edge — you tap it */
}
.field__input::placeholder { color: var(--ink-muted); }
/* focus ring; data-force parallel lets the catalog show the state statically (same pattern as
   the button) — never `autofocus`, which would steal focus + scroll the catalog on load. */
.field__input:focus-visible, .field__input[data-force~="focus"] { outline: 2px solid var(--color-accent); outline-offset: 1px; }

/* invalid state — native, no JS. Monochrome: a heavier rule, not a red one. */
.field__input:user-invalid { border-width: 2px; }

/* ---- the two message slots, declared HERE because they belong to the frame rather than to any one
   control: an input, a select, a textarea and a checkbox all want somewhere to say a thing, and a
   per-control copy of these rules is how one frame becomes four. Both hide when empty, which is what
   makes them safe to put in every template: a slot with nothing in it must not open a gap in the
   column, and an optional slot nobody fills is the common case, not the exception. */
.field__hint { font-size: var(--text-xs); color: var(--ink-muted); line-height: var(--leading-normal); }
/* An error is NOT a red one. Status is weight, not hue (DESIGN-SYSTEM §2): the message reads at full
   ink against a hint's faint, and --color-danger is hueless by default so a flavor that DOES own a
   hue can reach it without this file ever naming a color. */
.field__error { font-size: var(--text-xs); color: var(--color-danger); line-height: var(--leading-normal); }
.field__hint:empty, .field__error:empty { display: none; }

/* ---- the required marker. No markup carries it and no author can forget it: the frame reads the
   `required` attribute the control already has to have anyway, so the marker cannot drift from the
   constraint the browser actually enforces. Decorative by construction — the semantics are native,
   and a screen reader announces the control as required with or without this glyph. */
.field:has(:required) .field__label::after {
  content: "*"; margin-inline-start: var(--space-1); color: var(--color-accent);
}

/* ---- variants (attribute) ---- */
.field[data-variant="inline"] { flex-direction: row; align-items: center; gap: var(--space-3); }
.field[data-variant="inline"] .field__label { flex: 0 0 auto; }

/* ---- sizes (attribute) ---- */
.field[data-size="sm"] .field__input { padding: var(--space-1) var(--space-2); font-size: var(--text-sm); }
.field[data-size="lg"] .field__input { padding: var(--space-3) var(--space-4); font-size: var(--text-lg); }

/* ---- AI / in-transit: the non-text grain, same language as the button (AI-INTERFACE §5).
   A field the AI is touching (live pending, or any grain ancestor) wears the dashed
   "terminal" edge; the label + value already swap to the grain family via --type-font.
   EXCEPTION: while the AI is actively COMPOSING, the dispatcher sets data-grade="smooth"
   on the input itself (clean ink, real caret, like a human typing) — so that stays solid.
   The `:not([data-grade="smooth"])` guard makes the exception explicit: a self-smooth input
   never matches the dashed rule, so the outcome doesn't depend on stylesheet source order. */
.field[data-commit="pending"] .field__input:not([data-grade="smooth"]),
[data-grade="grain"] .field__input:not([data-grade="smooth"]) { border-style: dashed; }
.field__input[data-grade="smooth"] { border-style: solid; }
