/* ==========================================================
   IROZON DESIGN SYSTEM — Field (canonical, v1)
   Public API: <div class="iz-field"> wraps a label, a control
   (.iz-input / .iz-textarea / .iz-select — see input.css, select.css),
   and an optional .iz-field__hint or .iz-field__error. State
   (disabled, readonly, required, aria-invalid) lives on the control
   itself via native/ARIA attributes — this file has no .is-* classes.
   ========================================================== */

.iz-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.iz-field__label {
  font-family: var(--font-label);
  font-weight: 600;
  font-size: var(--fs-body-sm);
  color: var(--color-text-primary);
}

/* Optional in-label content marking a field as not required — e.g.
   "Phone (optional)". No automatic required asterisk is generated;
   see forms.html for the content policy this supports. */
.iz-field__optional {
  color: var(--color-text-muted);
  font-weight: 400;
}

.iz-field__hint {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-caption);
  color: var(--color-text-muted);
}

/* Error text pairs with a leading icon slot by convention (not
   generated here) so the message never relies on color alone — see
   forms.html for the markup. */
.iz-field__error {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-family: var(--font-body);
  font-size: var(--fs-caption);
  color: var(--color-error);
}
.iz-field__error svg {
  inline-size: 14px;
  block-size: 14px;
  margin-block-start: 1px;
  flex: none;
}

/* ---------- Control + inline action composition ----------
   For a control that needs an inline action inside its own box (e.g.
   a password show/hide toggle) — genuinely reusable across control
   types, so it lives here rather than being redrawn per page. The
   action itself is typically an .iz-button[data-icon-only]; behavior
   is never defined here, only layout. */
.iz-field__control-wrap {
  position: relative;
}
.iz-field__control-wrap .iz-input {
  padding-inline-end: 44px;
}
.iz-field__control-action {
  /* Centered via inset-block-start/end + margin-block:auto, not
     transform — .iz-button's own :active state sets `transform:
     scale(0.97)` on this same element, and an animated/active
     transform replaces the computed value outright rather than
     composing with a static one. A translateY(-50%) here would get
     clobbered on every press, which is what caused the button to
     visibly jump instead of just depressing in place. Same fix
     shape as the Loader/Button centering bug. */
  position: absolute;
  inset-inline-end: 4px;
  inset-block-start: 0;
  inset-block-end: 0;
  margin-block: auto;
}

/* Icon crossfade — for a control action whose icon changes with state
   (e.g. the password show/hide eye). Both icons are always present,
   stacked in the same fixed box via inset:0 + margin:auto, so neither
   the button nor the icon box ever changes size; only opacity moves. */
.iz-field__control-action svg {
  position: absolute;
  inset: 0;
  margin: auto;
  opacity: 0;
  transition: opacity var(--motion-duration-fast) var(--motion-ease-standard);
}
.iz-field__control-action svg[data-active="true"] {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .iz-field__control-action svg {
    transition: none;
  }
}
