/* ==========================================================================
   M ILYAS & SONS - MODERN RESPONSIVE GALLERY STYLING & PROMINENT ANIMATIONS
   ========================================================================== */

/* Keyframe Animations */
@keyframes misPopIn {
  0% {
    opacity: 0;
    transform: translateY(35px) scale(0.92);
  }
  65% {
    opacity: 1;
    transform: translateY(-5px) scale(1.015);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Filter Bar */
.elementor-gallery__titles-container {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 10px 14px !important;
  margin: 30px auto 40px auto !important;
  padding: 0 15px !important;
  max-width: 1200px !important;
  list-style: none !important;
}

.elementor-gallery-title {
  color: #2b2f38 !important;
  font-family: 'Poppins', sans-serif !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  cursor: pointer !important;
  padding: 9px 20px !important;
  border-radius: 25px !important;
  background: #f1f3f6 !important;
  border: 1px solid #e2e6eb !important;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
  text-decoration: none !important;
  display: inline-block !important;
  user-select: none !important;
}

.elementor-gallery-title:hover {
  color: #ff9843 !important;
  border-color: #ff9843 !important;
  background: #fff6ee !important;
  transform: translateY(-3px) scale(1.05) !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08) !important;
}

.elementor-gallery-title.elementor-item-active {
  color: #ffffff !important;
  background: #ff9843 !important;
  border-color: #ff9843 !important;
  box-shadow: 0 6px 20px rgba(255, 152, 67, 0.5) !important;
  transform: translateY(-2px) scale(1.03) !important;
}

/* Gallery Grid */
.elementor-gallery__container {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
  gap: 26px !important;
  max-width: 1240px !important;
  margin: 0 auto 60px auto !important;
  padding: 0 20px !important;
  box-sizing: border-box !important;
}

/* Gallery Item Card */
.e-gallery-item {
  position: relative !important;
  display: block;
  height: 250px !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  background-color: #eaedf1 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08) !important;
  transition: transform 0.3s ease, box-shadow 0.3s ease !important;
  cursor: pointer !important;
  text-decoration: none !important;
  will-change: transform, box-shadow;
  opacity: 1 !important;
}

/* Hidden gallery items when filtered */
.e-gallery-item.mis-gallery-hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Smooth Fast Fade-In on Filter (No Blank Delay) */
.e-gallery-item.mis-animate-in {
  animation: misFadeIn 0.25s ease-out both !important;
}

@keyframes misFadeIn {
  from {
    opacity: 0.4;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.e-gallery-item:hover {
  transform: translateY(-12px) scale(1.02) !important;
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.22) !important;
}

/* Image Background with Prominent Smooth Zoom */
.e-gallery-image {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background-size: cover !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
  transition: transform 0.65s cubic-bezier(0.25, 1, 0.5, 1) !important;
  display: block !important;
  will-change: transform;
}

.e-gallery-item:hover .e-gallery-image {
  transform: scale(1.14) rotate(0.5deg) !important;
}

/* Overlay & Zoom Icon with Distinct Spring Pop */
.elementor-gallery-item__overlay {
  position: absolute !important;
  inset: 0 !important;
  background: rgba(15, 20, 25, 0.48) !important;
  backdrop-filter: blur(3px) !important;
  -webkit-backdrop-filter: blur(3px) !important;
  opacity: 0 !important;
  transition: opacity 0.35s ease !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  z-index: 2 !important;
}

.e-gallery-item:hover .elementor-gallery-item__overlay {
  opacity: 1 !important;
}

.gallery-overlay-icon {
  width: 52px !important;
  height: 52px !important;
  border-radius: 50% !important;
  background: #ff9843 !important;
  color: #ffffff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 22px !important;
  box-shadow: 0 8px 24px rgba(255, 152, 67, 0.55) !important;
  transform: scale(0.5) rotate(-20deg) !important;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease !important;
}

.e-gallery-item:hover .gallery-overlay-icon {
  transform: scale(1.1) rotate(0deg) !important;
}

.gallery-overlay-icon:hover {
  transform: scale(1.22) rotate(15deg) !important;
  background: #e67d26 !important;
}

/* Hide any text over the image */
.gallery-overlay-title {
  display: none !important;
}

/* Lightbox Modal */
.mis-lightbox-modal {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(10, 12, 16, 0.94) !important;
  z-index: 999999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease !important;
  padding: 20px !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
}

.mis-lightbox-modal.active {
  opacity: 1 !important;
  visibility: visible !important;
}

.mis-lightbox-content {
  position: relative !important;
  max-width: 90vw !important;
  max-height: 85vh !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  transform: scale(0.9);
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.mis-lightbox-modal.active .mis-lightbox-content {
  transform: scale(1);
}

.mis-lightbox-img {
  max-width: 100% !important;
  max-height: 85vh !important;
  border-radius: 8px !important;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.7) !important;
  object-fit: contain !important;
  user-select: none !important;
}

.mis-lightbox-caption {
  display: none !important;
}

.mis-lightbox-close {
  position: absolute !important;
  top: 25px !important;
  right: 30px !important;
  width: 46px !important;
  height: 46px !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
  border: none !important;
  font-size: 26px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.25s ease !important;
  z-index: 1000000 !important;
}

.mis-lightbox-close:hover {
  background: #ff9843 !important;
  transform: rotate(90deg) scale(1.15) !important;
}

.mis-lightbox-arrow {
  position: absolute !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 54px !important;
  height: 54px !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
  border: none !important;
  font-size: 22px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
  z-index: 1000000 !important;
}

.mis-lightbox-arrow:hover {
  background: #ff9843 !important;
  transform: translateY(-50%) scale(1.15) !important;
}

.mis-lightbox-prev {
  left: 25px !important;
}

.mis-lightbox-next {
  right: 25px !important;
}

@media (max-width: 768px) {
  .elementor-gallery__container {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
    gap: 15px !important;
  }
  .e-gallery-item {
    height: 200px !important;
  }
  .mis-lightbox-arrow {
    width: 40px !important;
    height: 40px !important;
    font-size: 16px !important;
  }
  .mis-lightbox-prev {
    left: 10px !important;
  }
  .mis-lightbox-next {
    right: 10px !important;
  }
}
