/* ==========================================================================
   志铭中文站 · 产品中心 Mega 菜单
   结构（与外贸站一致）：左 = 两个二级分类（垂直居中）/ 中 = 该组小分类 /
   右 = 前 6 个产品（3 列 × 2 行铺满）+ 通栏「更多」按钮
   空分类 → 整块浅色背景占位，保证任何分组/小类切换时面板高度完全一致
   本文件自包含（生成页与首页 zblog 抓取版都引入），不依赖 site.css
   ========================================================================== */

/* 面板定位说明：
   UM002 主题中 .headerNav 为 position:fixed（顶部吸顶），面板作为它的
   子元素用 absolute 即可紧贴其下沿铺满整宽，同时**不修改** .headerNav 的
   定位方式，保证导航吸顶行为不变。 */
.megamenu {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: #fff;
  border-top: 2px solid #C80000;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .13);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .26s ease, transform .26s ease, visibility .26s;
  pointer-events: none;
}
.megamenu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.mega-wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px 30px;
  box-sizing: border-box;
}
/* 高度由内容决定：8 个小类都是 3 列 × 2 行，切换时高度天然一致，不跳高 */
.mega-layout {
  display: flex;
}

/* ---------- 左：两个二级分类（140px 高，整体垂直居中） ---------- */
.mega-groups {
  flex: 0 0 190px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding-right: 22px;
  border-right: 1px solid #ececec;
}
.mega-group {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 140px;
  padding: 8px 14px;
  border-radius: 6px;
  background: #f6f6f6;
  color: #333;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.mega-group span {
  display: block;
}
.mega-group:hover,
.mega-group.active {
  background: #C80000;
  color: #fff;
}
.mega-group:hover {
  text-decoration: none;
}
/* 选中项右侧小三角 */
.mega-group.active::after {
  content: "";
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 6px;
  border: 5px solid transparent;
  border-left-color: #C80000;
}

/* ---------- 中：该分组下的 7 个小分类（62px 高，垂直居中） ---------- */
.mega-subs {
  flex: 0 0 250px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 20px;
  border-right: 1px solid #ececec;
}
.mega-subcol {
  display: none;
}
.mega-subcol.active {
  display: flex;
  flex-direction: column;
}
.mega-sub {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 62px;
  padding: 0 12px;
  border-radius: 6px;
  color: #555;
  font-size: 14.5px;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  transition: background .15s, color .15s;
}
.mega-sub span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.mega-sub:hover,
.mega-sub.on {
  background: #f2f2f2;
  color: #1d1d1d;
  font-weight: 600;
  text-decoration: none;
}

/* ---------- 右：产品区 ---------- */
.mega-prods {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding-left: 26px;
}
.mega-prodlist {
  display: none;
}
.mega-prodlist.active {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}
.mega-prodhead {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 10px;
  margin-bottom: 13px;
  border-bottom: 1px solid #ececec;
}
.mega-prodhead h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #1d1d1d;
}
.mega-prodhead a {
  font-size: 13px;
  color: #C80000;
  text-decoration: none;
}
.mega-prodhead a:hover {
  text-decoration: underline;
}

/* 产品网格：固定 3 列 × 2 行 —— 任何分类都占满同样高度 */
.mega-prodgrid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, auto);
  gap: 24px 32px;
  align-content: center;
}
.mega-prod {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  color: #333;
  text-decoration: none;
}
.mega-prod:hover {
  text-decoration: none;
}
.mega-prodthumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 5 / 3;
  height: auto;
  border: 1px solid #f0f0f0;
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}
.mega-prodthumb img {
  display: block;
  width: 97%;
  height: 97%;
  object-fit: cover;
  object-position: center center;
}
.mega-prodthumb em {
  font-size: 13px;
  font-style: normal;
  color: #b5b5b5;
}
.mega-prodname {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 4px;
  border-bottom: 1px dashed #d8d8d8;
  color: #444;
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
  overflow: hidden;
  transition: background .15s, color .15s;
}
.mega-prod:hover .mega-prodthumb {
  border-color: #e2c9c9;
}
.mega-prod:hover .mega-prodname {
  background: #f7f7f7;
  color: #C80000;
}

/* 中间列表末尾的外链入口（VR 实景）：只跳转，不切右侧产品面板 */
.mega-sub-ext {
  margin-top: 8px;
  border-top: 1px dashed #e3e3e3;
  border-radius: 0 0 6px 6px;
  color: #C80000;
}
.mega-sub-ext:hover {
  background: #fdf3f3;
  color: #C80000;
}
.mega-vr-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 0 4px;
  border-radius: 3px;
  background: #C80000;
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  line-height: 15px;
  letter-spacing: .5px;
  vertical-align: 1px;
}

/* 空分类：整块浅色背景占位（与产品网格等高） */
.mega-blank {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  border-radius: 8px;
  background: #f7f8fa;
  text-align: center;
}
.mega-blank-t {
  margin: 0;
  color: #555;
  font-size: 16px;
  font-weight: 600;
}
.mega-blank-d {
  margin: 0;
  max-width: 520px;
  color: #9a9a9a;
  font-size: 13px;
  line-height: 1.75;
}
.mega-blank-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 9px 24px;
  border-radius: 4px;
  background: #C80000;
  color: #fff;
  font-size: 13px;
  text-decoration: none;
  transition: background .15s;
}
.mega-blank-btn:hover {
  background: #a80000;
  color: #fff;
  text-decoration: none;
}

/* ---------- 响应式（保持各列固定高，仍不跳高） ---------- */
@media (max-width: 1200px) {
  .mega-wrap {
    padding: 22px 22px;
  }
  .mega-groups {
    flex: 0 0 168px;
    padding-right: 18px;
  }
  .mega-subs {
    flex: 0 0 212px;
    padding: 0 14px;
  }
  .mega-prods {
    padding-left: 20px;
  }
  .mega-prodgrid {
    gap: 24px 24px;
  }
}
@media (max-width: 992px) {
  .mega-groups {
    flex: 0 0 148px;
  }
  .mega-group {
    height: 120px;
    font-size: 15.5px;
  }
  .mega-subs {
    flex: 0 0 176px;
  }
  .mega-sub {
    height: 58px;
    font-size: 13.5px;
  }
  .mega-prodname {
    font-size: 12.5px;
  }
}
@media (max-width: 860px) {
  .megamenu {
    display: none;
  }
}

/* 左侧大类改为 button（只切换面板、不再跳转），抹掉按钮默认样式 */
button.mega-group {
  width: 100%;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
button.mega-group:focus-visible {
  outline: 2px solid #C80000;
  outline-offset: 2px;
}

/* 手机端导航：产品中心直接进列表页，不做层级展开（照英文站做法），去掉下拉箭头 */
@media (max-width: 860px) {
  .navbar-item[data-mega] > .dot1 { display: none; }
}
