/* ============================================================
   TWZX 全站统一顶部导航 —— 样式（唯一来源）
   与 shared/header.html 配套：凡 include 了母版的页面自动获得本文件，
   页面自身无需再带任何导航 CSS。

   来源：/css/style-new.css 中全部导航相关规则的抽取（2026-09-18）。
   规则顺序与 style-new.css 保持一致，以保证层叠结果不变。

   唯一例外：.site-header 的盒模型规则用 :where() 包裹（特异性 0），
   以便个别页面（如 insights/*）自带的 .site-header 覆盖仍然生效。
   ============================================================ */

:root {
  --primary: #2ECC71;
  --primary-dark: #27AE60;
  --primary-light: #E8F8F0;
  --primary-lighter: #F0FFF7;

  --white: #FFFFFF;
  --gray-50: #F5F5F5;
  --gray-100: #F0F0F0;
  --gray-200: #E0E0E0;
  --gray-300: #BDBDBD;
  --gray-400: #9E9E9E;
  --gray-500: #757575;
  --gray-600: #616161;
  --gray-700: #424242;
  --gray-800: #303030;
  --gray-900: #212121;

  --text-primary: var(--gray-900);
  --text-secondary: var(--gray-600);
  --text-muted: var(--gray-400);

  --container-width: 1226px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;
  --space-2xl: 56px;
  --space-3xl: 80px;

  --tw-green-600:#16A35A;
  --tw-green-700:#0E7A48;
  --tw-green-900:#0E3B2E;
  --tw-ink:#16201B;
  --tw-ink-2:#3A463F;
  --tw-muted:#6B7A70;
  --tw-surface:#FFFFFF;
  --tw-surface-2:#F3F6F2;
  --tw-line:#E7EAE6;
  --tw-glow:0 10px 40px rgba(46,204,113,.28);
  --tw-r-sm:8px;
  --tw-r-pill:999px;
}

/* —— 导航容器内的最小重置（不污染页面其它区域）—— */
.site-header, .site-header *,
.mobile-drawer, .mobile-drawer *,
.drawer-backdrop {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
/* 注意：这里只去下划线，不设 color —— 否则 .site-header a (0,1,1)
   会压过 .nav-link 的 color (0,1,0)，导致抽屉链接丢失灰阶配色。 */
.site-header a, .mobile-drawer a { text-decoration: none; }
.site-header ul, .mobile-drawer ul { list-style: none; }
.site-header button, .mobile-drawer button { font: inherit; }

html { scroll-padding-top: 56px; }

/* ========================================
   1. 顶栏容器
   ======================================== */
:where(.site-header) {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--white);
  z-index: 1000;
  box-shadow: 0 1px 0 var(--gray-200);
}

.header-container {
  position: relative;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 26px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 300;
  letter-spacing: 1px;
}

.header-brand span {
  color: var(--primary);
  font-weight: 500;
}

.header-nav {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.nav-link {
  color: var(--gray-600);
  font-size: 14px;
  padding: var(--space-xs) 0;
  position: relative;
  transition: all 0.2s ease;
}

.nav-link:hover { color: var(--primary); }
.nav-link.active { color: var(--primary); }

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
}

.header-cta { display: flex; align-items: center; }

@media (max-width: 768px) {
  .header-nav { display: none; }
}

/* ========================================
   2. 导航重构覆盖（2026-08-12）
   ======================================== */
:where(.site-header) { height: 56px; }

.header-nav {
  position: static;
  transform: none;
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
  gap: 16px;
  overflow: visible;
}

@media (max-width: 768px) {
  .header-nav {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .header-nav::-webkit-scrollbar { display: none; }
}

.nav-link {
  font-size: 13px;
  white-space: nowrap;
}

.nav-link.active::after {
  bottom: 2px;
  height: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.twzx-auth-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  border: 1px solid var(--primary);
  border-radius: 20px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.twzx-auth-link:hover {
  background: var(--primary);
  color: #fff;
}

.header-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.header-hamburger .bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.25s ease;
}

/* —— 抽屉 —— */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.drawer-backdrop.open { opacity: 1; visibility: visible; }

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 85vw);
  background: #fff;
  z-index: 1100;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -2px 0 12px rgba(0, 0, 0, 0.08);
}

