/* ─────────────────────────── FORM FIELDS ─────────────────────────── */
.gt-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--gt-space-5); }
.gt-label { font-size: var(--gt-text-sm); font-weight: var(--gt-w-semibold); color: var(--gt-ink); }
.gt-label .gt-req { color: var(--gt-error); margin-left: 2px; }
.gt-label .gt-opt { color: var(--gt-ink-3); font-weight: var(--gt-w-regular); margin-left: 6px; }
.gt-hint { font-size: var(--gt-text-xs); color: var(--gt-ink-3); }
.gt-error-msg { font-size: var(--gt-text-xs); color: var(--gt-error); font-weight: var(--gt-w-medium); display: flex; align-items: center; gap: 5px; }
/* display:flex beats the [hidden] UA rule, so hiding the message needs saying. */
.gt-error-msg[hidden] { display: none; }

.gt-input, .gt-select, .gt-textarea {
  width: 100%; min-height: var(--gt-control-h); padding: 0 14px;
  font-family: var(--gt-font-body); font-size: var(--gt-text-sm); color: var(--gt-ink);
  background: var(--gt-surface); border: var(--gt-border-width-strong) solid var(--gt-border-2);
  border-radius: var(--gt-radius-input); transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.gt-textarea { padding: 12px 14px; min-height: 110px; line-height: var(--gt-leading-normal); resize: vertical; }
.gt-input::placeholder, .gt-textarea::placeholder { color: var(--gt-ink-3); }
.gt-input:hover, .gt-select:hover, .gt-textarea:hover { border-color: var(--gt-ink-3); }
.gt-input:focus, .gt-select:focus, .gt-textarea:focus { outline: none; border-color: var(--gt-primary); box-shadow: var(--gt-focus-ring); }
.gt-input--error, .gt-textarea--error, .gt-select--error,
.gt-input--error:hover, .gt-textarea--error:hover, .gt-select--error:hover,
.gt-input--error:focus, .gt-textarea--error:focus, .gt-select--error:focus { border-color: var(--gt-error); }
.gt-input[disabled], .gt-select[disabled], .gt-textarea[disabled] { background: var(--gt-surface-sunken); color: var(--gt-ink-3); cursor: not-allowed; }

.gt-select { appearance: none; padding-right: 40px;
  background-image: var(--gt-select-chevron);
  background-repeat: no-repeat; background-position: right 14px center; }

/* input with leading icon */
.gt-input-group { position: relative; display: flex; align-items: center; }
.gt-input-group .gt-input { padding-left: 42px; }
.gt-input-group svg { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--gt-ink-3); pointer-events: none; }

/* native checkbox & radio — styles raw Form API / Webform output directly */
input[type="checkbox"], input[type="radio"] {
  appearance: none; -webkit-appearance: none; box-sizing: border-box;
  flex: 0 0 auto; width: 22px; height: 22px; margin: 0;
  display: inline-grid; place-items: center; vertical-align: middle;
  background: var(--gt-surface); border: var(--gt-border-width-strong) solid var(--gt-border-2);
  cursor: pointer;
}
input[type="checkbox"] { border-radius: max(4px, calc(var(--gt-radius-input) - 4px)); }
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]::before {
  content: ""; width: 13px; height: 13px; transform: scale(0); background: var(--gt-on-primary);
  -webkit-mask: var(--gt-check-tick) center / contain no-repeat;
  mask: var(--gt-check-tick) center / contain no-repeat;
}
input[type="radio"]::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--gt-on-primary); transform: scale(0);
}
input[type="checkbox"]:checked, input[type="radio"]:checked { background: var(--gt-primary); border-color: var(--gt-primary); }
input[type="checkbox"]:checked::before, input[type="radio"]:checked::before { transform: scale(1); }
input[type="checkbox"]:hover:not([disabled]), input[type="radio"]:hover:not([disabled]) { border-color: var(--gt-ink-3); }
input[type="checkbox"][disabled], input[type="radio"][disabled] { background: var(--gt-surface-sunken); border-color: var(--gt-border-2); cursor: not-allowed; }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: none; box-shadow: var(--gt-focus-ring); }
@media (prefers-reduced-motion: no-preference) {
  input[type="checkbox"], input[type="radio"] { transition: border-color .15s, background-color .15s; }
  input[type="checkbox"]::before, input[type="radio"]::before { transition: transform .15s; }
}

