/* ========== 隐藏产品右上角 SALE ========== */
.wc-block-grid__product-onsale,
.wc-block-components-product-sale-badge,
.wp-block-woocommerce-product-image-gallery span.onsale {
    display: none !important;
}

/* ========== 相关产品 ========== */
.related-products h2 {
    font-size: var(--wp--preset--font-size--x-large) !important;
}
.related-products .wp-block-woocommerce-product-collection {
	margin: 2em 0;
    padding: 0;
}
.related-products .wp-block-button {
	display: none;
}

/* ========== 手机系统版本过低，用手机浏览器访问 https://www.footwearmach.com/cart/ 空购物车会显示一块黑色正方形 ========== */
/* 替换自带空购物车图标 */
h2.wc-block-cart__empty-cart__title.with-empty-cart-icon {
    background-image: url('/wp-content/uploads/shopping-cart.png');
    background-repeat: no-repeat;
    background-position: center top;
    background-size: 80px 80px; /* 控制图标大小，可自行调整 */
    padding-top: 100px; /* 给顶部图标留出空间，避免和文字重叠 */
    margin-top: 2rem; /* 给整个标题加上一点顶部距离 */
}

/* 隐藏自带的伪元素空购物车图标，避免重复显示 */
h2.wc-block-cart__empty-cart__title.with-empty-cart-icon::before {
    display: none !important;
}



/* ========== 首页产品，商店(Shop) 产品，相关产品，网格布局 ========== */
/* 1. 统一图片容器高度，针对 product-collection 内的 product-image 块 */
.wc-block-product-template .wc-block-components-product-image {
    width: 100%;
    height: 280px;                /* 桌面端固定高度 */
    background-color: #fff;    /* 留白区域的填充底色 */
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;            /* 让图片完整可见 */
}

/* 2. 覆盖 WooCommerce 默认的强制正方形比例 */
.wc-block-product-template .wc-block-components-product-image--aspect-ratio-1-1 {
    aspect-ratio: auto !important;
}

/* 3. 图片完整显示，不裁剪，让 a 标签也参与 flex 居中，确保图片在容器正中间 */
.wc-block-product-template .wc-block-components-product-image a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* 4. 图片等比缩小，不超过容器边界 */
.wc-block-product-template .wc-block-components-product-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
}

/* 5. 产品卡片纵向 Flex，确保按钮沉底 */
.wc-block-product-template > .wc-block-product {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* 6. 标题统一高度，超出省略 */
.wc-block-product-template .wp-block-post-title {
    min-height: 2.8em;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-top: 0.75rem !important;
    margin-bottom: 0.5rem !important;
}

/* 7. 价格与按钮间距 */
.wc-block-product-template .wp-block-woocommerce-product-price {
    margin-bottom: 0.5rem;
}

/* 8. 按钮始终沉底对齐 */
.wc-block-product-template .wp-block-woocommerce-product-button {
    margin-top: auto;
    width: 100%;
}

/* ========== 首页产品，商店(Shop) 产品，相关产品，响应式 ========== */
/* ========== 平板 (<= 1024px) ========== */
@media (max-width: 1024px) {
    .wc-block-product-template .wc-block-components-product-image {
        height: 240px;
    }
}
/* ========== 手机 (<= 768px) ========== */
@media (max-width: 768px) {
    .wc-block-product-template .wc-block-components-product-image {
        height: 200px;
    }
}
/* ========== 小屏手机 (<= 480px) ========== */
@media (max-width: 480px) {
    .wc-block-product-template .wc-block-components-product-image {
        height: 160px;
    }
}

