body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #000;
}

ul {
  width: 400px;
  aspect-ratio: 4 / 3;
  max-width: calc(100vw - 2rem);
  display: flex;
  overflow: auto;
  list-style-type: none;
  padding: 0;
  margin: 0;
  -ms-scroll-snap-type: x mandatory;
      scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scroll-marker-group: after;
  scrollbar-color: #0000 #0000;
}

li::scroll-marker {
  content: " ";
  background: hsl(0 0% 50%);
  height: .6em;
  width: .6em;
  border-radius: 100px;
}
ul::scroll-marker-group {
  gap: .4em;
  aspect-ratio: 3.75 / 1;
  display: inline-flex;
  height: 2em;
  position: relative;
  align-items: center;
  left: 50%;
  translate: -50% 1rem;
  justify-content: center;
}
li::scroll-marker {
  transition-property: background;
  transition-duration: 0.2s;
  transition-timing-function: ease-out;
  outline-offset: 2px;
  outline-color: #fff;
}
/* if you want it to toggle otherwise */
/* ::scroll-marker:target-current {
  flex: 2;
  background: white;
} */

li::scroll-marker {
  -webkit-animation: grow both linear;
          animation: grow both linear;
  animation-range: cover;
  animation-timeline: --item;
}

@-webkit-keyframes grow {
  0%, 100% { flex: 1; }
  50% { flex: 4; background: #fff; }
}

@keyframes grow {
  0%, 100% { flex: 1; }
  50% { flex: 4; background: #fff; }
}
ul::scroll-button(right),
ul::scroll-button(left) {
  content: '';
  position: absolute;
  top: 50%;
  width: 36px;
  aspect-ratio: 1;
  cursor: pointer;
  translate: 0 -50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 36'%3E%3Cpath d='M23.5587,16.916 C24.1447,17.4999987 24.1467,18.446 23.5647,19.034 L16.6077,26.056 C16.3147,26.352 15.9287,26.4999987 15.5427,26.4999987 C15.1607,26.4999987 14.7787,26.355 14.4867,26.065 C13.8977,25.482 13.8947,24.533 14.4777,23.944 L20.3818,17.984 L14.4408,12.062 C13.8548,11.478 13.8528,10.5279 14.4378,9.941 C15.0218,9.354 15.9738,9.353 16.5588,9.938 L23.5588,16.916 L23.5587,16.916 Z'%3E%3C/path%3E%3C/svg%3E");
  background-color: hsl(0 0% 100% / 0.5);
  border-radius: 100px;
  border: 0;
  transition-property: background, opacity;
  transition-duration: .2s;
  transition-timing-function: ease-out;
}
ul::scroll-button(*):focus-visible {
  outline-color: #fff;
  outline-offset: 2px;
}
ul::scroll-button(*):hover {
  background-color: hsl(0 0% 100% / 0.75);
}
ul::scroll-button(*):disabled {
  opacity: 0.35;
}
ul::scroll-button(left) {
  rotate: 180deg;
  right: calc(100% + 0.5rem);
}

ul::scroll-button(right) {
  left: calc(100% + 0.5rem);
}
section {
  position: relative;
}

li {
  height: 100%;
  width: 400px;
  aspect-ratio: 4 / 3;
  max-width: 100%;
  scroll-snap-align: center;
}

li:nth-of-type(3) {
  scroll-initial-target: nearest;
}

img {
  position: absolute;
  inset: 0;
  border-radius: 0.5rem;
  pointer-events: none;
}

@media(prefers-reduced-motion: no-preference) {
  li {
    view-timeline: --item inline;
  }
  img {
    opacity: 0;
    -webkit-animation: scale both ease-in-out;
            animation: scale both ease-in-out;
    mix-blend-mode: plus-lighter;
    animation-timeline: --item;
    animation-range: cover;
  }
}

@-webkit-keyframes scale {
  50% {
    opacity: 1;
    z-index: 2;
  }
}

@keyframes scale {
  50% {
    opacity: 1;
    z-index: 2;
  }
}