/*
 * ==========================================
 * 模块定位：产品页面 - 相关推荐卡片网格视觉规范 (5列紧凑版)
 * 代码类型：CSS (与产品列表特效完全同步版)
 * ==========================================
 */

.mx-related-product {
    padding: 30px 30px;
    background-color: #fff;
    border: 1px solid #f2f2f2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    margin-top: 20px; /* 👈 由这个重模块全权负责推开顶部的距离 */
    box-sizing: border-box;
    transform: translateZ(0); 
}

.mx-related-product__section-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 25px 0;
    position: relative;
    padding-bottom: 12px;
}

.mx-related-product__section-title::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 30px;
    height: 3px;
    background-color: #0056b3;
}

/* 一排 5 列布局 */
.mx-related-product__grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

/* 卡片本体：完全透明、无边框、无阴影 */
.mx-related-product__item {
    position: relative;
    display: block;
    width: 100%;
    box-sizing: border-box;
    background-color: transparent;
    border: none;
}

.mx-related-product__item::before {
    display: none;
}

.mx-related-product__link {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    height: 100%;
    outline: none;
}

/* 图片容器：无底色、无边框 */
.mx-related-product__image-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: transparent;
    overflow: hidden;
    position: relative;
    border: none;
    margin-bottom: 15px; /* 增加底部间距以配合列表排版 */
}

/* 图片特效：同步列表的 contain 模式和过渡动画 */
.mx-related-product__image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain; 
    transition: transform 0.4s ease, opacity 0.3s ease;
}

.mx-related-product__meta {
    padding: 0 10px;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 标题：同步列表的 15px，400字重 */
.mx-related-product__title {
    margin: 0;
    padding: 0;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.4;
    color: #333333;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s ease;
}

/* ==========================================
 * 悬停特效 (Hover) - 同步产品列表
 * ========================================== */

/* 悬停时图片微微放大且变半透明 */
.mx-related-product__item:hover .mx-related-product__image-wrap img {
    transform: scale(1.05);
    opacity: 0.9;
}

/* 悬停时标题变深蓝 */
.mx-related-product__item:hover .mx-related-product__title {
    color: #003366;
}

/* 键盘焦点辅助访问 */
.mx-related-product__link:focus-visible .mx-related-product__item {
    outline: 2px solid #003366;
    outline-offset: 4px;
}

/* ==========================================
 * 响应式断点
 * ========================================== */
@media (max-width: 1200px) {
    .mx-related-product__grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .mx-related-product__grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .mx-related-product {
        margin-top: 0; /* 修改为 0，彻底消除红框部分的间距 */
        margin-bottom: 0 !important;
        padding: 30px 10px !important;
        border-radius: 0;
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
        border-color: #f0f0f0;
        border-bottom: none !important;
    }
    .mx-related-product__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .mx-related-product__grid {
        gap: 10px;
    }
    .mx-related-product__meta {
        padding: 0 8px;
    }
    .mx-related-product__title {
        font-size: 14px; /* 移动端字号微调 */
    }
}