<script setup lang="ts">
const skeletonSlides = [0, 1, 2]; //
</script>

<template>
  <div
    class="relative w-full overflow-hidden"
    aria-label="Video gallery loading"
  >
    <div class="gallery-container">
      <div
        v-for="index in skeletonSlides"
        :key="index"
        :class="[
          'gallery-slide',
          index === 0 ? 'center' : index === 1 ? 'left' : 'right',
        ]"
      >
        <div
          class="skeleton-slide"
          :class="[index === 1 || index === 2 ? 'animate-pulse' : '']"
        ></div>
      </div>
    </div>

    <!-- Controls -->
    <div class="gallery-controls">
      <button class="gallery-controls-previous" disabled>
        <div class="h-4 w-4 rounded-full bg-gray-300"></div>
      </button>
      <button class="gallery-controls-next" disabled>
        <div class="h-4 w-4 rounded-full bg-gray-300"></div>
      </button>
    </div>
  </div>
</template>

<style scoped>
.gallery-container {
  position: relative;
  max-height: 580px;
  width: 100%;
  aspect-ratio: 16 / 9;
}
.skeleton-slide {
  width: 100%;
  height: 100%;
  background-color: #e5e7eb; /* gray-200 */
  border-radius: 16px;
}
.dark .skeleton-slide {
  background-color: #374151; /* gray-700 */
}

/* Desktop slides */
.gallery-slide {
  position: absolute;
  top: 0;
  width: 70%;
  height: 100%;
  opacity: 0;
  transform: scale(0.8);
  border-radius: 16px;
  transition: all 0.3s ease;
}
.gallery-slide.center {
  left: 50%;
  transform: translateX(-50%) scale(1);
  opacity: 1;
  z-index: 5;
}
.gallery-slide.left {
  left: 15%;
  transform: translateX(-26.3%) scale(0.9);
  opacity: 0.6;
  z-index: 3;
}
.gallery-slide.right {
  left: 85%;
  transform: translateX(-73.7%) scale(0.9);
  opacity: 0.6;
  z-index: 3;
}

/* Mobile — only center slide visible */
@media (max-width: 768px) {
  .gallery-slide {
    width: 100%;
    left: 0 !important;
    transform: none !important;
    opacity: 0;
  }
  .gallery-slide.center {
    opacity: 1;
    z-index: 5;
  }
  .gallery-slide.left,
  .gallery-slide.right {
    display: none;
  }
}

/* Controls */
.gallery-controls {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  transform: translate(-50%, -50%);
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  pointer-events: none;
  z-index: 20;
}
.gallery-controls button {
  background: white;
  border-radius: 999px;
  width: 48px;
  height: 48px;
  opacity: 0.4;
  display: flex;
  justify-content: center;
  align-items: center;
}
</style>
