/*
Theme Name: Twenty Twenty-Five Child
Theme URI: 
Author: xuejiuwangluo
Author URI: 
Description: 
Requires at least: 6.9
Tested up to: 6.9
Requires PHP: 
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Template: twentytwentyfive
Text Domain: twenty-twenty-five-child
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready

/* ===================================================================
 * 全局变量：可在此处一键修改电脑端/手机端菜单主色调
 * =================================================================== */

/* ===================================================================
 * 全局变量：可在此处一键修改电脑端/手机端菜单主色调
 * =================================================================== */
:root {
    --header-height: 56px;
    --menu-desktop-text: #333333;
    --menu-desktop-hover-bg: rgba(0, 0, 0, 0.05);
    --menu-desktop-hover-text: #0056b3;
    --menu-mobile-bg: #ffffff;
    --menu-mobile-text: #333333;
    --menu-mobile-hover-bg: #f5f5f5;
    --menu-mobile-separator: #eeeeee;
}

/* ===================================================================
 * 1. 基础结构：头部固定、间距清除
 * =================================================================== */
.erphpdown-content-vip { margin-top: 100px !important; }

.app-style-header {
    display: flex; align-items: center; justify-content: space-between;
    background-color: #ffffff; border-bottom: 1px solid #f0f0f0;
    position: fixed; top: 0; left: 0; width: 100%; z-index: 999;
    box-sizing: border-box; height: var(--header-height); padding: 0 15px;
}
.app-style-header.wp-block-group { padding: 0 15px; }
.app-style-header .wp-block-columns { width: 100%; gap: 0; }
.app-style-header .header-column.left,
.app-style-header .header-column.right { flex: 0 0 50px; display: flex; }
.app-style-header .header-column.left { justify-content: flex-start; }
.app-style-header .header-column.right { justify-content: flex-end; }
.app-style-header .header-column.center { flex: 1; text-align: center; }

.app-style-header .header-title,
.app-style-header .wp-block-post-title {
    font-size: 18px !important; font-weight: bold; color: #333333;
    margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.app-nav-action-button, .app-nav-back-button {
    background: none; border: none; cursor: pointer; color: #333333; 
    padding: 5px; display: flex; align-items: center; justify-content: center; text-decoration: none;
}
.app-nav-action-button:hover { opacity: 0.7; }

/* 页面顶部间距 */
body.page-template-page-erphpdown-user .user-center-container { padding-top: var(--header-height); }
body:not(.home) .wp-site-blocks { padding-top: var(--header-height); }

/* 首页白边消除 */
html, body.home { 
    margin-top: 0 !important; 
    padding-top: 0 !important; 
}
body.home .wp-site-blocks,
body.home .wp-site-blocks > div,
body.home .entry-content,
body.home .wp-block-post-content {
    margin-top: 0 !important;
    padding-top: 0 !important;
}
body.home .wp-site-blocks > * {
    margin-block-start: 0 !important;
}
body.page-template-wp-custom-template .wp-block-post-content.has-global-padding {
    max-width: none !important; padding-left: 0 !important; padding-right: 0 !important;
}
body.home .entry-content > p:first-child,
body.home .wp-block-post-content > p:first-child {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 0 !important;
}

/* ===================================================================
 * 2. 全局页眉悬浮效果（首页透明/内页白色）
 * =================================================================== */
body.home .xuejiu-global-header {
    position: absolute !important; 
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    z-index: 99999 !important;     
    background-color: transparent !important; 
    margin: 0 !important; 
    border-bottom: none !important;
}
body.home .xuejiu-global-header > .wp-block-group {
    background-color: transparent !important; 
    border-bottom: none !important;
}
body.home .xuejiu-global-header .wp-block-site-title a {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif !important;
    color: #ffffff !important; 
    font-size: 26px !important;
    font-weight: 600 !important; 
    letter-spacing: 2px !important; 
    text-decoration: none !important;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important; 
}

/* 内页站点标题颜色 */
body:not(.home) .wp-block-site-title a {
    color: #333333 !important;
    text-shadow: none !important;
}

/* ===================================================================
 * 3. 页眉列对齐：Logo与菜单强制同行垂直居中
 * =================================================================== */
.xuejiu-global-header .wp-block-columns {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important; 
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
}
.xuejiu-global-header .wp-block-column {
    margin: 0 !important;
    padding: 0 !important;
}
.xuejiu-global-header .wp-block-column > * {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* 左侧 Logo + 标题 */
.xuejiu-global-header .wp-block-column:first-child {
    flex: 0 0 auto !important;
}
.xuejiu-global-header .wp-block-column:first-child .wp-block-group {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 15px !important;
    margin: 0 !important;
}
.xuejiu-global-header .wp-block-site-logo,
.xuejiu-global-header .wp-block-site-title {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
}

/* 右侧菜单 + 搜索 */
.xuejiu-global-header .wp-block-column:last-child {
    flex: 1 1 auto !important;
    display: flex !important;
    align-items: center !important; 
    justify-content: flex-end !important;
    height: 100% !important;
}

/* ===================================================================
 * 4. Mega Menu 电脑端样式（完全独立于手机端）
 * =================================================================== */
#mega-menu-wrap-max_mega_menu_1 {
    background: transparent !important;
    clear: none !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
    z-index: 999999 !important;
}

/* 桌面端菜单条 */
#mega-menu-wrap-max_mega_menu_1 ul.mega-menu {
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
}

