/* ===============================================================================
   No Header/Footer Layout Adjustments
   当通过构建配置不生成 header 和 footer 时的布局调整
   =============================================================================== */

/* 
   当在 theme.conf 或 conf.py 中设置：
   show_header = False
   show_footer = False
   
   header 和 footer 的 HTML 代码将不会生成
   此 CSS 文件负责调整布局以适应无 header/footer 的情况
*/

/* ========================================
   检测并调整：当页面没有 header 时
   ======================================== */

/* 方法1: 使用 :has() 伪类（现代浏览器） */
body:not(:has(.quectel-header)) .quectel-layout {
    padding-top: 0 !important;
    min-height: 100vh !important;
}

body:not(:has(.quectel-header)) .quectel-contents {
    top: 0 !important;
    height: 100vh !important;
}

body:not(:has(.quectel-header)) .on-this-page {
    top: 0 !important;
    height: 100vh !important;
}

body:not(:has(.quectel-header)) .quectel-search-dropdown {
    top: var(--toc-title-height) !important;
}

body:not(:has(.quectel-header)) .quectel-content-header {
    top: 0 !important;
}

/* ========================================
   通用优化：确保布局合理
   ======================================== */

/* 当没有 header 时，确保内容区域从顶部开始 */
@supports not selector(:has(*)) {
    /* 对于不支持 :has() 的浏览器，添加一个 fallback class */
    body.no-header .quectel-layout {
        padding-top: 0 !important;
        min-height: 100vh !important;
    }
    
    body.no-header .quectel-contents {
        top: 0 !important;
        height: 100vh !important;
    }
    
    body.no-header .on-this-page {
        top: 0 !important;
        height: 100vh !important;
    }
    
    body.no-header .quectel-search-dropdown {
        top: var(--toc-title-height) !important;
    }
    
    body.no-header .quectel-content-header {
        top: 0 !important;
    }
}

/* ========================================
   Footer 相关调整（如果需要）
   ======================================== */

/* 当没有 footer 时，确保内容区域延伸到底部 */
body:not(:has(.quectel-footer)) .quectel-main {
    margin-bottom: 0 !important;
}
