/* =========================================
   搜索遮罩层
   ========================================= */
.search-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.search-backdrop.show {
    opacity: 1;
    visibility: visible;
}

/* =========================================
   顶部导航栏
   ========================================= */
.site-header {
    width: 100% !important;
    background: rgba(10, 37, 64, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 3000;
    transition: all 0.3s ease;
}

.site-header.scrolled {
    background: rgba(10, 37, 64, 0.98);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.header-container {
    width: 92%;
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(10px, 1.5vw, 20px);
    min-height: clamp(72px, 10vh, 180px);
    gap: clamp(8px, 1.6vw, 20px);
}

/* =========================================
   Logo
   ========================================= */
.header-logo .logo-img,
.header-logo svg {
    margin-left: clamp(10px, 3.2vw, 90px);
    height: clamp(90px, 8vw, 120px);
    width: auto;
    object-fit: contain;
    display: block;
    transform: scale(1.5);
    transform-origin: left center;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.4)) brightness(1.2);
}

/* =========================================
   主导航
   ========================================= */
.header-nav {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    margin-right: clamp(0px, 2vw, 60px);
    min-width: 0;
}

.main-menu,
.nav-dropdown {
    list-style: none;
    margin: 0;
    padding: 0;
}

.main-menu {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1vw, 16px);
}

.main-menu > li {
    position: relative;
    min-height: 64px;
    display: flex;
    align-items: center;
}

.main-menu > li > a {
    padding: 10px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

/* 顶级导航项 hover：底色减淡（导航条本身是深底，故用半透明白做出"变浅"）+ 字号放大。
   金色下划线、li:hover 持续高亮、:focus-visible 均已撤销，此处只保留要求的两个效果。 */
.main-menu > li > a:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.18);
    font-size: 1.25rem;
}

.main-menu > li.active > a {
    color: var(--accent-color);
}

.main-menu > li > a:not(:only-child)::after {
    content: '';
    margin-left: 6px;
    border-top: 4px solid rgba(255, 255, 255, 0.6);
    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
    transition: transform 0.3s;
}

.main-menu > li:active > a:not(:only-child)::after,
.main-menu > li:hover > a:not(:only-child)::after {
    border-top-color: #FFFFFF;
}

.header-cta {
    margin-left: auto;
    margin-right: clamp(10px, 2vw, 30px);
}

/* =========================================
   下拉菜单
   ========================================= */
.nav-dropdown {
    position: absolute;
    top: 50px;
    background: #FFFFFF;
    border: 1px solid #EDF2F7;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 260px;
    padding: 8px 0;
    /* 【页脚下方 414px 幽灵空白的真凶】原先用 visibility:hidden 收起。
       但 visibility:hidden 的元素仍然参与布局、仍然计入文档的可滚动溢出区。
       线上实测：每个三级面板高 1240px，底边伸到 1922，而页脚只到 1508 ——
       页脚下面凭空多出一段可滚空白，观感就是“页脚没置底”。
       改用 display:none 收起：不布局、不产生溢出。
       （对照：.mobile-sidebar / .search-backdrop 是 position:fixed，
         高 1000 却不计入溢出，机制一致。）
       transition-behavior 单独用 longhand 写，老浏览器忽略它时
       不会连带作废上面那条 transition:all。 */
    display: none;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.3s ease;
    transition-behavior: allow-discrete;
    z-index: 100;
}

.main-menu > li:hover > .nav-dropdown {
    display: block;
    opacity: 1;
    transform: translateY(0);
    top: 100%;
    left: 0;
}

.nav-dropdown > li {
    /* 【定位策略：贴行为主，上移为兑底】
       这里保留 position:relative，使三级面板 .sub-menu 默认贴住被悬停的那一行，
       视觉连贯（短面板不会跳到面板顶部去）。行贴不住时由 header.js 按视口
       高度逐项改写 --sub-top，上移下限就是二级面板的顶部（即旧 C 方案的位置）。
       无 JS 时走 CSS 静态兑底：top:-8px + max-height 钳制，仍然不会穿底。 */
    position: relative;
    padding: 0 8px;
}

.nav-dropdown > li > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    /* 行高锁定：常态实测 43.0px、hover 字号变大后 45.6px，若不取到 45.6 以上，
       悬停仍会把下方各行顶下去 2.6px。故用 46px 而非 43px。 */
    min-height: 46px;
    color: #4A5568;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.nav-dropdown > li:not(:last-child) {
    border-bottom: 1px solid #F1F5F9;
    margin-bottom: 2px;
}

.nav-dropdown > li:last-child {
    border-bottom: none;
}

/* 下拉项 hover：底色适当加深（原 #F1F7FF 太浅、几乎没有反馈）+ 字号放大。
   二级与三级菜单共用本规则（三级 UL 自带 nav-dropdown 类，选择器天然覆盖）。
   深底反白与金色指示条已撤销，文字沿用原配色 var(--secondary-color)。 */
.nav-dropdown > li > a:hover {
    background: rgba(30, 75, 138, 0.18);
    color: var(--secondary-color);
    font-size: 1rem;
}

