/* Temel Galeri Yapısı */
.dapg-gallery {
    width: 100%;
    display: block;
    box-sizing: border-box;
    position: relative;
}

.dapg-gallery img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
    transition: transform 0.3s ease;
}

/* Resim Kapsayıcısı (Önemli: Relative olmalı ki overlay içinde kalsın) */
.dapg-item {
    display: block;
    position: relative; /* Bu satır overlay'i sınırlar */
    overflow: hidden;
    cursor: zoom-in;
}

/* Overlay (Büyük + İşareti ve Arkaplanı) */
.dapg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* Yarı saydam siyah */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0; /* Başlangıçta gizli */
    transition: opacity 0.3s ease;
    z-index: 10;
    pointer-events: none; /* Tıklamayı engellemesin, alttaki linke geçsin */
}

/* Overlay İkonu (+) */
.dapg-overlay .et-pb-icon {
    font-size: 32px;
    color: #fff;
    font-weight: bold;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

/* Hover Efekti: Üzerine gelince göster */
.dapg-item:hover .dapg-overlay {
    opacity: 1;
}

.dapg-item:hover .dapg-overlay .et-pb-icon {
    transform: scale(1);
}

.dapg-item:hover img {
    transform: scale(1.03);
}

/* --- LAYOUT MODLARI --- */

/* Grid Modu */
.dapg-gallery.dapg-mode-grid .dapg-gallery-inner {
    display: grid;
    grid-template-columns: repeat(var(--dapg-desktop-cols), 1fr);
    gap: var(--dapg-gap);
}

/* Grid Ratio Ayarları */
.dapg-gallery.dapg-mode-grid.dapg-ratio-1-1 .dapg-item img { aspect-ratio: 1 / 1; object-fit: cover; width: 100%; }
.dapg-gallery.dapg-mode-grid.dapg-ratio-16-9 .dapg-item img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }
.dapg-gallery.dapg-mode-grid.dapg-ratio-4-5 .dapg-item img { aspect-ratio: 4 / 5; object-fit: cover; width: 100%; }
.dapg-gallery.dapg-mode-grid.dapg-ratio-3-2 .dapg-item img { aspect-ratio: 3 / 2; object-fit: cover; width: 100%; }

/* Masonry Modu */
.dapg-gallery.dapg-mode-masonry .dapg-gallery-inner {
    column-count: var(--dapg-desktop-cols);
    column-gap: var(--dapg-gap);
}
.dapg-gallery.dapg-mode-masonry .dapg-item {
    margin-bottom: var(--dapg-gap);
    break-inside: avoid;
}

/* Justified Modu */
.dapg-gallery.dapg-mode-justified .dapg-gallery-inner {
    display: flex;
    flex-wrap: wrap;
    gap: var(--dapg-gap);
}
.dapg-gallery.dapg-mode-justified .dapg-item {
    flex-grow: 1;
    height: 250px;
}
.dapg-gallery.dapg-mode-justified .dapg-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Responsive */
@media (max-width: 980px) {
    .dapg-gallery.dapg-mode-grid .dapg-gallery-inner { grid-template-columns: repeat(var(--dapg-tablet-cols), 1fr); }
    .dapg-gallery.dapg-mode-masonry .dapg-gallery-inner { column-count: var(--dapg-tablet-cols); }
}

@media (max-width: 480px) {
    .dapg-gallery.dapg-mode-grid .dapg-gallery-inner { grid-template-columns: repeat(var(--dapg-mobile-cols), 1fr); }
    .dapg-gallery.dapg-mode-masonry .dapg-gallery-inner { column-count: var(--dapg-mobile-cols); }
    .dapg-gallery.dapg-mode-justified .dapg-item { height: 150px; }
}

/* --- WOOCOMMERCE PHOTOSWIPE ÇAKIŞMASI İÇİN KESİN ÇÖZÜM --- */

/* 1. specificity'yi (önceliği) artırmak için 'body' ve '.pswp' zinciri kullanıyoruz */
body .pswp .pswp__button,
body .pswp .pswp__button--arrow--left,
body .pswp .pswp__button--arrow--right {
    background: none !important;       /* Resmi kaldır */
    background-image: none !important; /* Resmi kesin kaldır */
    background-color: transparent !important;
    box-shadow: none !important;
}

/* 2. WooCommerce'un oklu butonları oluşturduğu 'before' elementlerini ÖLDÜR */
body .pswp .pswp__button::before,
body .pswp .pswp__button::after,
body .pswp .pswp__button--arrow--left::before,
body .pswp .pswp__button--arrow--right::before {
    content: none !important;          /* İçeriği boşalt */
    display: none !important;          /* Görünmez yap */
    background: none !important;       /* Arkaplanı sil */
    width: 0 !important;
    height: 0 !important;
}

/* 3. Bizim SVG ikonumuzun görünür olduğundan emin ol */
body .pswp .pswp__icn {
    opacity: 1 !important;
    display: block !important;
    visibility: visible !important;
}

/* --- METİN ALANLARI (Title & Caption) --- */

.dapg-item {
    text-decoration: none !important; /* Link alt çizgisini kaldır */
    color: inherit; /* Yazı rengini ebeveynden al */
}

/* Resim Kapsayıcısı */
.dapg-image-wrap {
    position: relative;
    overflow: hidden;
    border-radius: 4px; /* Köşeleri yumuşat */
}

