/* ==========================================
   1. 全局色彩与变量 (大地自然系配色)
   ========================================= */
:root {
    --color-linen: #ebe5d9;     /* 极浅米色 (全站页面底色) */
    --color-sand: #d7cebd;      /* 沙色 (强调色) */
    --color-slate: #465568;     /* 灰蓝色 (导航栏背景) */
    --color-charcoal: #2c2f33;  /* 炭灰色 (正文主色) */
    --color-yellow: #e8b923;  
    --color-red: #d9534f;     
    --color-blue: #4a89bd;    
    --color-green: #5cb85c;   
    --bg-body: var(--color-linen);
    --bg-nav: var(--color-slate);
    --bg-logo: var(--color-linen);
    --text-main: var(--color-charcoal);
    --text-muted: #5a6268; 
    --white: #ffffff;          
}

/* ==========================================
   2. 基础重置与排版
   ========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-body);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased; 
    /* 👇 新增这三行魔法代码 👇 */
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* 强制 body 至少有一个屏幕的高度 */
}

a { text-decoration: none; color: inherit; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================
   3. 全局 Header (Logo上 / 导航下)
   ========================================== */
.site-header {
    background-color: var(--white); 
    box-shadow: none; 
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- 上层：Logo 区 --- */
.top-header {
    background-color: #ffffff; 
    padding: 20px 0;
}

.logo-link {
    display: flex;
    align-items: flex-end; /* 基础的底部对齐引擎 */
    gap: 15px;
}

.logo-img {
    height: 60px;
    width: auto; 
    display: block; 
}

.logo-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 1px;
    line-height: 1; 
    margin: 0;
    padding: 0; /* ✅ 第一步：清空所有可能捣乱的内边距 */
    
    /* 🪄 第二步：视觉微调黑魔法！用这个参数进行像素级上下移动 */
    /* 如果觉得文字偏高了，把数字变大（比如 2px, 5px）把它压下来 */
    /* 如果觉得文字偏低了，把数字变负（比如 -2px, -5px）把它抬上去 */
    transform: translateY(-2px); 
}

/* --- 下层：导航栏 --- */
.bottom-header {
    background-color: var(--bg-nav);
    color: #ffffff;
    height: 60px;
}

.bottom-header .header-container {
    height: 100%;
    width: 100%;
}

.main-nav {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    width: 100%;
    height: 100%;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 30px; 
    margin: 0;
    padding: 0;
}

.nav-links li {
    position: relative; 
    height: 60px;
    display: flex;
    align-items: center;
}

.main-nav a {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    transition: all 0.2s ease;
}

.main-nav a:hover { color: #ffffff; }

/* 下拉菜单 */
.main-nav .dropdown {
    display: none;
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--bg-nav);
    min-width: 140px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    border-radius: 0 0 4px 4px;
    padding: 10px 0;
    list-style: none;
    flex-direction: column;
}

.main-nav li.has-dropdown:hover .dropdown { display: flex; }

.main-nav .dropdown li {
    height: auto;
    width: 100%;
}

.main-nav .dropdown a {
    display: block;
    width: 100%;
    padding: 10px 20px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
}

.main-nav .dropdown a:hover {
    background-color: var(--color-yellow); 
    color: #ffffff;
}

/* ==========================================
   4. 首页/列表页 卡片网格 
   ========================================== */
.page-content { padding: 60px 0; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
}

.flat-card {
    background-color: #faf8f5; 
    border-radius: 8px;      
    overflow: hidden;
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
}

.flat-card:hover { transform: translateY(-5px); }

.flat-card-cover {
    height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bg-yellow { background-color: var(--color-yellow); }
.bg-red { background-color: var(--color-red); }
.bg-blue { background-color: var(--color-blue); }
.bg-green { background-color: var(--color-green); }

.flat-card-cover img, .flat-card-cover svg { width: 100px; height: 100px; }

.flat-card-body {
    padding: 30px;
    text-align: center;
    flex-grow: 1;
}

.flat-card-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-main);
}

.flat-card-desc {
    font-size: 14px;
    color: var(--text-muted);
}

