/* ============================================================
   PROJECT VISUALS CAROUSEL - Single-Slide Display
   ============================================================ */

/* ===== CONTAINER ===== */

.ssck-project-visuals-carousel {
  width: 100%;
  position: relative;
  margin-bottom: 30px;
}

/* ===== CONTENT WRAPPER (Chevrons + Slides) ===== */

.ssck-pvc-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  position: relative;
  width: 100%;
}

/* ===== CHEVRONS ===== */

.ssck-pvc-chevron {
  opacity: 0.4;
  user-select: none;
  -webkit-user-select: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  flex: 0 0 30px;
  z-index: 100;
  transition: opacity 0.2s ease;
}

.ssck-pvc-chevron:hover {
  opacity: 0.6;
}

.ssck-pvc-chevron img {
  width: 100%;
  height: auto;
  display: block;
}

/* Disabled state */
.ssck-pvc-chevron[disabled],
.ssck-pvc-chevron[aria-disabled="true"] {
  opacity: 0;
  cursor: default;
  pointer-events: none;
}

/* ===== MAIN SLIDE AREA ===== */

.ssck-pvc-slides {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  aspect-ratio: 16/9;
  max-height: 580px;
  overflow: hidden;
  touch-action: pan-y; /* Preserve native vertical scroll */
  cursor: pointer;
  margin: 0 20px;
  background: #fafafa;
}

/* ===== INDIVIDUAL SLIDES ===== */

.ssck-pvc-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translate3d(8px, 0, 0); /* Initial off-state for incoming slide */
  will-change: transform, opacity;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  margin: 0;
  padding: 0;
}

.ssck-pvc-slide.is-active {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* Slide Image */
.ssck-pvc-slide .ssck-pvc-slide-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  background: transparent;
  user-select: none;
  -webkit-user-drag: none;
}

/* Error/Loading Tile - hidden initially, shows after 0.3s delay */
.ssck-pvc-slide .ssck-pvc-error-tile {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  background: repeating-linear-gradient(45deg, #e6e6e6, #e6e6e6 10px, #f4f4f4 10px, #f4f4f4 20px);
  font-size: 0.95rem;
  letter-spacing: 0.3px;
  z-index: 0;
  opacity: 0;
  animation: ssck-pvc-show-loading 0s 0.3s forwards;
}

@keyframes ssck-pvc-show-loading {
  to {
    opacity: 1;
  }
}

/* Hide error tile when image loaded successfully (instant, no animation) */
.ssck-pvc-slide.is-loaded .ssck-pvc-error-tile {
  display: none;
  animation: none;
}

/* Show "Image unavailable" text on error */
.ssck-pvc-slide.is-error .ssck-pvc-error-tile::after {
  content: "Image unavailable";
}

.ssck-pvc-slide.is-error .ssck-pvc-slide-image {
  display: none;
}

/* ===== VIDEO SLIDE ELEMENTS ===== */

/* Play Icon Overlay */
.ssck-pvc-slide .ssck-pvc-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(48px, 20%, 160px);
  height: clamp(48px, 20%, 160px);
  background: center / contain no-repeat var(--ssck-play-icon-url);
  opacity: 0.85;
  pointer-events: none;
  z-index: 10;
  transition: opacity 0.3s ease;
}

/* Video Container */
.ssck-pvc-slide .ssck-pvc-video-container {
  position: absolute;
  inset: 0;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.ssck-pvc-slide.is-video-active .ssck-pvc-video-container {
  opacity: 1;
  pointer-events: auto;
}

.ssck-pvc-slide .ssck-pvc-video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Hide play icon when video is active */
.ssck-pvc-slide.is-video-active .ssck-pvc-play-icon {
  opacity: 0;
}

/* Hide play icon on autoplay slides until first rewind */
.ssck-pvc-slide.is-autoplay-initial .ssck-pvc-play-icon {
  opacity: 0;
  visibility: hidden; /* Instant hide - visibility doesn't transition */
}

/* ===== LOADING SPINNER ===== */

.ssck-pvc-slide .ssck-pvc-loading-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(48px, 15%, 120px);
  height: clamp(48px, 15%, 120px);
  opacity: 0;
  pointer-events: none;
  z-index: 11;
  transition: opacity 0.3s ease;
}

.ssck-pvc-spinner-ring {
  width: 100%;
  height: 100%;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  animation: ssck-pvc-spin 0.8s linear infinite;
}

@keyframes ssck-pvc-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== VIDEO SLIDE STATES ===== */

/* Loading state: spinner visible, play icon hidden */
.ssck-pvc-slide.is-video-loading .ssck-pvc-play-icon {
  opacity: 0;
}

.ssck-pvc-slide.is-video-loading .ssck-pvc-loading-spinner {
  opacity: 1;
}

/* Playing state: spinner hidden (play icon already hidden via is-video-active) */
.ssck-pvc-slide.is-video-active .ssck-pvc-loading-spinner {
  opacity: 0;
}

/* Error state: show play icon again (allows retry click) */
.ssck-pvc-slide.is-video-error .ssck-pvc-play-icon {
  opacity: 0.85;
}

.ssck-pvc-slide.is-video-error .ssck-pvc-loading-spinner {
  opacity: 0;
}

/* ===== THUMBNAILS ===== */

.ssck-pvc-thumbs {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  min-height: 60px; /* Reserve space to prevent CLS */
}

.ssck-pvc-thumb {
  width: 60px;
  height: 60px;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  opacity: 0.4; /* THUMB_OPACITY_INACTIVE - matches static site */
  transition: opacity 150ms linear; /* THUMB_FADE_MS */
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.ssck-pvc-thumb:not(.is-active):not(.is-pending):hover {
  opacity: 0.55; /* Hover state - matches static site */
}

.ssck-pvc-thumb.is-pending {
  opacity: 0.7 !important; /* Pending state - matches static site */
}

.ssck-pvc-thumb.is-active {
  opacity: 1; /* THUMB_OPACITY_ACTIVE */
}

.ssck-pvc-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Thumbnail Error Tile */
.ssck-pvc-thumb .ssck-pvc-thumb-error-tile {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  background: repeating-linear-gradient(45deg, #e6e6e6, #e6e6e6 10px, #f4f4f4 10px, #f4f4f4 20px);
}

.ssck-pvc-thumb.is-error .ssck-pvc-thumb-error-tile {
  display: block;
}

.ssck-pvc-thumb.is-error img {
  display: none;
}

/* Thumbnail Play Icon - 50% of thumbnail size, centered */
.ssck-pvc-thumb .ssck-pvc-thumb-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50%; /* 50% of thumbnail width (30px) */
  height: 50%; /* 50% of thumbnail height (30px) */
  background: center / contain no-repeat var(--ssck-play-icon-url);
  opacity: 0.9;
  pointer-events: none;
}

/* ===== ACCESSIBILITY ===== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== EMPTY STATE ===== */

.ssck-project-visuals-carousel-empty {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.ssck-project-visuals-carousel-empty p {
  margin: 0;
  font-size: 14px;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
  .ssck-pvc-slides {
    margin: 0 10px;
  }

  .ssck-pvc-chevron {
    width: 24px;
    flex: 0 0 24px;
  }

  .ssck-pvc-thumb {
    width: 48px;
    height: 48px;
  }
}

@media (max-width: 640px) {
  .ssck-pvc-chevron {
    width: 20px;
    flex: 0 0 20px;
  }

  .ssck-pvc-slides {
    margin: 0 8px;
  }

  .ssck-pvc-thumb {
    width: 40px;
    height: 40px;
  }
}
