/* AmCan mobile layout fixes
 * Loaded last via mu-plugin amcan-mobile-assets.php (wp_head priority 999).
 * 旧站只有 template/pc，<=768px 缺少容器/侧栏/列表/卡片堆叠规则；
 * 这里补齐，且不隐藏侧栏（侧栏含 Send Message 表单，必须保持可用）。
 * 内页 DOM 顺序是 sidebar 在前、page-main 在后；移动端用 flex order 把
 * 正文提到最上方、侧栏（含留言表单）排到正文之后，桌面端不受影响。
 */
@media (max-width:768px){
  /* 防止离屏汉堡菜单造成横向滚动 */
  html, body { overflow-x:hidden; }

  /* 统一内容区左右留白 */
  .l-wrap { padding-left:15px !important; padding-right:15px !important; }
  .banner-inner .banner-content .container {
    padding:10px 15px !important;
    flex-wrap:wrap;
  }
  .banner-inner .banner-content .banner-title-h1 {
    font-size:17px;
    line-height:1.35;
    margin:0;
    word-break:break-word;
  }
  .banner-breadcrumbs {
    font-size:12px;
    line-height:1.4;
    word-break:break-word;
  }
  .banner-inner img {
    max-width:100%;
    height:auto;
    max-height:220px;
    object-fit:cover;
  }

  /* 侧栏与主内容单列堆叠（不隐藏侧栏） */
  .page-container { flex-direction:column; }
  /* 移动端阅读顺序：正文在最上方，侧边栏（含 Send Message 表单）排在正文之后 */
  .page-container > .page-main { order:1 !important; }
  .page-container > .sidebar  { order:2 !important; }
  .sidebar, .page-main {
    width:100% !important;
    padding-left:0 !important;
    padding-right:0 !important;
    margin-left:0 !important;
    margin-right:0 !important;
  }
  .sidebar-item { padding:20px !important; }
  .common-main { padding:15px 0 20px; }

  /* 列表单列，缩略图自适应 */
  .newslist.list1 .newsitem,
  .pro-list.list1 li,
  .download-list li {
    width:100% !important;
    margin-right:0 !important;
  }
  /* 首页百科卡片：移动端走 home.css 的 50% 两列网格，
     不要在这里覆盖成 100%（否则会变回单列、板块过高）。 */
  .common-main img,
  .legacy-page-content img,
  .newscontent-details img,
  .prodetails-content img,
  .newslist img,
  .pro-list img,
  .news-img img {
    max-width:100%;
    width:auto;
    height:auto;
  }

  /* 正文表格允许横向滚动，不撑破页面 */
  .newscontent-details table,
  .legacy-page-content table,
  .prodetails-content table {
    display:block;
    width:100%;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
  }

  /* 首页优势卡片 */
  .choose-ul { width:100%; }
  .choose-ul .choose-item {
    width:48% !important;
    padding:18px 10px;
    border-radius:16px;
    box-sizing:border-box;
  }
  .home-about .about-wrap > div,
  .home-about .about-img { width:100% !important; }
  .newscontent-title { font-size:22px; line-height:1.4; word-break:break-word; }
  .home-title, .home-des { word-break:break-word; }

  /* 首页长文案：强制换行，避免右侧被裁 */
  .home-des,
  .home-choose .home-des,
  .choose-ul .choose-item .info,
  .choose-ul .choose-item .title {
    font-size:14px !important;
    line-height:1.6 !important;
    white-space:normal !important;
    word-break:break-all !important;
    overflow-wrap:anywhere !important;
    max-width:100% !important;
    margin-left:auto !important;
    margin-right:auto !important;
  }

  /* 留言表单 */
  #feedbackForm input, #feedbackForm textarea {
    max-width:100%;
    box-sizing:border-box;
  }
  .foot-nav .foot-item .foot-list li a { width:100%; }
}

@media (max-width:480px){
  .banner-inner .banner-content .container {
    flex-direction:column;
    align-items:flex-start;
  }
  .choose-ul .choose-item { width:100% !important; }
  .newslist.list1 .newsitem { width:100% !important; }
}
