/* Commerce primitives — product card + responsive grid. Shared by home
 * widgets, the shop archive, category archives, and related/cross-sell rows.
 * Surface-aware: inherits --surface-* from the section it sits in. */

/* ---- Section head (heading group on the start, "view all" link on the end) ---- */
.hb-section__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--sp-4);
    flex-wrap: wrap;
    margin-block-end: var(--sp-7);
}
.hb-section__head .hb-heading-group { margin-block-end: 0; }
.hb-section__link {
    font-weight: var(--fw-medium);
    color: var(--surface-accent);
    white-space: nowrap;
    transition: color var(--dur-fast) var(--ease-out);
}
.hb-section__link:hover { color: var(--surface-accent-2); }

/* ---- Products grid ---- */
.hb-products-grid {
    display: grid;
    grid-template-columns: repeat(var(--hb-cols, 4), 1fr);
    gap: var(--sp-5);
}
@media (max-width: 1024px) { .hb-products-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px)  { .hb-products-grid { grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); } }

/* ---- Product card ---- */
.hb-product-card {
    display: flex;
    flex-direction: column;
    background: var(--surface-bg-alt);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.hb-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 40px -22px rgba(0,0,0,.45);
}
.hb-product-card__media {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    background: var(--surface-bg);
    overflow: hidden;
}
/* selector (0,2,0) so it beats WooCommerce's `.woocommerce-page img` (0,1,1)
 * height:auto on shop/category/related rows */
.hb-product-card__media .hb-product-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--dur-slow) var(--ease-out);
}
.hb-product-card:hover .hb-product-card__img { transform: scale(1.05); }
.hb-product-card__badge {
    position: absolute;
    inset-block-start: var(--sp-3);
    inset-inline-start: var(--sp-3);
    padding: 4px 12px;
    font-size: var(--fs-eyebrow);
    font-weight: var(--fw-bold);
    letter-spacing: .04em;
    border-radius: var(--radius-pill);
    z-index: 1;
}
.hb-product-card__badge--sale { background: var(--hb-gold); color: var(--hb-charcoal); }
.hb-product-card__badge--oos  { background: var(--hb-charcoal); color: var(--hb-cream); }
.hb-product-card__body {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    padding: var(--sp-4);
    flex: 1;
}
.hb-product-card__cat {
    font-size: var(--fs-eyebrow);
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--surface-accent);
}
.hb-product-card__title {
    font-family: var(--font-body);
    font-size: var(--fs-h4);
    font-weight: var(--fw-medium);
    line-height: var(--lh-heading);
    color: var(--surface-text);
}
.hb-product-card__title a { color: inherit; }
.hb-product-card__title a:hover { color: var(--surface-accent); }
.hb-product-card__price {
    font-family: var(--font-num);
    font-size: var(--fs-h4);
    font-weight: var(--fw-bold);
    color: var(--surface-text);
    margin-block-start: auto;
}
.hb-product-card__price del { color: var(--surface-text-muted); font-weight: var(--fw-body); margin-inline-end: var(--sp-2); }
.hb-product-card__price ins { text-decoration: none; color: var(--surface-accent); }
.hb-product-card__action { margin-block-start: var(--sp-3); }
.hb-product-card__action .hb-cta { width: 100%; }

/* On dark surfaces the card body needs the dark card background */
.hb-section--dark .hb-product-card { background: var(--surface-bg-alt); border-color: var(--surface-border); }
