/* ==================== Header ==================== */
:root {
    --header-h: 98px;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: var(--header-h);
    z-index: 1000;
    --header-bg-alpha: 0.22;
    --header-line-alpha: 0;
    --header-shadow-alpha: 0;
    background: rgba(0, 0, 0, var(--header-bg-alpha));
    border-bottom: 1px solid rgba(255, 255, 255, var(--header-line-alpha));
    box-shadow: 0 8px 24px rgba(0, 0, 0, var(--header-shadow-alpha));
    box-sizing: border-box;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: 12px;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

/* Logo */
.logo {
    --logo-img-w: 194px;
    --logo-font: 23px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    flex-shrink: 0;
    gap: 2px;
    width: var(--logo-img-w);
    max-width: 45%;
}
.logo img {
    width: 100%;
    height: auto;
    display: block;
}
.logo-text {
    width: 100%;
}

/* html[lang="en"] .logo-text .name {
    font-size: 16px;
} */
.logo-text .name {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    width: 100%;
    margin: 0;
    padding: 0;
    font-family: "Alibaba PuHuiTi 3.0", "Microsoft YaHei", sans-serif;
    font-weight: normal;
    font-size: var(--logo-font);
    color: #ccf8ff;
    letter-spacing: 0;
    line-height: 1.15;
    white-space: nowrap;
    box-sizing: border-box;
}
.logo-text .name > span {
    flex: 0 0 auto;
}

/* Nav */
.nav {
    display: flex;
    align-items: center;
    height: 100%;
    min-width: 0;
}
.nav-menu {
    display: flex;
    align-items: center;
    height: 100%;
}
.nav-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}
.nav-link {
    display: flex;
    align-items: center;
    padding: 6px 18px;
    margin: 0 4px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    border-radius: 20px;
    background: transparent;
    transition:
        color 0.3s ease,
        background 0.3s ease;
    white-space: nowrap;
    cursor: pointer;
}
.nav-link:hover,
.nav-item.active .nav-link {
    color: var(--white);
    background: var(--primary);
}
.nav-item.has-child .nav-link::after {
    content: "\f107";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-left: 6px;
    font-size: 11px;
    transition: transform 0.3s ease;
}
.nav-item.has-child:hover .nav-link::after,
.nav-item.has-child.open .nav-link::after {
    transform: rotate(180deg);
}
.sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    padding-top: 0;
    background: rgba(13, 78, 140, 0.88);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(120, 200, 255, 0.35);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 28px rgba(0, 30, 60, 0.25);
    overflow: hidden;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    pointer-events: none;
    transition:
        opacity 0.28s ease,
        transform 0.28s ease,
        visibility 0.28s ease;
}
/* 扩大可悬停区域，避免移入二级菜单时中间断层导致消失 */
.nav-item.has-child::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 12px;
    display: none;
}
.nav-item.has-child:hover::after {
    display: block;
}
.nav-item:hover .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}
.sub-menu li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}
.sub-menu li:last-child {
    border-bottom: none;
}
.sub-menu a {
    display: block;
    padding: 12px 18px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.92);
    transition:
        color 0.25s ease,
        background 0.25s ease,
        padding-left 0.25s ease;
    white-space: nowrap;
}
.sub-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #3be1ff;
    padding-left: 24px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    position: relative;
    z-index: 1002;
}
.lang-switch {
    display: flex;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 16px;
    overflow: hidden;
}
.lang-switch a {
    padding: 4px 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}
.lang-switch a.active {
    background: var(--primary);
    color: var(--white);
}
.lang-switch a:hover:not(.active) {
    color: var(--white);
    background: rgba(255, 255, 255, 0.1);
}
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--white);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    position: relative;
    z-index: 1002;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.15);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}
.mobile-menu-btn i {
    pointer-events: none;
}

