/**
 * Copyright 2015 The AMP HTML Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software'
 * distributed under the License is distributed on an "AS-IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

amp-carousel {
}

/**
 * `amp-carousel-slide` class is added to every item in the carousel to
 * allow page authors to target items for user-defined styling.
 * Every `<amp-carousel>'s` immediate child is considered a slide in
 * the carousel.
 */
.amp-carousel-slide > .i-amphtml-replaced-content {
  /*
   * Apply contain object-fit to all replaced content to avoid distorted ratios.
   */
  object-fit: contain;
}

.amp-carousel-button {
  position: absolute;
  box-sizing: border-box;
  top: 50%;
  height: 34px;
  width: 34px;
  border-radius: 2px;
  opacity: 0;
  pointer-events: all;
  background-color: rgba(0, 0, 0, .5);
  background-position: 50% 50%;
  background-repeat: no-repeat;
  transform: translateY(-50%);
  visibility: hidden;
  z-index: 10;
}

.amp-carousel-button:focus {
  border: 1px black solid;
  outline: 1px white solid;
}

amp-carousel[controls] .amp-carousel-button,
amp-carousel.i-amphtml-carousel-has-controls .amp-carousel-button,
.amp-mode-mouse .amp-carousel-button {
  opacity: 1;
  visibility: visible;
}

.amp-carousel-button-prev {
  left: 16px;
  background-image: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="#fff" viewBox="0 0 18 18"><path d="M15 8.25H5.87l4.19-4.19L9 3 3 9l6 6 1.06-1.06-4.19-4.19H15v-1.5z"/></svg>');
  background-size: 18px 18px;
}

.amp-carousel-button-next {
  right: 16px;
  background-image: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="#fff" viewBox="0 0 18 18"><path d="M9 3L7.94 4.06l4.19 4.19H3v1.5h9.13l-4.19 4.19L9 15l6-6z"/></svg>');
  background-size: 18px 18px;
}

.i-amphtml-carousel-button-start-hint .amp-carousel-button:not(.amp-disabled) {
  animation: i-amphtml-carousel-hint 1s ease-in 3s 1 normal both;
}

.amp-mode-mouse .i-amphtml-carousel-button-start-hint .amp-carousel-button:not(.amp-disabled) {
  animation: none;
}

@keyframes i-amphtml-carousel-hint {
  0% {
    opacity: 1;
    visibility: visible;
  }
  100% {
    opacity: 0;
    visibility: hidden;
  }
}

amp-carousel .amp-carousel-button.amp-disabled {
  animation: none;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

amp-carousel[i-amphtml-carousel-hide-buttons] .amp-carousel-button-prev,
amp-carousel[i-amphtml-carousel-hide-buttons] .amp-carousel-button-next {
  opacity: 0;
  /**
   * Note, screen readers can still activate the buttons when hide buttons is
   * specified, even though we have `pointer-events: none`.
   */
  pointer-events: none;
  visibility: visible !important;
}

/* Begin SlideScroll */
.i-amphtml-slidescroll {
}

.i-amphtml-slides-container {
  display: flex !important;
  flex-wrap: nowrap;
  height: 100% !important;
  left: 0;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  position: absolute !important;
  top: 0;
  width: 100% !important;
  scroll-snap-type: x mandatory !important;
  /*
   * Hide scrollbars, with three different methods:
   *
   * 1. scrollbar-width
   *  - Note: this is actually scrollbar *thickness* and applies to horizontal
   *    scrollbars as well
   * 2. ::-webkit-scrollbar
   * 3. Using padding to push scrollbar outside of the overflow
   *
   * The last method has side-effect of having the bottom of the slides being
   * cut-off, since the height (or width) of the scrollbar is included when
   * calculating the 100% height (or width) of the slide.
   */
  scrollbar-width: none; /* Firefox */
  padding-bottom: 20px !important;
  box-sizing: content-box !important;
  -webkit-overflow-scrolling: touch !important;
}

/* Chrome, Safari */
.i-amphtml-slides-container::-webkit-scrollbar {
  display: none !important;
}

/** Only hide scroll bar for touch devices as it causes jitters on desktops */
.i-amphtml-slides-container.i-amphtml-no-scroll {
  overflow-x: hidden !important;
}

.i-amphtml-slide-item {
  align-items: center !important;
  display: none !important;
  flex: 0 0 100% !important;
  height: 100% !important;
  justify-content: center !important;
  position: relative !important;
  scroll-snap-align: start !important;
  width: 100% !important;
}

.i-amphtml-slide-item > * {
  height: 100%;
  width: 100%;
  overflow: hidden !important;
}

.i-amphtml-slide-item-show {
  display: flex !important;
}

.i-amphtml-carousel-start-marker,
.i-amphtml-carousel-end-marker {
  background-color: transparent !important;
  display: block !important;
  flex: 0 0 1px !important;
  height: 100% !important;
  position: relative !important;
  scroll-snap-align: start !important;
  width: 1px !important;
}

.i-amphtml-carousel-start-marker {
  order: -1 !important;
  margin-left: -1px !important;
}

.i-amphtml-carousel-end-marker {
  order: 100000000 !important;
  margin-right: -1px !important;
}

.i-amphtml-slidescroll-no-snap.i-amphtml-slides-container {
  scroll-snap-type: none !important;
}

.i-amphtml-slidescroll-no-snap .i-amphtml-slide-item {
  scroll-snap-align: none !important;
}

.i-amphtml-slidescroll-no-snap.i-amphtml-slides-container.i-amphtml-no-scroll {
  -webkit-overflow-scrolling: auto !important;
}

/* End SlideScroll */

/* Begin ScrollableCarousel */
.amp-scrollable-carousel-slide {
  display: inline-block !important;
  margin-left: 8px;
}

.amp-scrollable-carousel-slide:first-child {
  margin-left: 0px;
}

.i-amphtml-scrollable-carousel-container {
  white-space: nowrap !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch !important;
}
/* End ScrollableCarousel */
