.carousel {
  --c-width: 96vw;
  --c-viewport-items-per-snap: 3;
  display: flex;
  flex-direction: column;
  width: calc(var(--c-width) - 1rem);
  /* investigate proper usage of this property */
  overflow-anchor: none;
  margin-inline: auto auto;
}

.carousel--controls {
  order: 2;
  margin-inline: auto auto;
}

.carousel--viewport {
  --c-viewport-width: calc(var(--c-width) - 2rem);
  display: flex;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  /* ↓ important to get right; see custom props in .carousel */
  width: var(--c-viewport-width);
  gap: 1rem;
  margin-inline: auto auto;

  scrollbar-width: none; /* firefox: hide scrollbar but enable scrolling */
}

.carousel--viewport::-webkit-scrollbar {
  /* webkit: hide scrollbar but enable scrolling */
  width: 0;
  height: 0;
}

.carousel--snap-x {
  display: flex;
  scroll-snap-align: center;
  gap: 1rem;
  min-width: 100%;
}

.carousel--snap-x > * {
  --c-viewport-snap-item-width: 
  calc(
    (var(--c-viewport-width) / var(--c-viewport-items-per-snap)) * 1
  );

  width: calc(var(--c-viewport-snap-item-width));
  flex-shrink: 1;
  /* aspect-ratio: 1; */
}

/* ↓ on mobile, skip button navigation and allow user to scroll */
/* TODO: breaks on newer browsers, need reliable check */
@media not (hover: hover) {
  .carousel--controls {
    display: none;
  }
}
