/* ============================================
   GALLERY POPUP EFFECT - gallery-popup.css
   Clean integration with existing styles
   ============================================ */

/* ===== STACKING EFFECT ===== */
/* Add stacking to existing isotope items - using nth-child */
.isotope-item {
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    position: relative !important;
    z-index: 1 !important;
  }
  
  /* Stack each image differently */
  .isotope-item:nth-child(1) { 
    transform: rotate(-3deg) translateY(0px) !important; 
    z-index: 1 !important; 
  }
  .isotope-item:nth-child(2) { 
    transform: rotate(2deg) translateY(-10px) !important; 
    z-index: 2 !important; 
  }
  .isotope-item:nth-child(3) { 
    transform: rotate(-4deg) translateY(-20px) !important; 
    z-index: 3 !important; 
  }
  .isotope-item:nth-child(4) { 
    transform: rotate(3deg) translateY(-30px) !important; 
    z-index: 4 !important; 
  }
  .isotope-item:nth-child(5) { 
    transform: rotate(-2deg) translateY(-40px) !important; 
    z-index: 5 !important; 
  }
  .isotope-item:nth-child(6) { 
    transform: rotate(4deg) translateY(-50px) !important; 
    z-index: 6 !important; 
  }
  .isotope-item:nth-child(7) { 
    transform: rotate(-5deg) translateY(-60px) !important; 
    z-index: 7 !important; 
  }
  .isotope-item:nth-child(8) { 
    transform: rotate(3deg) translateY(-70px) !important; 
    z-index: 8 !important; 
  }
  .isotope-item:nth-child(9) { 
    transform: rotate(-3deg) translateY(-80px) !important; 
    z-index: 9 !important; 
  }
  .isotope-item:nth-child(10) { 
    transform: rotate(4deg) translateY(-90px) !important; 
    z-index: 10 !important; 
  }
  
  /* ===== POPUP ON HOVER ===== */
  .isotope-item:hover {
    transform: scale(1.15) rotate(0deg) translateY(-100px) !important;
    z-index: 1000 !important;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35) !important;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
  }
  
  /* ===== IMAGE SCALE ON HOVER ===== */
  .isotope-item:hover .thumbnail-mary-figure img {
    transform: scale(1.08) !important;
    transition: transform 0.5s ease !important;
  }
  
  .thumbnail-mary-figure img {
    transition: transform 0.5s ease !important;
  }
  
  /* ===== ENSURE PROPER POSITIONING ===== */
  .thumbnail-mary {
    position: relative !important;
    overflow: hidden !important;
    border-radius: 10px !important;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12) !important;
  }
  
  .isotope-item:hover .thumbnail-mary {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25) !important;
  }
  
  /* ===== CAPTION OVERLAY - Works with existing caption ===== */
  .thumbnail-mary-caption {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    padding: 30px 20px 20px !important;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0) 100%) !important;
    transform: translateY(100%) !important;
    transition: transform 0.5s ease, opacity 0.5s ease !important;
    opacity: 0 !important;
    text-align: center !important;
    z-index: 2 !important;
  }
  
  .isotope-item:hover .thumbnail-mary-caption {
    transform: translateY(0) !important;
    opacity: 1 !important;
  }
  
  /* Style the title in caption - Keep existing icon styles */
  .thumbnail-mary-caption .thumbnail-mary-title {
    color: #ffffff !important;
    margin: 0 !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    letter-spacing: 0.5px !important;
  }
  
  /* Keep existing zoom icon styles, just enhance on hover */
  .thumbnail-mary-caption .icon {
    display: inline-block !important;
    margin-bottom: 10px !important;
    color: #fff !important;
    font-size: 28px !important;
    background: rgba(255, 255, 255, 0.2) !important;
    padding: 10px !important;
    border-radius: 50% !important;
    transition: all 0.3s ease !important;
    width: 50px !important;
    height: 50px !important;
    line-height: 30px !important;
    text-decoration: none !important;
  }
  
  .thumbnail-mary-caption .icon:hover {
    background: rgba(255, 255, 255, 0.4) !important;
    transform: scale(1.15) !important;
    color: #fff !important;
  }
  
  /* ===== ANIMATION FOR SMOOTH APPEARANCE ===== */
  @keyframes fadeInUpGallery {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .isotope-item {
    animation: fadeInUpGallery 0.6s ease forwards !important;
  }
  
  .isotope-item:nth-child(1) { animation-delay: 0.1s !important; }
  .isotope-item:nth-child(2) { animation-delay: 0.2s !important; }
  .isotope-item:nth-child(3) { animation-delay: 0.3s !important; }
  .isotope-item:nth-child(4) { animation-delay: 0.4s !important; }
  .isotope-item:nth-child(5) { animation-delay: 0.5s !important; }
  .isotope-item:nth-child(6) { animation-delay: 0.6s !important; }
  
  /* ===== RESPONSIVE - Remove stacking on smaller screens ===== */
  @media (max-width: 992px) {
    .isotope-item:nth-child(n) {
      transform: rotate(0deg) translateY(0px) !important;
      margin-bottom: 20px !important;
    }
    .isotope-item:hover {
      transform: scale(1.08) rotate(0deg) translateY(-15px) !important;
    }
  }
  
  @media (max-width: 768px) {
    .isotope-item:hover {
      transform: scale(1.05) rotate(0deg) translateY(-10px) !important;
    }
    .thumbnail-mary-caption {
      transform: translateY(0) !important;
      opacity: 1 !important;
      background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 100%) !important;
      padding: 20px 15px 15px !important;
    }
    .thumbnail-mary-caption .thumbnail-mary-title {
      font-size: 14px !important;
    }
    .thumbnail-mary-caption .icon {
      font-size: 20px !important;
      width: 40px !important;
      height: 40px !important;
      line-height: 20px !important;
      padding: 8px !important;
    }
  }