.mobile-drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
}

.drawer-brand {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
}

.drawer-close {
  width: 36px;
  height: 36px;
  font-size: 26px;
  line-height: 1;
  background: transparent;
  border: none;
  color: var(--gray-500);
  cursor: pointer;
}

.drawer-nav { flex: 1; overflow-y: auto; padding: 12px 0; }

.drawer-nav .nav-link {
  display: block;
  padding: 14px 20px;
  font-size: 15px;
  border-bottom: 1px solid var(--gray-100);
}

.drawer-nav .nav-link.active {
  color: var(--primary);
  background: var(--primary-lighter);
}

.drawer-actions { padding: 16px 20px; border-top: 1px solid var(--gray-200); }

.drawer-actions .twzx-auth-link {
  width: 100%;
  text-align: center;
  padding: 10px 16px;
  border-radius: 8px;
}

body.drawer-open { overflow: hidden; }

/* —— 响应式断点 —— */
@media (max-width: 1180px) {
  .header-nav { gap: 12px; }
  .nav-link { font-size: 12.5px; }
}

@media (max-width: 1024px) {
  .header-nav { gap: 9px; }
  .nav-link { font-size: 12px; }
}

@media (max-width: 880px) {
  .header-nav { gap: 6px; }
  .nav-link { font-size: 11.5px; }
  .header-brand { font-size: 17px; }
}

@media (max-width: 1024px) {
  .header-nav { display: none; }
  .header-hamburger { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-drawer,
  .drawer-backdrop,
  .header-hamburger .bar { transition: none; }
}

/* —— 品牌/登录按钮防压缩 —— */
.header-brand { flex: 0 0 auto; white-space: nowrap; }
.header-actions { flex: 0 0 auto; }

/* ========================================
   3. 设计系统 v2 覆盖（知性暖绿）
   ======================================== */
.site-header {
  background: rgba(251,250,247,.82);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--tw-line);
  box-shadow: 0 1px 0 rgba(16,32,27,.02);
}

.header-brand {
  font-weight: 800;
  font-size: 18px;
  color: var(--tw-green-900);
  display: flex;
  align-items: center;
  gap: 0;
}

.header-brand span { position: relative; padding-left: 38px; }

.header-brand span::before {
  content: "通";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--tw-green-700));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 900;
  box-shadow: var(--tw-glow);
}

.header-nav .nav-link {
  padding: 8px 12px;
  border-radius: var(--tw-r-sm);
  font-weight: 600;
  color: var(--tw-ink-2);
  transition: all .15s ease;
}

.header-nav .nav-link:hover { color: var(--tw-green-700); background: var(--tw-surface-2); }
.header-nav .nav-link.active { color: var(--tw-green-700); background: rgba(46,204,113,.12); }
.drawer-nav .nav-link.active { color: var(--tw-green-700); background: rgba(46,204,113,.12); }

.twzx-auth-link {
  display: inline-flex;
  align-items: center;
  padding: 9px 20px;
  border-radius: var(--tw-r-pill);
  background: var(--tw-green-600);
  color: #fff !important;
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--tw-glow);
  transition: all .15s ease;
  border: none;
}

.twzx-auth-link:hover { background: var(--tw-green-700); transform: translateY(-1px); }

.header-hamburger .bar { background: var(--tw-green-700); }

/* ========================================
   4. 2 级归类导航 / 抽屉 2 级
   ======================================== */
.site-header,
.header-container { overflow: visible !important; }

.header-nav .nav-item { position: relative; display: flex; align-items: center; }
.header-nav .nav-item.has-dropdown > .nav-link { cursor: pointer; }

