/* 全站顶部导航（从 home.css 抽出，非首页共用，避免加载整份首页样式） */
/* 顶部导航 — 固定顶部，默认透明，滚动后白底 */
#header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    padding: calc(20px * var(--layout-scale)) calc(240px * var(--layout-scale)) 0;
    overflow: visible;
    background: transparent;
    transition: background 0.3s ease, box-shadow 0.3s ease, padding-bottom 0.3s ease;
}

#header.is-scrolled {
    background: rgba(255, 255, 255, 0.96);
    padding-bottom: calc(12px * var(--layout-scale));
    box-shadow: 0 calc(1px * var(--layout-scale)) 0 rgba(0, 0, 0, 0.04);
}

#header .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;

}

#header .logo {
    flex-shrink: 0;
    width: calc(212px * var(--layout-scale));
    height: calc(46px * var(--layout-scale));
}

#header .logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#header .nav {
    flex: 1;
    display: flex;
    justify-content: center;
    min-width: 0;
}

#header .nav>ul {
    display: flex;
    align-items: center;
    gap: calc(40px * var(--layout-scale));
}

#header .nav>ul>li {
    position: relative;
    flex-shrink: 0;
}

#header .nav>ul>li>a {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* height: calc(70px * var(--layout-scale)); */
    font-size: calc(16px * var(--layout-scale));
    font-weight: 400;
    color: #070B12;
    line-height: 1;
    white-space: nowrap;
    transition: color 0.3s;
}

#header .nav>ul>li>a:hover,
#header .nav>ul>li.active>a {
    color: #000000;
    font-weight: 600;
}

#header .nav>ul>li.active>a::after {
    content: '';
    display: block;
    position: absolute;
    left: 50%;
    bottom: calc(-16px * var(--layout-scale));
    transform: translateX(-50%);
    width: calc(16px * var(--layout-scale));
    height: calc(16px * var(--layout-scale));
    background: url('../img/nav_atv.png') no-repeat center / contain;
}

#header .nav-down {
    display: block;
    width: calc(12px * var(--layout-scale));
    height: calc(12px * var(--layout-scale));
    margin-left: calc(2px * var(--layout-scale));
    flex-shrink: 0;
    transition: opacity 0.2s ease;
}

#header .nav>ul>li.nav-item-has-sub {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
}

#header .nav-project-panel {
    display: block;
    position: absolute;
    top: 100%;
    left: 50%;
    z-index: 101;
    width: max-content;
    padding: calc(20px * var(--layout-scale)) 0 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(calc(4px * var(--layout-scale)));
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    box-sizing: border-box;
}

#header .nav-project-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

#header .nav-project-panel::before {
    content: '';
    position: absolute;
    top: calc(13px * var(--layout-scale));
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: calc(7px * var(--layout-scale)) solid transparent;
    border-right: calc(7px * var(--layout-scale)) solid transparent;
    border-bottom: calc(7px * var(--layout-scale)) solid #FFFFFF;
    filter: drop-shadow(0 calc(-2px * var(--layout-scale)) calc(2px * var(--layout-scale)) rgba(7, 11, 18, 0.06));
    pointer-events: none;
    z-index: 2;
}

#header .nav-project-list {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    background: #FFFFFF;
    border-radius: calc(12px * var(--layout-scale));
    box-shadow: 0 calc(4px * var(--layout-scale)) calc(16px * var(--layout-scale)) rgba(7, 11, 18, 0.08);
    overflow: hidden;
    box-sizing: border-box;
}

#header .nav-project-item {
    position: relative;
}

#header .nav-project-link {
    display: block;
    width: 100%;
    min-width: calc(234px * var(--layout-scale));
    padding: calc(14px * var(--layout-scale)) calc(20px * var(--layout-scale));
    background: transparent;
    color: #070B12;
    border-radius: 0;
    font-size: calc(20px * var(--font-scale));
    font-weight: 400;
    text-align: left;
    line-height: calc(20px * var(--layout-scale));
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
    box-sizing: border-box;
}

#header .nav-project-link:hover {
    background: #E7EEFF;
    color: #1654FF;
    font-weight: bold;
}

#header .header-phone {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: calc(12px * var(--layout-scale)) calc(16px * var(--layout-scale));
    background: #1654FF;
    border-radius: calc(8px * var(--layout-scale));
    transition: background 0.3s;
}

#header .header-phone:hover {
    background: #1a52d9;
}

#header .header-phone img {
    display: block;
    width: calc(20px * var(--layout-scale));
    height: calc(20px * var(--layout-scale));
    flex-shrink: 0;
}

#header .header-phone span {
    margin-left: calc(4px * var(--layout-scale));
    font-size: calc(20px * var(--font-scale));
    color: #ffffff;
    white-space: nowrap;
    letter-spacing: calc(0.5px * var(--layout-scale));
}

