/* ==========================================================================
 * touch-patch-1130.css — 移动端 / 平板 / 触控屏补强（2026-11-30）
 *
 * 覆盖 6 个核心页 + 21 个软件介绍页。独立于 tom-responsive.css，
 * 不动 tom-responsive.js（避免版本号连锁 bump 与并发会话冲突）。
 *
 * 解决三件事：
 *   1. 介绍页窄屏下「原生 nav + 注入 .tom-r-header」双 header 重影
 *   2. 正文 CTA / tab 触控目标 < 44px
 *   3. 触控基础体验（去 hover 依赖、点击高亮、横向溢出兜底）
 *
 * 触发条件与 tom-responsive.css / tom-responsive.js 的 NAV_MQ 严格一致：
 *   @media (max-width: 1024px), (hover: none) and (pointer: coarse)
 * ========================================================================== */

@media (max-width: 1024px), (hover: none) and (pointer: coarse) {

  /* ----------------------------------------------------------------------
   * 1. 介绍页双 header 重影修复
   * 注入统一顶栏后，隐藏介绍页原生 .nav 里重复的品牌与链接，
   * 只保留原生 nav 容器（汉堡按钮可能被塞在里面）与注入的 .tom-r-header。
   * html.tom-r-header-active = JS 注入统一 header 时打的类，未注入的页
   * （如 Bookwise）不受影响。
   * -------------------------------------------------------------------- */
  html.tom-r-header-active nav .nav-logo,
  html.tom-r-header-active nav .nav-links,
  html.tom-r-header-active nav .brand,
  html.tom-r-header-active nav .site-title {
    display: none !important;
  }
  /* 原生 nav 若仅剩空壳，直接让位给注入顶栏，避免残留半条边框/底色 */
  html.tom-r-header-active nav:not(:has(button, [role='button'])) {
    display: none !important;
  }
  /* 注入顶栏：保证品牌文字不被右侧语言/汉堡挤压裁切 */
  html.tom-r-header-active .tom-r-header__inner { min-width: 0; }
  html.tom-r-header-active .tom-r-header__brand {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* ----------------------------------------------------------------------
   * 2. 正文 CTA / 局部 tab 触控目标放大到 >= 44px
   * 现有 tom-responsive.js 的 markTaps() 只覆盖 header/nav/tab-nav，
   * 正文里的 CTA 链接与卡片按钮没人管。这里补上。
   * 只对「看起来像按钮」的元素动手：.btn / [class*=btn] / 明确的 CTA 文案
   * 容器，以及 role=button；不碰正文行内 <a>，避免行高被撑坏。
   * -------------------------------------------------------------------- */
  html body a.btn,
  html body button.btn,
  html body [class*='btn'],
  html body [role='button'],
  html body .tab,
  html body .tab-btn,
  html body [class*='-tab'],
  html body [class*='tab-'] {
    min-height: 44px !important;
  }
  /* 正文文字型 CTA（「去 XX →」「看免费社群 →」等）由 touch-patch.js
     精准打 .tp-tap / .tp-tap-inline 标记后再放大，避免 CSS 通用选择器
     误伤正文行内链接。样式定义在这里，JS 只负责挑元素。 */
  html body .tp-tap {
    min-height: 44px !important;
    min-width: 44px !important;
  }
  html body .tp-tap-inline {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    vertical-align: middle;
    min-height: 44px !important;
    padding-top: 4px !important;
    padding-bottom: 4px !important;
  }

  /* ----------------------------------------------------------------------
   * 3. 触控基础体验
   * -------------------------------------------------------------------- */
  /* 去掉点按后的灰色高亮块，用自定义过渡替代；禁止双击缩放带来的 300ms 延迟 */
  html body a, html body button, html body [role='button'] {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  /* 触屏没有 hover：把纯靠 :hover 显形的交互内容强制常显。
     限定在导航/panel 作用域，避免误伤装饰性 hover 动效。 */
  html body nav *,
  html body header *,
  html body [class*='panel'] *,
  html body [class*='popup'] * {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  /* ----------------------------------------------------------------------
   * 4. 横向溢出兜底
   * 所有页面根容器不允许把文档撑宽；表格 / 预格式化文本改为容器内滚动。
   * -------------------------------------------------------------------- */
  html, body { overflow-x: clip; max-width: 100vw; }
  html body table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  html body pre { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  html body img, html body video, html body canvas { max-width: 100%; height: auto; }

  /* 装饰性光晕/圆形背景不参与布局溢出统计 */
  html body .glow, html body .tech-orb,
  html body [class*='orb-'], html body [class*='-glow'] {
    pointer-events: none;
  }
}

/* ==========================================================================
 * 5. PC 端专属修复（宽屏，不受上面的触控媒体查询限制）
 * ========================================================================== */

/* 5a. 软件介绍页：i18n 语言切换器 is-floating 固定到右上角，
 *     会压住导航栏最右侧的锚点链接（XQW 的「素材库」等），导致点不到。
 *     给这类页面的 nav 右侧留出切换器宽度（约 92px）让位。
 *     只对「带 .nav-links 的 nav」生效，不影响其它页头。 */
@media (min-width: 1025px) {
  html body nav:has(.nav-links) {
    padding-right: 96px !important;
  }
}