.header-nav .nav-item.has-dropdown > .nav-link::after {
  content: "";
  display: inline-block;
  margin-left: 6px;
  border: 4px solid transparent;
  border-top-color: currentColor;
  transform: translateY(2px);
  opacity: .65;
  transition: transform .2s ease, opacity .2s ease;
}

.header-nav .nav-item.has-dropdown:hover > .nav-link::after {
  transform: translateY(1px) rotate(180deg);
  opacity: 1;
}

.header-nav .nav-item.has-dropdown.active > .nav-link { color: var(--tw-green-600, #16A35A); }

.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  min-width: 232px;
  padding: 10px;
  display: none;
  flex-direction: column;
  gap: 2px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .97);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(46, 204, 113, .18);
  box-shadow: 0 22px 60px rgba(14, 59, 46, .20);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease, visibility .22s;
  z-index: 300;
}

.header-nav .nav-item.has-dropdown:hover > .nav-dropdown,
.header-nav .nav-item.has-dropdown:focus-within > .nav-dropdown {
  display: flex;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* ===== 下拉悬停桥 (hover bridge) —— 2026-09-19 从 15 个 AI 选型页上移至母版 =====
   触发器(.nav-item) 底部与 .nav-dropdown(top:calc(100%+8px)) 之间有 8px 空隙，
   鼠标下移经过空隙时 :hover 掉线 → 面板抖动/闪退。
   方案（架构师 B · hover-gated）：只在 :hover / :focus-within 态生成桥，24px 高
   —— 覆盖 8px 空隙 + 10px translateY 起始位移 + 6px 余量，开合动画全程无死区。
   为什么 gating 是安全的：鼠标还在 .nav-link 上时 .nav-item:hover 已经为真，
   桥此刻已生成；鼠标下移进入桥区、再进入面板（面板是 nav-item 的子元素），
   hover 链不断。防闪退效果与常驻桥等价，但静止态不存在任何透明命中区，
   因此不会在 56px 顶栏下方形成拦截带、不会压住正文里的可点元素。
   z-index:2 低于面板 z-index:300，不遮挡面板内容。
   ⚠ 官网 style-new.css 里另有一条常驻 16px 桥，本次按裁定不动它。 */
.header-nav .nav-item.has-dropdown:hover::before,
.header-nav .nav-item.has-dropdown:focus-within::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 24px;
  z-index: 2;
}



.nav-dropdown::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: rgba(255,255,255,.97);
  border-left: 1px solid rgba(46, 204, 113, .18);
  border-top: 1px solid rgba(46, 204, 113, .18);
}

.nav-dropdown .dropdown-link {
  display: block;
  padding: 10px 14px;
  border-radius: 11px;
  color: #0E3B2E;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease, padding-left .15s ease;
}

.nav-dropdown .dropdown-link:hover {
  background: rgba(46, 204, 113, .12);
  color: var(--tw-green-600, #16A35A);
  padding-left: 18px;
}

.nav-dropdown .dropdown-link.active {
  background: rgba(46, 204, 113, .16);
  color: #128a4c;
  font-weight: 600;
}

/* —— 移动端抽屉：2 级展开（静态可见）—— */
.mobile-drawer .nav-item.has-dropdown { flex-direction: column; align-items: stretch; }
.mobile-drawer .nav-item.has-dropdown > .nav-link { font-weight: 700; color: #0E3B2E; }
.mobile-drawer .nav-item.has-dropdown > .nav-link::after { display: none; }

.mobile-drawer .nav-dropdown {
  position: static;
  transform: none;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  min-width: 0;
  padding: 2px 0 10px 14px;
  background: transparent;
  border: none;
  border-left: 2px solid rgba(46, 204, 113, .25);
  border-radius: 0;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  display: flex;
}

.mobile-drawer .nav-dropdown::before { display: none; }
.mobile-drawer .nav-dropdown .dropdown-link { color: #2c5e4e; font-weight: 500; padding: 9px 14px; }
.mobile-drawer .nav-dropdown .dropdown-link:hover { background: rgba(46,204,113,.10); padding-left: 18px; }
/* /TWZX 全站统一顶部导航 —— 样式 */
