/* ═══ SHOP GRID — Product archive layout ═════════════ */

/* ── Archive header ── */
body.inkside-theme .woocommerce-products-header {
    margin-bottom: var(--ink-space-lg);
}

body.inkside-theme .woocommerce-products-header__title {
    font-family: var(--ink-font);
    font-size: var(--ink-font-size-2xl);
    font-weight: 800;
    color: var(--ink-text);
    margin-bottom: var(--ink-space-sm);
}

body.inkside-theme .woocommerce-products-header .term-description {
    font-size: var(--ink-font-size-base);
    color: var(--ink-text-muted);
    max-width: 680px;
}

/* ── Top bar (count + sort) ── */
body.inkside-theme .ink-shop-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--ink-space-md);
    margin-bottom: var(--ink-space-lg);
    padding-bottom: var(--ink-space-md);
    border-bottom: 1px solid var(--ink-border);
}

/* ── Active filters (chips) ── */
body.inkside-theme .ink-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ink-space-xs);
    margin-bottom: var(--ink-space-md);
}

body.inkside-theme .ink-active-filters:empty {
    display: none;
}

body.inkside-theme .ink-active-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    font-size: var(--ink-font-size-xs);
    font-weight: 600;
    color: var(--ink-text);
    background: linear-gradient(135deg, rgba(48,73,97,0.06), rgba(48,73,97,0.10));
    border: 1px solid rgba(48,73,97,0.12);
    border-radius: var(--ink-radius-full);
    cursor: pointer;
    text-transform: capitalize;
    transition: all var(--ink-transition-fast);
}

body.inkside-theme .ink-active-filter:hover {
    background: rgba(48,73,97,0.12);
    border-color: rgba(48,73,97,0.20);
}

body.inkside-theme .ink-active-filter--clear {
    background: transparent;
    border-color: var(--ink-border);
    color: var(--ink-text-muted);
}

body.inkside-theme .ink-active-filter--clear:hover {
    background: rgba(239,68,68,0.06);
    border-color: rgba(239,68,68,0.30);
    color: var(--ink-red);
}

body.inkside-theme .ink-active-filter__remove {
    display: inline-flex;
    font-size: 14px;
    line-height: 1;
    color: var(--ink-text-faint);
    transition: color var(--ink-transition-fast);
}

body.inkside-theme .ink-active-filter:hover .ink-active-filter__remove {
    color: var(--ink-red);
}

/* ── Empty state ── */
body.inkside-theme .ink-shop-empty {
    text-align: center;
    padding: var(--ink-space-4xl) var(--ink-space-md);
    color: var(--ink-text-muted);
}

body.inkside-theme .ink-shop-empty__icon {
    font-size: 48px;
    margin-bottom: var(--ink-space-md);
    opacity: 0.4;
}

body.inkside-theme .ink-shop-empty__text {
    font-size: var(--ink-font-size-lg);
    font-weight: 600;
    margin-bottom: var(--ink-space-sm);
}

/* ── Loading overlay ── */
body.inkside-theme .ink-shop-loading {
    position: relative;
    min-height: 200px;
}

body.inkside-theme .ink-shop-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.7);
    z-index: 5;
    border-radius: var(--ink-radius-lg);
}

body.inkside-theme .ink-shop-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 3px solid var(--ink-border);
    border-top-color: var(--ink-primary);
    border-radius: 50%;
    z-index: 6;
    animation: ink-spin 0.7s linear infinite;
}

/* ── Product card — unified vertical rhythm ───────────
 * Cards in the same row share an identical structure:
 *   [thumbnail (1:1)] → [title 2 lines] → [meta] → [price] → [CTA]
 * The body is a flex column with `flex: 1 1 auto` so price + CTA are pinned
 * to the bottom via `margin-top: auto`, regardless of title length.
 */
