

/* 商品网格 */
.products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: auto;
  /* ✅ 强制每行高度由内容决定 */
  gap: 14px;
  padding: 2vw 1vw;
  justify-items: center;
  /* 水平居中每个产品 */
  width: 100%;
  max-width: 1200px;
  /* 确保网格不会超出容器 */
  margin: 0 auto; /* 水平居中 */
}

.product {
  background: #fff;
  border-radius: 4px;
  padding: 5px;
  text-align: center;
  transition: box-shadow 0.3s ease;
  max-width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}


.product:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  /* 手型光标 */
}

.product img {
  width: 100%;
  height: auto;
  max-height: 350px;
  /* 限制最大高度，避免图片过大 */
  display: block;
  object-fit: cover;
  /* 保持图像填充容器且不失真 */
  border-radius: 8px;
  margin-bottom: 12px;
  aspect-ratio: 1 / 1;
  /* 确保图片为正方形 */
}

.product h3 {
  font-size: 1.1rem;
  margin: 0 0 5px;
  line-height: 1.2;
  /* 缩小行间距 */
  text-decoration: none;
  /* 去掉下划线 */
  word-wrap: break-word;
  /* 确保长文本折行 */

  text-overflow: ellipsis;
  /* 超出部分显示省略号 */

}

.product .price {
  font-weight: bold;
  color: rgb(252, 24, 24);
  font-size: 0.95rem;
  margin: 0;
  /* 删除额外间距 */
  line-height: 1.4;
  /* 适当调整行间距 */
  text-decoration: none;
  /* 去掉下划线 */
  word-wrap: break-word;
  /* 确保价格长文本折行 */
  text-overflow: ellipsis;
  /* 超出部分显示省略号 */

}

/* 移动端响应样式 */
@media (max-width: 768px) {

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .product {
    padding: 0.2em;
    text-align: center;
  }

  .product img {
    max-height: 300px;
    /* 调整移动端图片尺寸 */
  }

}

