/* FORM CONTROLS: the one copy of the radio cards and the tick-box row, shared by
   booking, training, interest and the home page's join form (tools/build.py copies it to deploy/css/form-controls.css and the pages link it).
   Change the look here, never in a page. Colours are the page's own tokens. */

/* One choice from a few: radios stay in the DOM so keyboard and screen readers
   get a real radiogroup; the card is the label. */
fieldset{border:none;min-width:0}
.opts{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.opts--3{grid-template-columns:repeat(3,1fr)}
.opts--1{grid-template-columns:1fr}   /* a single column list */
.opt{position:relative;display:block}
.opt input{position:absolute;opacity:0;inset:0;width:100%;height:100%;margin:0;cursor:var(--kick,pointer)}
.opt-c{
  display:grid;grid-template-columns:20px 1fr;gap:10px;align-items:center;
  min-height:calc(var(--ctl) + 4px);padding:8px 12px;border-radius:var(--r-lg);
  background:var(--well);   /* same fill as an unchosen chip. No outline: the dot is the control (4.5:1 ring), the fill is the card, like the tick-box row */
  transition:background 160ms ease,box-shadow 160ms ease;
}
.opts--3 .opt-c{gap:8px;padding:8px 10px}
.opt-dot{
  width:20px;height:20px;border-radius:50%;border:0;   /* the handoff look: a white dot lifted by a soft shadow, no ring (its edge is under 3:1, see the accessibility table) */
  background:var(--surface);box-shadow:0 0 0 1px color-mix(in srgb,var(--ink) 10%,transparent),0 1px 3px color-mix(in srgb,var(--ink) 22%,transparent);
  display:grid;place-items:center;transition:border-color 160ms ease,background-color 160ms ease;
}
.opt-dot::after{
  content:'';width:8px;height:8px;border-radius:50%;background:var(--on-accent);
  transform:scale(0);transition:transform 160ms var(--out);
}
.opt-box{   /* the multi-select card: the same card as a radio, with a square tick box in place of the dot (<input type=checkbox>) */
  width:20px;height:20px;border-radius:var(--r-xs);border:0;
  background:var(--surface);box-shadow:0 0 0 1px color-mix(in srgb,var(--ink) 10%,transparent),0 1px 3px color-mix(in srgb,var(--ink) 22%,transparent);
  display:grid;place-items:center;transition:background-color 160ms ease;
}
.opt-box::after{
  content:'';width:10px;height:6px;border-left:2.4px solid var(--on-accent);border-bottom:2.4px solid var(--on-accent);
  transform:rotate(-45deg) scale(0);margin-top:-2px;transition:transform 160ms var(--out);
}
.opt-t{font-size:var(--sm);font-weight:500;color:var(--ink);line-height:1.3}
.opt input:checked + .opt-c .opt-t{color:var(--ink)}
/* Descriptions stay for screen readers; sighted users get a compact grid so the submit button stays in view. */
.opt-d{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.opt input:checked + .opt-c{background:var(--chosen)}   /* chosen = deeper fill + the dot fills in, so not colour alone */
.opt input:checked + .opt-c .opt-dot,.opt input:checked + .opt-c .opt-box{background:var(--accent);box-shadow:none}   /* solid purple dot, white centre */
.opt input:checked + .opt-c .opt-dot::after{transform:scale(1)}
.opt input:checked + .opt-c .opt-box::after{transform:rotate(-45deg) scale(1)}
.opt input:focus-visible + .opt-c{outline:2px solid var(--accent);outline-offset:2px}
.field.bad .opt-c{box-shadow:inset 0 0 0 1px var(--warn)}   /* the only outline: an error, always with the message line */
@media(hover:hover) and (pointer:fine){.opt:hover input:not(:checked) + .opt-c{background:var(--surface2)}}

/* A tick-box row: the whole row is the label so the target is 44px+. */
.consent{
  display:grid;grid-template-columns:24px 1fr;gap:10px;align-items:center;
  min-height:44px;padding:6px 12px;margin:0 0 2px;cursor:var(--kick,pointer);   /* 44px tap target; the row is exactly as wide as a field, so its hover fill never runs past one */
  background:transparent;border-radius:var(--r-lg);   /* no fill at rest or when ticked; the whole row is the tap target and shows a fill on hover */
}
.consent input{
  appearance:none;-webkit-appearance:none;width:24px;height:24px;margin:0;border-radius:var(--r-sm);
  border:2px solid var(--ink3);background:var(--bg);display:grid;place-items:center;cursor:var(--kick,pointer);
  transition:background 160ms ease,border-color 160ms ease;
}
.consent input::after{
  content:'';width:10px;height:6px;border-left:2.4px solid var(--on-accent);border-bottom:2.4px solid var(--on-accent);
  transform:rotate(-45deg) scale(0);margin-top:-2px;transition:transform 160ms var(--out);
}
.consent input:checked{background:var(--accent);border-color:var(--accent)}
.consent input:checked::after{transform:rotate(-45deg) scale(1)}
@media(hover:hover) and (pointer:fine){.consent:hover{background:var(--well)}}
.consent input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.consent span{font-size:var(--sm);color:var(--ink2);line-height:1.45}
.consent span i{font-style:normal;color:var(--lav)}
.consent small{display:block;font-size:var(--xs);color:var(--ink2)}
.field.bad .consent input{border-color:var(--warn)}
.consent.missing{box-shadow:inset 0 0 0 1px var(--warn);animation:consentNudge 400ms ease-out}   /* a tick row that has to be ticked before the form can go */
@keyframes consentNudge{0%,100%{transform:translateX(0)}25%{transform:translateX(-4px)}75%{transform:translateX(4px)}}
@media(prefers-reduced-motion:reduce){
  .opt-c,.opt-dot,.opt-dot::after,.opt-box,.opt-box::after,.consent input,.consent input::after,.consent.missing{transition:none;animation:none}
}
