/* ============================================================
   JSEMI - header.css
   顶部工具条 + 页头 + 主导航 + Mega-menu + 语言切换 + 移动端抽屉
   ============================================================ */

/* 顶部工具条 */
.js-topbar {
    background: var(--js-navy);
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    height: var(--js-topbar-h);
    line-height: var(--js-topbar-h);
}
.js-topbar-inner {
    display: flex; justify-content: space-between; align-items: center;
}
.js-topbar-left span { margin-right: 24px; }
.js-topbar-left i { margin-right: 6px; color: var(--js-steel-light); }
.js-topbar-right { display: flex; align-items: center; gap: 20px; }
.js-topbar-sample {
    color: #fff;
    padding: 3px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    transition: var(--js-transition);
}
.js-topbar-sample:hover { color: #fff; background: var(--js-steel); border-color: var(--js-steel); }
.js-topbar-sample i { margin-right: 5px; }

/* 语言切换器 */
.js-lang { position: relative; }
.js-lang-current {
    color: rgba(255, 255, 255, 0.85); cursor: pointer;
    display: inline-flex; align-items: center; gap: 4px;
}
.js-lang-current:hover,
.js-lang-current:focus-visible { color: #fff; }
.js-lang-current:focus-visible { outline-color: var(--js-steel-light); }
.js-lang-dropdown {
    position: absolute; top: 100%; right: 0;
    background: #fff; min-width: 120px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    border-radius: 0 0 4px 4px;
    padding: 6px 0;
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: var(--js-transition); z-index: 1000;
}
.js-lang.open .js-lang-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.js-lang-dropdown a {
    display: block; padding: 8px 18px;
    color: var(--js-text-2); font-size: 13px;
}
.js-lang-dropdown a:hover, .js-lang-dropdown a.active { background: var(--js-gray-bg); color: var(--js-steel); }

/* ============================================================
   页头
   ============================================================ */
.js-header {
    background: #fff;
    height: var(--js-header-h);
    position: sticky; top: 0; z-index: 999;
    box-shadow: 0 2px 10px rgba(29, 53, 70, 0.06);
    transition: var(--js-transition);
}
.js-header-inner {
    height: 100%;
    display: flex; align-items: center; justify-content: space-between;
    gap: 30px;
    position: relative; /* mega-menu 的定位上下文，使面板宽度/对齐与站点内容容器一致 */
}

/* Logo */
.js-logo { display: flex; flex-direction: column; line-height: 1.1; flex-shrink: 0; }
.js-logo-text { font-size: 26px; font-weight: 800; color: var(--js-navy); letter-spacing: 1px; }
.js-logo-sub { font-size: 11px; color: var(--js-steel); letter-spacing: 2px; font-weight: 500; }
.js-logo:hover { opacity: 0.85; }

/* 主导航 */
.js-nav { display: flex; align-items: center; gap: 4px; height: 100%; }
.js-nav-item {
    position: relative; height: 100%;
    display: flex; align-items: center;
    padding: 0 18px;
    font-size: 16px; color: var(--js-text-2); font-weight: 500;
    cursor: pointer;
}
.js-nav-item > a { display: flex; align-items: center; gap: 4px; height: 100%; }
.js-nav-item:hover,
.js-nav-item:focus-within { color: var(--js-steel); }
.js-nav-item:hover > a,
.js-nav-item:focus-within > a { color: var(--js-steel); }
.js-nav-item::after {
    content: ''; position: absolute; bottom: 10px; left: 50%;
    width: 0; height: 3px; background: var(--js-steel);
    transition: var(--js-transition); transform: translateX(-50%);
}
.js-nav-item:hover::after,
.js-nav-item:focus-within::after,
.js-nav-item.active::after { width: 60%; }

/* 样品申请 CTA —— 独立胶囊按钮，与普通导航项区分，强化行动召唤 */
.js-nav-cta {
    background: var(--js-steel); color: #fff !important;
    padding: 0 20px !important;
    height: 40px;
    border-radius: 40px;
    margin-left: 14px;
    font-size: 15px; font-weight: 600 !important;
    display: inline-flex; align-items: center; gap: 7px;
    box-shadow: 0 4px 12px rgba(67, 124, 163, 0.32);
    transition: var(--js-transition);
    overflow: hidden; position: relative;
}
.js-nav-cta i { font-size: 13px; transition: var(--js-transition); }
.js-nav-cta::after { display: none; }
/* 悬停高光扫过 */
.js-nav-cta::before {
    content: ''; position: absolute; top: 0; left: -120%;
    width: 60%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.35), transparent);
    transition: left 0.6s ease;
}
.js-nav-cta:hover {
    background: var(--js-navy); color: #fff !important;
    box-shadow: 0 6px 18px rgba(29, 53, 70, 0.4);
    transform: translateY(-1px);
}
.js-nav-cta:hover::before { left: 130%; }
.js-nav-cta:hover i { transform: rotate(-12deg) scale(1.1); }
.js-nav-cta.active { background: var(--js-navy); box-shadow: 0 4px 12px rgba(29, 53, 70, 0.3); }

/* ============================================================
   产品中心 Mega-menu（重新设计）
   理念：深色"控制台"面板，与白底站点对比，呼应 datasheet 的精密感。
   - 定位参照 .js-header-inner（= .w1480 内容容器），面板宽度与站点对齐，
     不再横跨整个视口。
   - 每列：钢蓝图标芯片 + 分类名 + 子项列表 + 行尾 CTA
   - 底部贯穿行动条：搜索提示 + 浏览全部产品
   ============================================================ */
