/*
Theme Name: Astra Child
Template: astra
Version: 1.0
*/

/* =========================
   基础安全修复
   目标：
   1. 去掉顶部缝隙
   2. 去掉默认页面标题区
   3. 不碰你自定义 .apx-nav 导航
   4. 不乱打全站 nav / header
========================= */

html {
    overflow-y: scroll;
}

body,
#page {
    margin: 0 !important;
    padding: 0 !important;
}

/* 页面主内容顶部不要额外空白 */
.site,
.site-content,
#content,
.content-area,
.site-main,
.ast-container,
.ast-plain-container,
.ast-page-builder-template,
.ast-page-builder-template .site-content,
.ast-page-builder-template .entry-content {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* 只处理 Astra 默认头部容器，不碰你自定义导航 */
#masthead,
.site-header,
.ast-site-header,
.ast-primary-header-bar,
.ast-main-header-wrap,
.ast-builder-grid-row-container,
.ast-builder-row-container,
.main-header-bar,
.ast-above-header,
.ast-below-header {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-bottom: 0 !important;
    box-shadow: none !important;
}

/* 默认头部如果是空的，直接不占位 */
#masthead:empty,
.site-header:empty {
    display: none !important;
}

/* 去掉默认页面标题区，避免顶部再撑开 */
.page-header,
.entry-header,
.page-title,
.entry-title,
.ast-archive-description,
.woocommerce-products-header,
.woocommerce-products-header__title {
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
    display: none !important;
}

/* 标题区被隐藏后，后面的内容紧贴上来 */
.entry-header + .entry-content,
.page-header + .entry-content,
.woocommerce-products-header + .products,
.woocommerce-products-header + ul.products {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* 防止页面第一个区块自带 margin 顶出空白 */
.entry-content > :first-child,
.site-main > :first-child,
.ast-container > :first-child,
.elementor-widget-container > :first-child,
.elementor-section-wrap > :first-child,
.e-con > :first-child {
    margin-top: 0 !important;
}

/* 防止页面底部多余空隙 */
.entry-content > :last-child,
.site-main > :last-child,
.ast-container > :last-child {
    margin-bottom: 0 !important;
}

/* Elementor / HTML 区块顶部归零 */
.elementor,
.elementor-section-wrap,
.elementor-widget-html,
.elementor-widget-html .elementor-widget-container,
.e-con,
.e-parent,
.e-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* WooCommerce 页面顶部归零 */
.woocommerce-page .site-main,
.single-product .site-main,
.post-type-archive-product .site-main,
.tax-product_cat .site-main,
.tax-product_tag .site-main,
.woocommerce-page .content-area {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* 媒体元素避免出现奇怪缝隙 */
img,
iframe,
video {
    display: block;
    max-width: 100%;
}