/**
 * Product card (woocommerce/content-product.php)
 *
 * Loaded site-wide after style.css, so the same calm card shows in the shop,
 * the homepage carousels and related products. Selectors are prefixed with
 * `li.product-card` to win over the legacy card rules in style.css.
 *
 * - Image: square, uniform light ground. `mix-blend-mode: multiply` lets the
 *   white backgrounds of supplier cut-outs melt into that ground, so mixed
 *   photo sources still read as one grid.
 * - Info: brand eyebrow, two-line name, then price + availability as quiet meta.
 *
 * @package KauplusRattapood
 */

:root {
    --kr-card-ground: #f3f3f1;
}

/* ── Card chrome: flat, no border or shadow on the card itself ───────── */
.woocommerce ul.products li.product-card,
.woocommerce ul.products li.product-card:hover {
    background: transparent;
    border: none;
    box-shadow: none;
    transform: none;
}

li.product-card .product-card-inner {
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    padding: 0;
    transition: none;
}

li.product-card:hover .product-card-inner {
    transform: none;
    box-shadow: none;
}

/* ── Image ───────────────────────────────────────────────────────────── */
li.product-card .product-image-wrapper {
    flex: none;
    aspect-ratio: 1 / 1;
    max-width: 100%;
    min-height: 0;
    max-height: none;
    border-radius: 10px;
    background: var(--kr-card-ground);
    overflow: hidden;
    transition: box-shadow 0.15s ease;
}

li.product-card .product-image-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

li.product-card .product-image-wrapper img {
    width: 100%;
    height: 100%;
    max-width: 82%;
    max-height: 82%;
    object-fit: contain;
    mix-blend-mode: multiply;
    transform: none;
}

/* Second-image hover swap (desktop only): the main photo fades out as the
   gallery photo fades in – both are see-through (multiply), so they'd overlap */
li.product-card .product-image-link > img {
    transition: opacity 0.25s ease;
}

li.product-card .product-image-hover {
    position: absolute;
    inset: 9%;
    opacity: 0;
    pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
    li.product-card:hover .product-image-link > img:not(.product-image-hover):has(~ .product-image-hover) {
        opacity: 0;
    }

    li.product-card:hover .product-image-hover {
        opacity: 1;
    }
}

/* Badge: small and dark in the image corner, one at most */
li.product-card .product-badges {
    top: 10px;
    left: 10px;
}

li.product-card .product-badges .badge {
    font-size: 10.5px;
    font-weight: var(--font-weight-medium);
    padding: 2px 7px;
    border-radius: 5px;
    background: var(--color-black);
    color: var(--color-white);
    text-transform: none;
    letter-spacing: 0;
}

li.product-card .product-badges .featured-badge {
    background: var(--color-white);
    color: var(--color-gray-700);
}

/* ── Info ────────────────────────────────────────────────────────────── */
li.product-card .product-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 0 !important; /* text starts right under the image */
    padding: 12px 2px 0 !important;
}

li.product-card .product-brand {
    font-size: 11px;
    font-weight: var(--font-weight-medium);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-gray-500);
}

/* Name: 14px, two-line clamp */
li.product-card .product-title,
li.product-card .product-title a {
    margin: 0;
    font-size: 14px !important;
    font-weight: var(--font-weight-medium);
    color: var(--color-black);
    line-height: 1.35;
}

li.product-card .product-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

li.product-card .product-title a:hover {
    color: var(--color-primary);
}

/* Price left, availability right */
li.product-card .product-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 2px 10px;
    margin-top: 4px;
}

/* Price: quiet supporting element — dark, 15px, never blue.
   get_price_html() has no .price wrapper, so style the container. */
li.product-card .product-price,
li.product-card .product-price ins,
li.product-card .product-price bdi {
    color: var(--color-black) !important;
    font-size: 15px !important;
    font-weight: var(--font-weight-semibold) !important;
    text-decoration: none;
    white-space: nowrap;
}

li.product-card .product-price del,
li.product-card .product-price del bdi {
    color: var(--color-gray-400) !important;
    font-size: 13px !important;
    font-weight: var(--font-weight-regular, 400) !important;
    text-decoration: line-through;
}

/* Availability: 12px with a status dot */
li.product-card .product-stock {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 12px;
    color: var(--color-gray-500);
    white-space: nowrap;
}

li.product-card .product-stock::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-gray-300);
}

li.product-card .product-stock--in-stock { color: #15803d; }
li.product-card .product-stock--in-stock::before { background: #22c55e; }
li.product-card .product-stock--backorder::before { background: #f59e0b; }
li.product-card .product-stock--out-of-stock { color: var(--color-gray-400); }

/* Financing line: muted, one line */
li.product-card .product-esto-info,
li.product-card .product-esto-info * {
    font-size: 11.5px;
    color: var(--color-gray-400);
    text-align: left !important;
}
