/* ============================================================
   nav.css — 顶部导航 / Mega Menu / 搜索 / 语言 / 移动端
   ============================================================ */

/* ---------- 头部容器 ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: var(--header-h);
  z-index: var(--z-header);
  color: #fff;
  transition: background .4s var(--ease), box-shadow .4s var(--ease), color .4s var(--ease);
}
/* 滚离首屏后变实色白底 */
.site-header.is-solid {
  background: #fff;
  color: var(--text);
  box-shadow: 0 2px 18px rgba(0, 0, 0, .08);
}

.nav-inner {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Logo ---------- */
.logo { flex: 0 0 auto; display: flex; align-items: center; }
.logo img { height: 38px; width: auto; transition: opacity .3s; }
/* 透明头部：深色 logo 反白显示 */
.logo .logo-white { filter: brightness(0) invert(1); }
.logo .logo-dark { display: none; }
.site-header.is-solid .logo .logo-white { display: none; }
.site-header.is-solid .logo .logo-dark { display: block; }

/* ---------- 桌面导航 ---------- */
.nav-desktop {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
}
.nav-list { display: flex; align-items: center; height: 100%; }
.nav-item { position: relative; height: 100%; display: flex; align-items: center; }
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 22px;
  height: 100%;
  font-size: 17px;
  letter-spacing: 1px;
  white-space: nowrap;
  transition: color .25s;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 22px; right: 22px; bottom: 22px;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform .3s var(--ease);
}
.nav-item:hover .nav-link::after { transform: scaleX(1); }
.site-header:not(.is-solid) .nav-link:hover { color: #fff; opacity: .85; }

/* 下拉箭头 */
.caret {
  width: 7px; height: 7px;
  margin-left: 7px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .3s var(--ease);
  opacity: .8;
}
.nav-item:hover .caret { transform: rotate(-135deg) translateY(-2px); }

/* ---------- Mega Menu ---------- */
.mega-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translate(-50%, 14px);
  display: flex;
  gap: 46px;
  padding: 34px 44px;
  background: #fff;
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease), visibility .3s;
  white-space: nowrap;
}
.nav-item:hover .mega-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
}
/* 点击菜单项跳转后立刻收起下拉，鼠标移出后再恢复 hover 行为 */
.nav-item.is-clicked .mega-menu {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 14px);
}
.mega-menu--wide { gap: 38px; padding: 30px 40px; }
.mega-col { display: flex; flex-direction: column; gap: 12px; }
.mega-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  transition: color .25s;
}
.mega-title:hover { color: var(--brand); }
.mega-sub { display: flex; flex-direction: column; gap: 10px; }
.mega-sub a {
  font-size: 14px;
  color: var(--text-2);
  transition: color .25s, padding-left .25s;
}
.mega-sub a:hover { color: var(--brand); padding-left: 4px; }

/* 产品/解决方案：2×3 网格，仅标题 */
.mega-menu--solutions {
  display: grid;
  grid-template-columns: repeat(2, minmax(200px, 1fr));
  gap: 22px 48px;
  padding: 28px 38px;
  white-space: normal;
  max-width: 620px;
}
.mega-menu--solutions .mega-col { gap: 8px; }

/* ---------- 右侧工具 ---------- */
.nav-tools { flex: 0 0 auto; display: flex; align-items: center; gap: 18px; margin-left: auto; }
.tool-btn { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; }
.tool-btn img { width: 20px; height: 20px; transition: transform .25s, filter .3s; }
.tool-btn:hover img { transform: scale(1.12); }
/* 搜索图标本身是白色，白底头部时反色为深色 */
.site-header.is-solid .tool-btn img { filter: brightness(0); }

/* 头部电话 */
.tool-phone {
  display: flex; align-items: center; gap: 6px;
  color: inherit; font-size: 15px; font-weight: 600;
  letter-spacing: .5px; white-space: nowrap;
  margin-right: 4px;
}
.tool-phone-ico { width: 18px; height: 18px; fill: currentColor; flex: 0 0 auto; }
.tool-phone:hover { opacity: .85; }
@media (max-width: 1100px) {
  .tool-phone { display: none; }
}