/* 桌面端菜单项 */
#mega-menu-wrap-max_mega_menu_1 #mega-menu-max_mega_menu_1 > li.mega-menu-item {
    white-space: nowrap !important; 
}

/* 桌面端链接默认样式（内页） */
#mega-menu-wrap-max_mega_menu_1 #mega-menu-max_mega_menu_1 > li.mega-menu-item > a.mega-menu-link {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif !important;
    background: transparent !important;
    color: var(--menu-desktop-text) !important;
    font-size: 18px !important;
    font-weight: 500 !important;
    letter-spacing: 1px !important;
    padding: 10px 20px !important;
    white-space: nowrap !important;
    transition: all 0.2s ease;
}

/* 桌面端悬停效果(内页) */
#mega-menu-wrap-max_mega_menu_1 #mega-menu-max_mega_menu_1 > li.mega-menu-item:hover > a.mega-menu-link {
    color: var(--menu-desktop-hover-text) !important;
    background: var(--menu-desktop-hover-bg) !important;
    border-radius: 6px;
}

/* 桌面端当前激活项 */
#mega-menu-wrap-max_mega_menu_1 #mega-menu-max_mega_menu_1 > li.mega-current-menu-item > a.mega-menu-link {
    color: var(--menu-desktop-hover-text) !important;
    font-weight: 600 !important;
}

/* 首页桌面端：白色透明菜单 */
body.home #mega-menu-wrap-max_mega_menu_1 #mega-menu-max_mega_menu_1 > li.mega-menu-item > a.mega-menu-link {
    color: #fff !important;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}
body.home #mega-menu-wrap-max_mega_menu_1 #mega-menu-max_mega_menu_1 > li.mega-menu-item:hover > a.mega-menu-link {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.15) !important;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8) !important;
}

/* ===================================================================
 * 5. 搜索框样式（桌面端 + 手机端统一处理）
 * =================================================================== */
.xuejiu-header-search {
    margin: 0 0 0 20px !important; 
    display: flex !important;
    align-items: center !important;
}
.xuejiu-header-search .wp-block-search__inside-wrapper {
    display: flex;
    align-items: center;
}
.xuejiu-header-search .wp-block-search__input {
    border-radius: 20px !important;
    border: 1px solid #dddddd !important;
    padding: 5px 15px !important;
    background: #f9f9f9 !important;
    color: #333333 !important;
    font-size: 14px !important;
    transition: all 0.3s ease;
    margin: 0 !important;
}
.xuejiu-header-search .wp-block-search__input:focus {
    border-color: #0056b3 !important;
    background: #ffffff !important;
    outline: none !important;
}
.xuejiu-header-search .wp-block-search__button {
    background: transparent !important;
    border: none !important;
    padding: 5px 10px !important;
    color: #666666 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    cursor: pointer;
}
.xuejiu-header-search .wp-block-search__button:hover {
    color: #0056b3 !important;
}

