section {
  background: #202020;
  padding: 50px 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.container {
  margin: 0 auto;
  padding: 0 20px;
}

.carousel {
  display: block;
  text-align: left;
  position: relative;
  margin-bottom: 22px;
}

.carousel__arrow {
  background: #202020;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  padding: 10px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  transition: background 0.3s ease-in-out;
  outline: none;
}

.carousel__arrow--left {
  left: -70px;
}

.carousel__arrow--right {
  right: -70px;
}

.carousel__arrow:hover {
  background: rgba(32, 32, 32, 0.8);
}

.carousel__thumbnails-wrapper {
  width: 100%;
}

.carousel__thumbnails {
  list-style: none;
  padding: 0;
  margin: 0 -10px;
  display: flex;
  transition: transform 1s ease-in-out;
}

.carousel__thumbnails li {
  flex: 1 1 auto;
  max-width: calc((100% / 4) - 20px);
  margin: 0 10px;
  transition: all 0.3s ease-in-out;
  position: relative;
  z-index: 1;
}

.carousel__thumbnails li:hover {
  transform: scale(1.2);
  z-index: 2;
}

.carousel__thumbnails li:hover~li {
  transform: translateX(10%);
}

.carousel__thumbnails li:has(~ li:hover) {
  transform: translateX(-10%);
}

.carousel__thumbnails label {
  display: block;
  position: relative;
  cursor: pointer;
}

/* Always-visible gradient overlay */
.carousel__thumbnails label::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));
  border-radius: 15px;
  z-index: 2;
}

/* aspect-ratio 1:1 */
.carousel__thumbnails label::before {
  display: block;
  content: "";
  width: 100%;
  padding-top: 100%;
}

.carousel__thumbnails label>img {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: all 0.3s ease-in-out;
}

/* Always-visible title text */
.hover-text {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 1rem;
  opacity: 1;
  z-index: 3;
  white-space: nowrap;
  transition: none;
  pointer-events: none;
}

#prevBtn,
#nextBtn {
  color: rgba(255, 255, 255, 0.6);
}

/* ── MOBILE ───────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .carousel {
    background: #242424 !important;
    overflow: hidden;
    padding-bottom: 60px;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #888 transparent;
  }

  .carousel::-webkit-scrollbar {
    width: 6px;
  }

  .carousel::-webkit-scrollbar-track {
    background: transparent;
  }

  .carousel::-webkit-scrollbar-thumb {
    background-color: #888;
    border-radius: 10px;
  }

  .carousel::-webkit-scrollbar-thumb:hover {
    background-color: #aaa;
  }

  .carousel__thumbnails {
    display: block;
    margin: 0;
  }

  .carousel__thumbnails li {
    max-width: 80%;
    margin: 10px auto;
    text-align: center;
    transition: none;
  }

  .carousel__thumbnails li:hover,
  .carousel__thumbnails li:hover~li,
  .carousel__thumbnails li:has(~ li:hover) {
    transform: none;
    z-index: 1;
  }

  .carousel__thumbnails label>img {
    transition: none;
  }

  /* Keep text inside image overlay on mobile */
  .hover-text {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    white-space: normal;
    text-align: center;
    opacity: 1;
    font-size: 1.1rem;
    z-index: 4;
    transition: none;
  }

  .carousel__thumbnails li.tapped {
    transform: scale(1.03);
  }

  .carousel__thumbnails li.tapped label>img {
    opacity: 0.7;
  }

  .carousel__arrow {
    display: none;
  }
}