/* ========================================
   3D STACK SLIDER - Desktop Only
   ======================================== */

/* Gallery Section */
.project-gallery {
  position: relative;
  width: 100%;
  overflow: hidden;
}

/* Desktop & Tablet: 3D Stack Layout - Starts at 560px */
@media (min-width: 560px) {
  .stack-slider {
    position: relative;
    width: 100%;
    height: 100vh;
    perspective: 2000px;
    perspective-origin: 50% 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
  }

  .stack-slide {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 80vw;
    height: auto;
    max-width: 80vw;
    max-height: calc(100vh - 40px);
    margin: auto;
    transform-style: preserve-3d;
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none; /* Prevent interaction with hidden slides */
  }
  
  /* Only allow interaction with visible slides */
  .stack-slide[style*="opacity: 1"],
  .stack-slide[style*="autoAlpha: 1"] {
    pointer-events: auto;
  }

  .stack-slide img {
    width: 100%;
    height: auto;
    max-height: calc(100vh - 40px);
    display: block;
    border-radius: 4px;
    box-shadow: none;
    object-fit: contain;
  }
}

/* Tablets and up - more padding */
@media (min-width: 768px) {
  .stack-slider {
    padding: 25px;
  }
  
  .stack-slide {
    width: 78vw;
    max-width: 78vw;
    max-height: calc(100vh - 50px);
  }
  
  .stack-slide img {
    width: 100%;
    height: auto;
    max-height: calc(100vh - 50px);
  }
}

/* Desktops - more padding */
@media (min-width: 992px) {
  .stack-slider {
    padding: 30px;
  }
  
  .stack-slide {
    width: 75vw;
    max-width: 75vw;
    max-height: calc(100vh - 60px);
  }
  
  .stack-slide img {
    width: 100%;
    height: auto;
    max-height: calc(100vh - 60px);
  }
}

/* Large desktops - more padding */
@media (min-width: 1200px) {
  .stack-slider {
    padding: 40px;
  }
  
  .stack-slide {
    width: 70vw;
    max-width: 70vw;
    max-height: calc(100vh - 80px);
  }
  
  .stack-slide img {
    width: 100%;
    height: auto;
    max-height: calc(100vh - 80px);
  }
}

/* Mobile: Normal Stacked Layout (3D disabled below 560px) */
@media (max-width: 559px) {
  .project-gallery {
    overflow: visible;
  }

  .stack-slider {
    position: static;
    width: 100%;
    height: auto;
    perspective: none;
    overflow: visible;
  }

  .stack-slide {
    position: static;
    width: 100%;
    height: auto;
    transform: none !important;
    opacity: 1 !important;
    margin-bottom: 0.5rem;
    padding: 0 0.5rem;
  }

  .stack-slide img {
    width: 100%;
    height: auto;
    display: block;
    box-shadow: none;
    border-radius: 0;
  }
  
  /* Hide transparent spacer slide on mobile to prevent blank space */
  #stack-spacer,
  .stack-slide-spacer {
    display: none !important;
  }
}

/* Tablet adjustments - handled by responsive breakpoints above */

/* Loading state */
.stack-slide img,
.stack-slide video {
  image-rendering: crisp-edges;
  image-rendering: -webkit-optimize-contrast;
}