.js-nav-product { position: static; }
/* 激活色下划线锚到内层 <a>，避免因 .js-nav-product 为 static 而
   回退锚到 .js-header-inner 导致横跨整条内容区。 */
.js-nav-product::after { display: none; }
.js-nav-product > a {
    position: relative;
}
.js-nav-product > a::after {
    content: ''; position: absolute; bottom: 10px; left: 50%;
    width: 0; height: 3px; background: var(--js-steel);
    transition: var(--js-transition); transform: translateX(-50%);
}
.js-nav-product:hover > a::after,
.js-nav-product:focus-within > a::after,
.js-nav-product.active > a::after { width: 60%; }

.js-megamenu {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--js-navy);
    color: rgba(255, 255, 255, 0.92);
    box-shadow: 0 24px 50px rgba(10, 22, 30, 0.35);
    border-radius: 0 0 var(--js-radius-lg) var(--js-radius-lg);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0s linear 0.28s;
    z-index: 998;
    pointer-events: none;
    overflow: hidden;
}
.js-nav-product:hover .js-megamenu,
.js-nav-product:focus-within .js-megamenu {
    opacity: 1; visibility: visible; transform: translateY(0);
    transition-delay: 0s;
    pointer-events: auto;
}

/* 顶部高光线，强化"打开"感 */
.js-megamenu::before {
    content: ''; position: absolute; top: -2px; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--js-steel) 20%, var(--js-steel-light) 50%, var(--js-steel) 80%, transparent);
    opacity: 0.9;
}

.js-megamenu-stage { padding: 36px 36px 0; }

.js-megamenu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
}

/* 列：用左侧 hairline 分隔，规格表式秩序感 */
.js-megamenu-col {
    padding: 4px 32px 28px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}
.js-megamenu-col:first-child { border-left: none; padding-left: 0; }
.js-megamenu-col:last-child { padding-right: 0; }

/* 列头：图标芯片 + 分类名 */
.js-megamenu-head {
    display: flex; align-items: center; gap: 12px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.js-megamenu-chip {
    flex-shrink: 0;
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    background: var(--js-steel);
    color: #fff;
    border-radius: 8px;
    font-size: 17px;
    box-shadow: 0 4px 12px rgba(67, 124, 163, 0.4);
    transition: transform 0.25s ease, background 0.25s ease;
}
.js-megamenu-head:hover .js-megamenu-chip {
    transform: translateY(-2px);
    background: var(--js-steel-light);
}
.js-megamenu-catname {
    font-size: 17px; font-weight: 600;
    color: #fff; letter-spacing: 0.5px;
}
.js-megamenu-head:hover .js-megamenu-catname { color: var(--js-steel-light); }

/* 子项列表 */
.js-megamenu-list {
    padding: 8px 0 4px;
}
.js-megamenu-list li { list-style: none; }
.js-megamenu-list a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.68);
    transition: color 0.2s ease, padding-left 0.2s ease;
}
.js-megamenu-arrow {
    color: var(--js-steel-light);
    font-size: 16px; line-height: 1;
    transform: translateX(-4px); opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.js-megamenu-list a:hover {
    color: #fff; padding-left: 6px;
}
.js-megamenu-list a:hover .js-megamenu-arrow {
    transform: translateX(0); opacity: 1;
}

/* 行尾：查看全部 */
.js-megamenu-all {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 10px;
    font-size: 13px; font-weight: 500;
    color: var(--js-steel-light);
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
}
.js-megamenu-all:hover {
    color: #fff;
    border-bottom-color: var(--js-steel-light);
}
.js-megamenu-all i { font-size: 12px; transition: transform 0.2s ease; }
.js-megamenu-all:hover i { transform: translateX(3px); }

/* 底部行动条 */
.js-megamenu-foot {
    display: flex; align-items: center; justify-content: space-between;
    gap: 20px; flex-wrap: wrap;
    margin-top: 28px;
    padding: 18px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.js-megamenu-hint {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}
.js-megamenu-hint i { color: var(--js-steel-light); }
.js-megamenu-cta {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 26px;
    background: var(--js-steel);
    color: #fff !important;
    font-size: 14px; font-weight: 600;
    border-radius: var(--js-radius);
    letter-spacing: 0.3px;
    transition: background 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
    box-shadow: 0 6px 18px rgba(67, 124, 163, 0.35);
}
.js-megamenu-cta:hover {
    background: var(--js-steel-light);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(67, 124, 163, 0.5);
}
.js-megamenu-cta i { font-size: 12px; transition: transform 0.2s ease; }
.js-megamenu-cta:hover i { transform: translateX(3px); }

/* 页头右侧：搜索 + 汉堡 */
.js-header-right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.js-search { display: flex; align-items: center; }
.js-search input {
    width: 180px; padding: 8px 14px;
    border: 1px solid var(--js-border); border-radius: 20px;
    font-size: 13px; outline: none;
    transition: var(--js-transition);
}
.js-search input:focus,
.js-search input:focus-visible { border-color: var(--js-steel); width: 220px; }
.js-search button {
    margin-left: -36px; width: 32px; height: 32px;
    border-radius: 50%; color: var(--js-steel);
    display: flex; align-items: center; justify-content: center;
}
.js-search button:hover { color: var(--js-navy); }

.js-menu-toggle {
    display: none; flex-direction: column; gap: 5px;
    width: 30px; padding: 4px;
}
.js-menu-toggle span {
    display: block; height: 2px; width: 100%; background: var(--js-navy);
    transition: var(--js-transition); border-radius: 2px;
}
.js-menu-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.js-menu-toggle.active span:nth-child(2) { opacity: 0; }
.js-menu-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
