/**
 * Component: Radio
 */
@include comp('radio') {
  position: relative;
  display: inline-flex;
  flex: none;
  vertical-align: middle;
  white-space: nowrap;
  flex-flow: row nowrap;
  justify-content: flex-start;
  align-content: center;
  align-items: center;

  height: rem($form-component-height);

  cursor: pointer;
  user-select: none;

  font-size: rem($form-font-size);

  @include elem('implicit') {
    display: none;
  }

  @include elem('symbol') {
    display: block;
    width: rem($form-symbol-size);
    height: rem($form-symbol-size);
    border-radius: 50%;
    border: rem(1) solid transparent;
    margin-right: rem($form-font-size / 2);
  }

  @each $theme in $type-theme {
    @include prop(
      (
        'theme': $theme,
      )
    ) {
      color: theme($theme);
      @include elem('symbol') {
        border-color: theme($theme, 'fg', 'sub');
        background-color: theme($theme, 'bg');
      }
    }
  }

  @include when('checked') {
    @include elem('symbol') {
      @keyframes vd-radio-checked {
        0% {
          //
        }
        50% {
          border-width: rem($form-symbol-size / 2);
        }
        100% {
          border-width: rem($form-symbol-size / 3);
          border-color: tone();
          background-color: $color-white;
        }
      }

      animation: vd-radio-checked $form-symbol-transition-duration ease-in-out forwards;
    }
  }
}

/**
 * Component: RadioGroup
 */
@include comp('radio-group') {
  position: relative;
  display: flex;
  flex: 1;
  flex-flow: row wrap;
  justify-content: flex-start;
  align-content: flex-start;
  align-items: flex-start;

  margin: 0 rem(-$gap-base / 2);
  .#{class-comp('radio')} {
    flex: none;
    padding: 0 rem($gap-base / 2);
  }

  @each $direction in $type-direction {
    @include prop(
      (
        'direction': $direction,
      )
    ) {
      flex-direction: $direction;
    }
  }
}
