/**
 * Zamseed Product Card Styles
 *
 * The base `.zs-product-card` component. Three renderers emit this markup
 * contract and all three depend on this file:
 *
 *   - Zamseed_Widget_Product_Grid::render() / content_template()
 *     (declared in its get_style_depends())
 *   - single-zs_product.php:411-426, the "More in <crop group>" row
 *     (enqueued directly at single-zs_product.php:75)
 *   - Zamseed_Widget_Product_Card, which has zero live instances
 *
 * It does NOT own `.zs-product-grid`; that container belongs to
 * widget-product-grid.css, which is the only file that declares it now.
 * Both used to declare it at identical specificity with different track
 * functions (repeat(3, 1fr) here vs repeat(3, minmax(0, 1fr)) there), so
 * long-title overflow behaviour depended on enqueue order.
 *
 * NOTE for anyone retiring class-zamseed-widget-product-card.php: this
 * stylesheet is load-bearing and must survive the class.
 *
 * @package Zamseed
 * @since 1.0.0
 */

/* ==========================================================================
   Product Card
   ========================================================================== */

.zs-product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--zs-card, #ffffff);
    border: 1px solid var(--zs-border, rgba(0, 0, 0, 0.08));
    border-radius: 16px;
    overflow: hidden;
    /* Figma gives the card a resting shadow; only the hover state had one. */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    text-decoration: none;
    color: inherit;
    transition: transform 260ms var(--zs-ease-hover, ease), box-shadow 260ms var(--zs-ease-hover, ease), border-color 260ms var(--zs-ease-hover, ease);
}