/* 首页搜索框玻璃效果 */
body.home .xuejiu-header-search .wp-block-search__input {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: #ffffff !important;
}
body.home .xuejiu-header-search .wp-block-search__input::placeholder {
    color: rgba(255, 255, 255, 0.7) !important;
}
body.home .xuejiu-header-search .wp-block-search__input:focus {
    background: rgba(255, 255, 255, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.6) !important;
}
body.home .xuejiu-header-search .wp-block-search__button {
    color: #ffffff !important;
}

/* ===================================================================
 * 6. 手机端响应式样式（≤1000px）
 * 重点：修复了 Flexbox 导致的菜单居中问题，并优化了左对齐
 * =================================================================== */
@media only screen and (max-width: 1000px) {

    /* 头部基础调整 */
    .xuejiu-global-header {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
.xuejiu-global-header .wp-block-site-title a {
        font-size: 17px !important; 
        letter-spacing: 0px !important; 
        line-height: 1.2 !important;
        white-space: nowrap !important; /* 关键修复：强制文字不换行 */
    }
    .xuejiu-global-header .wp-block-column:first-child {
        flex: 1 1 auto !important; 
        min-width: 0 !important;
    }
    .xuejiu-global-header .wp-block-column:last-child {
        display: flex !important;
        align-items: center !important; 
        justify-content: flex-end !important;
        height: 100% !important;
    }
    #mega-menu-wrap-max_mega_menu_1 {
        display: flex !important;
        align-items: center !important;
        height: 100% !important;
    }

    /* 汉堡图标按钮重置 */
    #mega-menu-wrap-max_mega_menu_1 .mega-menu-toggle {
        display: flex !important; 
        align-items: center !important; 
        margin: 0 !important;
        padding: 0 !important;
        height: auto !important;
    }
    #mega-menu-wrap-max_mega_menu_1 .mega-menu-toggle button.mega-toggle-standard {
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        line-height: 1 !important; 
        background: transparent !important;
    }
    body.home #mega-menu-wrap-max_mega_menu_1 #mega-menu-max_mega_menu_1 > li.mega-menu-item > a.mega-menu-link {
        color: black !important;
        text-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    }
    
    /* 【关键修复】：手机端菜单横排问题 → 强制竖直排列，并修复居中Bug */
    #mega-menu-wrap-max_mega_menu_1 ul.mega-menu {
        flex-direction: column !important;
        align-items: stretch !important; /* 覆盖电脑端的 center，让菜单项撑满整行 */
        width: 100% !important;
    }

    /* 可选：让子菜单也清晰展示 */
    #mega-menu-wrap-max_mega_menu_1 #mega-menu-max_mega_menu_1 ul.mega-sub-menu {
        display: block !important;
        position: static !important;
        box-shadow: none !important;
        padding-left: 10px !important;
    }
    /* 子菜单文字左对齐 */
    #mega-menu-wrap-max_mega_menu_1 #mega-menu-max_mega_menu_1 ul.mega-sub-menu a.mega-menu-link {
        text-align: left !important;
    }
    /* 隐藏“菜单”文字 */
    #mega-menu-wrap-max_mega_menu_1 .mega-menu-toggle .mega-toggle-label-closed,
    #mega-menu-wrap-max_mega_menu_1 .mega-menu-toggle .mega-toggle-label-open,
    #mega-menu-wrap-max_mega_menu_1 .mega-menu-toggle .mega-toggle-block-text {
        display: none !important; 
    }
    /* 汉堡图标 */
    #mega-menu-wrap-max_mega_menu_1 .mega-menu-toggle .mega-toggle-block-icon {
        display: flex !important;
        align-items: center !important;
        margin: 0 !important;
        font-size: 24px !important; 
    }
    #mega-menu-wrap-max_mega_menu_1 .mega-menu-toggle .mega-toggle-block-icon::before {
        margin: 0 !important;
        padding: 0 !important;
    }

    /* 首页汉堡图标白色，内页深色 */
    body.home #mega-menu-wrap-max_mega_menu_1 .mega-menu-toggle .mega-toggle-block-icon {
        color: #ffffff !important; 
    }
    body:not(.home) #mega-menu-wrap-max_mega_menu_1 .mega-menu-toggle .mega-toggle-block-icon {
        color: #333333 !important; 
    }

    /* 手机端弹出菜单整体容器样式 */
    #mega-menu-wrap-max_mega_menu_1 .mega-menu-toggle + #mega-menu-max_mega_menu_1 {
        background-color: var(--menu-mobile-bg) !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        border-radius: 0 0 8px 8px;
        padding: 10px 0;
        width: 90% !important;          
        left: 0 !important;             
        right: auto !important;
        margin-left: 0 !important;
        margin-right: auto !important;
    }

    /* 手机端菜单项链接基础样式 */
    #mega-menu-wrap-max_mega_menu_1 #mega-menu-max_mega_menu_1 > li.mega-menu-item > a.mega-menu-link {
        color: var(--menu-mobile-text) !important;
        font-size: 16px !important;
        padding: 14px 20px !important;
        border-bottom: 1px solid var(--menu-mobile-separator);
        text-shadow: none !important;
        background: transparent !important;
        display: block;
        width: 100%;
        font-weight: 500 !important;
        letter-spacing: 0.5px !important;
    }

    /* 手机端悬停/激活项 */
    #mega-menu-wrap-max_mega_menu_1 #mega-menu-max_mega_menu_1 > li.mega-menu-item:hover > a.mega-menu-link,
    #mega-menu-wrap-max_mega_menu_1 #mega-menu-max_mega_menu_1 > li.mega-current-menu-item > a.mega-menu-link {
        background: var(--menu-mobile-hover-bg) !important;
        color: #0056b3 !important;
        font-weight: 600 !important;
    }
    body.home #mega-menu-wrap-max_mega_menu_1 #mega-menu-max_mega_menu_1 > li.mega-menu-item:hover > a.mega-menu-link {
        color: #2196f3 !important;
        background: rgba(255, 255, 255, 0.15) !important;
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.8) !important;
    }

    /* 清除子菜单默认样式 */
    #mega-menu-wrap-max_mega_menu_1 #mega-menu-max_mega_menu_1 ul.mega-sub-menu {
        background-color: var(--menu-mobile-bg) !important;
    }
    #mega-menu-wrap-max_mega_menu_1 #mega-menu-max_mega_menu_1 ul.mega-sub-menu a.mega-menu-link {
        color: var(--menu-mobile-text) !important;
    }

    /* 手机端搜索框悬浮展开效果 */
    .xuejiu-global-header {
        position: relative !important; 
    }
    .xuejiu-global-header .wp-block-columns,
    .xuejiu-global-header .wp-block-column,
    .xuejiu-header-search,
    .xuejiu-header-search .wp-block-search__inside-wrapper {
        position: static !important;
    }
