/* ============================================================
   内容页手机版适配（wenshu99.cn · 2026-11-21）
   只在 ≤767px 生效，PC 版布局完全不受影响。
   页眉/页脚逻辑：≤767px 隐藏 PC 页眉，由 common/mobile_header.html
   的手机页眉接管（与律师主页一致）。
   ============================================================ */

/* 分类切换按钮行：PC 端一律隐藏 */
.m-cat-bar { display: none; }

/* 登录页提示条：PC 端一律隐藏（手机端在下方 media query 内开启） */
.m-login-note { display: none; }

@media (max-width: 767px) {
  html, body { overflow-x: hidden; overflow-wrap: break-word; }

  /* PC 页眉隐藏（手机页眉接管） */
  .pc-header { display: none !important; }

  /* 主容器 1140px 固定宽 → 全宽 */
  .w-\[1140px\] { width: auto !important; max-width: 100%; }
  .art-wrap { padding: 0 10px; display: flex; flex-direction: column; min-width: 0; }

  /* 手机端块顺序：面包屑 → 分类按钮行 → 全部分类宫格 → 正文区
     （全部分类在 DOM 里位于面包屑之前，用 order 调到按钮下方，展开像手风琴） */
  .art-wrap .art-crumb { order: 1; padding-top: 10px; padding-bottom: 4px; }
  .art-wrap .m-cat-bar { order: 2; }
  .art-wrap .cat-nav { order: 3; }
  .art-wrap .art-layout { order: 4; }

  /* 面包屑允许换行，长标题不撑破 */
  .art-crumb ol { flex-wrap: wrap; }
  .art-crumb li:last-child { white-space: normal; word-break: break-all; }

  /* 分类切换按钮行（手机版专属） */
  .art-wrap .m-cat-bar { display: flex; gap: 8px; padding: 2px 0 10px; }
  .m-cat-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
    padding: 9px 0; font-size: 14px; color: #14532d; background: #fff;
    border: 1px solid #16a34a; border-radius: 6px; cursor: pointer;
  }
  .m-cat-ico { width: 16px; height: 16px; fill: currentColor; }
  .m-cat-btn:active { background: #f0fdf4; }
  .m-cat-btn.m-open { background: #14532d; color: #fff; border-color: #14532d; }

  /* 全部分类宫格：默认收起；展开后 4 列全宽 */
  .art-wrap .cat-nav { display: none; padding-top: 0; padding-bottom: 8px; }
  .art-wrap .cat-nav.m-open { display: block; }
  .art-wrap .cat-nav .grid { grid-template-columns: repeat(4, 1fr); width: 100%; }
  .art-wrap .cat-nav .grid a { display: block; padding: 4px 0; white-space: nowrap; }

  /* 左侧栏目分类：默认收起；展开后全宽，显示在按钮行下方、正文上方 */
  .art-wrap .cat-side { display: none; width: 100% !important; margin-bottom: 12px; }
  .art-wrap .cat-side.m-open { display: block; }

  /* 主体两栏 → 单栏 */
  .art-layout { flex-direction: column; min-width: 0; }
  .art-main { margin-left: 0 !important; padding: 12px !important; min-width: 0; }

  /* 文章元信息 3 列 → 2 列紧凑 */
  .art-meta { grid-template-columns: 1fr 1fr; row-gap: 2px; font-size: 12px; }

  /* 文章标题：左对齐 + 字号回落 */
  .art-title { text-align: left; font-size: 1.25rem; line-height: 1.5; }

  /* 正文自适应：图片/表格不撑破，字号 16px */
  .art-content { font-size: 16px; }
  .art-content img, .art-content figure img { max-width: 100% !important; height: auto !important; }
  .art-content table { display: block; width: 100%; overflow-x: auto; }
  .art-content p, .art-content span, .art-content li { word-break: break-word; }
  .art-content pre { white-space: pre-wrap; }

  /* Tags 行换行 */
  .art-tags { word-break: break-all; }

  /* 分享行允许换行 */
  .art-share { flex-wrap: wrap; row-gap: 6px; }

  /* 页脚紧凑 */
  .site-footer { font-size: 12px; }
  .site-footer img { width: 96px; height: auto; }

  /* ---------- 首页：卡片岛参考 guwen99.cn 手机版 ----------
     每行一条 = 标题单行截断 + 右侧灰色小字日期，行间细分隔线，杜绝换行挤压 */
  .home-layout > :not([hidden]) ~ :not([hidden]) { margin-left: 0 !important; margin-top: 14px; }
  .home-layout > .flex-1 { min-width: 0; width: 100%; }
  .home-cards { grid-template-columns: 1fr !important; }
  .home-cards .p-5 { padding: 2px 14px 8px !important; }
  .home-cards .font-bold.text-xl { padding: 12px 0 9px; border-bottom: 1px solid #eee; font-size: 1.05rem; }
  .home-cards .space-y-2 { margin-top: 2px !important; }
  .home-cards .space-y-2 > :not([hidden]) ~ :not([hidden]) { margin-top: 0 !important; }
  .home-cards .flex.justify-between { flex-wrap: nowrap; align-items: center; padding: 9px 0; border-bottom: 1px solid #f3f3f3; }
  .home-cards .flex.justify-between:last-child { border-bottom: none; }
  .home-cards .flex.justify-between a { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; line-height: 1.5; }
  .home-cards .flex.justify-between span { flex-shrink: 0; margin-left: 10px; font-size: 12px; color: #9ca3af; }
  .home-side { width: 100% !important; }

  /* ---------- 律师库：参考 LinkedIn 列表 ----------
     一人一行、小头像、字段行对齐不再挤压 */
  .law-filter { padding: 12px !important; }
  .law-filter .flex { flex-wrap: wrap; }
  .law-filter .w-12 { width: auto !important; }
  .law-grid { grid-template-columns: 1fr !important; row-gap: 0 !important; }
  .law-card { padding: 14px 2px; border-bottom: 1px solid #f0f0f0; }
  .law-card:last-child { border-bottom: none; }
  .law-card img { width: 76px !important; height: 100px !important; object-fit: cover; border-radius: 6px; }
  .law-card .pl-3 { padding-left: 12px !important; min-width: 0; flex: 1; }
  .law-card .flex.justify-between { align-items: center; }
  .law-card .flex.justify-between > a { font-size: 1.1rem; white-space: nowrap; }
  .law-card .bg-sky-500 { padding: 3px 10px !important; font-size: 12px !important; flex-shrink: 0; }
  .law-card .mt-6 { margin-top: 12px !important; }
  .law-card .space-y-3 > :not([hidden]) ~ :not([hidden]) { margin-top: 8px !important; }
  .law-card .flex.space-x-3 { align-items: flex-start; }
  .law-card .flex.space-x-3 > :not([hidden]) ~ :not([hidden]) { margin-left: 8px !important; }
  .law-card .bg-gray-100 { font-size: 12px; padding: 1px 6px !important; flex-shrink: 0; white-space: nowrap; }
  .law-card .flex.space-x-3 > div:last-child { flex: 1; min-width: 0; word-break: break-word; }

  /* ---------- 登录页（手机端仅浏览，管理操作引导用 PC） ---------- */
  .page-login { padding: 14px 12px 30px; }
  .m-login-note { display: flex; align-items: center; gap: 8px; margin: 0 auto 14px; max-width: 420px; padding: 10px 14px; background: #fefce8; border: 1px solid #fbbf24; border-radius: 8px; font-size: 13px; color: #92400e; line-height: 1.6; }
  .m-login-note-ico { width: 18px; height: 18px; fill: #f59e0b; flex-shrink: 0; }
  .page-login .w-\[880px\] { position: static; left: auto; top: auto; transform: none; width: 100% !important; margin: 0 auto; display: block; }
  .page-login .w-\[320px\] { display: none; }
  .page-login .h-\[550px\] { height: auto !important; padding-bottom: 90px; }
  .page-login .w-\[360px\] { width: 100% !important; }
  .page-login .yp-input { width: 100%; }

  /* ---------- 搜索结果 ---------- */
  /* 复用 .art-main（边距归零/内边距收紧）与 .art-title（左对齐+字号回落），无需额外规则 */
}
