.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    /* 顶部默认状态：背景完全透明，文字可见 */
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid transparent;
    border-bottom: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1), filter 0.35s ease;
}

/* 滚动渐变状态：禁用所有过渡，由 JS 逐帧控制 */
.header.scrolling {
    transition: none;
}

/* 胶囊悬浮状态 */
.header.capsule {
    top: 28px;
    left: 10%;
    right: 10%;
    border-radius: 38px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.08),
        0 2px 8px rgba(0, 0, 0, 0.04);
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    position: absolute;
    left: 24px;
    transition: opacity 0.3s ease;
}

.logo:hover {
    opacity: 0.8;
}

.logo-svg {
    width: 28px;
    height: 28px;
    color: var(--text);
    transition: transform 0.3s ease;
}

.logo:hover .logo-svg {
    transform: scale(1.05);
}

.logo-text {
    font-family: var(--font-serif);
    font-size: 17px;
    font-weight: 500;
    letter-spacing: 1px;
    color: var(--text);
}

.nav {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav a {
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.25s ease;
    position: relative;
    padding: 6px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.3px;
}

.nav-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: all 0.25s ease;
}

.nav-icon-small {
    width: 15px;
    height: 15px;
}

.nav a:hover {
    color: var(--text);
}

.nav a:hover .nav-icon {
    color: var(--text);
}

.nav a.active {
    color: var(--text);
}

.nav a.active .nav-icon {
    color: var(--text);
}

.nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
    transition: all 0.25s ease;
    transform: translateX(-50%);
}

.nav a:hover::after {
    width: 100%;
}

.nav a.active::after {
    width: 100%;
}

@media (max-width: 768px) {
    .header-inner {
        padding: 0 16px;
        height: 56px;
    }

    .logo {
        left: 16px;
    }

    .logo-text {
        display: none;
    }

    .nav {
        gap: 24px;
    }

    .nav a {
        font-size: 13px;
    }

    .header.capsule {
        top: 16px;
        left: 4%;
        right: 4%;
        border-radius: 28px;
    }
}

@media (max-width: 480px) {
    .nav {
        gap: 20px;
    }

    .nav a {
        font-size: 12px;
    }

    .nav-icon {
        width: 14px;
        height: 14px;
    }

    .nav-icon-small {
        width: 13px;
        height: 13px;
    }

    .header.capsule {
        top: 12px;
        left: 3%;
        right: 3%;
        border-radius: 24px;
    }
}