/* 语言切换（还原原站 nav_lan 结构） */
.nav_lan { position: relative; height: 100%; display: flex; align-items: center; cursor: pointer; }
.nav_lan_box { display: flex; align-items: center; }
.nav_lan_box a { color: inherit; font-size: 15px; letter-spacing: 1px; margin-right: 6px; white-space: nowrap; }
.nav_lan_box img { width: 10px; height: auto; filter: brightness(0) invert(1); transition: filter .3s; }
/* 白底实色头部时箭头转黑 */
.site-header.is-solid .nav_lan_box img { filter: brightness(0); }
.nav_lan_sel {
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%);
  display: none;
  box-shadow: 0 0 10px rgba(0, 0, 0, .05);
}
.nav_lan:hover .nav_lan_sel { display: block; }
.nav_lan_sel_box {
  padding: 5px 20px;
  background: #fff;
  display: flex; flex-direction: column; align-items: center;
}
.nav_lan_sel_box a { margin: 3px 0; white-space: nowrap; font-size: 14px; color: var(--text); transition: color .2s; }
.nav_lan_sel_box a:hover { color: var(--brand); }

/* ---------- 汉堡按钮（移动端） ---------- */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px; height: 40px;
  margin-left: 10px;
}
.hamburger span {
  display: block; height: 2px; width: 24px;
  background: currentColor; border-radius: 2px;
  transition: transform .3s var(--ease), opacity .3s;
}
.hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.is-open span:nth-child(2) { opacity: 0; }
.hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- 搜索面板 ---------- */
.search-panel {
  position: fixed;
  inset: 0;
  z-index: var(--z-search);
  background: rgba(11, 27, 51, .92);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity .35s var(--ease), visibility .35s;
}
.search-panel.is-open { opacity: 1; visibility: visible; }
.search-inner { width: min(760px, 86vw); text-align: center; position: relative; }
.search-inner h2 { color: #fff; font-size: 24px; font-weight: 400; margin-bottom: 28px; letter-spacing: 2px; }
.search-form {
  display: flex; align-items: center;
  border-bottom: 2px solid rgba(255, 255, 255, .5);
  padding-bottom: 14px;
}
.search-form input {
  flex: 1; background: none; border: none; outline: none;
  color: #fff; font-size: 22px; padding: 8px 6px;
}
.search-form input::placeholder { color: rgba(255, 255, 255, .55); }
.search-form button { display: flex; padding: 6px; }
.search-form button img { width: 26px; height: 26px; filter: brightness(0) invert(1); }
.search-close {
  position: absolute; top: -64px; right: 0;
  width: 44px; height: 44px;
  font-size: 30px; color: #fff; line-height: 1;
  border: 1px solid rgba(255, 255, 255, .4); border-radius: 50%;
  transition: transform .3s, background .3s;
}
.search-close:hover { transform: rotate(90deg); background: rgba(255, 255, 255, .12); }

/* ---------- 移动端侧边导航 ---------- */
.mobile-nav {
  position: fixed;
  top: 0; left: 0;
  width: 80%; max-width: 340px;
  height: 100%;
  background: #fff;
  z-index: var(--z-mobile);
  padding: 70px 0 30px;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform .35s var(--ease);
  box-shadow: 4px 0 24px rgba(0, 0, 0, .12);
}
.mobile-nav.is-open { transform: translateX(0); }
.m-nav-item { border-bottom: 1px solid var(--line); }
.m-nav-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; font-size: 16px; font-weight: 600; cursor: pointer;
}
.m-nav-title .caret { transform: rotate(45deg); }
.m-nav-item.is-open .m-nav-title .caret { transform: rotate(-135deg); }
.m-nav-con {
  display: none;
  padding: 4px 22px 16px;
  background: var(--bg-2);
}
.m-nav-item.is-open .m-nav-con { display: block; }
.m-nav-con a { display: block; padding: 10px 0; font-size: 14px; color: var(--text-2); }
.m-nav-link { display: block; padding: 16px 22px; font-size: 16px; font-weight: 600; color: var(--text); }
.m-nav-link:active { color: var(--brand); }

.mobile-mask {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: calc(var(--z-mobile) - 1);
  opacity: 0; visibility: hidden;
  transition: opacity .35s, visibility .35s;
}
.mobile-mask.is-open { opacity: 1; visibility: visible; }

/* ---------- 响应式切换 ---------- */
@media (max-width: 1100px) {
  .nav-desktop { display: none; }
  .nav-tools .nav_lan { display: none; }
  .hamburger { display: flex; }
}
@media (min-width: 1101px) {
  .mobile-nav, .mobile-mask { display: none; }
}
