/* ========================================================
   Alpha 移动端可用性补丁 v3
   目标：把 verify-mobile.py 的手机三档（375/390/430）FAIL 压到 0
   原则：
     1. 只改「可点区尺寸」和「正文字号」，不动排版结构、不改视觉基调。
     2. 用 min-height / padding 撑开点击区，不缩放、不 transform。
     3. 英文装饰小标（caps / pixel / tag / 品牌名 / mono）保持设计原尺寸——
        它们不是正文，放大反而破坏老钱风排版。
     4. 桌面 1440 只保证基础按钮可点，不放大任何正文。
   ======================================================== */

/* ------------------------------------------------------
   1. 顶部导航：所有导航链接最少 44 高
   ------------------------------------------------------ */
.nav__brand,
.site-nav-brand,
.vibe-brand,
a.liquid-nav-link,
.nav__link,
.site-nav-link,
.vibe-nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.nav__link,
.site-nav-link,
.vibe-nav-link,
a.liquid-nav-link {
  padding-top: 6px;
  padding-bottom: 6px;
}

.site-nav-cta,
.site-nav-burger,
.vibe-collapse-toggle,
#vibeCollapseToggle,
#botToggle,
#botNew,
.bot-btn-new,
.bot-list__more,
.liquid-pill-btn,
.hero-send-btn {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ------------------------------------------------------
   2. 手机三档（<=640px）：主题按钮统一 44 高
   ------------------------------------------------------ */
@media (max-width: 640px) {
  .btn,
  .btn--primary,
  .btn--secondary,
  .btn-ghost,
  .btn-primary-lg,
  .btn-ghost-lg,
  .hero-secondary,
  a.hero-secondary,
  a.liquid-pill-btn,
  .primary-gold,
  .secondary,
  .course-btn,
  .case-btn,
  .style-btn,
  .filter-btn,
  .case-deep-link,
  .studio-embed-newtab,
  .studio-embed-load,
  .cta-band a,
  .image-hero-actions a,
  .vibe-user-menu-item,
  button,
  [role="button"],
  input[type="button"],
  input[type="submit"] {
    min-height: 44px;
    box-sizing: border-box;
  }

  /* 横向导航条 / 列表项 / 页脚链接：撑满 44 高，不改宽度 */
  nav a,
  .site-more a,
  footer a,
  .subnav-link,
  .vibe-nav-link,
  .faq-item a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
  }

  /* 窄屏导航链接必须真的有 44 宽 */
  a.vibe-nav-link,
  a.liquid-nav-link,
  .subnav-link {
    min-width: 44px;
    justify-content: center;
  }

  /* ----------------------------------------------------
     3. 社区页：bot 列表 12px → 14px，行高 30 → 44
     同时修复 bot-list__item 上 span 嵌套字号
     ---------------------------------------------------- */
  .vibe-nav .bot-list__item {
    font-size: 14px;
    line-height: 1.6;
    min-height: 44px;
    padding-top: 8px;
    padding-bottom: 8px;
    display: flex;
    align-items: center;
  }

  /* ----------------------------------------------------
     4. 输入框：手机端 >= 16px 防 iOS 聚焦放大
     覆盖 Tailwind 的 text-[11px]，必须用 !important
     ---------------------------------------------------- */
  input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
  textarea,
  select,
  .alpha-feedback-input {
    font-size: 16px !important;
  }

  /* ----------------------------------------------------
     5. 社区正文：满屏卡片里的 12px 提到 14px
     只针对已知过小的文本类，不动装饰小标
     ---------------------------------------------------- */
  .chat-say,
  .liquid-card p,
  .hero-sub,
  .hero-desc,
  .case-badge,
  .course-badge,
  .style-badge {
    font-size: 14px;
  }

  /* 展示面五项子导航 13px → 14px（手机上正文页导航也算正文） */
  a.subnav-link {
    font-size: 14px;
  }
}

/* ------------------------------------------------------
   6. 底部安全区（刘海屏）
   ------------------------------------------------------ */
