/**
 * hx-radio.css — Radio + RadioGroup SSOT
 * Token-driven only. No !important. No fallbacks.
 * 4-variant via data-theme + data-hx-vp (tokens flip automatically).
 * RadioGroup is the molecule (fieldset); Radio is the atom.
 */
.hx-radiogroup {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
  text-align: left;
  color: var(--hx-fg);
}

.hx-radiogroup__legend {
  padding: 0;
  margin: 0 0 var(--hx-space-2);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.hx-radiogroup__list {
  display: flex;
  flex-direction: column;
  gap: var(--hx-space-2);
}

.hx-radiogroup--row .hx-radiogroup__list {
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--hx-space-4) var(--hx-space-6);
}

.hx-radio {
  display: flex;
  align-items: flex-start;
  gap: var(--hx-space-2);
  margin: 0;
  cursor: pointer;
  color: inherit;
}

.hx-radio__input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  clip: rect(0 0 0 0);
}

.hx-radio__control {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 2px solid var(--hx-fg);
  border-radius: var(--hx-radius-full);
  box-sizing: border-box;
  background: transparent;
  position: relative;
}

.hx-radio--sm .hx-radio__control {
  width: 16px;
  height: 16px;
}

.hx-radio__input:checked + .hx-radio__control::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: var(--hx-radius-full);
  background: var(--hx-fg);
}

.hx-radio--sm .hx-radio__input:checked + .hx-radio__control::after {
  inset: 2px;
}

.hx-radio__input:focus-visible + .hx-radio__control {
  outline: 2px solid var(--hx-focus);
  outline-offset: 2px;
}

.hx-radio__copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hx-radio__label {
  font-size: 14px;
  line-height: 1.4;
}

.hx-radio__helper {
  font-size: 12px;
  color: var(--hx-fg-muted);
}

.hx-radio .hx-badge {
  margin-left: var(--hx-space-2);
  vertical-align: middle;
}

.hx-radio.is-disabled,
.hx-radio:has(.hx-radio__input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}

.hx-radiogroup__helper,
.hx-radiogroup__error {
  margin: var(--hx-space-2) 0 0;
  font-size: 12px;
  line-height: 1.4;
}

.hx-radiogroup--error .hx-radio__control {
  border-color: var(--hx-danger);
}

.hx-radiogroup__error {
  color: var(--hx-danger);
}

.hx-radio__help {
  font-size: var(--text-caption-size);
}

.hx-example__canvas .hx-radiogroup {
  pointer-events: auto;
}

/* 4-variant readiness */
html[data-theme="light"][data-hx-vp="desktop"],
html[data-theme="light"][data-hx-vp="mobile"],
html[data-theme="dark"][data-hx-vp="desktop"],
html[data-theme="dark"][data-hx-vp="mobile"] {
  /* tokens flip automatically */
}
