/* ============================================================
   梦之源官网 - products.css  硬件产品列表页
   依据 Figma 设计稿「硬件产品-列表」#283:1171:
   - 商品二级分类 tab (sticky) / 4 个分类 banner (360高) / 产品卡网格 (345×360)
   ============================================================ */

/* ---------- 商品二级分类 (sticky) ---------- */
.pl-cats {
  position: sticky;
  top: 64px;
  z-index: 50;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .05);   /* 设计稿 Rectangle 49 投影 */
  transition: top .3s var(--ease);
}
.pl-cats-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 64px;
}
/* PC: 横排 tab 列表 */
.pl-cats-list {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 96px;                                   /* 设计稿 tab 间距 96px */
}
.pl-cats-list a {
  font-size: 14px;
  font-weight: 513;
  color: #2D2F33;
  white-space: nowrap;
  transition: color .3s var(--ease);
}
.pl-cats-list a:hover,
.pl-cats-list a.active {
  color: #2168E5;
}
.pl-cats-list a.active {
  font-weight: 666;
  position: relative;
}
/* 移动端展开/收起箭头 (PC 隐藏) */
.pl-cats-arrow { display: none; }

/* ---------- 分类 banner (1920×360, 图铺满 + 白色文字叠加) ---------- */
.pl-banner {
  position: relative;
  width: 100%;
  height: 360px;
  overflow: hidden;
  background: #5F5F5F;              /* 图加载前灰底 (设计稿) */
}
.pl-banner-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;                /* 图铺满全屏 (设计稿 2048×360 cover) */
  pointer-events: none;
}
/* 白色文字叠加在图上 (设计稿 x=240, 顶 120px) */
.pl-banner-text {
  position: absolute;
  left: 12.5%;          /* 240/1920 设计稿: 相对区块宽度, 随屏幕自适应 */
  top: 33.3%;           /* 120/360 设计稿: 相对区块高度 */
  max-width: 520px;
  z-index: 2;
}
.pl-banner-text h2 {
  font-size: 36px;
  font-weight: 749;
  line-height: 48px;
  color: #fff;                      /* 白色 */
}
.pl-banner-text p {
  margin-top: 16px;
  font-size: 14px;
  font-weight: 503;
  line-height: 28px;
  color: rgb(255 255 255 / 75%);    /* 白色 75% */
}

/* ---------- 产品卡网格 (设计稿: 4列×345 + 3×20 = 1440) ---------- */
.pl-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 56px 0 56px;                    /* 与下一个 banner 间距 56px */
}
.pl-cat:last-of-type .pl-grid { padding-bottom: 88px; }   /* 最后一段 → footer 88px */
.pl-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  height: 396px;
  background: #EDEEF0;          /* 设计稿卡背景 */
  border-radius: 6px;
  overflow: hidden;
  text-align: center;
  transition: box-shadow .35s var(--ease), transform .35s var(--ease);
}
/* 图区 (设计稿 345×276 灰底 #D9D9D9, 双图 hover: 黑屏→彩屏) */
.pl-card-img {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 295px;
  background: #EDEEF0;
  overflow: hidden;
}
.pl-card-img img {
  max-height: 75%;             /* 设计稿: 产品图约占图区 46%–75% */
  max-width: 66%;
  object-fit: contain;
  transition: transform .4s var(--ease), opacity .3s var(--ease);
}
.pl-card-img .img-color { position: absolute; opacity: 0; }   /* 彩屏图默认隐藏 */
.pl-card:hover .img-dark { opacity: 0; }                     /* hover: 黑屏淡出 */
.pl-card:hover .img-color { opacity: 1; transform: scale(1.06); }  /* 彩屏显示+放大 */

