/* ============================================================
   首页手机端独立布局（2026-11-27）
   只在首页经 <link media="(max-width:760px)"> 引入；桌面端不应用其中任何规则。

   学习复用华为应用市场手机端首页（华为官网《应用市场首页变化说明》、
   中国日报网/中国青年网《原生鸿蒙应用市场全面焕新》、华为社区 UI 改版说明）：
     ① 顶部醒目搜索栏；
     ② 杂志化大卡焦点，视觉焦点落在单款内容、大面积留白；
     ③ 各栏目紧凑单行列表（本站按需求收敛到 5 条）；
     ④ 扁平的底部 Tab 导航。
   桌面 .d-home 与手机 .m-home 是两套独立 DOM，本文件只负责 .m-home 的版式，
   不复用桌面组件 class，避免影响 content:check 里按桌面 class 计数的断言。
   2026-11-27 二次调整：删热词 chips / 快捷入口 / 列表日期；文章行加归属游戏封面图标；
   未来内容计划改厂商图片网格（.m-vendor-grid）。
   2026-11-29 三次调整：三个文章栏的「标题列表行」改为 2 列配图卡片（.m-art-grid），
   行业观察栏整栏下线；游戏 / 合集 / 工具 / 小游戏栏目仍沿用紧凑列表。
   ============================================================ */

body.page-home .m-home {
  --m-r: 16px;
  padding: 0 0 calc(82px + env(safe-area-inset-bottom, 0px));
  background: var(--hm-panel);
  color: var(--hm-ink);
}

/* ---------------- 顶部：副标题 + 搜索（热词 chips 已按需求删除） ---------------- */
/* 站点页眉本身是 sticky（z-index 100），这里保持普通流，不与它争顶层。 */
/* 2026-11-30：按用户要求删掉搜索框上方那一行副标题（原 .m-brand-sub），
   并把上下内边距 12px → 18px/16px，给搜索框留出更舒展的行距；
   副标题文案本身仍由桌面页眉与首屏承接，手机端不再重复。 */
body.page-home .m-top {
  padding: 18px 16px 16px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--hm-line);
}
body.page-home .m-search {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 9px 9px 15px;
  background: var(--hm-card);
  border: 1px solid var(--hm-line);
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
}
body.page-home .m-search svg { flex: 0 0 auto; color: var(--hm-ink-3); }
body.page-home .m-search input {
  flex: 1 1 auto; min-width: 0;
  border: 0; outline: 0; background: transparent;
  color: var(--hm-ink); font-size: 14px;
}
body.page-home .m-search input::placeholder { color: var(--hm-ink-3); }
body.page-home .m-search button {
  flex: 0 0 auto;
  padding: 9px 20px; border: 0; border-radius: 999px;
  background: var(--brand); color: #fff;
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
/* 2026-11-27：搜索框下 5 个热词 chips（原 .m-chips）已按需求删除。 */

/* ---------------- 杂志化大卡焦点（2026-11-30 起停用） ----------------
   用户要求热门游戏改 1+4 且大图在前，原独立「今日精选 TOP1」大图已并入热门栏
   （.m-art-grid--hot 的第 1 张 .m-art-card--lead），首页不再输出 .m-focus-* DOM。
   以下规则刻意保留作历史参考，勿在新版首页重新引用。 */
body.page-home .m-focus-wrap { padding: 16px 16px 0; }
body.page-home .m-focus {
  display: block; position: relative; overflow: hidden;
  aspect-ratio: 16 / 10; border-radius: var(--m-r);
  background: var(--hm-card); text-decoration: none; color: #fff;
}
body.page-home .m-focus-cover {
  display: block; width: 100%; height: 100%;
  display: grid; place-items: center;
}
body.page-home .m-focus-cover img {
  display: block; width: 100%; height: 100%; object-fit: cover;
}
body.page-home .m-focus-cover .cover-fallback { font-size: 28px; color: var(--hm-ink-3); }
body.page-home .m-focus::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 28%, rgba(0,0,0,.8) 100%);
}
body.page-home .m-focus-body {
  position: absolute; left: 16px; right: 16px; bottom: 14px; z-index: 1;
  display: flex; flex-direction: column; gap: 4px;
}
body.page-home .m-focus-tag { font-size: 10px; letter-spacing: .14em; opacity: .85; }
body.page-home .m-focus-body strong { font-size: 19px; font-weight: 700; line-height: 1.3; }
body.page-home .m-focus-body small {
  font-size: 12px; line-height: 1.5; opacity: .9;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
body.page-home .m-focus-cta { margin-top: 6px; font-size: 12px; font-weight: 600; }

/* ---------------- 未来内容计划：厂商图片网格 ---------------- */
/* 2026-11-27：按需求删除「游/讯/略/集/具」5 个快捷入口（原 .m-quick）；
   未来内容计划只显示厂商图片（vendors.js 的 logo / svg 兜底），链接进 studios/<slug>/，
   不显示厂商名与归档数文字；2 列网格、图片 16:9 填充。 */
body.page-home .m-vendor-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px; padding: 10px 0 8px;
}
body.page-home .m-vendor {
  display: block; overflow: hidden;
  aspect-ratio: 16 / 9; border-radius: 12px;
  border: 1px solid var(--hm-line); background: var(--hm-panel);
  text-decoration: none;
}
body.page-home .m-vendor img {
  display: block; width: 100%; height: 100%; object-fit: cover;
}