body.inkside-theme .woocommerce ul.products li.product.ink-product-card,
body.inkside-theme.archive ul.products li.product {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Thumbnail wrapper — square, never distorted */
body.inkside-theme .woocommerce ul.products li.product.ink-product-card .ink-card__media,
body.inkside-theme .woocommerce ul.products li.product.ink-product-card > a img:first-child,
body.inkside-theme.archive ul.products li.product > a img:first-child {
    aspect-ratio: 1 / 1;
    width: 100%;
    object-fit: cover;
    background: var(--ink-bg-muted);
    border-radius: var(--ink-radius-md) var(--ink-radius-md) 0 0;
    flex-shrink: 0;
}

/* Body — fills remaining vertical space */
body.inkside-theme .woocommerce ul.products li.product.ink-product-card .ink-card__body,
body.inkside-theme.archive ul.products li.product .ink-card__body {
    padding: var(--ink-space-md);
    display: flex;
    flex-direction: column;
    gap: var(--ink-space-xs);
    flex: 1 1 auto;
    min-height: 0;
}

/* Title — locked to exactly 2 lines on every breakpoint */
body.inkside-theme .woocommerce ul.products li.product.ink-product-card .woocommerce-loop-product__title,
body.inkside-theme.archive ul.products li.product .woocommerce-loop-product__title {
    font-family: var(--ink-font);
    font-size: var(--ink-font-size-base);
    font-weight: 600;
    color: var(--ink-text);
    line-height: 1.35;
    /* Fixed dual-line slot so price/CTA align across cards */
    min-height: calc(1.35em * 2);
    max-height: calc(1.35em * 2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding: 0;
    margin: 0;
}

/* Optional meta line (category / SKU) — single line, fixed slot */
body.inkside-theme .woocommerce ul.products li.product.ink-product-card .ink-card__meta,
body.inkside-theme.archive ul.products li.product .ink-card__meta {
    font-size: var(--ink-font-size-xs);
    color: var(--ink-text-muted);
    line-height: 1.3;
    min-height: 1.3em;
    max-height: 1.3em;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Price — pinned just above the CTA */
body.inkside-theme .woocommerce ul.products li.product.ink-product-card .price,
body.inkside-theme.archive ul.products li.product .price {
    padding: 0;
    margin: 0;
    margin-top: auto;
    font-family: var(--ink-font);
    font-size: var(--ink-font-size-md);
    font-weight: 700;
    color: var(--ink-price);
    line-height: 1.2;
    min-height: 1.2em;
}

body.inkside-theme .woocommerce ul.products li.product.ink-product-card .price del,
body.inkside-theme.archive ul.products li.product .price del {
    color: var(--ink-text-faint);
    font-weight: 500;
    margin-right: var(--ink-space-xs);
}

body.inkside-theme .woocommerce ul.products li.product.ink-product-card .price ins,
body.inkside-theme.archive ul.products li.product .price ins {
    text-decoration: none;
    color: var(--ink-price);
}

/* CTA — uniform height across all cards & breakpoints */
body.inkside-theme .woocommerce ul.products li.product.ink-product-card .button,
body.inkside-theme .woocommerce ul.products li.product.ink-product-card .add_to_cart_button,
body.inkside-theme .woocommerce ul.products li.product.ink-product-card .ink-card__cta,
body.inkside-theme.archive ul.products li.product .button,
body.inkside-theme.archive ul.products li.product .add_to_cart_button,
body.inkside-theme.archive ul.products li.product .ink-card__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: var(--ink-btn-height-sm);
    margin-top: var(--ink-space-sm);
    padding: 0 var(--ink-space-md);
    font-family: var(--ink-font);
    font-size: var(--ink-font-size-sm);
    font-weight: var(--ink-btn-font-weight);
    line-height: 1;
    border-radius: var(--ink-btn-radius);
    box-sizing: border-box;
    flex-shrink: 0;
}

/* ── Responsive grid ── *
 * Use the same scoped selectors as overrides/woocommerce.css to keep
 * specificity aligned and avoid Elementor Pro Products widget overrides.
 */
@media (max-width: 768px) {
    body.inkside-theme.archive.woocommerce-page ul.products,
    body.inkside-theme.archive ul.products,
    body.inkside-theme.post-type-archive-product ul.products,
    body.inkside-theme.tax-product_cat ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--ink-space-sm);
    }
}

@media (max-width: 480px) {
    body.inkside-theme.archive.woocommerce-page ul.products,
    body.inkside-theme.archive ul.products,
    body.inkside-theme.post-type-archive-product ul.products,
    body.inkside-theme.tax-product_cat ul.products {
        grid-template-columns: 1fr;
    }
}

/* ── Spinner keyframes ── */
@keyframes ink-spin {
    to { transform: rotate(360deg); }
}