/* Metin Kutusu */
.dapg-meta {
    padding: 10px 0 15px 0; /* Üst ve alt boşluk */
    width: 100%;
}

/* Başlık */
.dapg-title {
    margin: 0 0 5px 0 !important; /* Alt boşluk */
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3em;
    color: #333; /* Varsayılan renk (Modülden değişir) */
}

/* Açıklama */
.dapg-caption {
    margin: 0 !important;
    font-size: 14px;
    line-height: 1.5em;
    color: #666; /* Varsayılan renk (Modülden değişir) */
}

/* Masonry modunda metin kutusu bozulmasın */
.dapg-gallery.dapg-mode-masonry .dapg-item {
    display: block;
    margin-bottom: var(--dapg-gap);
    background: #fff; /* Kart görünümü için (Opsiyonel) */
}

/* --- TEMEL YAPILAR --- */
.dapg-gallery { width: 100%; box-sizing: border-box; }
.dapg-item { text-decoration: none !important; color: inherit; display: block; position: relative; }
.dapg-image-wrap { position: relative; overflow: hidden; border-radius: 4px; }
.dapg-image-wrap img { width: 100%; height: auto; display: block; transition: transform 0.3s ease; }

/* HOVER */
.dapg-item:hover .dapg-image-wrap img { transform: scale(1.03); }
.dapg-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s; z-index: 2; pointer-events: none; }
.dapg-item:hover .dapg-overlay { opacity: 1; }
.dapg-overlay .et-pb-icon { font-size: 32px; color: #fff; }

/* METİNLER */
.dapg-meta { padding: 10px 0 15px 0; }
.dapg-title { margin: 0 0 4px 0 !important; font-weight: 600; font-size: 15px; color: #333; }
.dapg-caption { font-size: 13px; color: #666; line-height: 1.4em; }

/* --- MOD: GRID --- */
.dapg-gallery.dapg-mode-grid .dapg-gallery-inner { display: grid; grid-template-columns: repeat(var(--dapg-desktop-cols), 1fr); gap: var(--dapg-gap); }
/* Grid Ratio */
.dapg-gallery.dapg-mode-grid.dapg-ratio-1-1 .dapg-image-wrap img { aspect-ratio: 1/1; object-fit: cover; }
.dapg-gallery.dapg-mode-grid.dapg-ratio-16-9 .dapg-image-wrap img { aspect-ratio: 16/9; object-fit: cover; }
.dapg-gallery.dapg-mode-grid.dapg-ratio-3-2 .dapg-image-wrap img { aspect-ratio: 3/2; object-fit: cover; }
.dapg-gallery.dapg-mode-grid.dapg-ratio-4-5 .dapg-image-wrap img { aspect-ratio: 4/5; object-fit: cover; }

/* --- MOD: MASONRY --- */
.dapg-gallery.dapg-mode-masonry .dapg-gallery-inner { column-count: var(--dapg-desktop-cols); column-gap: var(--dapg-gap); }
.dapg-gallery.dapg-mode-masonry .dapg-item { margin-bottom: var(--dapg-gap); break-inside: avoid; }

/* --- MOD: JUSTIFIED (DÜZELTİLDİ) --- */
/* Justified modunda metin varsa Flex wrap kullanıyoruz ama metinlerin hizayı bozmaması için yükseklik kontrolü yapıyoruz */
.dapg-gallery.dapg-mode-justified .dapg-gallery-inner { display: flex; flex-wrap: wrap; gap: var(--dapg-gap); }
.dapg-gallery.dapg-mode-justified .dapg-item { flex-grow: 1; width: auto; max-width: 100%; }

/* Justified modunda resim yüksekliği sabittir, genişlik esner */
.dapg-gallery.dapg-mode-justified .dapg-image-wrap { height: 250px; } 
.dapg-gallery.dapg-mode-justified .dapg-image-wrap img { width: 100%; height: 100%; object-fit: cover; }

/* RESPONSIVE */
@media (max-width: 980px) {
    .dapg-gallery.dapg-mode-grid .dapg-gallery-inner { grid-template-columns: repeat(var(--dapg-tablet-cols), 1fr); }
    .dapg-gallery.dapg-mode-masonry .dapg-gallery-inner { column-count: var(--dapg-tablet-cols); }
}
@media (max-width: 480px) {
    .dapg-gallery.dapg-mode-grid .dapg-gallery-inner { grid-template-columns: repeat(var(--dapg-mobile-cols), 1fr); }
    .dapg-gallery.dapg-mode-masonry .dapg-gallery-inner { column-count: var(--dapg-mobile-cols); }
    .dapg-gallery.dapg-mode-justified .dapg-image-wrap { height: 150px; } /* Mobilde daha kısa satırlar */
}

/* WOOCOMMERCE ÇAKIŞMA ÖNLEYİCİ */
body .pswp .pswp__button { background: none !important; background-image: none !important; box-shadow: none !important; }
body .pswp .pswp__button::before, body .pswp .pswp__button::after { display: none !important; }
body .pswp .pswp__icn { opacity: 1 !important; visibility: visible !important; }

/* LIGHTBOX CAPTION STİLİ */
.pswp__custom-caption {
    background: rgba(0, 0, 0, 0.7);
    font-size: 14px;
    color: #fff;
    width: 100%;
    text-align: center;
    padding: 10px;
    position: absolute;
    bottom: 0;
    left: 0;
}
.pswp__custom-caption strong { font-size: 15px; display: block; margin-bottom: 2px; }