@import "settings.colors";

@import "mixins/settings.fonts";
@import "mixins/tools.functions";
@import "mixins/components.carousel";

.c-carousel {
  @include c-carousel-height;
  @include c-carousel-gutter;
  @include c-carousel-slides;
}
.c-carousel__header {
  margin-bottom: rem(10);
}
.c-carousel__heading,
.c-carousel__count {
  font-size: rem(14);
  line-height: line-height(14, 15);
  letter-spacing: rem(1);
  color: $color-grey-900;
  margin: 0;
}
.c-carousel__heading {
  @include font-gm-sans-bold;
  text-transform: uppercase;
}
.c-carousel__count {
  @include font-gm-sans;
  display: none;
}
.c-carousel__body {
  display: flex;
  position: relative;
}
.c-carousel__content {
  width: 100%;
  margin: 0 auto;
}
.c-carousel__arrow {
  height: 100%;
  align-items: center;
  position: absolute;
  display: none;

  .c-button {
    width: 100%;
    height: 100%;
    padding: 0;
    opacity: 0.85;
    border-color: $color-stone-200;
    background-color: rgba($color-white, 0.7);
    z-index: 1; // For iOS Safari

    &:hover,
    &:focus {
      background-color: rgba($color-white, 0.8);
    }
    &:active {
      background-color: rgba($color-white, 0.9);
    }
    &:focus,
    &:hover:focus {
      outline-offset: -2px;
    }
    .c-button__icon {
      min-width: rem(12);
      width: rem(12);
      height: rem(20);
    }
  }
}
.c-carousel__arrow-inner {
  width: rem(30);
  height: rem(40);
  padding: rem(10) 0;
  background-color: $color-grey-600;
  position: absolute;
}
.c-carousel__arrow--rewind {
  .c-button .c-button__icon {
    min-width: rem(23);
    width: rem(23);
  }
}
.c-carousel__arrow--left {
  left: 0;
  .c-carousel__arrow-inner {
    border-top-right-radius: rem(2);
    border-bottom-right-radius: rem(2);
    left: 0;
  }
}
.c-carousel__arrow--right,
.c-carousel__arrow--rewind {
  right: 0;
  .c-carousel__arrow-inner {
    border-top-left-radius: rem(2);
    border-bottom-left-radius: rem(2);
    right: 0;
  }
}
.c-carousel__slides {
  list-style-type: none;
  margin: 0;
  padding: 0;
  // Has to be "scroll" for momentum, not "auto"
  overflow-x: scroll;
  overflow-y: hidden;
  // Momentum touch scrolling (non-standard feature)
  -webkit-overflow-scrolling: touch; // sass-lint:disable-line no-vendor-prefixes
  scroll-behavior: smooth;
  // Prevent carousels from panning horizontally when user scrolls page vertically
  touch-action: pan-x;
  flex: 1;
  display: flex;
}
.c-carousel__slide {
  flex: 0 0 auto;
}
// Nested selectors to increase specificity to override mixin
.c-carousel .c-carousel__slide {
  &:first-child {
    padding-left: 0;
  }
  &:last-child {
    padding-right: 0;
  }
}
.c-carousel__slide--placeholder {
  display: none;
}