/* ==========================================
   5. 文章详情页
   ========================================== */
.flat-post-card {
    background-color: var(--white); 
    padding: 60px 40px;      
    box-shadow: 0 4px 20px rgba(0,0,0,0.1); 
    margin-bottom: 40px;
}

.post-title {
    text-align: center;
    font-size: 32px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 15px;
}

.post-meta {
    text-align: center;
    color: var(--color-slate); 
    font-size: 14px;
    margin-bottom: 50px;     
}

.post-content {
    max-width: 900px;        
    margin: 0 auto;
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-main);
}

.post-content img,
.post-content video,
.post-content iframe {
    max-width: 100%;
    height: auto;
    border-radius: 8px; 
    margin: 40px auto;  
    display: block;     
}

.post-content p { margin-bottom: 20px; }
.post-content h2, .post-content h3 {
    color: var(--text-main);
    margin: 40px 0 20px;
    font-weight: 600;
}

/* ==========================================
   6. 页面主体与页脚
   ========================================== */
.main-content {
    margin: 40px 0; 
    min-height: calc(100vh - 350px); 
    flex: 1;
}

.site-footer {
    background-color: var(--bg-nav); 
    color: rgba(255, 255, 255, 0.7); 
    padding: 30px 0;
    text-align: center;
}

.site-footer a {
    color: rgba(255, 255, 255, 0.9);
    transition: color 0.2s ease;
}

.site-footer a:hover {
    color: var(--color-yellow); 
}

/* ==========================================
   7. 分类列表页头部、通用外框与分页
   ========================================== */
.category-header {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05); 
}

.category-title {
    font-size: 32px;
    color: var(--color-slate);
    text-align: center;
    border: none;
}

.category-content {
    margin-bottom: 50px;
}

/* 分页容器 */
.pagination {
    margin-top: 50px;
    display: flex;
    justify-content: center; 
    gap: 10px;
    flex-wrap: wrap; /* 增加换行，防止手机端页码过多撑破屏幕 */
}

/* 具体的页码按钮样式 */
.pagination .page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    background-color: var(--white);
    color: var(--text-main);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pagination .page-btn:hover {
    background-color: var(--color-yellow);
    color: var(--white);
    border-color: var(--color-yellow);
}

/* 当前所在页的激活样式 */
.pagination .page-btn.active {
    background-color: var(--color-slate);
    color: var(--white);
    border-color: var(--color-slate);
    cursor: default;
    pointer-events: none; /* 当前页不可再点击 */
}

/* ==========================================
   8. 列表页图文卡片 (list-cover)
   ========================================== */
.list-cover {
    display: grid;
    grid-template-columns: repeat(3, 1fr); 
    gap: 30px;
}

.list-cover-item {
    background-color: var(--white);
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); 
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
}

.list-cover-item:hover {
    transform: translateY(-5px); 
}

.list-cover-item .cover-image {
    height: 200px;
    background-color: var(--color-sand); 
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.list-cover-item .cover-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
}

.list-cover-item .no-image {
    color: rgba(0, 0, 0, 0.4);
    font-size: 14px;
    letter-spacing: 2px;
}

.list-cover-item .content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.list-cover-item .title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.4;
    text-align: center;
}

.list-cover-item .title a {
    color: var(--text-main);
    transition: color 0.2s ease;
}

.list-cover-item .title a:hover {
    color: var(--color-yellow); 
}

.list-cover-item .summary {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 0;
    /*display: -webkit-box;*/
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    display: none;
}

/* ==========================================
   9. 日常随笔列表 (list-blog)
   ========================================== */
.list-blog {
    display: flex;
    flex-direction: column;
    gap: 40px; 
    margin: 0 auto;   
}

.list-blog-item {
    background-color: var(--white); 
    padding: 50px; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.1); 
    transition: transform 0.2s ease;
}

.list-blog-item:hover {
    transform: translateY(-3px); 
}

.list-blog-item .blog-title {
    font-size: 26px;
    font-weight: 600;
    margin-bottom: 15px;
    line-height: 1.4;
}