.zs-product-card:hover {
    transform: translateY(-4px);
    border-color: var(--zs-primary, #2d5a27);
    box-shadow: var(--zs-shadow, 0 18px 50px rgba(45, 90, 39, 0.12));
    color: inherit;
}

/* The whole card is the link, so it is the focus target. The Image Overlay
   variant declares its own ring in widget-product-grid.css:127; the standard
   variant had none anywhere, which left keyboard users with no visible
   position in a product grid. */
a.zs-product-card:focus-visible {
    outline: 2px solid var(--zs-primary, #2d5a27);
    outline-offset: 3px;
}

/* Image Wrapper */
.zs-product-card__image-wrapper {
    position: relative;
    overflow: hidden;
}

/* Image */
/* 300px is the Figma card image area (384.67 x 300 inside a 386.67 x 409
   card, node 11121:38061). The card previously held 200px, which made the
   image area a third shallower than the mockup everywhere the component is
   used — the products overview grid and the crop page's related cards alike. */
.zs-product-card__image {
    width: 100%;
    height: 300px;
    overflow: hidden;
}

.zs-product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 560ms var(--zs-ease-standard, ease);
}

/* No image on the record. This is the live state of the whole catalogue —
   every published zs_product has an empty card/hero image and _thumbnail_id 0
   — so without it the card holds a 200px box of nothing. A token-coloured
   field keeps the grid rhythm and reads as deliberate rather than broken.
   single-zs_product.php:416 emits the same modifier on a <span>. */
.zs-product-card__image--placeholder {
    display: block;
    background-color: var(--zs-green-soft, #eef4df);
    background-image: linear-gradient(
        135deg,
        var(--zs-green-soft, #eef4df) 0%,
        var(--zs-warm-deep, #f3efe6) 100%
    );
}

/* The optional Missing Image Label. Only emitted when an editor has typed one
   into the widget's Missing Image Label control, so a card with no label is
   byte-identical to what shipped before the control existed. The label carries
   its own centring rather than changing the --placeholder rule's display, so
   the wordless field above is untouched. */
.zs-product-card__image-label {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    padding: 12px;
    font-family: var(--zs-font-body, inherit);
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.35;
    text-align: center;
    letter-spacing: 0.02em;
    color: var(--zs-primary, #2d5a27);
    opacity: 0.72;
}

.zs-product-card:hover .zs-product-card__image img {
    transform: scale(1.025);
}

.zs-product-card--no-zoom:hover .zs-product-card__image img {
    transform: none;
}

/* Horizontal layout variant */
.zs-product-card--horizontal {
    flex-direction: row;
    align-items: stretch;
}

.zs-product-card--horizontal .zs-product-card__image-wrapper {
    flex: 0 0 38%;
    max-width: 38%;
}

.zs-product-card--horizontal .zs-product-card__image {
    height: 100%;
    min-height: 160px;
}

/* Image Overlay */
.zs-product-card__image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: transparent;
    transition: background-color 0.3s ease;
    pointer-events: none;
}

.zs-product-card:hover .zs-product-card__image-overlay {
    background-color: rgba(45, 90, 39, 0.2);
}

/* Badge */
.zs-product-card__badge {
    position: absolute;
    top: 16px;
    left: 16px;
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 12px;
    font-family: var(--zs-font-sans, 'Inter', sans-serif);
    font-size: 0.6875rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: 999px;
    z-index: 2;
}

.zs-product-card__badge--primary {
    background: var(--zs-primary, #2d5a27);
    color: #ffffff;
}

.zs-product-card__badge--secondary {
    background: var(--zs-secondary, #d35400);
    color: #ffffff;
}

.zs-product-card__badge--accent {
    background: var(--zs-accent, #c48c33);
    color: #1c1c1c;
}

/* Content */
.zs-product-card__content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px;
}

/* Category */
.zs-product-card__category {
    display: inline-block;
    margin-bottom: 8px;
    padding: 6px 12px;
    font-family: var(--zs-font-sans, 'Inter', sans-serif);
    font-size: 0.6875rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--zs-green-soft, #eef4df);
    color: var(--zs-primary, #2d5a27);
    border-radius: 999px;
    width: fit-content;
}

/* Title */
.zs-product-card__title {
    margin: 0 0 12px;
    font-family: var(--zs-font-serif, 'Cormorant Garamond', serif);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--zs-text, #1c1c1c);
}

/* Description */
.zs-product-card__description {
    flex: 1;
    margin: 0;
    font-family: var(--zs-font-sans, 'Inter', sans-serif);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--zs-muted, #555555);
}

/* Highlight tag pills */
.zs-product-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.zs-product-card__tag {
    padding: 6px 12px;
    font-family: var(--zs-font-sans, 'Inter', sans-serif);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--zs-primary, #2d5a27);
    background-color: var(--zs-green-soft, #eef4df);
    border-radius: 999px;
}

/* Whole-card link hint ("View variety →") */
.zs-product-card__view-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    font-family: var(--zs-font-sans, 'Inter', sans-serif);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--zs-primary, #2d5a27);
}

.zs-product-card__view-link svg {
    transition: transform 0.2s ease;
}

a.zs-product-card:hover .zs-product-card__view-link svg {
    transform: translateX(4px);
}

/* Specs */
.zs-product-card__specs {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.zs-product-card__spec {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--zs-font-sans, 'Inter', sans-serif);
    font-size: 0.8125rem;
    color: var(--zs-muted, #555555);
}

.zs-product-card__spec-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 14px;
    color: var(--zs-primary, #2d5a27);
}

.zs-product-card__spec-icon svg { width: 1em; height: 1em; fill: currentColor; }
.zs-product-card__spec-icon img { display: block; width: 1em; height: 1em; object-fit: contain; }

.zs-product-card__spec-label { font-weight: 600; }

.zs-product-card__spec-value { color: var(--zs-text, #1c1c1c); margin-left: auto; }

/* Buttons */
.zs-product-card__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.zs-product-card__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-family: var(--zs-font-sans, 'Inter', sans-serif);
    font-size: 0.8125rem;
    font-weight: 700;
    text-decoration: none;
    border-radius: 999px;
    border: 1.5px solid transparent;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.zs-product-card__btn--primary {
    background-color: var(--zs-primary, #2d5a27);
    border-color: var(--zs-primary, #2d5a27);
    color: #ffffff;
}

.zs-product-card__btn--primary:hover {
    background-color: #245020;
}

.zs-product-card__btn--secondary {
    background-color: transparent;
    border-color: var(--zs-primary, #2d5a27);
    color: var(--zs-primary, #2d5a27);
}

.zs-product-card__btn--secondary:hover {
    background-color: var(--zs-primary, #2d5a27);
    color: #ffffff;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 600px) {
    .zs-product-card--horizontal {
        flex-direction: column;
    }

    .zs-product-card--horizontal .zs-product-card__image-wrapper {
        flex-basis: auto;
        max-width: 100%;
    }
}

@media (max-width: 760px) {
    .zs-product-card__content {
        padding: 20px;
    }

    .zs-product-card__title {
        font-size: 1.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .zs-product-card,
    .zs-product-card__image img,
    .zs-product-card__image-overlay,
    .zs-product-card__view-link svg {
        transition: none;
    }

    .zs-product-card:hover {
        transform: none;
    }

    .zs-product-card:hover .zs-product-card__image img {
        transform: none;
    }

    a.zs-product-card:hover .zs-product-card__view-link svg {
        transform: none;
    }
}
