/* =============================================================================
   GFA Directory — shared accessible form primitives

   Every later screen (registration, org profile editor, admin settings, claim
   evidence) builds on THESE classes rather than inventing its own field markup —
   the reason this ships in Phase 4, before any of those screens exist.
   ============================================================================= */

.gfa-field {
  margin-bottom: var(--gfa-space-md, 2rem);
}

.gfa-field label,
.gfa-field .gfa-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--gfa-color-primary, #fff);
}

.gfa-field .gfa-required {
  color: var(--gfa-color-accent, #FE66C4);
  margin-left: 0.2em;
}

.gfa-field .gfa-hint {
  display: block;
  font-size: 0.85em;
  color: var(--gfa-color-muted, rgba(255,255,255,0.62));
  margin-top: 0.3rem;
}

/* Inline field error. Paired with an id the input's aria-describedby points at —
   see the pattern in partials/field.php once the Phase 8+ screens introduce it. */
.gfa-field-error {
  display: block;
  color: var(--gfa-color-accent, #FE66C4);
  font-size: 0.9em;
  margin-top: 0.35rem;
}
.gfa-field.has-error input,
.gfa-field.has-error select,
.gfa-field.has-error textarea {
  outline: 2px solid var(--gfa-color-accent, #FE66C4);
  outline-offset: -1px;
}

/* Grouped controls (radio/checkbox sets) — a real <fieldset>/<legend>, styled to
   match the rest of the form rather than the browser default box. */
.gfa-fieldset {
  border: 1px solid var(--gfa-color-border, rgba(255,255,255,0.14));
  border-radius: var(--gfa-button-radius, 5px);
  padding: 1rem 1.25rem 1.25rem;
  margin: 0 0 var(--gfa-space-md, 2rem);
}
.gfa-fieldset legend {
  padding: 0 0.5rem;
  font-weight: 500;
  color: var(--gfa-color-primary, #fff);
}
.gfa-fieldset .gfa-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.5rem 0;
}
.gfa-fieldset .gfa-option input {
  width: auto;
  margin: 0.2rem 0 0;
}

/* Form-level error summary. Rendered ABOVE the form on a failed submission, with
   in-page anchor links to each field — the accessible pattern for "here is
   everything wrong, and where", read by a screen reader before any field markup. */
.gfa-error-summary {
  border: 2px solid var(--gfa-color-accent, #FE66C4);
  border-radius: var(--gfa-button-radius, 5px);
  padding: 1rem 1.25rem;
  margin-bottom: var(--gfa-space-md, 2rem);
}
.gfa-error-summary h2 {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
  color: var(--gfa-color-accent, #FE66C4);
}
.gfa-error-summary ul {
  margin: 0;
  padding-left: 1.25rem;
}
.gfa-error-summary a {
  color: var(--gfa-color-primary, #fff);
  text-decoration: underline;
}
.gfa-error-summary a:hover {
  color: var(--gfa-color-accent-hover, #2BD311);
}

/* Skip link — present on every page via layouts/app.php, styled here alongside the
   rest of the interaction-critical primitives.
   Off-canvas via clip/1px box, NOT left:-9999px — see theme.css's .gfa-skip for why
   (Phase 16 320px audit: the negative-offset technique was growing the document's
   scrollable overflow region and causing spurious horizontal scroll on this form
   page). This rule loads after theme.css and was the one actually winning. */
.gfa-skip {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  left: 1rem;
  top: 0;
  z-index: 1000;
  background: var(--gfa-color-accent, #FE66C4);
  color: var(--gfa-color-button-text, #fff);
  padding: var(--gfa-button-padding-y, 10px) var(--gfa-button-padding-x, 20px);
  border-radius: var(--gfa-button-radius, 5px);
}
.gfa-skip:focus {
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
  top: 1rem;
}

/* :focus-visible ring. The brand spec forbids a HOVER animation on buttons, but a
   visible FOCUS ring is a separate, non-negotiable accessibility requirement — it is
   how keyboard users navigate, and it never appears for mouse users. Dual black+white
   so it stays >=3:1 against either a light or a dark surface — a single colour ring
   would vanish against a same-hue background. */
:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px #000;
  border-radius: 2px;
}

/* A dialog primitive (native <dialog>, progressively enhanced). */
.gfa-dialog {
  border: 1px solid var(--gfa-color-border, rgba(255,255,255,0.14));
  border-radius: var(--gfa-button-radius, 5px);
  background: var(--gfa-color-background, #000);
  color: var(--gfa-color-primary, #fff);
  padding: 1.5rem;
  max-width: 32rem;
  width: 90vw;
}
.gfa-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

/* Spacing utility classes (.gfa-m0, .gfa-mt-sm, .gfa-mt-md) already ship in
   theme.css — no inline style="" attribute is ever needed, since the CSP's
   style-src has no 'unsafe-inline' (see SecurityHeaders) and would silently drop one. */