/* choice row — control sits beside its label (Drupal renders the label after the control) */
.gt-field.form-type-checkbox, .gt-field.form-type-radio { flex-direction: row; align-items: flex-start; gap: 10px; min-height: 24px; margin-bottom: var(--gt-space-2); }
.gt-field.form-type-checkbox .gt-label, .gt-field.form-type-radio .gt-label { font-weight: var(--gt-w-regular); }

/* fieldset / grouped choices */
fieldset { border: 0; margin: 0 0 var(--gt-space-5); padding: 0; min-width: 0; }
legend { font-size: var(--gt-text-sm); font-weight: var(--gt-w-semibold); color: var(--gt-ink); margin-bottom: var(--gt-space-2); padding: 0; }

/* checkbox & radio — styled wrapper (SDC demo markup) */
.gt-check, .gt-radio { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; min-height: 24px; font-size: var(--gt-text-sm); color: var(--gt-ink); }
.gt-check input, .gt-radio input { position: absolute; opacity: 0; width: 0; height: 0; }
.gt-check .gt-box, .gt-radio .gt-box {
  flex: 0 0 auto; width: 22px; height: 22px; margin-top: 1px;
  border: var(--gt-border-width-strong) solid var(--gt-border-2); background: var(--gt-surface);
  display: grid; place-items: center; transition: border-color .15s, background-color .15s;
}
.gt-check .gt-box { border-radius: max(4px, calc(var(--gt-radius-input) - 4px)); }
.gt-radio .gt-box { border-radius: 50%; }
.gt-check .gt-box svg { width: 13px; height: 13px; color: var(--gt-on-primary); opacity: 0; transition: opacity .12s; }
.gt-radio .gt-box::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--gt-on-primary); transform: scale(0); transition: transform .15s; }
.gt-check input:checked + .gt-box { background: var(--gt-primary); border-color: var(--gt-primary); }
.gt-check input:checked + .gt-box svg { opacity: 1; }
.gt-radio input:checked + .gt-box { background: var(--gt-primary); border-color: var(--gt-primary); }
.gt-radio input:checked + .gt-box::after { transform: scale(1); }
.gt-check input:focus-visible + .gt-box, .gt-radio input:focus-visible + .gt-box { box-shadow: var(--gt-focus-ring); }

/* switch */
.gt-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 24px; font-size: var(--gt-text-sm); }
.gt-switch input { position: absolute; opacity: 0; }
.gt-switch .gt-track { width: 44px; height: 26px; border-radius: var(--gt-radius-pill); background: var(--gt-border-2); position: relative; transition: background-color .18s; flex: 0 0 auto; }
.gt-switch .gt-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--gt-switch-knob); box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s; }
.gt-switch input:checked + .gt-track { background: var(--gt-primary); }
.gt-switch input:checked + .gt-track::after { transform: translateX(18px); }
.gt-switch input:focus-visible + .gt-track { box-shadow: var(--gt-focus-ring); }

/* file upload (dropzone) */
.gt-file {
  /* position: relative so the covering file input has this as its containing
     block; visually neutral on its own. display: block because a <label> is
     inline by default — inside .gt-field the flex layout blockifies it, but
     standalone the border would fragment around the block children. */
  display: block;
  position: relative;
  border: 2px dashed var(--gt-border-2); border-radius: var(--gt-radius-input);
  background: var(--gt-surface-2); padding: var(--gt-space-8); text-align: center; cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.gt-file:hover { border-color: var(--gt-primary); background: var(--gt-primary-soft); }
.gt-file svg { width: 32px; height: 32px; color: var(--gt-ink-3); margin-bottom: 8px; }
.gt-file strong { color: var(--gt-primary); }
/* The file input is visually hidden but NOT `hidden` — a `hidden` input is not
   focusable, which left the whole control unreachable by keyboard while still
   looking like a working field. It covers the drop zone instead, so a click
   anywhere opens the picker and the label shows a focus ring. */
.gt-file input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.gt-file:focus-within { border-color: var(--gt-primary); box-shadow: var(--gt-focus-ring); }

