// prettier-ignore
$radio: (
  (1,1,0,0,0,0),
  (1,1,1,1,0,0),
  (1,1,1,1,1,0),
  (1,1,1,1,1,1),
  (1,1,1,1,1,0),
  (1,1,1,1,0,0),
  (1,1,0,0,0,0),
);
// prettier-ignore
$radio-checked-focus: (
  (2,2,0,0,0,0),
  (2,2,2,2,0,0),
  (2,2,2,2,2,0),
  (2,2,2,2,2,2),
  (2,2,2,2,2,0),
  (2,2,2,2,0,0),
  (2,2,0,0,0,0),
);
 
.nes-ui-radio {
  
  $colors: ($base-color, map-get($default-colors, 'shadow'));

  margin-right: 18px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;

  @include visually-hidden();

  & + span {
    position: relative;
    display: inline-flex;
    margin-right: 1em;
    user-select: none;
    align-items: center;
    cursor: var(--cursor-click-url), pointer;
  }

  &:checked + span::before {
    position: absolute;
    left: -20px;
    margin-top: -18px;
    content: '';

    @include pixelize(2px, $radio, $colors);
  }

  &:checked:hover,
  &:checked:focus {
    & + span::before {
      animation: blink 1s infinite steps(1);
    }
  }

  &:checked:focus + span::before {
    @include pixelize(2px, $radio-checked-focus, $colors);
  }
}


.nes-ui-dark-mode {

  $colors-radio-dark: ($color-white, map-get($default-colors, 'shadow'));

  .nes-ui-radio {
    + span {
      color: $color-white;
    }

    + span::before {
      color: $color-white;
    }
 
    &:checked + span::before {
      @include pixelize(2px, $radio-checked-focus, $colors-radio-dark);

      color: $color-white;
    }

    &:checked:focus + span::before {
      @include pixelize(2px, $radio-checked-focus, $colors-radio-dark);

      color: $color-white;
    }
  }
}

label.nes-ui-is-radio {
  margin-right: 10px;
}

.nes-ui-radio {

  &.nes-ui-is-disabled {
    $color: map-get($disabled-colors, 'normal');
    $colors-radio-disabled: ($color, map-get($disabled-colors, 'shadow'));

    + span {
      color: $color;
      cursor: not-allowed;
    }

    /* stylelint-disable-next-line no-descending-specificity */
    + span::before {
      color: $color;
      cursor: not-allowed;
    }

    &:checked:hover,
    &:checked:focus {
      & + span::before {
        animation: unset;
      }
    }

    /* stylelint-disable-next-line no-descending-specificity */
    &:checked + span::before {
      @include pixelize(2px, $radio-checked-focus, $colors-radio-disabled);

      color: $color;
    }

    &:checked:focus + span::before {
      @include pixelize(2px, $radio-checked-focus, $colors-radio-disabled);

      color: $color;
    }
  }
}