/*
 Theme Name:   New Mornings Coffee
 Theme URI:    https://newmorningscoffee.com
 Description:  Divi Child Theme for New Mornings Coffee
 Author:       New Mornings Coffee
 Author URI:   https://newmorningscoffee.com
 Template:     Divi
 Version:      1.0.3
 License:      All Rights Reserved
 Text Domain:  newmorningscoffee-child
*/

.image-carousel {
  position: relative;
  overflow: hidden;
  width: 100%;

  /* Pre-JS fallback layout */
  display: flex;
  gap: 40px;
}

/* Divi image modules (pre-JS) */
.image-carousel > .et_pb_module.et_pb_image {
  flex: 0 0 auto;
  width: min(350px, 50vw);
  margin: 0 !important;
}

/* Track created by JS */
.image-carousel .image-carousel__track {
  display: flex;
  align-items: center;
  gap: 40px;
  width: max-content;

  /* CSS-driven motion */
  animation: image-carousel-scroll 60s linear infinite; /* Adjust duration as needed for number of images used */
  will-change: transform;
}

/* Items once JS runs */
.image-carousel .image-carousel__item {
  flex: 0 0 auto;
  width: min(350px, 50vw);
  margin: 0 !important;
}

/* Images */
.image-carousel img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;

  aspect-ratio: 8 / 10;
  object-fit: cover;

  /* Keeps layout stable while loading */
  background-color: #99c0b0;
}

/* Animation */
@keyframes image-carousel-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .image-carousel .image-carousel__track {
    animation: none;
  }
}

/* Mobile tuning */
@media (max-width: 767px) {
  .image-carousel {
    gap: 24px;
  }

  .image-carousel > .et_pb_module.et_pb_image,
  .image-carousel .image-carousel__item {
    width: 70vw;
  }

  .image-carousel .image-carousel__track {
    gap: 24px;
  }
}
