/*
Theme Name: Astra Child
Theme URI: https://wpastra.com/
Description: 子主题用于安全修改 Astra 主题而不被更新覆盖。
Author: Feng Wang
Template: astra
Version: 1.2.1
Text Domain: astra-child
*/
/* ================================================= */
/* 优化：Astra 主题子菜单四列显示 (4-Column Dropdown) - 增加居中定位 */
/* ================================================= */

/* 1. 目标：Astra 主题主导航菜单中的第一级子菜单 (.sub-menu) */
@media (min-width: 921px) {
.main-header-menu > .menu-item > .sub-menu {
    /* 1.1 基础设置：保持您的四列宽度设置 */
    width: 800px !important; 
    min-width: 400px !important; 
    
    /* 1.2 布局：启用 CSS Grid */
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    
    /* 1.3 核心居中定位逻辑 */
    /* 关键步骤 1: 将菜单的左边缘拉到父级菜单项的中心点 */
    left: 50% !important; 
    
    /* 关键步骤 2: 将菜单自身往左平移它宽度的一半 (800px / 2 = 400px) */
    transform: translateX(-400px) !important; 
    /* 如果您更改了 width，请修改这里的平移值 */

    /* 1.4 清除默认的列表堆叠限制 */
    max-height: none !important; 
    overflow: visible !important;
    
    /* 1.5 确保背景和边框正确显示 */
    padding: 10px; 
}

/* 2. 目标：子菜单中的列表项 (li) - 保持不变 */
.main-header-menu .sub-menu li {
    width: auto !important; 
    display: block !important; 
    margin: 0 !important;
    padding: 5px 5px !important; 
    white-space: normal !important; 
}

/* 3. 目标：子菜单项中的链接 (a) - 保持不变 */
.main-header-menu .sub-menu li a {
    white-space: normal !important;
    display: block !important;
}
}


@media (max-width: 544px) {
  .ast-builder-menu-mobile .main-navigation .menu-item.menu-item-has-children > .ast-menu-toggle {
    top: 0;
    width: 100%;
  }
  .ast-archive-description .ast-archive-title {
    font-size: 1.6rem;
  }
}



/* 不要使用 @import - 应该在 functions.php 中用 wp_enqueue_style 加载 */

.ast-archive-description .entry-meta .posted-by,
.blog-layout-1 .entry-meta .posted-by,
.search .entry-meta .posted-by,
.archive .entry-meta .posted-by {
    display: none !important;
}
/* ============================================
   响应式设计 - 手机端（关键部分）
   ============================================ */
@media (max-width: 544px) {  /* Astra 默认 mobile 断点通常是 ≤544px，可根据实际调整为 767px 或 600px 测试 */
    .ast-row {
        display: flex;
        flex-wrap: wrap;
        margin-left: -10px;   /* 减小左右间距，防止太挤，可调 0~-15px */
        margin-right: -10px;
    }

    article.ast-grid-common-col {
        width: 50% !important;          /* 强制两列 */
        padding-left: 10px;
        padding-right: 10px;
        box-sizing: border-box;
        flex: 0 0 50%;
        max-width: 50%;
    }

    /* 如果有奇数个项目，最后一个占满一行（可选，美观） */
    article.ast-grid-common-col:last-child:nth-child(odd) {
        width: 100% !important;
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* 防止图片或内容溢出 */
    article .post-thumb-img-content img,
    article .entry-title,
    article .ast-excerpt-container { 
        width: 100%;
    }

    /* 可选：缩小字体/间距，让手机更舒适 */
    article .entry-title {
        font-size: 1.1rem;   /* 根据需要调小 */
    }

    article .ast-excerpt-container p {
        font-size: 0.95rem;
    }
    
  .woocommerce-js ul.products li.product .ast-woo-product-category, .woocommerce-page ul.products li.product .ast-woo-product-category {
    font-size: .85em;
    margin-bottom: .1em;
    display: block;
    line-height: 1.3;
    opacity: .6;
} 
    
}


/* 搜索结果页面产品样式优化 */
.search .woocommerce ul.products li.product {
    text-align: center;
}

.search .woocommerce ul.products li.product .price {
    font-size: 0.9em;
    font-weight: bold;
    color: #812134; /* 与你的微信提示颜色保持一致 */
    margin: -5px 0 5px;
}

.search .woocommerce ul.products li.product h2.woocommerce-loop-product__title {
    font-size: 1em;
}