/*
 * www.vipzai.com - 手机端产品列表页专用样式
 * 依赖：/m/skin/css/vipzai-design-system.css
 * 作用域：body.m-product-list-template
 *
 * 维护原则：
 * 1. 只控制手机端产品中心及产品分类列表页。
 * 2. 保留现有两列产品卡片、分页和底部 CTA 布局。
 * 3. 图片只在产品卡片媒体容器中按 4:3 居中裁切。
 * 4. 不影响产品详情主图、正文长图、案例、文章及 PC 页面。
 */

body.m-product-list-template,
body.m-product-list-template * {
  box-sizing: border-box;
}

body.m-product-list-template {
  padding-bottom: 1.05rem;
  overflow-x: hidden;
}

/* 顶部栏目区域：保留现有结构与交互。 */
.m-product-list-template .cateList h2 {
  position: relative;
  min-width: 0;
  margin: 0;
  font-size: .3rem;
  font-weight: normal;
  overflow-wrap: anywhere;
}

.m-product-list-template .cateList h2 s {
  position: absolute;
  top: .34rem;
  right: .4rem;
  display: none;
  width: .22rem;
  height: .18rem;
  margin-left: .1rem;
  background-position: -1.06rem -2.2rem;
}

.m-product-list-template .m-product-list-page {
  min-width: 0;
  padding-top: 0;
}

/* 栏目标题与简介。 */
.m-product-list-template .m-product-list-head {
  min-width: 0;
  margin: 0 3%;
  padding: .3rem 0 .22rem;
  border-bottom: 1px solid var(--vip-border);
}

.m-product-list-template .m-product-list-head h1 {
  margin: 0;
  color: var(--vip-heading);
  font-size: .36rem;
  line-height: 1.45;
  text-align: left;
  overflow-wrap: anywhere;
}

.m-product-list-template .m-product-list-head p {
  margin: .12rem 0 0;
  color: var(--vip-muted);
  font-size: .23rem;
  line-height: 1.65;
  text-align: justify;
  overflow-wrap: anywhere;
}

/*
 * 产品网格：保持手机端两列。
 * 明确覆盖旧 style.css 中可能残留的 float、固定宽度和 nth-child 外边距。
 */
.m-product-list-template .m-product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .22rem .18rem;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: .26rem 3% .12rem;
  list-style: none;
}

.m-product-list-template .m-product-grid::before,
.m-product-list-template .m-product-grid::after {
  display: none;
  content: none;
}

.m-product-list-template .m-product-grid .m-product-card,
.m-product-list-template .m-product-grid .m-product-card:nth-child(2n) {
  display: flex;
  min-width: 0;
  width: auto;
  height: 100%;
  margin: 0;
  padding: 0;
  float: none;
  overflow: hidden;
  background: var(--vip-white);
  border: 1px solid var(--vip-border);
  border-radius: var(--vip-radius-sm);
}

.m-product-list-template .m-product-card > a {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.m-product-list-template .m-product-card > a:focus-visible {
  outline: 2px solid var(--vip-primary);
  outline-offset: -2px;
  box-shadow: var(--vip-focus-ring);
}

/*
 * 产品缩略图媒体盒：padding-top 为旧浏览器兜底；现代浏览器使用 aspect-ratio。
 * 图片只在本组件内裁切，不会影响产品主图及正文详情图。
 */
.m-product-list-template .m-product-card-media {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 100%;
  margin: 0;
  padding-top: 75%;
  overflow: hidden;
  background: var(--vip-bg-soft);
}

@supports (aspect-ratio: 4 / 3) {
  .m-product-list-template .m-product-card-media {
    aspect-ratio: 4 / 3;
    padding-top: 0;
  }
}

.m-product-list-template .m-product-card-media img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 0;
  margin: 0;
  object-fit: cover;
  object-position: center;
  background: var(--vip-bg-soft);
}

/* 文字区域与图片区分离，标题长短不改变图片高度。 */
.m-product-list-template .m-product-card-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  padding: .15rem .14rem .16rem;
}

.m-product-list-template .m-product-card h2 {
  display: -webkit-box;
  min-height: .76rem;
  height: auto;
  margin: 0;
  padding: 0;
  overflow: hidden;
  color: var(--vip-heading);
  font-size: .26rem;
  font-weight: normal;
  line-height: .38rem;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.m-product-list-template .m-product-card span {
  display: inline-block;
  align-self: flex-start;
  margin-top: auto;
  padding-top: .08rem;
  color: var(--vip-primary);
  font-size: .21rem;
  line-height: 1.5;
}

.m-product-list-template .m-product-card span::after {
  content: " →";
}

/* 分页：清除旧浮动，并补齐触摸与键盘焦点状态。 */
.m-product-list-template .m-product-pagination {
  clear: both;
  float: none;
  min-width: 0;
  padding: .26rem 3% .14rem;
}

.m-product-list-template .m-product-pagination a:hover,
.m-product-list-template .m-product-pagination .active a {
  color: var(--vip-white);
  background: var(--vip-primary);
  border-color: var(--vip-primary);
}

.m-product-list-template .m-product-pagination a:focus-visible {
  outline: 2px solid var(--vip-primary);
  outline-offset: 2px;
  box-shadow: var(--vip-focus-ring);
}

/* 底部询价 CTA：保留现有两按钮布局。 */
.m-product-list-template .m-product-list-cta {
  min-width: 0;
  margin: .28rem 3% .35rem;
  padding: .28rem .24rem;
  color: var(--vip-white);
  background: var(--vip-surface-dark);
  border-radius: var(--vip-radius-md);
}

.m-product-list-template .m-product-list-cta h2 {
  margin: 0;
  color: var(--vip-white);
  font-size: .32rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.m-product-list-template .m-product-list-cta p {
  margin: .1rem 0 0;
  color: rgba(255, 255, 255, .82);
  font-size: .23rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.m-product-list-template .m-product-list-cta-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .14rem;
  margin-top: .2rem;
}

.m-product-list-template .m-product-list-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: .72rem;
  padding: .1rem .14rem;
  border: 1px solid transparent;
  border-radius: var(--vip-radius-sm);
  font-size: .25rem;
  line-height: 1.35;
  text-align: center;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
}

.m-product-list-template .m-product-list-btn:focus-visible {
  outline: 2px solid var(--vip-white);
  outline-offset: 2px;
}

.m-product-list-template .m-product-list-btn--primary {
  color: var(--vip-white);
  background: var(--vip-accent);
  border-color: var(--vip-accent);
}

.m-product-list-template .m-product-list-btn--secondary {
  color: var(--vip-white);
  background: transparent;
  border-color: rgba(255, 255, 255, .58);
}

/* 极窄屏仍保持两列，但缩小间距，避免卡片或按钮溢出。 */
@media (max-width: 360px) {
  .m-product-list-template .m-product-grid {
    gap: .18rem .12rem;
    padding-right: 2.5%;
    padding-left: 2.5%;
  }

  .m-product-list-template .m-product-card-body {
    padding-right: .11rem;
    padding-left: .11rem;
  }

  .m-product-list-template .m-product-list-cta-actions {
    gap: .1rem;
  }

  .m-product-list-template .m-product-list-btn {
    padding-right: .08rem;
    padding-left: .08rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .m-product-list-template .m-product-card,
  .m-product-list-template .m-product-card-media img,
  .m-product-list-template .m-product-list-btn {
    transition: none;
  }
}