.nav-dropdown > li > a:not(:only-child)::after {
    content: "〉";
    border: none;
    transform: none;
    font-size: 12px;
    color: #A0AEC0;
    margin-left: 10px;
    font-weight: bold;
}

.nav-dropdown > li > a:not(:only-child):hover::after {
    color: var(--secondary-color);
}

/* 【2026-09-22 已更正：三级面板改回向右展开，见下方规则与其后的媒体查询】
   以下旧理由记录的是当时改为“向左展开”的动机，经线上复测已不成立，保留备查。
   旧理由：导航条 .header-nav 右对齐，担心二级面板右缘顶到视口右缘，
   （1600 宽时二级 right=1600），三级面板 1599→1859，整块 259px 落在屏幕外。
   入场位移同步翻成 -15px，保持"从外侧滑入"的手感。 */
.sub-menu {
    /* --sub-top / --sub-max 由 header.js 按实时视口写入；未写入时用后面的默认值。
       默认 top:-8px 是相对本行定位，抵消二级 ul 的 8px 上内边距，使面板视觉贴行。 */
    top: var(--sub-top, -8px);
    left: var(--sub-left, 100%);
    right: var(--sub-right, auto);
    transform: translateX(var(--sub-shift, 15px));
    max-width: var(--sub-w, none);
    z-index: 101;
    /* 视口钳制。三级面板是叶子节点、内部没有 abspos 后代，可安全成为滚动容器。
       【为什么不能给 .nav-dropdown 一起加】二级面板里装着 .sub-menu，
       而 .sub-menu 定位在 left:100%（父盒之外）；给二级面板加 overflow 会把它
       变成裁剪容器，整个三级面板会被直接切掉。所以钳制只能落在叶子面板上。
       overscroll-behavior:contain 不可省，否则滚到边界时滚动链传给页面，
       鼠标一飘菜单就关。 */
    max-height: var(--sub-max, calc(100vh - var(--nav-panel-gap, 110px)));
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    /* 基类是 transition: all，会把 --sub-top 引起的 top 变化也补间，
       面板每次展开就会“滑”一下。改成显式列表，只给 opacity/transform/display
       做入场动画，top 与 max-height 必须瞬到位（display 要留着，
       否则配合不了上面的 transition-behavior: allow-discrete 淡入）。 */
    transition-property: opacity, transform, display;
}

.nav-dropdown > li:hover > .sub-menu {
    display: block;
    opacity: 1;
    transform: translateX(0);
}

/* 三级面板默认向右展开（与层级阅读方向一致）。
   【以下仅为无 JS 时的兵底】有 header.js 时，方向/位移/宽度三个变量
   会被行内样式直接覆写，按实时几何量出来的结果比这一行阈值准得多。
   容器宽 92%，视口变窄时右侧余量消失，故 <1400px 先翻到左侧。 */
@media (max-width: 1399.98px) {
    .sub-menu {
        --sub-left: auto;
        --sub-right: 100%;
        --sub-shift: -15px;
    }
}

/* 触屏无 hover：改为点一级标题先展开面板，再点一次才导航。
   注意用 (hover: none) 而不是宽度断点——笔记本窄屏仍有鼠标，
   平板横屏虽宽但没悬停，只有媒体特性才能区分。 */
@media (hover: none) {
    .main-menu > li.open > .nav-dropdown {
        display: block;
        opacity: 1;
        transform: translateY(0);
        top: 100%;
        left: 0;
    }
}

/* display:none 与 block 之间没有插值起点，补 @starting-style 让淡入仍然成立。
   不支持该特性的浏览器会直接瞬时显示菜单，功能不受影响。 */
@starting-style {
    .main-menu > li:hover > .nav-dropdown {
        opacity: 0;
        transform: translateY(15px);
    }

    .nav-dropdown > li:hover > .sub-menu {
        opacity: 0;
    }
}

/* =========================================
   全站搜索栏
   ========================================= */
.search-wrapper-full {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #FFFFFF;
    border-bottom: 1px solid #E2E8F0;
    overflow: hidden;
    max-height: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    visibility: hidden;
    opacity: 0;
    z-index: 50;
}

.search-wrapper-full.show {
    max-height: 120px;
    visibility: visible;
    opacity: 1;
    padding: 25px 0;
}

.search-inner-container {
    width: 88%;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
}

.search-form-full {
    width: 100%;
    max-width: 900px;
}

.search-input-group {
    display: flex;
    align-items: center;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 50px;
    padding: 6px 6px 6px 20px;
    transition: all 0.3s ease;
}

.search-input-group:focus-within {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(30, 75, 138, 0.1);
}

.search-icon-hint {
    margin-right: 10px;
    flex-shrink: 0;
}

.search-input-main {
    flex: 1;
    border: none;
    outline: none;
    font-size: clamp(0.85rem, 1vw, 1.2rem);
    color: var(--text-color);
    max-height: 64px;
    background: transparent;
}

.search-submit-btn-new {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0 30px;
    height: 44px;
    border-radius: 25px;
    font-size: clamp(0.85rem, 1vw, 1.2rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-left: 10px;
}

.search-submit-btn-new:hover {
    background: var(--secondary-color);
}

.search-toggle-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    color: rgba(255, 255, 255, 0.8);
}

