/* Sport-selection toggle — a brutalist segmented control.
 *
 * Two radio inputs presented as paired label-buttons. Both options are
 * visible at all times (no hidden menu). The active state inverts to
 * ink fill + paper text; the unselected state is paper fill + ink
 * text with a thick ink border. The two options butt against each
 * other so they read as one structural object, not two adjacent
 * buttons.
 *
 * The active state does NOT carry the hard offset shadow — that's
 * reserved for genuine pressable buttons (primary action). The fill
 * inversion alone is plenty of signal at this size, and skipping the
 * shadow avoids it overlapping the adjacent option.
 *
 * Accent (forge orange) is intentionally NOT used here. Accent is the
 * one-CTA-per-page colour reserved for the primary action and the
 * result panel header. The selected sport uses ink fill so the
 * "Parse" button stays the only orange element on screen.
 *
 * Inputs are visually hidden using the WCAG-recommended clip pattern
 * (not display:none) so keyboard focus and the browser's native
 * arrow-key navigation between radios in a name-group still work.
 */

.sport-toggle {
  /* Reset the fieldset's chrome — the toggle's structure is carried
   * by the option labels, not by the fieldset border. Bottom margin
   * separates the toggle from the textarea below at the same rhythm
   * the action-row uses (space-4 between intra-form blocks). */
  margin: 0 0 var(--space-4);
  padding: 0;
  border: 0;
}

/* inline-flex so the toggle hugs its content rather than stretching;
 * the textarea below takes full width, the toggle does not. */
.sport-toggle__options {
  display: inline-flex;
}

/* Visually hidden but still focusable. Standard WCAG pattern — do NOT
 * switch to ``display: none`` or ``visibility: hidden``, both remove
 * the input from the tab order and break keyboard arrow-nav between
 * radios in the same name-group. */
.sport-toggle__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.sport-toggle__option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 7rem;
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--size-2);
  font-weight: var(--weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--ink);
  background: var(--paper);
  border: var(--border-thick);
  cursor: pointer;
  user-select: none;
  transition:
    background-color 80ms ease,
    color 80ms ease;
}

/* Butted layout: each option after the first drops its left border so
 * the shared internal line is a single 3px ink rule, not 6px. Works
 * for any number of options ≥ 2; today we have 2. */
.sport-toggle__options > .sport-toggle__option:not(:first-of-type) {
  border-left-width: 0;
}

/* Active state: ink fill + paper text. The colour inversion is the
 * "on" signal; no shadow (see file header). */
.sport-toggle__input:checked + .sport-toggle__option {
  color: var(--paper);
  background: var(--ink);
}

/* Hover on an unselected option: tint to paper-soft. Deliberately
 * subtle — the unselected hover must NOT preview the selected state
 * (full ink invert), otherwise hovering looks identical to selecting. */
.sport-toggle__input:not(:checked) + .sport-toggle__option:hover {
  background: var(--paper-soft);
}

/* Keyboard focus ring uses the brand accent, consistent with the rest
 * of the design system. ``position: relative`` + ``z-index: 1`` keeps
 * the outline above the adjacent (border-sharing) option's edge. */
.sport-toggle__input:focus-visible + .sport-toggle__option {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