.pl-card h3 {
  margin-top: 0;                 /* 设计稿: 标题紧贴图区下方 (y=276) */
  font-size: 20px;
  font-weight: 666;
  line-height: 32px;
  color: #2E3033;
}
.pl-card p {
  margin-top: 8px;               /* 设计稿: 标题下方 8px */
  font-size: 14px;
  font-weight: 513;
  line-height: 20px;
  color: #222426;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1336px) {
  .pl-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1100px) {
  .pl-banner-text { left: 8.7%; }
}
@media (max-width: 767px) {
  /* 移动端: 二级分类折叠列表 (PC 横排 tab 改为竖排折叠面板)
     折叠时只显示当前高亮那一行, 展开时直接展示完整竖排列表(无重复行) */
  .pl-cats { position: sticky; }
      .pl-cats-inner {
        height: auto;
        padding: 0;
        justify-content: flex-start;
        width: 100%;
    }
  /* 展开/收起箭头: 悬浮在列表当前行右侧 */
  .pl-cats-arrow {
    position: absolute;
    top: 0;
    right: 16px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 48px;
    color: #2D2F33;
    cursor: pointer;
  }
  .pl-cats-chevron {
    width: 20px;
    height: 20px;
    flex: none;
    transition: transform .3s var(--ease);
  }
  .pl-cats.open .pl-cats-chevron { transform: rotate(180deg); }
  /* 竖排列表: 默认折叠(只显示当前高亮项), 展开显示全部 */
  .pl-cats-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    justify-content: flex-start;   /* 文字靠左, 不居中 */
    align-items: stretch;
    width: 100%;
  }
  .pl-cats-list a {
    display: none;
    align-items: center;
    justify-content: flex-start;
    height: 48px;
    padding: 0 20px;
    font-size: 14px;
    font-weight: 513;
    color: #2D2F33;
    border-bottom: 1px solid #F3F4F6;
  }
  .pl-cats-list a:last-child { border-bottom: none; }
  /* 折叠态: 当前高亮项作为列表第一行显示 (仅文字蓝色 + 下划线) */
  .pl-cats-list a.active {
    display: flex;
    color: #2168E5;
    font-weight: 666;
    background: none;
    text-underline-offset: 4px;
  }
  /* 展开态: 显示全部项 */
.pl-cats.open .pl-cats-list a {
        width: 100%;
        display: block;
        line-height: 48px;
    }
  /* 移动端锚点偏移: 顶部导航64 + 折叠第一行48 = 112px */
  .pl-cat { scroll-margin-top: 112px; }

  .pl-banner { height: 300px; }
  /* 图铺满 + 半透明遮罩保证白字可读 */
  .pl-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(20, 24, 32, .35);
    z-index: 1;
  }
  .pl-banner-text {
    left: 24px;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    max-width: none;
    text-align: center;
  }
  .pl-banner-text h2 { font-size: 26px; line-height: 38px; }
  .pl-banner-text p { font-size: 13px; line-height: 22px; }
  .pl-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 32px 12px 48px;
  }
  .pl-card { height: auto; padding: 0 10px 30px; }   /* 客户要求: 移动端自适应高度 + 内边距 */
  .pl-card-img { height: auto; }                    /* 客户要求: 图区自适应高度 */
  .pl-card-img img {                                /* 客户要求: 移动端产品图放宽到 100% */
    max-height: 75%;
    max-width: 100%;
    object-fit: contain;
    transition: transform .4s var(--ease), opacity .3s var(--ease);
  }
  .pl-card h3 { font-size: 17px; line-height: 26px; margin-top: 0; }
  .pl-card p { font-size: 12px; line-height: 18px; margin-top: 4px; }
}

/* ---------- 产品列表页头部: 始终白底 (不随滚动变透明) ---------- */
body.page-products .site-header,
body.page-products .site-header.is-scrolled {
  background: #fff;
  box-shadow: inset 0 -1px 0 0 #EBEBEB;
}
body.page-products .site-header .logo-dark { display: block; }
body.page-products .site-header .logo-light { display: none; }
body.page-products .site-header .navbar > li > a { color: #2E3033; }
body.page-products .site-header .navbar > li > a:hover,
body.page-products .site-header .navbar > li.active > a { color: #2168E5; }
body.page-products .site-header .vr-pill { border-color: #5C6066; color: #2E3033; }
body.page-products .site-header:not(.is-scrolled):not(.dd-open) .icon-btn img { filter: none; }
body.page-products .site-header:not(.is-scrolled):not(.dd-open) .nav-toggle span { background: #2E3033; }

/* 滚动方向交互: 顶部导航随滚动隐藏/回来 */
body.page-products .site-header {
  transition: background .3s var(--ease), box-shadow .3s var(--ease),
              transform .3s var(--ease);
}
/* 向下滚动: 顶部导航上移隐藏, 二级导航吸顶到视口顶部 */
body.page-products.nav-hide .site-header {
  transform: translateY(-100%);
}
body.page-products.nav-hide .pl-cats {
  top: 0;
}

/* 分类区块: 锚点滚动偏移 (顶部导航64 + sticky分类栏64 = 128px), banner 不被遮挡 */
.pl-cat {
  scroll-margin-top: 128px;
}

/* 产品列表页: main 顶部补偿 fixed header (64px), 防止 .pl-cats/banner 被头部遮挡 */
body.page-products main {
  padding-top: 64px;
}