.search-toggle-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
}

.header-tools {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* =========================================
   Google Translate Bar
   ========================================= */
.google-translate-container {
    background: rgba(10, 37, 64, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease;
}

.translate-header {
    width: 88%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.translate-message {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    gap: 6px;
}

.translate-message::before {
    content: "🌐";
    font-size: 16px;
}

.translate-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.translate-keep-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.translate-keep-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: #FFFFFF;
}

.translate-close-icon {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.6);
    padding: 4px 6px;
    border-radius: 4px;
    line-height: 1;
    transition: all 0.2s;
}

.translate-close-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
}

/* 【保留·勿删】Google Translate 覆盖样式。
   外部审计把这块列为"死代码"，但那是误判：英文站即将上线翻译功能，本块是其样式基础。
   0828 施工日志 §6 F2 早已裁定"保留，不移除"。再次有人提议删它，请回看那条。 */
/* Google Translate 覆盖样式 */
.goog-te-banner-frame.skiptranslate,
.goog-te-gadget-simple img,
.goog-te-gadget-icon {
    display: none !important;
}

.goog-te-gadget-simple {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 6px !important;
    padding: 4px 8px !important;
    font-size: 14px !important;
    color: #FFFFFF !important;
}

/* 修正 Google Translate 导致的 body 偏移 */
body {
    top: 0 !important;
}

.goog-te-banner-frame {
    display: none !important;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   移动端菜单按钮
   ========================================= */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* =========================================
   移动端侧边栏
   ========================================= */
.mobile-sidebar {
    position: fixed;
    top: 0;
    right: -300px;
    width: 260px;
    height: 100%;
    background: #FFFFFF;
    z-index: 5000;
    transition: 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    overflow-y: auto;
}

.mobile-sidebar.open {
    right: 0;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 4999;
    display: none;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    margin: 0;
}

.mobile-nav-item {
    border-bottom: 1px solid #F5F5F5;
}

.mobile-nav-link-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-nav-link-wrap a {
    display: block;
    padding: 15px 20px;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    flex: 1;
}

.mobile-submenu-toggle {
    background: transparent;
    border: none;
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: transform 0.3s ease;
}

.mobile-submenu-toggle.active svg {
    transform: rotate(180deg);
}

.mobile-sub-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #F8FAFC;
    display: none;
}

.mobile-sub-menu li a {
    display: block;
    padding: 12px 20px 12px 40px;
    color: #555;
    font-size: 14px;
    text-decoration: none;
    border-bottom: 1px solid #EEE;
}

.mobile-sub-menu li:last-child a {
    border-bottom: none;
}

.mobile-sidebar .header-cta-mobile {
    padding: 20px;
    border-top: 1px solid #F5F5F5;
}

/* 移动端 CTA 按钮 - 仅覆盖差异化属性，基础样式继承 base.css .btn-accent */
.mobile-sidebar .btn-accent {
    width: 100%;
    justify-content: center;
    padding: 12px 24px;
}

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 768px) {
    .translate-header {
        padding: 0 16px 8px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .translate-actions {
        width: 100%;
        justify-content: flex-end;
    }

    #google_translate_element {
        padding: 0 16px;
    }
}

@media (max-width: 991.98px) {
    .site-header {
        margin-top: 0;
    }

    .header-container {
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
        padding-top: 8px;
        padding-bottom: 8px;
        gap: 10px;
    }

    .header-logo {
        flex: 1;
        min-width: 0;
    }

    .header-logo .logo-img,
    .header-logo svg {
        max-width: 100%;
        height: clamp(50px, 12vw, 70px);
        width: auto;
        margin-left: 0;
    }

    .header-nav {
        display: none !important;
    }

    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .header-tools {
        margin-left: auto;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        flex-shrink: 0;
        gap: 8px;
    }

    .header-cta {
        display: none;
    }

    .search-wrapper-full.show {
        max-height: 220px;
        padding: 16px 0;
    }

    .search-inner-container {
        width: 92%;
    }

    .search-input-group {
        padding: 8px 8px 8px 14px;
        border-radius: 14px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .search-input-main {
        min-width: 0;
        width: 100%;
        height: 40px;
    }

    .search-submit-btn-new {
        width: 100%;
        margin-left: 0;
        height: 40px;
        border-radius: 10px;
    }

    .translate-header {
        justify-content: space-between;
        gap: 10px;
    }
}

@media (min-width: 1200px) {
    .header-container {
        width: 100%;
    }
}

@media (min-width: 2000px) {
    .header-container {
        max-width: 1600px;
    }
}

@media (min-width: 2700px) {
    .header-container {
        max-width: 2400px;
    }

    .nav-dropdown > li > a {
        font-size: 1.2rem !important;
        padding: 14px 20px !important;
    }

    .nav-dropdown .sub-menu > li > a {
        font-size: 1.1rem !important;
    }

    .nav-dropdown {
        min-width: 360px !important;
    }

    .header-logo .logo-img,
    .header-logo svg {
        transform: scale(2.5) !important;
    }
}
