@import '../utilities/_variables.scss';

.carousel {
  position: relative;
  overflow: hidden;
}

.carousel__nav {
  position: absolute;
  top: 0;
  bottom: 48px;
  z-index: 1;
  width: 30px;
  padding: 0;
  margin: 0;
  text-align: center;
  background: rgba(0, 0, 0, 0.5);
  outline: 0;
  transition: opacity 0.25s ease, background-color 0.25s ease;

  @media (max-width: $breakpoint-small - 1) {
    display: none;
  }

  @media (min-width: $breakpoint-small) {
    width: 40px;
  }

  @media (min-width: $breakpoint-large) {
    bottom: 60px;
    width: 50px;
  }

  &:hover,
  &:focus {
    background: rgba(0, 0, 0, 0.75);
  }

  &[disabled] {
    cursor: default;
    opacity: 0;
  }
}

.carousel__nav--left {
  left: 0;
}

.carousel__nav--right {
  right: 0;
}

.carousel__items {
  width: 100%;
  overflow: hidden;
  overflow-x: scroll;
  line-height: 0;
  white-space: nowrap;
  transform: translateZ(0);
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: none;
  scroll-snap-type: x mandatory;
  scroll-padding: 15px;

  @media (min-width: $breakpoint-small) {
    scroll-padding: 40px;
  }

  @media (min-width: $breakpoint-large) {
    scroll-padding: 50px;
  }

  &::-webkit-scrollbar {
    display: none;
  }
}

.carousel__items .card {
  display: inline-block;
  width: calc(.33333 * (100% - 22px));
  padding-right: 8px;
  margin: 0;
  white-space: normal;
  vertical-align: top;
  scroll-snap-align: start;

  @media (min-width: $breakpoint-xsmall) {
    width: calc(.25 * (100% - 72px));
  }

  @media (min-width: $breakpoint-medium) {
    width: calc(.2 * (100% - 72px));
  }

  @media (min-width: $breakpoint-large) {
    width: calc(.2 * (100% - 92px));
  }

  @media (min-width: 1500px) {
    width: calc(.16667 * (100% - 92px));
  }

  @media (min-width: 1800px) {
    width: calc(.14286 * (100% - 92px));
  }

  @media (min-width: 2500px) {
    width: calc(.125 * (100% - 92px));
  }

  &:first-child {
    margin-left: 15px;

    @media (min-width: $breakpoint-small) {
      margin-left: 40px;
    }

    @media (min-width: $breakpoint-large) {
      margin-left: 50px;
    }
  }

  &:last-child {
    margin-right: 7px;

    @media (min-width: $breakpoint-small) {
      margin-right: 32px;
    }

    @media (min-width: $breakpoint-large) {
      margin-right: 42px;
    }
  }
}

.carousel__items .credits-item {
  display: inline-block;
  width: calc(.33333 * (100% - 22px));
  padding-right: 8px;
  margin: 0;
  white-space: normal;
  vertical-align: top;
  scroll-snap-align: start;

  @media (min-width: $breakpoint-small) {
    width: calc(.25 * (100% - 72px));
  }

  @media (min-width: 930px) {
    width: calc(.2 * (100% - 72px));
  }

  @media (min-width: 1130px) {
    width: calc(.16667 * (100% - 72px));
  }

  @media (min-width: $breakpoint-large) {
    width: calc(.16667 * (100% - 92px));
  }

  @media (min-width: 1450px) {
    width: calc(.14286 * (100% - 92px));
  }

  &:first-child {
    margin-left: 15px;

    @media (min-width: $breakpoint-small) {
      margin-left: 40px;
    }

    @media (min-width: $breakpoint-large) {
      margin-left: 50px;
    }
  }

  &:last-child {
    margin-right: 7px;

    @media (min-width: $breakpoint-small) {
      margin-right: 32px;
    }

    @media (min-width: $breakpoint-large) {
      margin-right: 42px;
    }
  }
}

.credits-item__link:hover,
.credits-item__link:focus {
  .credits-item__img {
    transform: scale(1.02);
  }
}

.credits-item__name {
  margin-top: 1rem;
  font-size: 1.3rem;
  letter-spacing: $letter-spacing;

  @media (min-width: $breakpoint-large) {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
  }
}

.credits-item__character {
  font-size: 1.2rem;
  color: $text-color-grey;
  letter-spacing: $letter-spacing;

  @media (min-width: $breakpoint-large) {
    font-size: 1.4rem;
  }
}

.card__img{
    img,
    span {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

    span {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}
