/* Forms (assets/forms.js). Loaded by the pages that post a form; tokens come from mq.css. */

/* a message under its field: a line of text, no box, so nothing jumps more than that one line */
.fx-err { display: block; margin: 4px 2px 0; font-size: 12.5px; font-weight: 600; line-height: 1.6; color: var(--down, #B3382F); }
.fx-err[hidden] { display: none; }
.fx-bad input:not([type=radio]):not([type=checkbox]):not([type=file]),
.fx-bad select,
.fx-bad textarea,
input[aria-invalid='true'], select[aria-invalid='true'], textarea[aria-invalid='true'] {
  border-color: var(--down, #B3382F) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--down, #B3382F) 18%, transparent);
}
fieldset.fx-bad { outline: 1px solid var(--down, #B3382F); outline-offset: 4px; border-radius: 12px; }

/* the character counter: tabular, on the end side, never wraps */
.fx-count { display: block; text-align: end; margin: 2px 2px 0; font-size: 11.5px; color: var(--text-3, #6b7280); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.fx-count.fx-near { color: var(--down, #B3382F); font-weight: 700; }

/* touch targets of at least 44px inside an enhanced form. Wrapped in :where() so the rule has no
   specificity of its own: it is a floor under the design's heights (50px fields), never a ceiling over them */
:where(form.fx input:not([type=radio], [type=checkbox], [type=hidden], [type=file]), form.fx select) { min-height: 44px; }
:where(form.fx button, form.fx .mq-btn, form.fx .btn) { min-height: 44px; }
:where(form.fx input[type=radio], form.fx input[type=checkbox]) { min-width: 22px; min-height: 22px; }
:where(form.fx .shop-stars label) { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }

/* a pressed submit button: the label stays (same width, nothing shifts) and a ring turns beside it */
button.fx-busy { position: relative; cursor: progress; opacity: .8; }
button.fx-busy::after {
  content: ''; position: absolute; inset-inline-end: 12px; top: 50%; width: 16px; height: 16px; margin-top: -8px;
  border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: fx-spin .8s linear infinite;
}
@keyframes fx-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  button.fx-busy::after { animation: none; border-top-color: currentColor; opacity: .55; }
  .fx-err { transition: none; }
}
