/* ==========================================================================
   山风 (ShanFeng) - 全局基础排版与组件 (核心框架瘦身版)
   ========================================================================== */

/* --- 0. 全局变量与重置 --- */
:root {
    --sf-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --sf-font-display: "PingFang SC", "Microsoft YaHei", sans-serif;
    --sf-bg-body: #FFFFFF;
    --sf-bg-card: #FFFFFF;
    --sf-text-main: #1D1E20;
    --sf-text-muted: #8A8F98;
    --sf-accent-red: #D71A1B;
    --sf-accent-black: #111111;
    --sf-border-color: #EAECEF;
    
    /* 核心修改 1：双宽度控制系统 */
    --sf-header-width: 1200px;    /* 头部菜单专用大宽度，让肩膀彻底打开 */
    --sf-container-width: 1040px; /* 下方内容区紧凑宽度，更聚焦 */
    
    --sf-gap: 20px;
    --sf-radius: 12px;
    --sf-radius-lg: 16px;
    --sf-transition: all 0.3s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { overflow-y: scroll; }
body { 
    font-family: var(--sf-font-sans); 
    background-color: var(--sf-bg-body); 
    color: var(--sf-text-main); 
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: clip; 
}

img { 
    max-width: 100% !important; 
    height: 100% !important; 
    object-fit: cover;      
    display: block; 
}
a { color: inherit; text-decoration: none; transition: var(--sf-transition); }
a:hover { color: var(--sf-accent-red); }

.sf-container { max-width: var(--sf-container-width); margin: 0 auto; padding: 0 20px; overflow: visible; }

/* ==========================================================================
   1. Header 导航区域
   ========================================================================== */
.site-header { background-color: #ffffff !important; border-bottom: none !important; position: sticky !important; top: 0; z-index: 2000 !important; }
.site-header .sf-container { max-width: var(--sf-header-width) !important; }
.header-inner { display: flex; justify-content: space-between; align-items: center; height: 80px; }

/* 站点 Logo 文字版 */
.site-branding .site-title { font-family: var(--sf-font-display); font-size: 26px; font-weight: 800; letter-spacing: -1px; margin: 0; }
.site-branding .site-title .sf-dot { color: var(--sf-accent-red); }
/* 站点 Logo 图片版自适应 */
.site-branding .custom-logo { max-height: 40px; width: auto; object-fit: contain; }

/* --- 菜单排版与高级悬浮聚焦效果 --- */
.main-navigation ul { display: flex; list-style: none; gap: 5px; margin: 0; padding: 0; }
.main-navigation a { 
    font-family: var(--sf-font-display); 
    font-size: 18px; 
    font-weight: 500; 
    color: var(--sf-text-main); /* 默认字色 */
    padding: 8px 18px; 
    border-radius: 30px; 
    transition: color 0.3s ease, background-color 0.3s ease; /* 确保颜色过渡丝滑 */
}

/* 当前所在页面的菜单：保持深黑色，并给一点极淡的底色以示区分 */
.main-navigation .current-menu-item > a { color: var(--sf-accent-black); background-color: #F7F7F9; }
/* 当鼠标悬停在整排菜单区域时，强制让所有菜单文字变浅灰色 */
.main-navigation ul:hover a { color: var(--sf-text-muted); background-color: transparent; }
/* 焦点反转：唯独当前鼠标精准指着的那个菜单，恢复深色，并浮现浅灰胶囊背景 */
.main-navigation ul:hover a:hover { color: var(--sf-accent-black); background-color: #F7F7F9; }

/* 导航位置排版魔法 */
.main-navigation.nav-align-left { flex: 1; display: flex; justify-content: flex-start; margin-left: 40px; }
.main-navigation.nav-align-center { position: absolute; left: 50%; transform: translateX(-50%); }

/* --- 头部右侧操作区 --- */
.header-actions { display: flex; align-items: center; gap: 15px; }

/* 功能按钮 (搜索/个人中心) 无浮动稳重版 */
.action-btn { 
    background: transparent; border: none; color: #111; font-size: 20px; cursor: pointer; padding: 5px; display: flex; align-items: center; justify-content: center; transition: opacity 0.2s ease; 
}
.action-btn:hover { opacity: 0.7; }
/* 登录后的头像展示 */
.sf-header-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 1px solid #eaeCEF; }


/* ==========================================================================
   2. 主体框架 (左侧悬浮导航 + 右侧主信息流)
   ========================================================================== */
html, body, .site, #page, #content, #primary, .site-content, .sf-container {
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
}

.sf-sticky-line {
    display: block !important;
    height: 1px !important;
    background-color: var(--sf-border-color) !important;
    width: 100% !important;
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 80px; 
    z-index: 2001 !important; 
    margin: 30px 0 30px 0 !important; 
    pointer-events: none;
}

/* 修改底部主内容网格 */
.sf-content-layout { 
    display: grid; 
    grid-template-columns: 220px 1fr 220px; 
    gap: var(--sf-gap); 
    align-items: flex-start !important; 
    width: 100% !important; 
    padding: 0 !important; 
    margin: 0 auto 60px auto; 
    overflow: visible; 
}

/* 确保右侧小工具在 220px 宽度下依然精致不拥挤 */
.sf-right-sidebar .widget { padding: 15px !important; }

/* --- 左侧悬浮导航区 --- */
.sf-left-nav {
    width: 100%;
    padding: 0 !important;
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 110px !important; 
    height: calc(100vh - 120px) !important; 
    display: flex !important;
    flex-direction: column !important;
    z-index: 100;
}

.nav-menu .sf-left-menu-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 25px; }
.nav-menu .sf-left-menu-list a { display: flex; align-items: center; gap: 15px; font-size: 18px; font-weight: 500; color: #C1C1C1; transition: color 0.3s ease; }
.nav-menu .sf-left-menu-list a i { font-size: 20px; width: 24px; text-align: center; }
.nav-menu .sf-left-menu-list li.current-menu-item > a, .nav-menu .sf-left-menu-list a:hover { color: var(--sf-text-main); }
.nav-copyright { margin-top: auto !important; font-size: 12px; color: #B0B0B0; line-height: 1.8; }
.nav-copyright a { color: #B0B0B0; text-decoration: none; }
.nav-copyright a:hover { color: var(--sf-text-main); }


/* --- 右侧主信息流 --- */
.sf-main-feed { width: 100%; min-width: 0; padding: 0 !important; }
.sf-right-sidebar { width: 100%; padding: 0 !important; position: sticky; top: 110px; }

.widget-title { font-size: 15px; font-weight: 700; margin-bottom: 15px; padding-left: 10px; border-left: 3px solid var(--sf-accent-red); }

/* 文章列表卡片 */
.sf-post-item { display: flex; justify-content: space-between; align-items: flex-start; gap: 25px; padding: 25px 0; border-bottom: 1px solid var(--sf-border-color); padding-left: 0 !important; padding-right: 0 !important; width: 100% !important; }
.sf-post-content { flex: 1; min-width: 0; padding: 0 !important; }
.sf-post-title { font-size: 20px; font-weight: 500; line-height: 1.4; margin: 8px 0; }
.sf-post-title a { color: var(--sf-text-main); transition: color 0.2s; }
.sf-post-title a:hover { color: var(--sf-accent-red); }
.sf-post-excerpt { font-size: 13px; color: var(--sf-text-muted); line-height: 1.6; margin-bottom: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sf-post-thumbnail { flex: 0 0 170px; height: 130px; border-radius: 6px; overflow: hidden; background-color: #f5f5f7; border: 1px solid var(--sf-border-color); margin-left: 20px; }
.sf-post-thumbnail img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.sf-post-item:hover .sf-post-thumbnail img { transform: scale(1.03); }

/* 去掉最后一篇文章的底部横线，防止多余线条堆叠 */
.sf-post-item:last-child { border-bottom: none; }

/* 底部元数据 */
.sf-post-footer { margin-top: auto; display: flex; flex-wrap: wrap; justify-content: flex-start; align-items: center; gap: 10px; color: var(--sf-text-muted); font-size: 12px; }
.sf-post-author { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.sf-post-author img { width: 20px !important; height: 20px !important; border-radius: 50%; }
.footer-divider { color: #E0E0E0; font-size: 10px; user-select: none; }
.sf-post-meta { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; font-size: 12px; }
.sf-post-meta a { color: var(--sf-text-muted); }
.sf-post-meta a:hover { color: var(--sf-accent-red); }

/* --- 三列顶部完美对齐补丁 --- */
.sf-main-feed .sf-post-item:first-child { padding-top: 0 !important; }
.sf-right-sidebar > *:first-child, .sf-right-sidebar .widget:first-child { margin-top: 0 !important; padding-top: 0 !important; }
.nav-menu .sf-left-menu-list { margin-top: 0 !important; }


/* ==========================================================================
   3. 全局底部版权区域优化 (居中显示)
   ========================================================================== */
.site-footer {
    text-align: center !important; /* 核心：强制所有内容水平居中 */
    padding: 40px 20px !important; /* 增加上下留白，让底部有呼吸感 */
    color: #86868b !important;     /* 极简风格的次要文字灰色 */
    font-size: 13px !important;
    line-height: 1.6 !important;
    border-top: 1px solid #f5f5f7 !important; /* 顶部加一条极淡的分割线收口 */
    background-color: transparent !important;
}

.site-footer a { color: #555 !important; text-decoration: none !important; transition: color 0.3s ease !important; }
.site-footer a:hover { color: #1d1d1f !important; }

/* 仅在“首页”的电脑端隐藏底部版权信息，内页正常保留 */
@media (min-width: 901px) {
    body.home .site-footer,
    body.blog .site-footer { display: none !important; }
}

/* 默认 PC 端隐藏移动端专门的底部版权（因为左侧悬浮导航里已经有了） */
.sf-mobile-footer { display: none; }


/* ==========================================================================
   4. 移动端终极响应式适配 (Mobile & Tablet)
   ========================================================================== */
/* 默认隐藏移动端元素 */
.mobile-menu-btn { display: none; }
.sf-mobile-nav-wrap { display: none; }

@media (max-width: 1024px) {
    .sf-content-layout { grid-template-columns: 1fr; } 
    .sf-right-sidebar { display: none; } 
    
    /* 【修复】：横向滑动标签栏 - 彻底解决整页左右晃动 */
    .sf-left-nav {
        display: block !important;
        position: relative !important;
        top: 0 !important;
        height: auto !important;
        padding: 5px 0 0px 0 !important; 
        z-index: 10;
        width: 100% !important;
        min-width: 0; 
        overflow: hidden; 
    }
    
    .nav-menu .sf-left-menu-list { 
        display: flex; flex-direction: row; overflow-x: auto; -webkit-overflow-scrolling: touch; 
        gap: 12px; padding-bottom: 5px; padding-left: 0px; padding-right: 20px; width: 100%;
        scrollbar-width: none; -ms-overflow-style: none; 
    }
    .nav-menu .sf-left-menu-list::-webkit-scrollbar { display: none; }
    
    .nav-menu .sf-left-menu-list a { 
        white-space: nowrap; font-size: 14px; background: #f4f5f7; padding: 8px 18px; 
        border-radius: 20px; gap: 6px; color: var(--sf-text-main); flex-shrink: 0; 
    }
    
    /* 彻底杀掉手机端的侧边栏版权文字 */
    .nav-copyright { display: none !important; }

    /* 平板端显示底部版权 */
    .sf-mobile-footer {
        display: block; text-align: center; padding: 10px 20px 30px; margin-top: 0; 
        border-top: none; background-color: transparent;
    }
    .sf-mobile-footer .site-info { font-size: 13px; color: var(--sf-text-muted); line-height: 1.8; }
    .sf-mobile-footer .site-info a { color: var(--sf-text-muted); text-decoration: none; }
}

@media (max-width: 768px) {
    /* --- 【核心修复】：隐藏 PC 端文字菜单 --- */
    .main-navigation { display: none !important; } 
    .social-icons { display: none !important; }
    /* 确保手机菜单按钮显示 */
    .mobile-menu-btn { display: flex !important; } 
    .site-branding .site-title { font-size: 22px; }
    
    /* 移动端下拉菜单面板 */
    .sf-mobile-nav-wrap {
        display: block; position: absolute; top: 100%; left: 0; width: 100%;
        background-color: #fff; box-shadow: 0 10px 20px rgba(0,0,0,0.06);
        max-height: 0; overflow: hidden; transition: max-height 0.4s cubic-bezier(0.25, 1, 0.5, 1), padding 0.4s ease;
        border-top: 1px solid transparent; z-index: 1999;
    }
    .sf-mobile-nav-wrap.active { max-height: 500px; padding: 10px 25px 25px 25px; border-top: 1px solid #f0f0f0; }
    .sf-mobile-nav-wrap ul { list-style: none; padding: 0; margin: 0; }
    .sf-mobile-nav-wrap li a { display: block; padding: 14px 0; font-size: 16px; font-weight: 500; color: var(--sf-text-main); border-bottom: 1px dashed #f0f0f0; }
    .sf-mobile-nav-wrap li:last-child a { border-bottom: none; }

    /* ==========================================================
       文章流适配：左文右图精致版 (替换了原来的上下大图结构)
       ========================================================== */
    .sf-post-item { flex-direction: row !important; justify-content: space-between !important; align-items: center !important; gap: 20px !important; padding: 20px 0 !important; }
    .sf-post-content { flex: 1 !important; min-width: 0 !important; padding: 0 !important; }
    .sf-post-title { font-size: 16px !important; margin: 0 0 20px 0 !important; line-height: 1.4 !important; font-weight: 500 !important; }
    /* 手机端隐藏摘要，突出标题 */
    .sf-post-excerpt { display: none !important; }
    /* 底部元数据缩小 */
    .sf-post-footer { gap: 8px !important; font-size: 11px !important; }
    .sf-post-author img { width: 16px !important; height: 16px !important; }
    /* 缩略图固定在右侧，尺寸调小 */
    .sf-post-thumbnail { flex: 0 0 105px !important; height: 85px !important; margin-left: 0 !important; margin-bottom: 0 !important; border-radius: 8px !important; }

    /* ==================================
       修复手机端菜单展开时的层级穿透问题
       ================================== */
    /* 1. 强行压低那条横线的层级，防止它飘在菜单上面 */
    .sf-sticky-line { position: relative !important; z-index: 10 !important; }
    /* 2. 拔高整个移动端下拉菜单的层级，确保它傲视群雄 */
    .sf-mobile-nav-wrap { z-index: 99999 !important; }
    /* 3. 保险起见，把包裹整个菜单的网站头部层级也一起拔高，并恢复吸顶！ */
    .site-header { position: -webkit-sticky !important; position: sticky !important; top: 0 !important; z-index: 99999 !important; }
    
    /* 手机端：底部区域增加顶部分割线 */
    .site-footer { border-top: 1px solid #f0f0f0 !important; margin-top: 30px !important; padding-top: 20px !important; }
}

/* ==========================================================================
   首页分页美化 (Apple 极简风)
   ========================================================================== */
.pagination, .nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 50px 0 0px; /* 增加上下留白，给底部腾出呼吸感 */
}

/* 基础数字/按钮样式 */
.pagination a, 
.pagination span,
.nav-links a, 
.nav-links span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    border-radius: 12px; /* 大圆角更具亲和力 */
    font-size: 15px;
    font-weight: 600;
    color: var(--sf-text-muted, #8A8F98);
    background-color: #F7F7F9; /* 浅灰色底色 */
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 鼠标悬停效果 */
.pagination a:hover, 
.nav-links a:hover {
    background-color: #E8E8ED; /* 悬停加深 */
    color: var(--sf-text-main, #1D1E20);
}

/* 当前活动页码 (Active) */
.pagination span.current, 
.nav-links span.current {
    background-color: var(--sf-accent-red, #D71A1B); /* 使用你的品牌红 */
    color: #FFFFFF !important;
    box-shadow: 0 4px 12px rgba(215, 26, 27, 0.25); /* 给红色按钮加点阴影光效 */
}

/* “上一页”和“下一页”特别加宽 */
.pagination .prev, 
.pagination .next,
.nav-links .prev, 
.nav-links .next {
    padding: 0 15px;
    font-weight: 500;
}

/* 省略号样式 */
.pagination .dots, 
.nav-links .dots {
    background: transparent !important;
    color: #CCC;
    cursor: default;
}

/* 移动端适配：缩小间距防止换行 */
@media (max-width: 768px) {
    .pagination, .nav-links {
        gap: 6px;
        margin: 30px 0 50px;
    }
    .pagination a, .pagination span {
        min-width: 36px;
        height: 36px;
        font-size: 14px;
        border-radius: 10px;
    }
}