/* ---------------- 栏目卡片 + 紧凑列表 ---------------- */
body.page-home .m-sec {
  margin: 12px 16px 0; padding: 14px 14px 6px;
  background: var(--hm-card);
  border: 1px solid var(--hm-line);
  border-radius: var(--m-r);
}
body.page-home .m-sec-head {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px;
}
body.page-home .m-sec-head h2 {
  margin: 0; font-size: 15px; font-weight: 600; color: var(--hm-ink);
}
body.page-home .m-sec-head .m-sec-en {
  font-size: 9px; letter-spacing: .16em; color: var(--hm-ink-3);
}
body.page-home .m-sec-head a {
  margin-left: auto; font-size: 12px; font-weight: 500;
  color: var(--brand); text-decoration: none; white-space: nowrap;
}
body.page-home .m-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--hm-line);
  text-decoration: none; color: inherit;
}
body.page-home .m-item:first-child { border-top: 0; }
body.page-home .m-thumb {
  flex: 0 0 44px; width: 44px; height: 44px;
  border-radius: 10px; overflow: hidden;
  display: grid; place-items: center; background: var(--hm-panel);
}
body.page-home .m-thumb img { width: 100%; height: 100%; object-fit: cover; }
body.page-home .m-thumb .cover-fallback { font-size: 13px; color: var(--hm-ink-3); }
/* 行业观察栏（2026-11-27 缩放修复，2026-11-29 起已停用）：文章自带主题海报为 1200×675（16:9），
   方形 44px + cover 会裁掉左右两侧主题文字，只剩色块；改为 16:9 容器 + contain 整图可见。
   行业观察栏现已按用户要求从首页下线，首页不再输出 .m-thumb--watch DOM；
   规则刻意保留作历史参考，勿在新版首页里重新引用。 */