.xuejiu-header-search {
        display: flex !important;
        margin-left: 0 !important;
        margin-right: 5px !important; /* 关键修复：将 15px 改为 5px，让两个按钮靠得更近 */
        order: -1 !important; 
    }
    .xuejiu-header-search .wp-block-search__input {
        position: absolute !important;
        top: 100% !important; 
        left: 0 !important;
        width: 100% !important; 
        height: 50px !important;
        padding: 0 20px !important;
        border-radius: 0 !important;
        border: none !important;
        border-bottom: 1px solid #eee !important;
        background: #ffffff !important;
        color: #333333 !important;
        font-size: 16px !important;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1) !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transform: translateY(-10px) !important;
        transition: all 0.3s ease !important;
        z-index: -1 !important;
    }
    body.home .xuejiu-header-search .wp-block-search__input {
        background: rgba(0, 0, 0, 0.85) !important; 
        border-bottom: 1px solid rgba(255,255,255,0.2) !important;
        color: #ffffff !important;
    }
    .xuejiu-header-search:focus-within .wp-block-search__input {
        opacity: 1 !important;
        pointer-events: auto !important;
        transform: translateY(0) !important;
        z-index: 99999 !important;
    }
    .xuejiu-header-search .wp-block-search__button {
        padding: 5px !important;
        position: relative !important;
        z-index: 100000 !important; 
    }

    /* 【关键修复】：强制手机端菜单项左对齐，并保持图标间距 */
    #mega-menu-wrap-max_mega_menu_1 .mega-menu-toggle + #mega-menu-max_mega_menu_1 > li.mega-menu-item > a.mega-menu-link {
        display: flex !important;
        justify-content: flex-start !important;
        align-items: center !important;
        text-align: left !important;
        padding-left: 20px !important; /* 给左侧留一点呼吸空间 */
    }

    /* 让图标和文字之间有一点间距 */
    #mega-menu-wrap-max_mega_menu_1 .mega-menu-toggle + #mega-menu-max_mega_menu_1 > li.mega-menu-item > a.mega-menu-link > i,
    #mega-menu-wrap-max_mega_menu_1 .mega-menu-toggle + #mega-menu-max_mega_menu_1 > li.mega-menu-item > a.mega-menu-link > svg {
        margin-right: 10px !important;
    }

    /* 如果有下拉箭头指示器，让它靠右对齐 */
    #mega-menu-wrap-max_mega_menu_1 .mega-menu-toggle + #mega-menu-max_mega_menu_1 > li.mega-menu-item > a.mega-menu-link .mega-indicator {
        margin-left: auto !important;
    }
}

