.carousel-title {
  text-align: center;
  margin-top: 20px; 
}

#carousel {
  position: relative;
  height: 40vw;
  overflow: hidden;
  margin-top: 5vh;
  margin-bottom: 6vh;
}

#carousel div {
  position: absolute;
  transition: transform 1s, left 1s, opacity 1s, z-index 0s;
  opacity: 1;
}

#carousel div img {
  width: 30vw;
  height: 30vw;
  object-fit: contain;
  transition: width 1s, height 1s;
}

#carousel div.hideLeft {
  left: 0%;
  opacity: 0;
  transform: translateY(50%) translateX(-50%);
}

#carousel div.hideLeft img,
#carousel div.hideRight img,
#carousel div.prevLeftSecond img,
#carousel div.nextRightSecond img {
  width: 80%;
}

#carousel div.hideRight {
  left: 100%;
  opacity: 0;
  transform: translateY(50%) translateX(-50%);
}

#carousel div.prev {
  z-index: 5;
  left: 30%;
  transform: translateY(50px) translateX(-50%);
}

#carousel div.prev img,
#carousel div.next img {
  width: 90%;
}

#carousel div.prevLeftSecond {
  z-index: 4;
  left: 15%;
  transform: translateY(50%) translateX(-50%);
  opacity: 0.7;
}

/* Define the initial transformations as variables */
:root {
  --translate: translateY(0px) translateX(-50%);
  --scale: scale(1);
}

#carousel div.selected {
  z-index: 10;
  left: 50%;
  /* Use the variables for transform property */
  transform: var(--translate) var(--scale);
}

#carousel div.selected img {
  width: 100%;
}

#carousel div.next {
  z-index: 5;
  left: 70%;
  transform: translateY(50px) translateX(-50%);
}

#carousel div.nextRightSecond {
  z-index: 4;
  left: 85%;
  transform: translateY(50%) translateX(-50%);
  opacity: 0.7;
}

.selected {
  position: relative;
  transition: transform 5s;
}

/* All other images should not scale on hover */
.hideLeft:hover,
.hideRight:hover,
.next:hover,
.prev:hover {
  transform: scale(1);
}

.selected:hover {
  /* Update the scale variable on hover */
  --scale: scale(1.1);
}

.selected:hover .image-overlay {
  display: flex; 
}

.image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  background-color: rgba(0,0,0,0.6);
  color: white;
  text-align: center;
}

.image-text {
  z-index: 10;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgb(255, 255, 255);
  font-size: 18px;
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  pointer-events: none;
}

@media (max-width: 600px) { 
  #carousel div img {
    width: 40vw;
    height: 40vw;
    
  }

  #carousel {
    position: relative;
    height: 60vw;
    overflow: hidden;
    margin-top: 5vh;
    margin-bottom: 7vh;
  }
}