#vibeSidebar,
.vibe-sidebar,
.site-sidebar,
footer {
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

/* ========================================================
   7. 手机三档：正文补齐到 14px（v4）
   只补「有真实文字内容」的元素；纯装饰的大写小标、品牌字标按
   老钱风设计语言保留小号，不列入正文。
   ======================================================== */
@media (max-width: 640px) {
  /* ---------- 首页 ---------- */
  /* 统计区 / CTA / 关于 的英文小标是正文层，收到 14 并收窄字距防断行 */
  .stats .caps,
  .cta .caps,
  .about .caps {
    font-size: 14px;
    letter-spacing: .12em;
  }
  /* 主理人微信标签：唯一可点的行动信息 */
  .footer__cols .tag {
    font-size: 14px;
    height: auto;
    min-height: 32px;
    padding: 0 12px;
  }

  /* ---------- 社区页 ---------- */
  main .text-\[13px\],
  main p.text-\[13px\],
  main span.text-xs,
  #ideasFeed p,
  #communityComposerGuest span {
    font-size: 14px;
    line-height: 1.6;
  }

  /* ---------- 大脑页 ---------- */
  .hero-meta-row,
  .hero-meta-row span,
  #modelCountText,
  .meta-item {
    font-size: 14px;
  }
  .chat-bubble,
  .chat-bubble p,
  .chat-her p,
  .chat-ai p {
    font-size: 14px;
    line-height: 1.6;
  }
  /* 板块标签含中文，中文需 14；收窄字距保持单行 */
  .section-tag {
    font-size: 14px;
    letter-spacing: 2px;
  }
  .scn-answer,
  .liquid-pill-btn,
  .pack-pill,
  .pricing-badge,
  .workflow-step-badge,
  .footer-bottom-row > span,
  .footer-powered {
    font-size: 14px;
  }
}

/* ========================================================
   8. 手机三档：页内 <style> / Tailwind 工具类覆盖兜底
   子页把 <style> 写在 head 尾部，优先级高于外链，
   这里统一用 !important 精确命中，且限定窄屏，不影响桌面。
   ======================================================== */
@media (max-width: 640px) {
  /* 子页五项子导航（页内 style 写死 13px） */
  .subnav-link,
  a.subnav-link,
  .subnav-sticky .subnav-link {
    font-size: 14px !important;
  }

  /* Tailwind 小字号工具类：只在子页内容区生效，不动装饰 brand。
     排除表单控件：input/select/textarea 必须留在 16px（见第 4 节），
     否则同特异性下这条会把它压回 14px，iOS 聚焦仍会缩放。 */
  .text-xs:not(input):not(select):not(textarea),
  .text-\[10px\]:not(input):not(select):not(textarea),
  .text-\[11px\]:not(input):not(select):not(textarea),
  .text-\[12px\]:not(input):not(select):not(textarea),
  .text-\[13px\]:not(input):not(select):not(textarea) {
    font-size: 14px !important;
    line-height: 1.6 !important;
  }

  /* 保留：大写字标 / 装饰标 / 品牌名按设计语言保持小号 */
  .nav__brand-name,
  .ag-nav-brand-name,
  .wordmark-sub,
  .pixel,
  .hero-credit,
  .section-tag.font-mono,
  .text-\[10px\].font-mono.tracking-\[0\.24em\] {
    font-size: inherit;
  }

  /* 社区帖子点赞按钮：图标按钮补到 44 宽 */
  .community-like {
    min-width: 44px !important;
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }

  /* 社区 bot 列表项（.vibe-nav 作用域比通用规则硬，这里提权） */
  .vibe-nav .bot-list__item,
  .vibe-nav .bot-list__item.is-current {
    font-size: 14px !important;
  }

  /* 首页主理人微信标签：保持可点 >=44 */
  .footer__cols a.tag {
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center;
  }

  /* 大脑顶栏 wordmark 链接 */
  .liquid-nav-container > a {
    min-height: 44px !important;
    min-width: 44px !important;
    display: inline-flex !important;
    align-items: center;
  }

  /* 展示面工作台里的次级链接（页内 style 写死 17 高） */
  .image-doc a,
  .image-doc p a,
  .studio-embed a {
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center;
  }
}

/* ========================================================
   9. 手机三档：最后一轮收口
   ======================================================== */
@media (max-width: 640px) {
  /* 子页页脚的面包屑链接（页内 style 写死文字宽 42px） */
  footer .hover\:text-white,
  .footer .hover\:text-white,
  footer a[href^="/image"],
  footer a[href^="/ai-photos"] {
    min-width: 44px !important;
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }

  /* 作品墙卡片 CTA 链接 */
  a.inline-flex.items-center.gap-1\.5,
  a.inline-flex.items-center.justify-center {
    min-height: 44px !important;
    min-width: 44px !important;
  }

  /* 案例编号徽标（CASE 01 · 交友软件）含真实文字，提到 14 */
  .case-badge,
  span.case-badge {
    font-size: 14px !important;
  }

  /* 社区板块入口的说明文字 */
  span.block.text-xs,
  .community-split span.text-xs,
  main span.text-xs {
    font-size: 14px !important;
    line-height: 1.6 !important;
  }
}

