@import '../tools/mixins/position';
@import '../tools/mixins/transition';
@import '../settings/variables';

.c-toggle {
  $this: &;

  &__label {
    @include transition(color);
    font-size: 0.75em;
    color: $color-paragraph-light;
    cursor: pointer;
    vertical-align: middle;

    &--active {
      font-weight: bold;
      color: $color-paragraph;
      letter-spacing: -0.009375rem;
      cursor: default;
    }
  }

  &__wrapper {
    font-size: 1.125em;
    cursor: pointer;
    display: inline-flex;
    position: relative;
    width: 1.8em;
    vertical-align: middle;
    margin-left: $margin-small;
    margin-right: $margin-small;
  }

  &__area {
    @include absolute(0, 0, 0, 0);
    border: $hairline solid $color-primary-dark;
    border-radius: 1em;
    opacity: 0.4;
  }

  &__button {
    @include transition(margin);
    color: $color-background;
    background-color: $color-primary-dark;
    border-radius: 50%;
    font-size: 0.3125em;
    width: 1.125rem;
    height: 1.125rem;
    display: flex;
    justify-content: center;
    align-items: center;

    &--active {
      margin-left: 2.5em;
    }
  }

  &--on-off {
    #{$this}__wrapper {
      margin-left: 0;
    }

    #{$this}__area {
      border: $hairline solid $color-paragraph-light;
    }

    #{$this}__label {
      font-weight: $font-weight-normal;
      color: $color-paragraph;
      font-size: inherit;

      &--active {
        font-weight: $font-weight-normal;
        letter-spacing: inherit;
      }
    }

    #{$this}__button {
      background-color: $color-paragraph-light;
      &--active {
        background-color: $color-primary;
      }
    }

  }

  &--disabled {
    .c-toggle__area {
      border-color: $color-paragraph-light;
    }

    .c-toggle__button {
      background-color: $color-paragraph-light;
      line-height: 1em;
    }

    .c-toggle__label {
      color: $color-paragraph-light;
    }
  }
}