/* ===================================================================
 * 7. 高级微调：内页 Mega Menu 文本颜色修复
 * =================================================================== */
body:not(.home) #mega-menu-wrap-max_mega_menu_1 #mega-menu-max_mega_menu_1 > li.mega-menu-item > a.mega-menu-link {
    color: var(--menu-desktop-text) !important;
}
body:not(.home) #mega-menu-wrap-max_mega_menu_1 #mega-menu-max_mega_menu_1 > li.mega-menu-item:hover > a.mega-menu-link {
    color: var(--menu-desktop-hover-text) !important;
    background: var(--menu-desktop-hover-bg) !important;
}
body:not(.home) #mega-menu-wrap-max_mega_menu_1 #mega-menu-max_mega_menu_1 > li.mega-menu-item > a.mega-menu-link {
    text-shadow: none !important;
}

/* ===================================================================
 * 8. 文章内页高级排版微调 (单栏居中卡片式)
 * =================================================================== */
/* 限制文章正文中的图片最大宽度，防止撑破卡片 */
.wp-block-post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

/* 优化段落行高和字距，提升阅读体验 */
.wp-block-post-content p {
    font-size: 16px;
    line-height: 1.8;
    color: #444444;
    margin-bottom: 25px;
}

/* 移动端文章卡片适配 */
@media (max-width: 768px) {
    main.wp-block-group {
        padding-top: 20px !important;
        padding-bottom: 20px !important;
    }
    /* 手机端减小卡片内边距，取消圆角让其撑满屏幕 */
    main.wp-block-group > .wp-block-group {
        padding: 20px 15px !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }
}
/* ===================================================================
 * 9. 归档页（文章列表页）高级排版与交互
 * =================================================================== */

/* 右侧文章卡片悬停动效 */
.xuejiu-archive-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid transparent;
}
.xuejiu-archive-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.08) !important;
    border-color: #f0f0f0;
}

/* 优化文章标题悬停颜色，去掉默认下划线 */
.xuejiu-archive-card .wp-block-post-title a {
    text-decoration: none !important;
    transition: color 0.3s ease;
}
.xuejiu-archive-card .wp-block-post-title a:hover {
    color: #0056b3 !important;
}

/* 强制缩略图比例和填充方式，防止图片变形 */
.xuejiu-archive-card .wp-block-post-featured-image img {
    object-fit: cover;
    width: 100%;
    height: 100%;
    transition: transform 0.5s ease;
}
/* 缩略图外框隐藏溢出，实现图片放大动效 */
.xuejiu-archive-card .wp-block-post-featured-image {
    overflow: hidden;
}
.xuejiu-archive-card:hover .wp-block-post-featured-image img {
    transform: scale(1.05);
}

/* 修复左侧菜单在卡片内的样式（去除重复的阴影和圆角冲突） */
.wp-block-column .xuejiu-sidebar-menu {
    box-shadow: none !important;
    border-radius: 0 !important;
}
.wp-block-column .xuejiu-sidebar-menu .sidebar-header {
    border-radius: 8px 8px 0 0 !important; /* 顶部圆角贴合外层卡片 */
}

/* 移动端适配：列表页改为上下堆叠 */
@media (max-width: 768px) {
    .xuejiu-archive-card .wp-block-columns {
        flex-direction: column !important;
        gap: 15px !important;
    }
    .xuejiu-archive-card .wp-block-column {
        width: 100% !important;
        margin-left: 0 !important;
    }
    /* 手机端缩略图比例调整 */
    .xuejiu-archive-card .wp-block-post-featured-image {
        margin-bottom: 10px;
    }
}
