.media-carousel {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  position: relative;
  z-index: 5555;
}

.carousel-item {
  flex-shrink: 0;
  scroll-snap-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Video carousel fullscreen */
.media-carousel.videos .carousel-item {
  width: 100vw;
  height: 100vh;
}

.media-carousel.videos video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Carousel container */
.media-carousel {
  position: relative;
  display: flex;
  overflow-x: auto;
  gap: 16px;
  width: 100%;
  scroll-snap-type: x mandatory;
  margin-top: 5%;
}

/* Close button */
.carousel-close-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  width: 50px;
  height: 50px;
  font-size: 2.5rem;
  color: #fff;
  background-color: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Carousel item scrollable */
.carousel-item {
  flex-shrink: 0;
  scroll-snap-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  /* scroll inside item */
}

.carousel-item {
  -webkit-overflow-scrolling: touch;
}


/* Image scrollable */
.carousel-item img {
  display: block;
  max-width: none;
  /* allow image to exceed container width */
  max-height: none;
  /* allow image to exceed container height */
  object-fit: none;
  /* preserve natural image size */
  cursor: grab;
}


.carousel-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
}

/* Video specific */
.video-item {
  width: 100vw;
  height: 100vh;
}

.carousel-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.media-carousel.hide {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}


/* Carousel container with 7% vertical margins */
.media-carousel {
  position: relative;
  display: flex;
  overflow-x: auto;
  gap: 16px;
  width: 100%;
  scroll-snap-type: x mandatory;
  margin: 7% 0;
  /* 7% top & bottom margin */
  -webkit-overflow-scrolling: touch;
  z-index: 5555;
}


.media-carousel-wrapper {
  position: absolute;      /* absolute inside post-card-container */
  top: 5%;
  left: 0;
  width: 100%;
  height: calc(100% - 10%);
  z-index: 115;
  display: flex;
  justify-content: center;
  align-items: center;
}


.media {
  height: 100%;
  /* container height */
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
}

/* Carousel container */
.media-carousel.videos {
  display: flex;
  width: 100%;
  height: 100%;
  /* match media height */
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}

/* Each carousel item */
.media-carousel.videos .carousel-item {
  flex: 0 0 100%;
  /* full width of carousel */
  height: 100%;
  /* match media height */
  justify-content: center;
  align-items: center;
  scroll-snap-align: center;
  position: relative;
}

/* Video fills the full height of carousel item */
.media-carousel.videos .carousel-item video {
  height: 100%;
  /* full height of parent (80vh) */
  width: auto;
  /* preserve aspect ratio */
  object-fit: contain;
  /* whole video visible */
  display: block;
}

.media-carousel-overlay {
  position: absolute;
  top: 50px;
  /* leave 100px space at top */
  bottom: 50px;
  /* leave 100px space at bottom */
  left: 0;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  overflow: hidden;
}



.carousel-content-container {
  width: 90%;
  height: 100%;
  overflow: hidden;
}

.carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.4s ease-in-out;
}

.carousel-slide {
  flex: 0 0 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  box-sizing: border-box;
}

.media-content {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.carousel-nav-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(255, 255, 255, 0.2);
  border: none;
  width: 30px;
  height: 40px;
  font-size: 2rem;
  color: white;
  cursor: pointer;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease;
}

.carousel-nav-button:hover {
  background-color: rgba(255, 255, 255, 0.4);
}

.carousel-nav-button.prev {
  left: 5px;
}

.carousel-nav-button.next {
  right: 5px;
}

/* Close button is now part of the nav buttons structure */
.carousel-nav-button.close {
  /* Inherits: position: absolute, top: 50%, transform: translateY(-50%) */
  right: 5px;

  /* ADD: Use margin-top to push the button down relative to its centered position.
     The value (e.g., 50px) should be slightly more than the height of the button (40px)
     plus some spacing. */
  margin-top: 50px;

  /* Reset the height/width if you want it to look different from the nav arrows */
  width: 30px;
  height: 40px;
  font-size: 1.5rem;
  /* Make the 'x' a bit smaller than 3rem, but still visible */
  background-color: rgba(255, 255, 255, 0.2);
}

.carousel-nav-button.mute {
  /* Inherits: position: absolute, top: 50%, transform: translateY(-50%) */
  left: 5px;

  /* ADD: Use margin-top to push the button down relative to its centered position.
     The value (e.g., 50px) should be slightly more than the height of the button (40px)
     plus some spacing. */
  margin-top: 50px;

  /* Reset the height/width if you want it to look different from the nav arrows */
  width: 30px;
  height: 40px;
  font-size: 1.5rem;
  /* Make the mute icon a bit smaller than 3rem, but still visible */
  background-color: rgba(255, 255, 255, 0.2);
}

.video-button {
  position: absolute;
  top: 70%;
  left: 0;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  padding: 8px 10px;
  border: 2px solid #aaa;
  border-radius: 0 8px 8px 0;
  font-weight: bold;
  cursor: pointer;
  z-index: 120;
  box-shadow: -2px 2px 8px rgba(0,0,0,0.3);
  font-family: Arial, sans-serif;
}

.photo-button {
  position: absolute;
  top: 70%;
  right: 0;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  padding: 8px 10px;
  border: 2px solid #aaa;
  border-radius: 8px 0 0 8px;
  font-weight: bold;
  cursor: pointer;
  z-index: 120;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.3);
  font-family: Arial, sans-serif;
}