/* 移动端菜单按钮（默认隐藏，JS 注入） */
.header-menu-toggle {
    display: none;
    flex-shrink: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 40px;
    height: auto;
    margin-left: 8px;
    padding: 4px 6px;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    box-sizing: border-box;
}

.header-menu-toggle-bars span {
    display: block;
    width: 20px;
    height: 2px;
    margin: 3px auto;
    background: #070B12;
    border-radius: 1px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.header-menu-toggle-label {
    font-size: 11px;
    line-height: 1;
    color: #070B12;
    font-weight: 400;
}

#header.is-nav-open .header-menu-toggle-bars span:nth-child(1) {
    transform: translateY(5px) rotate(45deg);
}

#header.is-nav-open .header-menu-toggle-bars span:nth-child(2) {
    opacity: 0;
}

#header.is-nav-open .header-menu-toggle-bars span:nth-child(3) {
    transform: translateY(-5px) rotate(-45deg);
}

.nav-overlay {
    display: none;
}

body.is-nav-locked {
    overflow: hidden;
}

/* 顶部导航响应式 ≤800px（仅手机端侧滑菜单） */
@media (max-width: 800px) {
    #header {
        padding: 8px 12px;
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
    }

    #header.is-scrolled {
        padding-bottom: 8px;
    }

    #header .header-inner {
        position: relative;
        z-index: 103;
        gap: 8px;
    }

    #header .logo {
        width: 120px;
        height: 28px;
        flex-shrink: 0;
    }

    #header .header-phone {
        display: flex;
        align-items: center;
        margin-left: auto;
        padding: 6px 10px;
        border-radius: 8px;
        flex-shrink: 1;
        min-width: 0;
    }

    #header .header-phone img {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }

    #header .header-phone span {
        display: block;
        margin-left: 4px;
        font-size: 13px;
        letter-spacing: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .header-menu-toggle {
        display: flex;
        flex-shrink: 0;
    }

    .nav-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 101;
        background: rgba(7, 11, 18, 0.45);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    #header.is-nav-open .nav-overlay {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    #header .nav {
        position: fixed;
        top: 0;
        right: 0;
        z-index: 102;
        flex: none;
        width: min(300px, 88vw);
        height: 100vh;
        height: 100dvh;
        padding: 56px 0 24px;
        background: #FFFFFF;
        box-shadow: -8px 0 24px rgba(7, 11, 18, 0.08);
        box-sizing: border-box;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        justify-content: flex-start;
    }

    #header.is-nav-open .nav {
        transform: translateX(0);
    }

    #header .nav>ul {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        width: 100%;
    }

    #header .nav>ul>li {
        width: 100%;
        border-bottom: 1px solid #F0F2F5;
    }

    #header .nav>ul>li>a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 13px 16px;
        font-size: 14px;
        line-height: 22px;
        box-sizing: border-box;
    }

    #header .nav>ul>li.active>a {
        color: #1654FF;
        font-weight: 600;
        background: #F5F8FF;
    }

    #header .nav>ul>li.active>a::after {
        display: none;
    }

    #header .nav>ul>li.nav-item-has-sub {
        display: block;
        align-items: stretch;
    }

    #header .nav-down {
        width: 12px;
        height: 12px;
        margin-left: 8px;
        transition: transform 0.25s ease;
    }

    #header .nav-item-has-sub.is-sub-open .nav-down {
        transform: rotate(180deg);
    }

    #header .nav-project-panel {
        position: static;
        left: auto;
        top: auto;
        width: 100%;
        padding: 0;
        opacity: 1;
        visibility: visible;
        transform: none;
        pointer-events: auto;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    #header .nav-project-panel::before {
        display: none;
    }

    #header .nav-item-has-sub.is-sub-open .nav-project-panel,
    #header .nav-project-panel.is-open {
        max-height: 240px;
    }

    #header .nav-project-list {
        border-radius: 0;
        box-shadow: none;
        background: #F8FAFC;
    }

    #header .nav-project-link {
        min-width: 0;
        padding: 11px 16px 11px 28px;
        font-size: 13px;
        line-height: 20px;
        white-space: normal;
    }

    #header .nav-project-link:hover {
        font-weight: 500;
    }
}

/* 导航响应式补充（原 home.css 媒体查询中的 #header 规则） */
@media (max-width: 1200px) {
    #header {
        padding-left: 40px;
        padding-right: 40px;
    }

    #header .nav>ul {
        gap: 20px;
    }

    #header .nav>ul>li>a {
        font-size: 14px;
    }

    #header .header-phone {
        padding: 8px 12px;
    }

    #header .header-phone span {
        font-size: 14px;
    }
}

@media (max-width: 800px) {
    #header .nav>ul {
        gap: 0;
    }
}
