/* Grid Container */
.custom-product-grid {
    display: grid;
    grid-template-columns: repeat(var(--cg-col-desktop, 4), 1fr);
    gap: 20px;
    margin: 20px 0;
}

/* Card */
.product-card {
    display: flex;
    flex-direction: column;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px 15px;
    background: #fff;
    transition: box-shadow 0.3s, transform 0.2s;
    /* Default scale for title size (will be overridden by inline style) */
    --cg-title-scale: 1;
}

.product-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

/* Image Wrapper – now fully fluid using aspect ratio */
.product-image-wrapper {
    display: block;
    width: 100%;
    height: auto;
    overflow: hidden;
    margin-bottom: 12px;
    border-radius: 8px;
}

.product-image-wrapper img {
    width: 100%;
    object-fit: contain;          /* fills the aspect-ratio box without distortion */
    display: block;
}

/* Title */
.product-title {
    margin: 0 0 10px;
    line-height: 1.3;
    text-align: left !important;
    font-size: calc(var(--cg-title-size, 18px) * var(--cg-title-scale, 1));
    font-weight: var(--cg-title-weight, 700);
}

.product-title a {
    text-decoration: none;
    color: #111;
}

.product-title a:hover {
    color: #555;
}

/* Excerpt */
.product-excerpt {
    margin-bottom: 10px;
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

/* Price */
.product-price {
    margin-bottom: 15px;
    font-size: 16px;
    color: #222;
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.product-price del {
    opacity: 0.6;
    text-decoration: line-through;
    font-size: 0.9em;
}

.product-price ins {
    text-decoration: none;
    font-weight: 600;
    color: #d32f2f;
    font-size: 1.1em;
}

/* Add to Cart Button */
.add-to-cart-btn {
    display: inline-block;
    width: 100%;
    padding: 10px 15px;
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    margin-top: auto;
    transition: filter 0.2s, transform 0.1s;
    box-sizing: border-box;
}

.add-to-cart-btn:hover {
    filter: brightness(1.1);
    text-decoration: none;
}

.add-to-cart-btn:active {
    transform: scale(0.98);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .custom-product-grid {
        grid-template-columns: repeat(var(--cg-col-tablet, 2), 1fr);
        gap: 15px;
    }
    .product-card {
        --cg-title-scale: 0.85;   /* title shrinks by 15% */
        padding: 16px 12px;
    }
    .product-price {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .custom-product-grid {
        grid-template-columns: repeat(var(--cg-col-mobile, 1), 1fr);
        gap: 12px;
    }
}
.product-title a {
    font-size: 15px;
}
    .product-card {
        --cg-title-scale: 0.75;   /* further reduction */
        padding: 14px 10px;
    }
    .product-excerpt {
        font-size: 13px;
    }
    .product-price {
        font-size: 14px;
    }
}