/* 从 Google Fonts 加载思源宋体 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;700&display=swap');

/* 从 Adobe Fonts 加载字体 */
@import url("https://use.typekit.net/[你的kit代码].css");

/* 从阿里 CDN 加载字体 */
@font-face {
    font-family: 'AlibabaPuHuiTi';
    src: url('https://puhuiti.oss-cn-hangzhou.aliyuncs.com/AlibabaPuHuiTi-2/AlibabaPuHuiTi-2-55-Regular.otf') format('opentype');
    font-display: swap;
}

/* 使用 JsDelivr CDN */
@font-face {
    font-family: 'MaShanZheng';
    src: url('https://cdn.jsdelivr.net/gh/googlefonts/MaShanZheng@master/fonts/webfonts/MaShanZheng-Regular.woff2') format('woff2');
    font-display: swap;
}

/* 导航容器 - 水墨风格 */
.nav-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 70px; /* 稍微加高 */
    background: linear-gradient(180deg, 
        rgba(252, 250, 245, 0.98) 0%,
        rgba(249, 246, 240, 0.95) 100%); /* 更温和的米色渐变 */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 
        0 2px 15px rgba(0, 0, 0, 0.03),
        0 10px 30px rgba(210, 198, 180, 0.12),
        0 0 1px rgba(210, 198, 180, 0.3); /* 多层次阴影 */
    border-bottom: 1px solid rgba(210, 198, 180, 0.15);
    z-index: 1000;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 导航内容容器 */
.nav-inner {
    max-width: 1200px;
    height: 100%;
    margin: 0 auto;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

/* Logo */
.nav-logo {
    height: 45px; /* 稍微加大 */
    display: flex;
    align-items: center;
    transition: all 0.4s ease;
    position: relative;
    font-family: 
        'Noto Serif SC',          /* Google思源宋体 */
        'STSong',                 /* 华文宋体 */
        'SimSun',                 /* 宋体 */
        serif;
    font-weight: 700;            /* 加粗显示 */
    text-shadow: 2px 2px 4px rgba(139, 69, 19, 0.1);
}

.nav-logo:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    filter: drop-shadow(0 4px 8px rgba(139, 69, 19, 0.2));
}

.nav-logo img {
    height: 100%;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* 导航菜单 */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 40px; /* 增加间距 */
}

/* 导航项 */
.nav-item {
    position: relative;
}

/* 导航链接 */
.nav-item > a {
    font-family: 
        'Noto Serif SC',          /* Google思源宋体 */
        'STSong',                 /* 华文宋体 */
        'SimSun',                 /* 宋体 */
        serif;
    font-weight: 500;            /* 中等粗细 */
    font-size: 1.15rem;
    letter-spacing: 1px;
    color: #2C1810;
    
    /* 优化文字渲染 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    
    /* 文字阴影效果 */
    text-shadow: 
        0.5px 0.5px 0 rgba(139, 69, 19, 0.2),
        1px 1px 2px rgba(139, 69, 19, 0.1);
    
    /* 其他样式保持不变 */
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

/* 导航项悬停效果 */
.nav-item > a::before {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(to right, 
        rgba(139, 69, 19, 0.8),
        rgba(210, 105, 30, 0.6)); /* 古铜色渐变 */
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-50%);
    opacity: 0;
}

/* 水墨效果装饰 */
.nav-item > a::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, 
        rgba(139, 69, 19, 0.1) 0%,
        transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: 30px;
}

/* 悬停效果优化 */
.nav-item > a:hover {
    color: #8B4513;
    text-shadow: 
        1px 1px 0 rgba(139, 69, 19, 0.2),
        1px 1px 3px rgba(139, 69, 19, 0.15);
}

.nav-item > a:hover::before {
    width: 70%;
    opacity: 1;
}

.nav-item > a:hover::after {
    opacity: 1;
}

/* 箭头图标 */
.nav-arrow {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.8;
}

/* 二级菜单 */
.sub-menu {
    position: absolute;
    top: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    min-width: 220px;
    background: rgba(252, 250, 245, 0.98);
    box-shadow: 
        0 4px 30px rgba(210, 198, 180, 0.25),
        0 0 1px rgba(210, 198, 180, 0.3);
    border-radius: 12px;
    padding: 10px 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* 二级菜单小箭头 */
.sub-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background: rgba(252, 250, 245, 0.98);
    box-shadow: -1px -1px 1px rgba(210, 198, 180, 0.1);
}

/* 二级菜单水墨装饰 */
.sub-menu::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle at top right,
        rgba(139, 69, 19, 0.03),
        transparent 70%);
    pointer-events: none;
}

/* 二级菜单字体 */
.sub-menu a {
    font-family: 
        'Noto Serif SC',
        'STSong',
        'SimSun',
        serif;
    font-weight: 400;            /* 常规粗细 */
    font-size: 1.05rem;
    letter-spacing: 0.5px;
    
    /* 优化移动端文字渲染 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    
    /* 其他样式保持不变 */
    display: block;
    padding: 12px 24px;
    color: #2C1810;
}