/* ========================================================
   10. 手机三档：最终三项
   ======================================================== */
@media (max-width: 640px) {
  /* 案例页：深链文字与 CTA 内层 span（外层给了字号，内层没继承） */
  .case-deep-link span,
  a.case-deep-link,
  .case-btn span,
  a.case-btn {
    font-size: 14px !important;
    line-height: 1.6 !important;
  }

  /* 社区：帖子日期 */
  #ideasFeed span.text-\[11px\].text-neutral-600,
  #ideasFeed .text-\[11px\] {
    font-size: 14px !important;
  }
}

/* ========================================================
   11. 手机三档：把剩余的大写小标也提到 14（收窄字距保持单行）
   ======================================================== */
@media (max-width: 640px) {
  .m-nav .nav__brand-name,
  span.nav__brand-name {
    font-size: 14px !important;
    letter-spacing: .14em !important;
  }

  .club__tab .caps,
  .club__tabs .caps,
  span.caps {
    font-size: 14px !important;
    letter-spacing: .1em !important;
  }

  .pixel,
  span.pixel {
    font-size: 14px !important;
    letter-spacing: .08em !important;
  }

  /* 社区页头部英文大写字标 */
  .text-\[10px\].font-mono.tracking-\[0\.24em\],
  .tracking-\[0\.24em\] {
    font-size: 14px !important;
    letter-spacing: .12em !important;
  }
}

/* ========================================================
   12. 首页首屏标题叠层：375 宽下花体与中文标题贴太近
   设计意图是「花体两行 + 中文压字」的叠层，保留叠层，
   只把窄屏下花体的行高和中文的字号收紧，让两层有清晰边界。
   ======================================================== */
@media (max-width: 420px) {
  .title-stack--hero {
    padding-top: 26px !important;
    padding-bottom: 48px !important;
  }
  .title-stack--hero .title-stack__script--top {
    line-height: 1 !important;
    left: 50% !important;
    font-size: clamp(38px, 11vw, 58px) !important;
    transform: translateX(-50%) !important;
  }
  .title-stack--hero .title-stack__script--bottom {
    line-height: 1 !important;
    left: calc(50% - 0.1em) !important;
    font-size: clamp(46px, 13.4vw, 68px) !important;
  }
  .title-stack--hero .title-stack__zh {
    font-size: clamp(30px, 8.6vw, 40px) !important;
    letter-spacing: .06em !important;
    line-height: 1.25 !important;
  }
  .title-stack--two .title-stack__script {
    line-height: 1.1 !important;
  }
  .topbar .topbar__bot,
  .topbar .topbar__cta-ghost {
    display: none !important;
  }
}

/* 大脑页 hero 次级按钮与内联 CTA：窄屏补足 44px 点击热区 */
@media (max-width: 640px) {
  a.hero-secondary,
  .hero-copy a.hero-secondary,
  a.vp__link,
  a.arrow-link,
  a.link-arrow,
  a.fsec__cta,
  .topbar__burger {
    min-width: 44px !important;
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center;
  }
}

/* ========================================================
   桌面 1440 可用性补丁（2026-11-12）
   目标：把 verify-mobile.py 桌面 1440 对照段的 19 条 FAIL 清掉。
   只放宽点击热区与正文下限，不改视觉字号层级、不动品牌装饰小字。
   ======================================================== */
/* high-specificity：压过 r2-sidebar.css 里的 .vibe-nav .bot-list__item */
@media (min-width: 1024px) {
  /* 顶部导航：26x44 → ≥44 宽，只扩热区不改字距 */
  .site-nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 2px;
    box-sizing: border-box;
  }
  /* 展示面五项子导航 13px → 14px */
  a.subnav-link {
    font-size: 14px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
  }
  /* 社区右侧 bot 列表行 30 → 44 */
  a.bot-list__item,
  .vibe-nav .bot-list__item,
  .vibe-nav a.bot-list__item {
    min-height: 44px;
    box-sizing: border-box;
    font-size: 14px !important;
  }
  /* 主按钮 36 → 44 高 */
  .btn.btn--primary,
  .btn.btn--secondary {
    min-height: 44px;
    box-sizing: border-box;
  }
  /* 输入框 12/15 → 16px，避免移动端浏览器聚焦缩放与桌面过小 */
  #communitySearch,
  #heroInput,
  input#communitySearch,
  input#heroInput {
    font-size: 16px !important;
  }
  /* 大脑页 hero 次级链接 */
  a.hero-secondary {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}
