/* <div class="w-field"><label class="w-label" for="x">Name</label><input class="w-input" id="x"><p class="w-hint">…</p></div>
   .w-input works on <input>, <select> and <textarea>. aria-invalid="true" marks an error.
   Size a field to what goes in it: .size-xs (7ch), .size-sm (11ch), .size-md (20ch), .size-lg (32ch),
   .size-full; a narrow screen gives every field the full width. .num right-aligns a number.
   A unit beside a field: <div class="w-affix"><input class="w-input size-sm num" …><span>%</span></div> */
.w-field { display: grid; gap: 6px; margin-bottom: var(--w-space-4); }
.w-label { font: 500 var(--w-text)/1.3 var(--w-font); color: var(--w-fg); }
.w-hint { margin: 0; font: var(--w-text-sm)/1.4 var(--w-font); color: var(--w-muted); }
.w-input { box-sizing: border-box; width: 100%; min-height: 36px; padding: 6px var(--w-space-3);
  border: 1px solid var(--w-border); border-radius: var(--w-radius); background: var(--w-bg); color: var(--w-fg);
  font: var(--w-text)/1.4 var(--w-font); transition: border-color var(--w-speed); }
.w-input::placeholder { color: var(--w-muted); }
.w-input:focus-visible { outline: 2px solid var(--w-ring); outline-offset: 1px; }
.w-input:disabled { opacity: .5; cursor: not-allowed; }
.w-input[aria-invalid="true"], .w-input:user-invalid { border-color: var(--w-destructive); }   /* :user-invalid: after the user has touched it */
.w-input[aria-invalid="true"] ~ .w-hint { color: var(--w-destructive); }
textarea.w-input { min-height: 80px; resize: vertical; }
select.w-input { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--w-muted) 50%), linear-gradient(135deg, var(--w-muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }

/* Field widths that say what goes in them, in characters plus the field's padding and border; on a
   narrow screen every field takes the full width. */
/* min(…, 100%), not max-inline-size: a select in a grid field would otherwise outgrow it. */
.w-input[class*="size-"] { inline-size: min(calc(var(--w-chars) + 2 * var(--w-space-3) + 2px), 100%); }
select.w-input[class*="size-"] { inline-size: min(calc(var(--w-chars) + var(--w-space-3) + 34px), 100%); }
.w-input.size-xs { --w-chars: 7ch; }
.w-input.size-sm { --w-chars: 11ch; }
.w-input.size-md { --w-chars: 20ch; }
.w-input.size-lg { --w-chars: 32ch; }
.w-input.size-full, select.w-input.size-full { inline-size: 100%; }
@media (max-width: 30rem) { .w-input[class*="size-"], select.w-input[class*="size-"] { inline-size: 100%; } }
.w-input.num { text-align: end; font-variant-numeric: tabular-nums; }
.w-affix { display: flex; align-items: center; gap: var(--w-space-2); max-inline-size: 100%; }
.w-affix > .w-input { flex: 0 1 auto; min-inline-size: 0; }
.w-affix > span { color: var(--w-muted); font: var(--w-text)/1.4 var(--w-font); white-space: nowrap; }
