.radio-group {
  --radio-dot-size: 0.5rem;

  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
}

.radio-group__circle {
  border-radius: var(--radius-pill);
}

.radio-group__dot {
  inline-size: var(--radio-dot-size);
  block-size: var(--radio-dot-size);
  border-radius: var(--radius-pill);
  background-color: var(--color-accent-contrast);
  scale: 0;
  transition: scale var(--duration-enter) var(--easing-enter);
}

.radio-group__option:has(:checked) .radio-group__dot {
  scale: none;
}

.radio-group--segmented {
  --radio-group-inset: var(--space-3xs);

  position: relative;
  flex-direction: row;
  padding: var(--radio-group-inset);
  background-color: var(--color-surface-sunken);
}

.radio-group--segmented .radio-group__option,
.radio-group__pill {
  border-radius: calc(var(--control-corner) - var(--radio-group-inset));
}

.radio-group--segmented .radio-group__option {
  flex: 1;
  justify-content: center;
  min-block-size: 0;
  padding-inline: var(--space-sm);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-muted);
  white-space: nowrap;
}

@media (hover: hover) {
  .radio-group--segmented .radio-group__option:hover {
    color: var(--color-text);
  }
}

.radio-group--segmented .radio-group__option:has(:focus-visible) {
  outline-offset: calc(-1 * var(--focus-ring-offset));
}

.radio-group--segmented .radio-group__option:has(:checked) {
  color: var(--color-text);
}

.radio-group--segmented:not([data-pill]) .radio-group__option:has(:checked) {
  border: var(--border-width) solid var(--color-border);
  background-color: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.radio-group__pill {
  position: absolute;
  inset-block: var(--space-3xs);
  inset-inline-start: 0;
  inline-size: 0;
  border: var(--border-width) solid var(--color-border);
  background-color: var(--color-surface);
  box-shadow: var(--shadow-sm);
  translate: 0;
  pointer-events: none;
  will-change: translate, inline-size;
  transition:
    translate var(--duration-enter) var(--easing-enter),
    inline-size var(--duration-enter) var(--easing-enter);
}

.radio-group[data-placing] .radio-group__pill {
  transition: none;
}

@media (forced-colors: active) {
  .radio-group__dot {
    background-color: currentcolor;
  }

  .radio-group__pill {
    outline: var(--focus-ring-width) solid currentcolor;
  }

  .radio-group--segmented:not([data-pill]) .radio-group__option:has(:checked) {
    outline: var(--focus-ring-width) solid currentcolor;
    outline-offset: calc(-1 * var(--focus-ring-width));
  }
}
