
.instagram-carousel {
  position: relative;
  margin: 20px 0;
  overflow: hidden;
  &:last-child {
    margin-bottom: 0;
  }
  &:first-child {
    margin-top: 0;
  }
  @media (max-width: $screen-xs-max) {
    margin: 20px -15px 0;
  }
}

.instagram-feed-full {
  margin: 0;
  padding: 0;
  list-style: none;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  a {
    display: block;
    position: relative;
    float: left;
    padding: 0;
    width: 16.666%;
    &:before {
      position: absolute;
      z-index: 1;
      top: 50%;
      left: 50%;
      width: 40px;
      margin: -20px 0 0 -20px;
      content: '\e90f';
      font-family: 'icon-foxic';
      font-size: 40px;
      line-height: 1em;
      color: $instagram-icon_color;
      text-align: center;
      opacity: 0;
      @include transform (scale(0.5));
      @include transition (.3s);
      -webkit-backface-visibility: hidden;
    }
    &:after {
      position: absolute;
      z-index: 0;
      content: '';
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
      background: $instagram-hover_bg;
      opacity: 0;
      @include transition (.3s);
    }
    &:hover:before {
      opacity: 1;
      @include transform (scale(1));
    }
    &:hover:after {
      opacity: .35;
    }
    span {
      display: block;
      height: 0;
      padding-bottom: 100%;
      overflow: hidden;
      position: relative;
    }
    img {
      display: block;
      position: absolute;
      width: 100%;
      height: 100%;
    }
  }
}

.instagram-carousel-arrows {
  position: absolute;
  z-index: 1;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  @include transition (opacity 0.2s);
  @media (max-width: $screen-sm-max) {
    left: 0;
    width: 100%;
    transform: translate3d(0, 0, 0);
  }
  .slick-prev,
  .slick-next {
    position: absolute;
    z-index: 1;
    display: block;
    height: 47px;
    width: 47px;
    line-height: 0px;
    font-size: 0px;
    cursor: pointer;
    background: $slick-arrow_bg;
    top: 50%;
    padding: 0;
    margin-top: -23px;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    @include transition (0.2s);
    @media (max-width: $screen-xs-max) {
      height: 44px;
      width: 44px;
    }
    &:hover {
      background: $slick-arrow-hover_bg;
    }
  }
  .slick-prev:before,
  .slick-next:before {
    display: inline-block;
    font-size: 25px;
    line-height: 49px;
    color: $slick-arrow_color-dark;
    opacity: 1;
    @media (max-width: $screen-xs-max) {
      font-size: 24px;
      line-height: 44px;
    }
  }
  .slick-prev:hover:before,
  .slick-next:hover:before {
    color: $slick-arrow_color-dark;
    opacity: 1;
  }
  .slick-prev {
    left: 0;
    right: auto;
  }
  .slick-next {
    right: 0;
    left: auto;
  }
}

@media (min-width: $screen-lg-min) {
  .instagram-carousel-arrows {
    .slick-prev {
      opacity: 0;
      left: -15px;
      right: auto;
    }
    .slick-next {
      opacity: 0;
      right: -15px;
      left: auto;
    }
  }
  .instagram-carousel:hover .instagram-carousel-arrows {
    .slick-prev {
      opacity: 1;
      left: 0;
      right: auto;
    }
    .slick-next {
      opacity: 1;
      right: 0;
      left: auto;
    }
  }
}

.instagram-grid {
  position: relative;
  overflow: hidden;
  & > *, .instagram_gallery {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
  }
  .instagram_gallery {
    width: calc(100% + 20px);
    margin-left: -10px;
    margin-right: -10px;
    @media (max-width: $screen-sm-max) {
      margin-left: -5px;
      margin-right: -5px;
    }
  }
  &:not(.instagram-grid.instagram-grid--sm) a:not(.btn) {
    margin-left: 10px;
    margin-right: 10px;
    margin-top: 20px;
    @include flexWidth(calc(16.666% - 20px));
    @media (min-width: $screen-lg-min) {
      &:nth-child(-n+6) {
        margin-top: 0;
      }
    }
    @media (max-width: $screen-md-max) {
      @include flexWidth(calc(20% - 30px));
      &:nth-child(-n+5) {
        margin-top: 0;
      }
      &:nth-child(10) ~ a {
        display: none;
      }
    }
    @media (max-width: $screen-sm-max) {
      margin-left: 5px;
      margin-right: 5px;
      margin-bottom: 10px;
      margin-top: 0;
      @include flexWidth(calc(33.333% - 10px));
      &:nth-child(6) ~ a {
        display: none;
      }
    }
  }
  a:not(.btn) {
    display: block;
    opacity: 1;
    -webkit-backface-visibility: hidden;
    -webkit-transform: translateZ(0) scale(1.0, 1.0);
    &:hover span:after {
      opacity: 0.25;
    }
    span {
      display: block;
      height: 0;
      padding-bottom: 100%;
      overflow: hidden;
      position: relative;
      &:after {
        content: '';
        position: absolute;
        z-index: 1;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        background: $instagram-grid-hover_bg;
        opacity: 0;
        @include transition(opacity .2s);
      }
    }
    img {
      display: block;
      position: absolute;
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }
}

.instagram-grid--sm {
  a:not(.btn) {
    @include flexWidth(25%);
    margin: 0;
    span {
      padding-bottom: 87.5%;
    }
  }
}

.instagram-grid-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate3d(-50%, -50%, 0);
  z-index: 1;
  pointer-events: none;
  .btn {
    pointer-events: all;
  }
}