.list-blog-item .blog-title a {
    color: var(--text-main);
    transition: color 0.2s ease;
}

.list-blog-item .blog-title a:hover {
    color: var(--color-yellow); 
}

.list-blog-item .blog-meta {
    font-size: 14px;
    color: var(--color-slate); 
    margin-bottom: 20px;
}

.list-blog-item .blog-summary {
    font-size: 16px;
    color: var(--text-main);
    line-height: 1.8;
    margin-bottom: 25px;
    text-indent: 2em;
}

.list-blog-item .blog-read-more {
    display: inline-block;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-slate);
    border-bottom: 1px solid transparent; 
    transition: all 0.2s ease;
}

.list-blog-item .blog-read-more:hover {
    color: var(--color-yellow);
    border-bottom-color: var(--color-yellow); 
}

.list-blog-item .blog-summary img {
    max-width: 100%;
}

/* ==========================================
   10. 详情页返回按钮
   ========================================== */
.post-actions {
    margin-top: 60px; 
    text-align: center; 
}

.flat-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: #ffffff; 
    background-color: #f39c12; 
    padding: 10px 30px;
    border-radius: 0; 
    font-weight: 500;
    transition: all 0.2s ease;
}

.flat-back-btn::before {
    content: "";
    display: inline-block;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 7px solid #ffffff; 
    margin-right: 10px; 
    transition: transform 0.2s ease;
}

.flat-back-btn:hover {
    background-color: #e67e22; 
    color: #ffffff;
}

.flat-back-btn:hover::before {
    transform: translateX(-4px); 
}

/* ==========================================
   11. 详情页面包屑导航
   ========================================== */
.breadcrumb-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap; 
    gap: 10px;
    font-size: 14px;
    color: var(--color-slate); 
    margin-bottom: 20px; 
}

.breadcrumb-nav a {
    color: var(--color-slate);
    transition: color 0.2s ease;
}

.breadcrumb-nav a:hover {
    color: #f39c12; 
}

.breadcrumb-nav .separator {
    color: rgba(70, 85, 104, 0.3); 
    font-size: 13px;
}

.breadcrumb-nav .current {
    color: #333333;
    font-weight: 500;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================
   12. 终极响应式装甲 (Mobile & Tablet)
   ========================================== */

/* 🛡️ 1. 全局防溢出与流式容器 */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px; 
    box-sizing: border-box;
}

img {
    max-width: 100%;
    height: auto;
}

/* ---- 桌面端：隐藏汉堡按钮，Logo正常排列 ---- */
.mobile-menu-btn {
    display: none; 
    cursor: pointer;
    width: 28px;
    height: 20px;
    flex-direction: column;
    justify-content: space-between;
}
.mobile-menu-btn span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: #333333; 
    border-radius: 3px;
    transition: all 0.3s ease;
}

.branding-link {
    display: flex;
    align-items: center;
    gap: 15px;
}
.site-logo {
    max-height: 60px;
    width: auto;
}

