/* ============================================================
   nav.css - 全站统一顶部导航栏样式（公共组件）
   风格：与首页完全一致 / 深色半透明固定悬浮 / 金色下划线hover
   不跟随页面深/浅色主题切换
   ============================================================ */

.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 14px 24px;
    background: rgba(20, 20, 20, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.nav-menu {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 0.85rem;
    letter-spacing: 1.5px;
    padding: 8px 14px;
    transition: all 0.3s ease;
    position: relative;
    font-family: 'Noto Serif SC', serif;
    display: inline-block;
}

.nav-link:hover {
    color: #fff;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    width: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 20px;
}

.nav-link.active {
    color: #fff;
}

.nav-link.active::after {
    width: 20px;
}

/* 移动端汉堡菜单按钮 */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    cursor: pointer;
    padding: 8px;
    width: 36px;
    height: 36px;
}

.hamburger span {
    width: 18px;
    height: 1.5px;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    display: block;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
}

/* ============ 移动端/响应式折叠 ============ */
@media screen and (max-width: 900px) {
    .top-nav {
        padding: 12px 16px;
    }

    .nav-container {
        gap: 12px;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        background: rgba(20, 20, 20, 0.95);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        padding: 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-link {
        display: block;
        text-align: center;
        padding: 12px 16px;
        font-size: 0.85rem;
        color: rgba(255, 255, 255, 0.75);
    }

    .nav-link::after {
        display: none;
    }

    .hamburger {
        display: flex;
    }
}

/* 给页面内容预留顶部空间，避免被固定导航遮挡 */
body {
    /* 仅在没有显式设置 padding-top 时生效：
       通过 [data-nav-mounted] 标识，导航注入后页面会自动补偿空间 */
}
body[data-nav-mounted="1"] {
    padding-top: 64px;
}
@media screen and (max-width: 900px) {
    body[data-nav-mounted="1"] {
        padding-top: 60px;
    }
}
