/* ==========================================================================
   产品分类展示模块 (v2 - 质感升级版)
   首页 banner 下方 | 图片 + 描述 + 品牌深蓝配色
   ========================================================================== */

/* 区域背景 */
.product-categories-section {
  padding: 72px 0 60px;
  background: linear-gradient(180deg, #fff 0%, #f4f6f8 40%, #eef1f5 100%);
  position: relative;
  overflow: hidden;
}

/* 顶部装饰线 */
.product-categories-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, transparent, #002f60, transparent);
  border-radius: 0 0 2px 2px;
}

.product-categories-section .sec-title {
  margin-bottom: 48px;
}

.product-categories-section .sec-title h2 {
  font-size: 36px;
  font-weight: 700;
  color: #002f60;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}

.product-categories-section .sec-title .sub-title {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: #002f60;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
  padding: 5px 20px;
  background: rgba(0, 47, 96, 0.06);
  border-radius: 30px;
  border: 1px solid rgba(0, 47, 96, 0.08);
}

.section-description {
  color: #5b6778;
  max-width: 660px;
  margin: 12px auto 0;
  font-size: 15px;
  line-height: 1.7;
}

/* 网格布局 - 桌面端4列 */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

/* ==========================================================================
   卡片基础样式
   ========================================================================== */

.category-card {
  position: relative;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

/* 顶部色条 */
.category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--cat-color, #002f60);
  z-index: 2;
  transition: height 0.35s ease;
}

/* ==========================================================================
   缩略图区域 + 图片缺失时CSS兜底
   ========================================================================== */

.card-thumb {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--cat-light, #e8ecf2), #f0f4f8);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.category-card:hover .card-thumb img {
  transform: scale(1.06);
}

/* 图片缺失时的兜底：分类颜色圆形 + 首字 */
.card-thumb img[src=""],
.card-thumb img:not([src]),
.card-thumb:has(img[src=""])::after,
.card-thumb.no-image::after {
  content: '';
  display: none;
}

/* JS/CSS 兜底：img 加载失败时显示彩色占位 */
@keyframes subtle-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.85; }
}

.card-thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  width: 68px;
  height: 68px;
  margin: auto;
  border-radius: 50%;
  background: var(--cat-color, #002f60);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.card-thumb img.error-fallback ~ .card-thumb::before,
.card-thumb:has(img[src=""])::before {
  opacity: 0.13;
}

/* ==========================================================================
   卡片文字区域
   ========================================================================== */

.card-content {
  padding: 20px 20px 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.category-card h3 {
  font-size: 17px;
  font-weight: 700;
  color: #002f60;
  margin: 0 0 8px;
  line-height: 1.35;
  letter-spacing: -0.2px;
}

.category-card .card-desc {
  font-size: 13px;
  color: #637081;
  line-height: 1.65;
  margin-bottom: 16px;
  flex: 1;
}

/* "了解更多"链接 */
.category-card .learn-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--cat-color, #002f60);
  text-decoration: none;
  margin-top: auto;
  padding: 6px 0;
  transition: gap 0.3s ease, color 0.3s ease;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding-top: 14px;
}

.category-card .learn-more i {
  font-size: 11px;
  transition: transform 0.3s ease;
}

/* ==========================================================================
   8 个产品分类配色 —— 统一为 #002f60 深蓝 → #0E7490 青蓝 同色系深浅
   （已去除紫 / 红 / 橙 / 绿等杂色，配合全局方案 B）
   ========================================================================== */

/* 1. 显色底物 - 最深海军蓝 */
.category-card.cat-c1 {
  --cat-color: #002f60;
  --cat-light: rgba(0, 47, 96, 0.07);
  --cat-hover-glow: rgba(0, 47, 96, 0.16);
}

/* 2. 发光底物 */
.category-card.cat-c2 {
  --cat-color: #0A3D77;
  --cat-light: rgba(10, 61, 119, 0.07);
  --cat-hover-glow: rgba(10, 61, 119, 0.16);
}

/* 3. 酶&蛋白稳定剂 */
.category-card.cat-c3 {
  --cat-color: #134E8C;
  --cat-light: rgba(19, 78, 140, 0.07);
  --cat-hover-glow: rgba(19, 78, 140, 0.16);
}

/* 4. 阻断剂 */
.category-card.cat-c4 {
  --cat-color: #1D63A6;
  --cat-light: rgba(29, 99, 166, 0.07);
  --cat-hover-glow: rgba(29, 99, 166, 0.16);
}

/* 5. 封闭液 - 青蓝主调 */
.category-card.cat-c5 {
  --cat-color: #0E7490;
  --cat-light: rgba(14, 116, 144, 0.07);
  --cat-hover-glow: rgba(14, 116, 144, 0.16);
}

/* 6. 优化剂/增强剂 */
.category-card.cat-c6 {
  --cat-color: #13899C;
  --cat-light: rgba(19, 137, 156, 0.07);
  --cat-hover-glow: rgba(19, 137, 156, 0.16);
}

/* 7. IVD 防腐剂 */
.category-card.cat-c7 {
  --cat-color: #1E9DA8;
  --cat-light: rgba(30, 157, 168, 0.07);
  --cat-hover-glow: rgba(30, 157, 168, 0.16);
}

/* 8. 辅助试剂 - 最亮青蓝 */
.category-card.cat-c8 {
  --cat-color: #36B0B8;
  --cat-light: rgba(54, 176, 184, 0.07);
  --cat-hover-glow: rgba(54, 176, 184, 0.16);
}

/* ==========================================================================
   悬停效果（增强质感）
   ========================================================================== */

.category-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06),
              0 12px 36px var(--cat-hover-glow, rgba(0, 47, 96, 0.16));
  border-color: rgba(0, 0, 0, 0.06);
}

.category-card:hover::before {
  height: 5px;
}

.category-card:hover .learn-more {
  gap: 10px;
  color: var(--cat-color, #002f60);
}

/* ==========================================================================
   响应式设计
   ========================================================================== */

@media (max-width: 991px) {
  .product-categories-section {
    padding: 50px 0 45px;
  }

  .product-categories-section .sec-title h2 {
    font-size: 28px;
  }

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

  .card-thumb {
    height: 160px;
  }

  .card-content {
    padding: 16px 16px 14px;
  }

  .category-card h3 {
    font-size: 16px;
  }
}

@media (max-width: 767px) {
  .product-categories-section {
    padding: 40px 0 35px;
  }

  .product-categories-section .sec-title h2 {
    font-size: 22px;
  }

  .product-categories-section .sec-title {
    margin-bottom: 32px;
  }

  .categories-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .category-card {
    flex-direction: row;
  }

  .card-thumb {
    width: 120px;
    min-width: 120px;
    height: 100px;
    border-radius: 10px 0 0 10px;
  }

  .card-content {
    flex: 1;
    padding: 14px 16px;
  }

  .category-card h3 {
    font-size: 15px;
    margin-bottom: 4px;
  }

  .category-card .card-desc {
    font-size: 12px;
    margin-bottom: 10px;
  }

  .category-card .learn-more {
    font-size: 12px;
    border-top: 0;
    padding-top: 0;
  }
}