.sub-menu a:hover {
    color: #8B4513;
    text-shadow: 1px 1px 2px rgba(139, 69, 19, 0.1);
    background: linear-gradient(to right,
        rgba(139, 69, 19, 0.08),
        rgba(139, 69, 19, 0.03));
}

/* 二级菜单项装饰 */
.sub-menu a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    height: 0;
    width: 3px;
    background: linear-gradient(to bottom, 
        rgba(139, 69, 19, 0.8),
        rgba(210, 105, 30, 0.6));
    transform: translateY(-50%);
    transition: height 0.3s ease;
    opacity: 0.8;
}

.sub-menu a:hover::before {
    height: 70%;
}

/* 汉堡菜单按钮 */
.nav-toggle {
    display: none;
    width: 30px;
    height: 24px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
}

.nav-toggle span {
    display: block;
    position: absolute;
    width: 100%;
    height: 2px;
    background: #8B4513; /* 古铜色 */
    left: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-toggle span:nth-child(1) { top: 0; }
.nav-toggle span:nth-child(2) { top: 11px; }
.nav-toggle span:nth-child(3) { top: 22px; }

/* 导航隐藏状态 */
.nav-hidden {
    transform: translateY(-100%);
    opacity: 0;
}

/* 平板和手机端共享样式 */
@media (max-width: 1024px) {
    /* 调整文章容器宽度 */
    .container,
    .content-wrapper,
    .main-content {
        padding-left: 15px;
        padding-right: 15px;
        width: 100%;
        box-sizing: border-box;
    }

    /* 随机推荐卡片布局 */
    .random-articles {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 20px;
        padding: 15px;
        width: 100%;
        box-sizing: border-box;
    }

    .random-article {
        width: 100%;
        margin: 0;
        box-sizing: border-box;
    }
}

/* 手机端特定样式 */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }

    .nav-menu {
        position: fixed;
        top: 64px;
        right: -100%;
        width: 85%;
        height: calc(100vh - 64px);
        background: rgba(252, 250, 245, 0.98);
        padding: 20px;
        flex-direction: column;
        gap: 15px;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow: -5px 0 30px rgba(210, 198, 180, 0.3);
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-item {
        width: 100%;
        border-radius: 8px;
    }

    .nav-item > a {
        /* 移动端字体大小和间距调整 */
        font-size: 1.1rem;
        letter-spacing: 0.5px;
        font-weight: 500;
        
        /* 移动端文字效果优化 */
        text-shadow: 
            0.5px 0.5px 0 rgba(139, 69, 19, 0.15),
            0.5px 0.5px 1px rgba(139, 69, 19, 0.1);
        
        /* 移动端性能优化 */
        will-change: transform;
        transform: translateZ(0);
    }

    .sub-menu {
        position: static;
        transform: none;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        display: none;
        padding: 0;
        margin: 5px 0 5px 20px;
        background: transparent;
    }

    .sub-menu::before {
        display: none;
    }

    .nav-item.active {
        background: rgba(139, 69, 19, 0.08);
    }

    .nav-item.active .sub-menu {
        display: block;
    }

    .nav-item.active .nav-arrow {
        transform: rotate(-135deg);
    }

    /* 汉堡按钮动画 */
    .nav-toggle.active span {
        background: linear-gradient(to right, #8B4513, #D2691E);
    }

    .nav-toggle.active span:nth-child(1) {
        transform: translateY(11px) rotate(45deg);
    }

    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
        transform: translateX(-10px);
    }

    .nav-toggle.active span:nth-child(3) {
        transform: translateY(-11px) rotate(-45deg);
    }

    /* 遮罩层 */
    body.menu-open::after {
        content: '';
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(44, 24, 16, 0.2);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.4s ease;
        backdrop-filter: blur(4px);
    }

    body.menu-open.active::after {
        opacity: 1;
    }

    /* 手机端特定的容器样式 */
    .container,
    .content-wrapper,
    .main-content {
        padding-left: 0;
        padding-right: 0;
    }

    .article-card,
    .random-article {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        border-radius: 0;
    }

    .article-content {
        padding: 15px;
        width: 100%;
    }

    /* 文章列表和随机推荐容器 */
    .articles-container,
    .random-articles {
        padding: 0;
        gap: 1px; /* 手机端卡片间隔更小 */
    }

    /* 分页器边距 */
    .pagination {
        padding: 20px;
    }

    .sub-menu a {
        font-size: 1rem;
        letter-spacing: 0.3px;
        font-weight: 400;
    }
}

/* 桌面端样式 */
@media (min-width: 1025px) {
    .nav-item:hover .sub-menu {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
    }

    .nav-item:hover .nav-arrow {
        transform: rotate(-135deg);
        opacity: 1;
    }
}

