/* 强制优化非首页页面头部 - 最高优先级样式 */


/* 此文件必须在最后加载以确保优先级 */


/* 只隐藏非首页页面头部的标题部分，保留导航栏 - 最高优先级规则 */


/* 隐藏标题部分 */

#page-header.not-home-page #page-site-info,
body #page-header.not-home-page #page-site-info,
html body #page-header.not-home-page #page-site-info,
html body .layout #page-header.not-home-page #page-site-info,
.layout #page-header.not-home-page #page-site-info,
#post #page-header.not-home-page #page-site-info,
.post #page-header.not-home-page #page-site-info,
body .layout #page-header.not-home-page #page-site-info,
#page-header.not-home-page.fixed #page-site-info,
body #page-header.not-home-page.fixed #page-site-info,
html body #page-header.not-home-page.fixed #page-site-info {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}


/* 隐藏标题部分的子元素 */

#page-header.not-home-page #page-site-info *,
#page-header.not-home-page #site-title,
#page-header.not-home-page h1#site-title {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
}


/* 调整 header 高度，只保留 nav 的高度 */

#page-header.not-home-page,
body #page-header.not-home-page,
html body #page-header.not-home-page,
html body .layout #page-header.not-home-page,
.layout #page-header.not-home-page,
#post #page-header.not-home-page,
.post #page-header.not-home-page,
body .layout #page-header.not-home-page,
#page-header.not-home-page.fixed,
body #page-header.not-home-page.fixed,
html body #page-header.not-home-page.fixed {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    padding: 0 !important;
    margin-bottom: 0 !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
}


/* 如果 header 是 fixed，确保它不影响页面布局 */

#page-header.not-home-page.fixed {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 1000 !important;
}


/* 确保 nav 正常显示 - 最高优先级 */

#page-header.not-home-page #nav,
body #page-header.not-home-page #nav,
html body #page-header.not-home-page #nav,
html body .layout #page-header.not-home-page #nav,
.layout #page-header.not-home-page #nav,
#post #page-header.not-home-page #nav,
.post #page-header.not-home-page #nav,
body .layout #page-header.not-home-page #nav,
#page-header.not-home-page.fixed #nav,
body #page-header.not-home-page.fixed #nav,
html body #page-header.not-home-page.fixed #nav,
#page-header.not-home-page #nav.show,
body #page-header.not-home-page #nav.show {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    z-index: 1000 !important;
}


/* 确保隐藏 header 背景图片 */

#page-header.not-home-page::before,
body #page-header.not-home-page::before,
html body #page-header.not-home-page::before {
    display: none !important;
    content: none !important;
    background: none !important;
    background-image: none !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}


/* 确保隐藏 header 后内容区域正常显示 */

#page-header.not-home-page+*,
#page-header.not-home-page~*,
#page-header.not-home-page~.layout_post,
#page-header.not-home-page~#article-container,
body:has(#page-header.not-home-page) .layout_post,
body:has(#page-header.not-home-page) #article-container {
    margin-top: 0 !important;
    padding-top: 0 !important;
}


/* 完全隐藏背景图片 */

#page-header.not-home-page::before,
body #page-header.not-home-page::before,
html body #page-header.not-home-page::before {
    display: none !important;
    content: none !important;
    background: none !important;
    background-image: none !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}


/* 强制移除 #page-header:not(.not-top-img):before 伪元素 */

#page-header:not(.not-top-img)::before,
body #page-header:not(.not-top-img)::before,
html body #page-header:not(.not-top-img)::before,
.layout #page-header:not(.not-top-img)::before,
html body .layout #page-header:not(.not-top-img)::before {
    display: none !important;
    content: none !important;
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
    position: static !important;
    width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    z-index: -1 !important;
}


/* 隐藏遮罩层 */

#page-header.not-home-page .mask,
#page-header.not-home-page .header-mask {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    pointer-events: none !important;
}


/* 优化标题 */

#page-header.not-home-page .post-title,
#page-header.not-home-page h1,
#page-header.not-home-page .title {
    margin-top: 0 !important;
    margin-bottom: 5px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    font-size: 1.4em !important;
    line-height: 1.4 !important;
    font-weight: 600 !important;
    text-shadow: none !important;
}


/* 优化元信息 */

#page-header.not-home-page .post-meta,
#page-header.not-home-page .meta-info {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    font-size: 0.8em !important;
    opacity: 0.8 !important;
}


/* 暗色模式 */

[data-theme='dark'] #page-header.not-home-page {
    background: rgba(0, 0, 0, 0.3) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2) !important;
}


/* 隐藏分类页面的标题 - 通用规则 */


/* 使用JavaScript辅助类来隐藏分类页面头部 */

.category-header-hidden #page-header.not-home-page,
.category-header-hidden #page-header {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
    opacity: 0 !important;
}


/* 通用分类页面头部隐藏规则 */

.category-page #page-header,
.category-page #page-header.not-home-page,
.page-category #page-header,
.page-category #page-header.not-home-page,
body[class*="category"] #page-header,
body[class*="category"] #page-header.not-home-page {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
    opacity: 0 !important;
}


/* 隐藏分类页面标题内容 */

body[class*="category"] #page-header .post-title,
body[class*="category"] #page-header h1,
body[class*="category"] #page-header .title,
.category-page #page-header .post-title,
.category-page #page-header h1,
.category-page #page-header .title,
.page-category #page-header .post-title,
.page-category #page-header h1,
.page-category #page-header .title {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}


/* 隐藏分类页面头部背景 */

body[class*="category"] #page-header::before,
.category-page #page-header::before,
.page-category #page-header::before {
    display: none !important;
    content: none !important;
    height: 0 !important;
}


/* 确保分类页面内容区域紧贴顶部 */

body[class*="category"] #article-container,
body[class*="category"] .layout_post,
.category-page #article-container,
.category-page .layout_post {
    margin-top: 0 !important;
    padding-top: 0 !important;
}


/* 移动端 */

@media screen and (max-width: 768px) {
    #page-header.not-home-page {
        max-height: 70px !important;
        padding: 10px 15px !important;
    }
    #page-header.not-home-page .post-title,
    #page-header.not-home-page h1 {
        font-size: 1.2em !important;
    }
}