/**
 * Kupetz catalog v0.8.2: product-card visual refinement.
 * Scope: active v0.8 pilot, product cards ONLY; category tiles not affected.
 * No generated content and no replacement of WooCommerce price or cart handlers.
 */

body.kupetz-catalog-v08 .kcv8-results ul.products li.product:not(.product-category) {
    min-width: 0;
    height: 100%;
}

body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .kupetz-product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    padding: 0 0 14px;
    border: 1px solid #e6d7c3;
    border-radius: 4px;
    background: #fffdfa;
    box-shadow: 0 2px 12px rgb(52 4 12 / 4%);
    overflow: hidden;
    transition: border-color .18s ease, box-shadow .18s ease;
}

body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .kupetz-product-card:hover {
    border-color: #cba975;
    box-shadow: 0 7px 22px rgb(52 4 12 / 10%);
}

body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .kupetz-product-card__inner {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    height: auto;
}

/* The actual product photo fills the entire media region, including its edges. */
body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .kupetz-product-card__media {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #f7f1e8;
}

body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .kupetz-product-card__media img {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: center;
    transition: transform .32s ease;
}

@media (hover: hover) and (pointer: fine) {
    body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .kupetz-product-card:hover .kupetz-product-card__media img {
        transform: scale(1.025);
    }
}

/* Preserve complete imported product names; avoid splitting the card grid. */
body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .kupetz-product-card__title {
    display: block;
    min-height: 0;
    min-width: 0;
    margin: 0;
    padding: 12px 13px 4px;
    color: #40252b;
    font-family: var(--kupetz-font-serif, Georgia, serif);
    font-size: clamp(17px, 1.15vw, 19px);
    font-weight: 400;
    line-height: 1.22;
    letter-spacing: 0;
    text-align: left;
    text-transform: none;
    overflow-wrap: anywhere;
    word-break: normal;
    hyphens: auto;
}

body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .kupetz-product-card__weight-value {
    margin: 2px 13px 8px;
    color: #92745e;
    font-size: 12px;
    line-height: 1.35;
    text-align: left;
}

body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .kupetz-product-card__purchase {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 9px 8px;
    margin: auto 0 0;
    padding: 9px 13px 0;
}

body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .kupetz-product-card__price-wrap {
    flex: 1 1 88px;
    min-width: 0;
    min-height: 0;
    margin: 0;
    text-align: left;
}

body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .kupetz-product-card__price,
body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .woocommerce-Price-amount.amount {
    color: #540b16;
    font-family: var(--kupetz-font-serif, Georgia, serif);
    font-size: clamp(17px, 1.25vw, 21px);
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .kupetz-product-card__price bdi {
    white-space: nowrap;
}

/* Do not replace WooCommerce purchase logic: only improve its interactive skin. */
body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .add_to_cart_button,
body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .button.product_type_simple,
body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .button.product_type_variable,
body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .button.product_type_external {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 98px;
    min-height: 38px;
    max-width: 100%;
    width: auto;
    margin: 0;
    padding: 8px 11px;
    border: 1px solid #540b16;
    border-radius: 3px;
    background: #540b16;
    color: #fff8ed;
    font-family: var(--kupetz-font-body, Arial, sans-serif);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    text-decoration: none;
    text-align: center;
    white-space: normal;
    transition: background-color .18s ease, border-color .18s ease;
}

body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .add_to_cart_button:hover,
body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .button.product_type_simple:hover,
body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .button.product_type_variable:hover {
    background: #792130;
    border-color: #792130;
    color: #fff8ed;
}

body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .kupetz-product-card a:focus-visible {
    outline: 2px solid #b18b52;
    outline-offset: 2px;
}

/* Keep two readable columns on small screens. */
@media (max-width: 860px) {
    body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .kupetz-product-card__title {
        font-size: 18px;
        padding: 10px 10px 4px;
    }
    body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .kupetz-product-card__purchase {
        padding: 8px 10px 0;
    }
}

@media (max-width: 480px) {
    body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .kupetz-product-card__title {
        font-size: 16px;
        line-height: 1.24;
        padding: 9px 9px 3px;
    }
    body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .kupetz-product-card__weight-value {
        margin-inline: 9px;
    }
    body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .kupetz-product-card__purchase {
        flex-direction: column;
        align-items: stretch;
        gap: 7px;
        padding: 8px 9px 0;
    }
    body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .kupetz-product-card__price-wrap {
        flex: 0 0 auto;
        width: 100%;
    }
    body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .add_to_cart_button,
    body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .button.product_type_simple,
    body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .button.product_type_variable,
    body.kupetz-catalog-v08 .kcv8-results li.product:not(.product-category) .button.product_type_external {
        width: 100%;
        min-width: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.kupetz-catalog-v08 .kcv8-results .kupetz-product-card,
    body.kupetz-catalog-v08 .kcv8-results .kupetz-product-card__media img,
    body.kupetz-catalog-v08 .kcv8-results .add_to_cart_button {
        transition: none;
    }
}
