/* Nefes Atölyesi - Mağaza v1.2.0
   Yalnız mağaza gövdesine uygulanır; header/footer ve tema renklerini değiştirmez.
   Mevcut tema link/buton renkleri miras alınır. */

/* Ürün ızgarasında eşit kartlar ve profesyonel aralıklar */
body.nmgd-image-fix .nmgd-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 26px !important;
    align-items: stretch !important;
    margin-bottom: 32px !important;
    padding: 0 !important;
    list-style: none !important;
}
body.nmgd-image-fix .nmgd-grid > .nmgd-card {
    float: none !important;
    clear: none !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 100% !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}
body.nmgd-image-fix .nmgd-card {
    position: relative;
    padding: 16px !important;
    border: 1px solid rgba(20, 30, 40, 0.09) !important;
    border-radius: 18px !important;
    box-shadow: 0 5px 18px rgba(15, 23, 42, .035);
    transition: box-shadow .2s ease, transform .2s ease;
}
body.nmgd-image-fix .nmgd-card:hover {
    box-shadow: 0 12px 28px rgba(15, 23, 42, .10);
    transform: translateY(-3px);
}

/* Kullanıcının bildirdiği <a class="product-images"> dahil bütün resim çerçeveleri */
body.nmgd-image-fix .nmgd-card a.product-images.nmgd-media,
body.nmgd-image-fix ul.products li.product a.product-images.nmgd-media,
body.nmgd-image-fix .nmgd-card .nmgd-media {
    display: flex !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    width: 100% !important;
    height: var(--nmgd-photo-height, 320px) !important;
    min-height: var(--nmgd-photo-height, 320px) !important;
    max-height: var(--nmgd-photo-height, 320px) !important;
    aspect-ratio: auto !important;
    padding: 14px !important;
    padding-bottom: 14px !important;
    margin: 0 0 16px !important;
    overflow: hidden !important;
    line-height: 0 !important;
    border-radius: 12px !important;
    position: relative !important;
    text-decoration: none !important;
}
/* Görselin tamamı sabit alan içinde ortalanır; kapak boyu değişse de çerçeve değişmez. */
body.nmgd-image-fix .nmgd-card .nmgd-media > img,
body.nmgd-image-fix .nmgd-card .nmgd-media picture img,
body.nmgd-image-fix .nmgd-card .nmgd-media .wp-post-image,
body.nmgd-image-fix ul.products li.product a.product-images.nmgd-media img,
body.nmgd-image-fix .nmgd-card .nmgd-media .attachment-woocommerce_thumbnail {
    display: block !important;
    flex: 0 1 auto !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 auto !important;
    border: none !important;
    aspect-ratio: auto !important;
    object-fit: var(--nmgd-photo-fit, contain) !important;
    object-position: 50% 50% !important;
    transform: scale(var(--nmgd-photo-scale, 1)) !important;
    transform-origin: center !important;
    vertical-align: middle !important;
}
body.nmgd-image-fix .nmgd-card .nmgd-media > picture,
body.nmgd-image-fix .nmgd-card .nmgd-media > .fusion-image-wrapper,
body.nmgd-image-fix .nmgd-card .nmgd-media > .product-image {
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
}
/* Bazı özel temalarda img yerine background-image kullanılıyor. */
body.nmgd-image-fix .nmgd-card .nmgd-media[style*="background-image"] {
    background-position: center !important;
    background-size: var(--nmgd-photo-fit, contain) !important;
    background-repeat: no-repeat !important;
}
body.nmgd-image-fix .nmgd-card .nmgd-media::before,
body.nmgd-image-fix .nmgd-card .nmgd-media::after {
    padding: 0 !important;
}


/* WooCommerce temalarında görsel, başlık ve fiyat aynı <a> içinde bulunabilir.
   O durumda bağlantıyı daraltmadan yalnızca img ölçüsü eşitlenir. */
body.nmgd-image-fix .nmgd-card img.nmgd-direct-image,
body.nmgd-image-fix ul.products li.product img.nmgd-direct-image {
    display: block !important;
    width: 100% !important;
    height: var(--nmgd-photo-height, 320px) !important;
    min-height: var(--nmgd-photo-height, 320px) !important;
    max-height: var(--nmgd-photo-height, 320px) !important;
    max-width: 100% !important;
    object-fit: var(--nmgd-photo-fit, contain) !important;
    object-position: center !important;
    transform: scale(var(--nmgd-photo-scale, 1)) !important;
    margin: 0 0 16px !important;
    border-radius: 12px !important;
}

/* Aynı hizadaki başlık ve fiyatlar: tema renkleri aynen kalır. */
body.nmgd-image-fix .nmgd-card .woocommerce-loop-product__title,
body.nmgd-image-fix .nmgd-card .product-title,
body.nmgd-image-fix .nmgd-card .fusion-product-title,
body.nmgd-image-fix .nmgd-card h2.woocommerce-loop-product__title {
    line-height: 1.35 !important;
    min-height: 2.7em;
    margin-top: 2px !important;
    margin-bottom: 12px !important;
    font-weight: 600 !important;
}
body.nmgd-image-fix .nmgd-card .price,
body.nmgd-image-fix .nmgd-card .woocommerce-Price-amount {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
body.nmgd-image-fix .nmgd-card .button,
body.nmgd-image-fix .nmgd-card .add_to_cart_button,
body.nmgd-image-fix .nmgd-card .product-buttons a {
    border-radius: 10px;
    text-align: center;
}

@media (max-width: 991px) {
    body.nmgd-image-fix .nmgd-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 18px !important; }
    body.nmgd-image-fix { --nmgd-photo-height-mobile: 260px; }
    body.nmgd-image-fix .nmgd-card .nmgd-media, body.nmgd-image-fix .nmgd-card img.nmgd-direct-image { height: var(--nmgd-photo-height-mobile) !important; min-height: var(--nmgd-photo-height-mobile) !important; max-height: var(--nmgd-photo-height-mobile) !important; }
}
@media (max-width: 560px) {
    body.nmgd-image-fix .nmgd-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 18px !important; }
    body.nmgd-image-fix .nmgd-card { padding: 14px !important; }
    body.nmgd-image-fix .nmgd-card .nmgd-media, body.nmgd-image-fix .nmgd-card img.nmgd-direct-image { height: 300px !important; min-height: 300px !important; max-height: 300px !important; }
}
@media (prefers-reduced-motion: reduce) {
    body.nmgd-image-fix .nmgd-card { transition: none !important; transform: none !important; }
}
