/* ==========================================================================
   奇固科威 移动端自适应补丁
   --------------------------------------------------------------------------
   本文件在 Layout.astro 中最后加载（位于平台 app.css 与 theme CSS 之后），
   用于修补平台 71360 主题在移动视口下的以下实测缺陷（2026-09-24 Playwright 实测）：

   1. 正文字号仅 12px，低于移动端 16px 基线（WCAG / Google 移动友好性）
   2. 汉堡按钮点击区仅 20×18px，导航链接仅 38×27px，远小于 48×48px 建议
   3. 移动端导航默认展开且与汉堡按钮状态不一致
   4. 宽表格（知识库多列表格）在窄屏被挤压
   5. 图片无 width/height，存在 CLS（累积布局偏移）风险

   策略：移动优先，只在 <=1024px / <=768px / <=480px 断点覆盖桌面版式，
   桌面端行为保持不变。
   ========================================================================== */

/* ---------- 1. 基础安全网：任何视口都不产生横向溢出 ---------- */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body,
html {
  overflow-x: hidden;
}
img,
video,
canvas,
svg,
iframe {
  max-width: 100%;
  height: auto;
}
/* 平台固定宽容器（.laybox 声明 width:1440px）在窄屏改为流式 */
.laybox {
  width: 100% !important;
  max-width: 1440px;
  min-width: 0 !important;
}

/* ---------- 2. 平板及以下（<=1024px）：字号与点击目标 ---------- */
@media (max-width: 1024px) {
  /* 2.1 正文与表格字号提升到可读基线（实测原为 12px） */
  .mybody,
  .layout_body {
    font-size: 15px;
  }
  .mybody p,
  .layout_body p,
  .mybody li,
  .layout_body li {
    font-size: 15px !important;
    line-height: 1.8;
  }
  .mybody td,
  .layout_body td,
  .mybody th,
  .layout_body th {
    font-size: 14px !important;
  }
  /* 2.2 导航链接：扩大点击区到 ≥44px 高 */
  .navLine a.pageLink,
  .pageLink.nav_item_name {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px !important;
    font-size: 16px !important;
  }
  /* 2.3 汉堡按钮：扩大点击区到 ≥44×44px */
  .menuPart {
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 12px 10px !important;
    box-sizing: border-box;
    cursor: pointer;
  }
  .menuPart .lineTop,
  .menuPart .lineMiddle,
  .menuPart .lineButtom {
    height: 2px;
    width: 22px;
  }
  /* 2.4 面包屑与页脚链接：避免过小点击区 */
  .basic_crumbs_list a,
  .myFooter a,
  .footer_link a {
    display: inline-block;
    padding: 6px 2px;
    min-height: 32px;
  }
  /* 2.5 页面容器内边距收窄，避免内容贴边 */
  .mybody .laybox_child_frame,
  .layout_body > div {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* ---------- 3. 手机（<=768px）：导航折叠 + 单栏布局 ---------- */
@media (max-width: 768px) {
  /* 3.1 移动端导航：默认折叠，由汉堡按钮控制展开 */
  .mb_header .mobilePart {
    display: none;
  }
  .mb_header.menu-open .mobilePart {
    display: block;
  }
  .mb_header .mobilePart .navLine {
    display: block !important;
    width: 100%;
    background: #fff;
    border-top: 1px solid #eee;
    padding: 4px 0;
  }
  .mb_header .mobilePart .navLine > span.itemNav {
    display: block;
    width: 100%;
  }
  .mb_header .mobilePart .navLine li,
  .mb_header .mobilePart .navLine a {
    display: block;
    width: 100%;
  }
  .mb_header .mobilePart .navLine .icon-z-nav-line-0 {
    display: none;
  }
  .mb_header .mobilePart .navLine a {
    min-height: 46px;
    padding: 0 16px !important;
    font-size: 16px !important;
    border-bottom: 1px solid #f2f2f2;
  }

  /* 3.2 知识库/百科页的侧栏 + 正文双栏改为单栏堆叠 */
  .layout_body > div > div,
  .mybody > div > div {
    flex-wrap: wrap !important;
  }
  .layout_body aside,
  .mybody aside {
    width: 100% !important;
    position: static !important;
    max-height: 320px;
    overflow-y: auto;
  }
  .layout_body main,
  .mybody main {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* 3.3 宽表格：允许横向滚动（JS 会为其包裹 .table-scroll 容器） */
  .table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 12px 0;
  }
  .table-scroll table {
    width: 100%;
    min-width: 480px;
    border-collapse: collapse;
  }
  /* 未被 JS 包裹的表格（AI 爬虫看到的原始结构）同样不撑破布局 */
  table {
    max-width: 100%;
  }

  /* 3.4 网格类布局降为单列 */
  .home-solutions-grid,
  .home-content-grid {
    grid-template-columns: 1fr !important;
  }
  .home-solutions-grid > div {
    min-width: 100% !important;
  }

  /* 3.5 长链接与长串（文号/URL）允许断行，避免撑宽 */
  .mybody a,
  .layout_body a {
    overflow-wrap: anywhere;
  }
}

/* ---------- 4. 小屏手机（<=480px）---------- */
@media (max-width: 480px) {
  .mybody p,
  .layout_body p {
    font-size: 15px !important;
  }
  /* 表格内文字进一步收紧以容纳更多列 */
  .mybody td,
  .layout_body td,
  .mybody th,
  .layout_body th {
    font-size: 13px !important;
    padding: 6px 4px !important;
  }
  .table-scroll table {
    min-width: 420px;
  }
}

/* ---------- 5. 无障碍与打印 ---------- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
