/* === AUTO GALLERY LAYOUT === */
.auto-gallery {
  width: 100%;
  margin: 0 auto;
  padding: var(--space-md) 0;
}

.gallery-grid {
  display: grid;
  gap: var(--space-sm);
}

.gallery-grid.gallery-cols-2 { grid-template-columns: repeat(2, 1fr); }
.gallery-grid.gallery-cols-3 { grid-template-columns: repeat(3, 1fr); }
.gallery-grid.gallery-cols-4 { grid-template-columns: repeat(4, 1fr); }

.gallery-item {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: 10px;
  background-color: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-image {
  position: relative;
  width: 100%;
  height: 100%;
  cursor: pointer; /* ✅ Tıklanabilir olduğunu göster */
}

.gallery-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  transition: transform 0.3s ease;
}

.gallery-image:hover img {
  transform: scale(1.05);
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  color: #fff;
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: opacity 0.3s ease;
  pointer-events: none; /* ✅ Overlay tıklamayı engellemesin */
}

.gallery-image:hover .gallery-overlay {
  opacity: 1;
}

.gallery-caption {
  font-size: clamp(0.9rem, 0.5vw + 0.5rem, 1.1rem);
  font-weight: 500;
  text-shadow: 0 2px 4px rgba(0,0,0,0.6);
}

/* === LIGHTBOX - GÜNCELLENMİŞ === */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999; /* ✅ ÇOK DAHA YÜKSEK z-index */
  opacity: 0;
  visibility: hidden; /* ✅ Gizlilik için visibility */
  pointer-events: none;
  transition: all 0.3s ease;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.lightbox-img {
  max-width: 90%;
  max-height: 90%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.1);
  transform: scale(0.9); /* ✅ Açılış animasyonu */
  transition: transform 0.3s ease;
}

.lightbox.active .lightbox-img {
  transform: scale(1); /* ✅ Aktifken normal boyut */
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 3rem;
  font-weight: 300;
  cursor: pointer;
  user-select: none;
  z-index: 1000000; /* ✅ En üstte */
  transition: all 0.2s ease;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  line-height: 1;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.8);
  transform: scale(1.1);
}

/* ✅ Body scroll kilidi */
body.lightbox-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* === LIGHTBOX NAVIGATION === */
.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  color: #fff;
  background: rgba(0,0,0,0.5);
  border: none;
  cursor: pointer;
  user-select: none;
  z-index: 1000001;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255,255,255,0.2);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
  left: 20px;
}

.lightbox-next {
  right: 20px;
}


/* === RESPONSIVE GALLERY GRID === */

/* 📱 Mobil cihazlar (max 576px) — 2 sütun */
@media (max-width: 576px) {
  .gallery-grid.gallery-cols-4,
  .gallery-grid.gallery-cols-3,
  .gallery-grid.gallery-cols-2 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: var(--space-xs, 6px);
  }

  .gallery-item {
    border-radius: 6px;
  }
}

/* 📱 Tablet (577px – 991px) — 3 sütun */
@media (min-width: 577px) and (max-width: 991px) {
  .gallery-grid.gallery-cols-4,
  .gallery-grid.gallery-cols-3 {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  .gallery-item {
    border-radius: 8px;
  }
}

/* 💻 Büyük ekran (992px ve üzeri) — mevcut yapı 4 sütun */
@media (min-width: 992px) {
  .gallery-grid.gallery-cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

