// Radio buttons & checkboxes

// By default, multiple choice inputs stack vertically
.gv-c-multiple-choice {

  display: block;
  float: none;
  clear: left;
  position: relative;

  padding: (8px $gutter-one-third 9px 50px);
  margin-bottom: $gutter-one-third;

  cursor: pointer; // Encourage clicking on the label

   // remove 300ms pause on mobile
  -ms-touch-action: manipulation;
  touch-action: manipulation;

  @include media(tablet) {
    float: left;
    padding-top: 7px;
    padding-bottom: 7px;
    // width: 25%; - Test : check that text within labels will wrap
  }

  // Absolutely position inputs within label, to allow text to wrap
  &__control {
    position: absolute;
    cursor: pointer;
    left: 0;
    top: 0;
    width: 38px;
    height: 38px;

    // IE8 doesn’t support pseudoelements, so we don’t want to hide native elements there.
    @if ($is-ie == false) or ($ie-version == 9) {
      margin: 0;
      @include opacity(0);
    }
  }

  &__label {
    cursor: pointer;
  }

  [type=radio] + &__label::before {
    content: "";
    border: 2px solid;
    background: transparent;
    width: 34px;
    height: 34px;
    position: absolute;
    top: 0;
    left: 0;
    @include border-radius(50%);
  }

  [type=radio] + &__label::after {
    content: "";
    border: 10px solid;
    width: 0;
    height: 0;
    position: absolute;
    top: 9px;
    left: 9px;
    @include border-radius(50%);
    @include opacity(0);
  }

  // Focused state
  &__control:focus + &__label::before {
    @include box-shadow(0 0 0 5px $focus-colour);
  }

  // Selected state
  &__control:checked + &__label::after {
    @include opacity(1);
  }

  // Disabled state
  &__control:disabled + &__label {
    @include opacity(0.5);
  }

  &:last-child,
  &:last-of-type {
    margin-bottom: 0;
  }
}

// To sit multiple choice inputs next to each other, use .inline on parent
.inline .gv-c-multiple-choice {
  clear: none;

  @include media (tablet) {
    margin-bottom: 0;
    margin-right: $gutter;
  }
}
