/* Astra parent-theme compatibility overrides.
 * These rules constrain Astra/container defaults that previously caused mobile horizontal overflow.
 * Keep business template styles out of this file; page-specific CSS belongs in assets/css/templates or assets/css/pages.
 */

/* ========== 移动端全局重置（修复页面横向溢出问题） ========== */
@media (max-width: 767px) {
  /* 1. 基础防溢出锁死：严格限制 html 和 body */
  html, body {
    overflow-x: hidden; 
    width: 100%;
    -webkit-text-size-adjust: 100%;
  }

  /* 2. 容器重置：加上了致命缺失的 box-sizing: border-box，并删除了强制溢出 */
  body,
  .site,
  .site-content,
  .content-area,
  .site-main,
  .entry-content,
  .post-content,
  .page-content,
  .hentry,
  .ast-container,
  .ast-container-fluid,
  .ast-row,
  .container,
  .wrapper,
  #page,
  #primary,
  #content,
  #main,
  .main-container,
  .page-wrapper,
  .elementor,
  .elementor-section-wrap,
  .elementor-container,
  [class*="ast-container"],
  [class*="container"] {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box; /* 关键修复：防止残留的 padding 撑破 100% 宽度 */
  /* 删除了原有的强制 visible 横向溢出规则（那是导致灾难的根源） */
  }

  /* 3. 确保 Astra 的网格列在手机端全宽且防撑破 */
  .ast-row {
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
  }

  /* 移除 Astra 默认的列内边距 */
  .ast-grid-common-col,
  [class*="ast-col-"] {
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
  }

  /* 4. 评测页面的专属安全边距 */
  .wb-page {
    padding: 0 0 36px;
  }

  .wb-shell {
    width: 100%;
    max-width: 100%;
    padding: 0 12px;
    margin: 0 auto;
    box-sizing: border-box; /* 确保 12px 内边距向内挤压，而不是向外溢出 */
  }

  /* 5. 移除 Astra 页面构建器模板带来的默认外边距 */
  .ast-plain-container,
  .ast-page-builder-template .entry-header,
  .ast-page-builder-template .entry-content {
    margin: 0;
    padding: 0;
  }
}

/* Responsive Astra container safeguards extracted from responsive.css. */
@media (max-width: 1100px) {
  .ast-container,
  .site-content > .ast-container,
  body .ast-container,
  #page .ast-container,
  .site-content,
  .content-area,
  #primary,
  #main {
    max-width: 100%;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding-left: 12px;
    padding-right: 12px;
    box-sizing: border-box;
  }

  html,
  body {
    overflow-x: hidden;
    width: 100%;
  }
}

@media (max-width: 768px) {
  body.single-post .ast-container,
  body.single-post #page .ast-container,
  body.single-post .site-content > .ast-container,
  body.single-post .site-content,
  body.single-post #primary,
  body.single-post #main,
  body.page .ast-container,
  body.page #page .ast-container,
  body.page .site-content > .ast-container,
  body.page .site-content,
  body.page #primary,
  body.page #main {
    max-width: 100%;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
  }

  body.single-post .entry-content,
  body.page .entry-content {
    padding-left: 12px;
    padding-right: 12px;
  }
}

@media (max-width: 480px) {
  body.single-post .entry-content,
  body.page .entry-content,
  .ast-container,
  .site-content > .ast-container,
  body .ast-container,
  #page .ast-container,
  .site-content,
  .content-area,
  #primary,
  #main,
  .entry-content {
    padding-left: 10px;
    padding-right: 10px;
  }
}
