.case-detail-gallery-frame {
  width: min(100%, 24rem);
  margin-inline: auto;
}

.case-detail-gallery-main-link {
  display: block;
  width: 100%;
  height: 100%;
}

.case-thumbnail-scroller {
  padding-inline: calc(50% - 2rem);
  scroll-padding-inline: calc(50% - 2rem);
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.case-thumbnail-scroller::-webkit-scrollbar {
  display: none;
}

.case-thumbnail-scroller > .case-gallery-thumbnail {
  flex: 0 0 4rem;
  width: 4rem;
  height: 4rem;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 0.625rem;
  background: #f1f5f9;
  opacity: 0.6;
  scroll-snap-align: center;
  touch-action: manipulation;
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.case-gallery-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.case-gallery-thumbnail--active {
  border-color: #a13c9e !important;
  box-shadow: 0 0 0 2px #a13c9e, 0 0 0 4px #fff, 0 1px 5px rgb(15 23 42 / 20%);
  opacity: 1;
  transform: scale(0.95);
}

.case-gallery-thumbnail:hover {
  opacity: 1;
}

.case-gallery-thumbnail:focus-visible,
[data-gallery-step]:focus-visible {
  outline: 2px solid #a13c9e;
  outline-offset: 2px;
}

@media (min-width: 640px) {
  .case-thumbnail-scroller {
    padding-inline: calc(50% - 2.5rem);
    scroll-padding-inline: calc(50% - 2.5rem);
  }

  .case-thumbnail-scroller > .case-gallery-thumbnail {
    flex-basis: 5rem;
    width: 5rem;
    height: 5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .case-thumbnail-scroller,
  .case-thumbnail-scroller > .case-gallery-thumbnail {
    scroll-behavior: auto !important;
  }
}
