/* FIELD: the one copy of the text field, select, textarea, label, helper and error line.
   tools/build.py copies it to deploy/css/field.css and every page whose template has the field_css placeholder links it. Change the look here, never in a page.
   Sizes, radii and type come from templates/design-tokens.css. Colours are the page's own tokens
   plus --field-fill. A field has no border: its fill, label and focus ring carry it (edge contrast is under 3:1, see docs/TYPE-RADIUS-FIELDS.md).
   .lbl is a label ONLY as a direct child of .field: booking and training buttons use <span class="lbl"> for their text.
   The page keeps its own class names for now (.in, .input, .join-input, .req-input); they share these rules. */

/* SECOND TONE: put .on-bg on a container whose controls sit straight on the page ground (--bg) and not on a white sheet or card. */
.on-bg{--well:var(--well-page);--chosen:var(--chosen-page);--field-fill:var(--well-page)}

/* SPACING: the wrapper of one field (label, control, helper, error) owns the space under it. Pages no longer set their own. */
.field{display:block;margin-bottom:var(--field-gap)}   /* display:block so a <label class="field"> stacks like a <div> */
.field:has(.consent){margin-bottom:10px}   /* a field that ends in a tick-box row sits closer to what follows */
.field .consent{margin-bottom:0}

.lab,.field>.lbl,.req-lbl{
  display:block;margin-bottom:6px;
  font-family:var(--ui);font-size:var(--fs-label);font-weight:500;line-height:1.3;
  letter-spacing:0;text-transform:none;color:var(--ink2);
}
.lab i,.field>.lbl i,.req-lbl i{font-style:normal;color:var(--warn)}   /* the * only; the field's own aria-required says it aloud */
.hint{font-size:var(--fs-help);color:var(--ink2);line-height:1.45;margin-top:7px}
.lab .hint{font-weight:400;margin-top:0}   /* --ink3 is 4.0:1 on a dark --surface; helper text sits on --surface, so it uses --ink2 */

.in,.input,.join-input,.req-input{
  display:block;width:100%;height:var(--ctl);padding:0 18px;
  border:0;border-radius:var(--r-lg);                      /* 16px, filled, no border */
  background:var(--field-fill);color:var(--ink);
  font-family:var(--ui);font-size:var(--fs-field);line-height:1.3;
  outline:none;appearance:none;-webkit-appearance:none;
  transition:box-shadow 160ms var(--out),background-color 160ms var(--out);
}
textarea.in,textarea.input{height:auto;min-height:calc(var(--ctl) * 2);padding:14px 18px;line-height:1.5;resize:none}
.in::placeholder,.input::placeholder,.join-input::placeholder,.req-input::placeholder{color:var(--ink2);opacity:1}
@media(hover:hover) and (pointer:fine){
  .in:hover,.input:hover,.join-input:hover,.req-input:hover{background:var(--surface2)}
}
/* Focus: a 2px accent ring on a white fill, so the cue is a line and not colour alone. */
.in:focus-visible,.input:focus-visible,.join-input:focus-visible,.req-input:focus-visible,
.in:focus,.input:focus,.join-input:focus,.req-input:focus{
  background:var(--surface);box-shadow:0 0 0 2px var(--accent),0 0 0 6px rgb(var(--accent-rgb) / .15);   /* ring plus a soft halo, as in the handoff */
}
/* Error: faint wash + the message under the field (the .err line), never colour alone. */
.in[aria-invalid="true"],.input[aria-invalid="true"],.join-input[aria-invalid="true"],.req-input[aria-invalid="true"],
.field.bad .in,.field.bad .input{
  box-shadow:none;                                          /* no border: a pink wash, plus the message line, so it is never colour alone */
  background:var(--field-error-fill);
}
.in[aria-invalid="true"]:focus-visible,.input[aria-invalid="true"]:focus-visible,
.join-input[aria-invalid="true"]:focus-visible,.req-input[aria-invalid="true"]:focus-visible{
  box-shadow:0 0 0 2px var(--warn),0 0 0 6px color-mix(in srgb,var(--warn) 15%,transparent);
}
/* Disabled is faded and not-allowed, so a grey field never reads as disabled by accident. */
.in:disabled,.input:disabled,.join-input:disabled,.req-input:disabled{
  opacity:.6;cursor:not-allowed;background:var(--bg);
}

/* VARIANT .in--round: the text field with fully rounded ends, 56px, for a one-field call to action that sits beside a button (the home hero's email box).
   Same hover, focus ring, error and disabled states as .in; the shape, size and a white (--surface) fill are what change. */
.in--round{height:var(--ctl-lg);padding:0 24px;border-radius:var(--r-pill);background:var(--surface)}   /* white (--surface) in light; hover and focus still use the shared states */

/* Select: a native select with the arrow drawn by .sel::after */
.sel{position:relative;display:block}
.sel select.in{padding-right:48px;text-overflow:ellipsis;cursor:pointer}
.sel::after{
  content:"";position:absolute;right:18px;top:50%;width:8px;height:8px;margin-top:-6px;
  border-right:2px solid var(--ink2);border-bottom:2px solid var(--ink2);
  transform:rotate(45deg);pointer-events:none;
}

/* Helper and error text under a field */
.note{font-size:var(--fs-help);line-height:1.45;color:var(--ink2);margin:4px 0 12px}
.note a{text-decoration:underline;color:inherit}
.err{display:none;font-size:var(--fs-help);font-weight:400;line-height:1.4;color:var(--warn);margin-top:6px}
.err.on,.field.bad .err{display:block}

/* Banner for a failed submit (the save, not one field) */
.formerr{
  display:none;margin-bottom:14px;padding:12px 16px;border-radius:var(--r-md);
  background:color-mix(in srgb,var(--warn) 12%,transparent);border:1px solid var(--warn);
  font-size:var(--sm);color:var(--warn);line-height:1.45;
}
.formerr.on{display:block}

@media(prefers-reduced-motion:reduce){
  .in,.input,.join-input,.req-input{transition:none}
}