/* ≤1100：折叠菜单 */
@media (max-width: 1100px) {
    :root {
        --header-h: 64px;
    }
    .header-inner {
        padding-left: 16px;
        padding-right: 16px;
        width: 100%;
        max-width: 100%;
    }
    .logo {
        --logo-img-w: 118px;
        --logo-font: 12px;
    }
    .mobile-menu-btn {
        display: inline-flex;
    }
    .nav {
        position: absolute;
        top: var(--header-h);
        left: 0;
        width: 100%;
        background: linear-gradient(180deg, #07182a 0%, #0a2238 100%);
        height: auto;
        max-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        transition: max-height 0.4s ease;
        -webkit-overflow-scrolling: touch;
        box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    }
    .nav.open {
        max-height: min(78vh, 680px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }
    .nav-menu {
        flex-direction: column;
        height: auto;
        width: 100%;
        padding: 6px 0 12px;
    }
    .nav-item {
        height: auto;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    .nav-link {
        width: 100%;
        margin: 0;
        padding: 15px 20px;
        min-height: 52px;
        border-radius: 0;
        justify-content: space-between;
        font-size: 15px;
        font-weight: 500;
        letter-spacing: 0.5px;
        color: rgba(255, 255, 255, 0.92);
        background: transparent;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        box-sizing: border-box;
    }
    .nav-link:hover,
    .nav-item.active .nav-link {
        background: transparent;
        color: #fff;
    }
    .nav-item.active > .nav-link,
    .nav-item.has-child.open > .nav-link {
        background: rgba(29, 120, 189, 0.16);
        color: #fff;
        box-shadow: inset 3px 0 0 #3be1ff;
    }
    .nav-item.has-child .nav-link::after {
        font-size: 13px;
        opacity: 0.65;
        margin-left: 10px;
    }
    .nav-item.has-child.open .nav-link::after {
        opacity: 1;
        color: #3be1ff;
    }
    .nav-item.has-child::after {
        display: none !important;
    }
    .nav-item:hover .sub-menu {
        opacity: 0;
        visibility: hidden;
        transform: none;
        pointer-events: none;
        max-height: 0;
    }
    .sub-menu {
        position: static;
        left: auto;
        top: auto;
        width: 100%;
        min-width: 0;
        margin: 0;
        padding: 4px 0 8px;
        max-height: 0;
        opacity: 0;
        visibility: hidden;
        transform: none;
        pointer-events: none;
        box-shadow: none;
        background: rgba(0, 0, 0, 0.28);
        border: none;
        border-radius: 0;
        overflow: hidden;
        transition:
            max-height 0.36s ease,
            opacity 0.28s ease,
            visibility 0.28s ease;
    }
    .nav-item.has-child.open .sub-menu {
        max-height: 420px;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    .sub-menu li {
        border-bottom: none;
        margin: 0;
    }
    .sub-menu a {
        color: rgba(255, 255, 255, 0.72);
        padding: 13px 20px 13px 36px;
        font-size: 14px;
        font-weight: 400;
        text-align: left;
        min-height: 46px;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        position: relative;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        transition:
            color 0.2s ease,
            background 0.2s ease;
    }
    .sub-menu a::before {
        content: "";
        position: absolute;
        left: 22px;
        top: 50%;
        width: 4px;
        height: 4px;
        border-radius: 50%;
        background: rgba(59, 225, 255, 0.45);
        transform: translateY(-50%);
    }
    .sub-menu li:last-child a {
        border-bottom: none;
    }
    .sub-menu a:hover,
    .sub-menu a:active {
        background: rgba(59, 225, 255, 0.08);
        color: #3be1ff;
        padding-left: 36px;
    }
    .sub-menu a:hover::before,
    .sub-menu a:active::before {
        background: #3be1ff;
    }
    .header-actions {
        gap: 10px;
    }
}

@media (max-width: 480px) {
    :root {
        --header-h: 58px;
    }
    .header-inner {
        padding-left: 12px;
        padding-right: 12px;
    }
    .logo {
        --logo-img-w: 102px;
        --logo-font: 11px;
    }
    /* html[lang="en"] .logo-text .name {
        font-size: 14px;
    } */
    .lang-switch a {
        padding: 4px 8px;
        font-size: 11px;
    }
    .nav-link {
        padding: 14px 16px;
        font-size: 15px;
    }
    .sub-menu a {
        padding: 12px 16px 12px 32px;
    }
    .sub-menu a::before {
        left: 18px;
    }
    .sub-menu a:hover,
    .sub-menu a:active {
        padding-left: 32px;
    }
}