body.page-home .m-thumb--watch {
  flex: 0 0 64px; width: 64px; height: 36px;
  border-radius: 8px;
}
body.page-home .m-thumb--watch img { object-fit: contain; }
body.page-home .m-item-main {
  flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column; gap: 3px;
}
body.page-home .m-item-main strong {
  font-size: 13.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body.page-home .m-item-main small {
  font-size: 11.5px; color: var(--hm-ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 2026-11-27：列表项不再输出日期，.m-item-date 规则随之移除。 */
body.page-home .m-item-arrow { flex: 0 0 auto; font-size: 16px; color: var(--hm-ink-3); }

/* ---------------- 文章栏目：2 列配图卡片（2026-11-29） ----------------
   按用户要求下线三个文章栏的「标题列表行」，改为 16:9 位图封面卡片；
   5 篇时最后一张跨两列铺满，4 篇正好 2×2。行业观察栏整栏下线。 */
body.page-home .m-art-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px; padding: 8px 0 6px;
}
body.page-home .m-art-card {
  display: flex; flex-direction: column; gap: 5px; min-width: 0;
  text-decoration: none; color: inherit;
}
body.page-home .m-art-grid:not(.m-art-grid--hot):not(.m-art-grid--feat) .m-art-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
/* 2026-11-30：三个「1+4」栏（热门游戏 / 在线小游戏 / 实用工具）——第 1 张通栏大图卡 + 后 4 张 2×2。
   --hot（热门）与 --feat（小游戏 / 工具）共用同一套规则。
   硬约束：末张通栏规则必须同时排除这两类（上一行 :not 已排除），否则 5 张时第 5 张也通栏，第 4 张成孤行。 */
body.page-home .m-art-grid--hot .m-art-card--lead,
body.page-home .m-art-grid--feat .m-art-card--lead { grid-column: 1 / -1; }
body.page-home .m-art-grid--hot .m-art-card--lead .m-art-cover,
body.page-home .m-art-grid--feat .m-art-card--lead .m-art-cover { aspect-ratio: 16 / 10; }
body.page-home .m-art-grid--hot .m-art-card--lead .m-art-title,
body.page-home .m-art-grid--feat .m-art-card--lead .m-art-title { font-size: 16px; }
body.page-home .m-art-grid--hot .m-art-card--lead .m-art-summary,
body.page-home .m-art-grid--feat .m-art-card--lead .m-art-summary {
  font-size: 12px; line-height: 1.5; white-space: normal;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
body.page-home .m-art-cover {
  display: block; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: 10px; background: var(--hm-panel);
}
body.page-home .m-art-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
body.page-home .m-art-title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 12.5px; font-weight: 600; line-height: 1.4; color: var(--hm-ink);
}
body.page-home .m-art-summary {
  font-size: 11px; color: var(--hm-ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------------- 底部固定 Tab ---------------- */
body.page-home .m-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--bg-soft);
  border-top: 1px solid var(--hm-line);
}
/* 2026-11-28：两行结构互换——上方小字英文单词，下方大字中文两字（原 data-ico 大字单字方案移除）。 */
body.page-home .m-tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--hm-ink-3); text-decoration: none;
}
body.page-home .m-tab-en {
  font-size: 10px; line-height: 1.1; letter-spacing: 0.02em;
}
body.page-home .m-tab-cn {
  font-size: 16px; font-weight: 700; line-height: 1.2;
}
body.page-home .m-tabbar a.is-active { color: var(--brand); }
body.page-home .m-tabbar a.is-active .m-tab-cn { font-weight: 800; }

/* ---------------- 窄屏微调 ---------------- */
@media (max-width: 380px) {
  body.page-home .m-focus-body strong { font-size: 17px; }
  body.page-home .m-sec { margin-left: 12px; margin-right: 12px; }
  body.page-home .m-kb-banner { margin-left: 12px; margin-right: 12px; }
  body.page-home .m-vendor-grid { gap: 8px; }
}

/* ---------------- 宋·平行世界知识库横幅（2026-12-01 起移到页面底部） ---------------- */
/* 手机端在末栏「实用工具」之后、底部 Tab 之前；位图等比缩放，链接同桌面。
   2026-12-02：上间距对齐栏目节奏（.m-sec 的 12px），避免紧贴上一张卡片。
   2026-12-03：上间距增大到 32px（用户要求）；横幅改挂标准宽幅通栏 970×250 位图，
   等比缩放后仍全宽展示。同日把页脚上边距收为 0（见下方说明），消除横幅下方的大片空洞。 */
body.page-home .m-kb-banner {
  margin: 32px 14px 0; overflow: hidden; border-radius: 13px 0 13px 0;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .08);
}
body.page-home .m-kb-banner a { display: block; }
body.page-home .m-kb-banner img { display: block; width: 100%; height: auto; }

/* 横幅下方空洞修复（2026-12-03）：.m-home 自带 82px 底部内边距给固定 Tab 让位，
   而 .site-footer 还有全局 64px 的 margin-top，两者叠加成 ~146px 的深色空白，
   横幅像悬在空洞中间。手机首页收掉页脚的 64px，只保留 Tab 让位的 82px。
   本文件整份只在 ≤760px 生效，不影响桌面页脚间距。 */
body.page-home .site-footer { margin-top: 0; }