/* 📱 2. 手机端 (小于 768px) 深度适配 */
@media (max-width: 768px) {
    
    /* ---- A. 彻底修复顶部栏：强制单行排列、纯白背景 ---- */
    .site-header { position: relative; z-index: 1000; }
    .top-header {
        padding: 10px 15px !important;
        background-color: #ffffff !important;
        border-bottom: 1px solid #f0f0f0; 
    }
    .top-header .header-container {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        flex-wrap: nowrap !important; 
        padding: 0 !important;
    }
    
    /* ✅ 修复点4：Logo与文字底对齐，文字加大 */
    .logo-link {
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-end !important; /* 核心：底部对齐 */
        gap: 10px !important;
        background: transparent !important; 
    }
    .logo-img {
        height: 38px !important; /* Logo稍微放大一点点搭配大文字 */
        width: auto !important;
        margin: 0 !important;
        display: block !important;
    }
    .logo-title {
        font-size: 24px !important; /* 文字显著加大 */
        color: #333 !important;
        background: transparent !important;
        margin: 0 !important;
        line-height: 1 !important;
        white-space: nowrap !important; 
        padding-bottom: 2px !important; /* 视觉微调：消除英文字母下沉的影响，完美踩准底线 */
        transform: none !important;
    }
    .mobile-menu-btn { display: flex; }

    /* ---- B. 悬浮右侧的迷你下拉菜单 ---- */
    .bottom-header {
        display: none;
        position: absolute !important;
        top: 55px !important; 
        right: 15px !important; 
        left: auto !important; 
        width: 140px !important; /* 宽度再收缩，更精致 */
        background-color: var(--color-slate) !important; 
        border-radius: 8px !important;
        box-shadow: 0 10px 30px rgba(0,0,0,0.2) !important;
        padding: 5px 0 !important;
        z-index: 9999 !important;
        height: auto !important; /* ✅ 修复点1：致命Bug修复！允许高度自动撑开包裹所有菜单项 */
    }
    .bottom-header.nav-active {
        display: block !important;
    }

    /* ---- C. 紧凑型菜单项 ---- */
    .main-nav { display: block !important; height: auto !important; }
    .nav-links {
        display: block !important;
        flex-direction: column !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .nav-links li {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        position: relative !important; 
    }
    
    /* ✅ 修复点2：菜单项大瘦身，缩小留白 */
    .nav-links > li > a {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 10px 15px !important; /* 上下左右留白减小 */
        font-size: 14px !important;
        color: #ffffff !important;
        border-bottom: 1px solid rgba(255,255,255,0.05) !important;
        height: auto !important;
        line-height: 1.2 !important;
    }
    .nav-links > li:last-child > a { border-bottom: none !important; }

    /* ---- D. 子菜单从【左侧】滑出魔法 ---- */
    .has-dropdown .dropdown {
        display: none !important; 
        position: absolute !important;
        top: 0 !important;
        right: 100% !important; 
        left: auto !important;
        margin-right: 2px !important; /* 缩短与主菜单的缝隙 */
        width: 120px !important; /* 子菜单变得更娇小 */
        background-color: #3b4859 !important; 
        border-radius: 8px !important;
        box-shadow: -5px 5px 15px rgba(0,0,0,0.2) !important;
        padding: 5px 0 !important;
        transform: none !important;
    }
    .has-dropdown.dropdown-active .dropdown { display: block !important; }
    .has-dropdown.dropdown-active > a i {
        transform: rotate(90deg) !important; 
    }
    
    /* ✅ 修复点2：子菜单项更加紧凑 */
    .has-dropdown .dropdown a {
        padding: 8px 12px !important; /* 极致紧凑的内边距 */
        font-size: 13px !important;
        color: rgba(255,255,255,0.9) !important;
        text-align: left !important;
        border-bottom: none !important;
        display: block !important;
        line-height: 1.2 !important;
    }

    /* ---- E. 汉堡按钮变 X 的动画 ---- */
    .mobile-menu-btn.toggle-active span:nth-child(1) { transform: translateY(8.5px) rotate(45deg); }
    .mobile-menu-btn.toggle-active span:nth-child(2) { opacity: 0; }
    .mobile-menu-btn.toggle-active span:nth-child(3) { transform: translateY(-8.5px) rotate(-45deg); }

    /* ---- F. 正文卡片瘦身响应式 & 修复点3：单列显示 ---- */
    .list-cover { grid-template-columns: 1fr !important; } /* ✅ 强制图文卡片变单列 */
    
    .flat-post-card, .list-blog-item { padding: 25px 20px; }
    .post-title { font-size: 24px; line-height: 1.4; }
    .blog-title { font-size: 20px; }
    .post-content, .blog-summary { font-size: 15px; }
    .breadcrumb-nav { font-size: 13px; margin-bottom: 15px; }
    .post-actions .flat-back-btn { width: 100%; box-sizing: border-box; }
}

/* 💻 3. 平板端 (小于 992px) 轻微过渡 */
@media (max-width: 992px) {
    .list-cover { grid-template-columns: repeat(2, 1fr); }
}