/**
 * Component: Carousel
 */
@include comp('carousel') {
  $carousel-indicator-height: 8;

  position: relative;
  flex: 1 1 100%;
  max-width: 100%;
  min-width: 0;

  @include elem('container') {
    position: relative;
    overflow: hidden;
  }

  @include elem('wrapper') {
    position: relative;

    display: flex;
    flex-flow: row nowrap;
    justify-content: flex-start;
    align-content: stretch;
    align-items: stretch;

    width: 100%;

    transition: transform ease-in-out 320ms;
  }

  @include elem('item') {
    position: relative;
    flex: 1 0 100%;
    max-width: 100%;
    min-width: 0;

    display: flex;
    flex-flow: row nowrap;
    justify-content: center;
    align-content: center;
    align-items: center;

    padding: 0;
    margin: 0;

    overflow: hidden;

    color: inherit;
  }

  @include elem('button-previous', 'button-next') {
    position: absolute;
    top: 0;
    bottom: 0;
    width: rem($carousel-switch-button-size);
    height: rem($carousel-switch-button-size) * 1.618;
    margin: auto 0;
    padding: 0;
    border: none;

    display: flex;
    flex-flow: row nowrap;
    justify-content: center;
    align-content: center;
    align-items: center;

    border-radius: rem($radius-base);
    font-size: rem($carousel-switch-button-size) * 0.618;
    color: $color-white;
    background: $color-black;

    opacity: 0.5;

    transition: opacity ease-in-out $button-transition-duration;
  }
  &:hover {
    @include elem('button-previous', 'button-next') {
      opacity: 0.75;
    }
  }

  @include elem('button-previous') {
    left: rem($carousel-switch-button-size + $gap-base) * -1;
    @include when('inside') {
      left: 0;
    }
  }
  @include elem('button-next') {
    right: rem($carousel-switch-button-size + $gap-base) * -1;
    @include when('inside') {
      right: 0;
    }
  }

  @include elem('indicator-wrapper') {
    position: relative;
    @include when('inside') {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
    }

    width: 100%;
    height: initial;

    padding: rem($gap-base / 2);

    display: flex;
    flex-flow: row nowrap;
    justify-content: center;
    align-content: center;
    align-items: center;
  }

  @include elem('indicator') {
    display: flex;
    padding: rem($gap-base / 2);
    margin: 0;
    border: none;
    background-color: transparent;
  }

  @include elem('indicator-inner') {
    display: flex;
    width: rem($carousel-indicator-height * 1.618 * 2);
    height: rem($carousel-indicator-height);
    border-radius: rem($radius-base);

    opacity: 0.75;

    background-color: $color-white;
  }

  @include elem('indicator') {
    @include when('selected') {
      @include elem('indicator-inner') {
        background-color: tone();
      }
    }
  }
}
