/**
 * @file
 * Styles for the Media Scroller field formatter.
 */

.media_scroller-wrapper {
  max-width: 860px;
  margin: 0 auto;
}

.media_scroller-slider {
  width: 100%;
  margin-bottom: 20px;
}

/*
 * Slick renders .slick-prev before .slick-list (which holds the slides) and
 * .slick-next after it, in that DOM order; neither Slick's own CSS nor
 * Drupal's slick.theme.css assigns .slick-prev/.slick-next a z-index (the
 * latter only does so for the differently-named .slick__arrow BEM class
 * used by Drupal's own Slick formatter, not by a direct $.fn.slick() call
 * like this module's). Without one, normal DOM-order stacking puts the
 * slide image on top of .slick-prev but leaves .slick-next, which comes
 * after the image in the DOM, unaffected -- so only the left arrow was
 * ever actually hidden underneath the slide.
 */
.media_scroller-slider .slick-arrow,
.media_scroller-nav .slick-arrow {
  z-index: 1;
}

/*
 * No forced aspect-ratio or object-fit here: the slide's actual proportions
 * come entirely from whichever image style the editor picked for this
 * field, so portrait and landscape images each render at their own native
 * ratio instead of being cropped to a fixed shape. Slick's adaptiveHeight
 * option (set in media-scroller.js) resizes the slider container to match
 * each slide as it becomes active.
 */
.media_scroller-slider img {
  display: block;
  width: 100%;
  height: auto;
}

/*
 * Only present when the PhotoSwipe module is installed and enabled (see
 * MediaScrollerFieldFormatter::viewElements()); the anchor wraps each main
 * slide's image and opens it in the PhotoSwipe lightbox on click.
 */
.media_scroller-slider a.photoswipe {
  display: block;
  cursor: zoom-in;
}

.media_scroller-nav {
  max-width: 850px;
  margin: 0 auto;
}

.media_scroller-nav .slick-list {
  margin: 0;
}

.media_scroller-nav .slick-slide {
  transition: opacity 0.3s ease-in-out;
  opacity: 0.6;
}

.media_scroller-nav .slick-slide.is-active {
  opacity: 1;
}

.media_scroller-nav .media_scroller-image {
  height: var(--media-scroller-thumbnail-size, 60px);
  padding: 0 3px;
  cursor: pointer;
}

.media_scroller-nav img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 48rem) {
  .media_scroller-wrapper {
    max-width: 600px;
  }
}

@media (max-width: 40rem) {
  .media_scroller-wrapper {
    max-width: 100%;
  }

  .media_scroller-nav {
    max-width: 100%;
  }
}
