/* ============================================================
   v0.53.19 手机端专项适配（仅在 ≤768px 生效，桌面端零影响）
   放在 front.css 之后加载，以本文件规则覆盖旧的混乱手机样式。
   ============================================================ */
/* 桌面端：筛选抽屉透明化——始终展开、摘要不显示、不画框 */
.browse-filter { margin: 0; }
.browse-filter > summary { display: none; }

@media (max-width: 768px) {
  .browse-filter > summary { display: flex; }

  /* ---------- 顶部条 ---------- */
  body { padding: 0; }
  .header-top { padding: 5px 0; }
  .header-top-inner { padding: 0 10px; gap: 8px; }
  .top-slogan { display: none; }
  .top-actions { gap: 0; flex-wrap: nowrap; width: 100%; justify-content: space-between; }
  .top-actions a { font-size: 11px; letter-spacing: 0; }

  /* ---------- 品牌 + 搜索行：logo 与桌面端同款组合 ---------- */
  .header-brand-row { padding: 10px 0 12px; }
  .header-brand-inner { padding: 0 12px; flex-wrap: wrap; gap: 10px; }
  .header-brand-inner .site-brand { gap: 8px; flex-wrap: nowrap; min-width: 0; }
  .site-seal { width: 42px; height: 42px; flex: 0 0 auto; }
  .site-name { font-size: 22px; white-space: nowrap; }
  .brand-divider { display: block; height: 30px; margin: 0 4px 0 6px; flex: 0 0 auto; }
  .brand-meta { display: flex; flex-direction: column; gap: 1px; line-height: 1.25; min-width: 0; }
  .brand-domain { font-size: 10px; white-space: nowrap; }
  .brand-sub { font-size: 16px; letter-spacing: 1px; white-space: nowrap; }
  .header-search { order: 3; flex: 1 1 100%; margin-left: 0; max-width: none; }
  .header-search input { font-size: 16px; padding: 9px 12px; }
  .header-search button { padding: 9px 16px; }

  /* ---------- 主导航：汉堡键 + 下拉 ---------- */
  .site-nav { display: block; position: sticky; top: 0; z-index: 200; }
  .nav-toggle {
    display: flex; width: 100%; align-items: center; justify-content: center; gap: 8px;
    background: #faf6ee; border: none; border-bottom: 1px solid #e0d8c8;
    font-size: 15px; color: #1a3a52; padding: 11px 12px; cursor: pointer;
  }
  .nav-toggle::after {
    content: "▾"; font-size: 13px; transition: transform .2s;
  }
  .site-nav.open .nav-toggle::after { transform: rotate(180deg); }
  .nav-main {
    display: none; flex-direction: column; align-items: stretch;
    gap: 0; padding: 0; background: #fff;
    border-bottom: 2px solid #b8860b;
    max-height: 70vh; overflow-y: auto;
  }
  .site-nav.open .nav-main { display: flex; }
  .nav-main a {
    padding: 13px 20px; font-size: 15px; border-bottom: 1px solid #f0e9d8;
  }
  .nav-main a:last-child { border-bottom: none; }

  /* ---------- 新门户首页（portal） ---------- */
  .np .hero-grid { display: block; }
  .np .hero-side { margin-bottom: 18px; }
  .np .main-col { gap: 26px; }
  .np .hero {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "ttl ttl"
      "sub sub"
      "tags tags"
      "slides slides"
      "stat stat"
      "enter enter";
    padding: 18px 16px 16px; gap: 12px;
  }
  .np .hero h1 { font-size: 24px; }
  .np .hero .sub { font-size: 13px; margin: 0; }
  .np .hero .stat { padding: 12px; }
  .np .hero .enter { justify-content: center; }
  .np .sec { padding: 22px 14px; }
  .np .sec-head h2 { font-size: 19px; }
  .np .sec-head p { font-size: 12.5px; }
  .np .sec-head .more { font-size: 12.5px; }

  /* 首页书卡：单列巨图 → 两列小卡 */
  .np .book-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .np .bcard .cover { height: auto !important; aspect-ratio: 3 / 4; padding: 0 !important; position: relative; }
  .np .bcard .bi { padding: 9px 10px 11px; gap: 3px; }
  .np .bcard h3 { font-size: 13px; min-height: 0; -webkit-line-clamp: 2; }
  .np .bcard .au { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .np .bcard .pr b { font-size: 16px; }
  .np .bcard .pr .shop { display: none; }

  /* 时代长河：横滑改三列紧凑卡 */
  .np .river-track { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .np .river-track .node { min-width: 0; }
  .np .river-track .node a { padding: 12px 6px; border-radius: 10px; }
  .np .river-track .ball { width: 40px; height: 40px; font-size: 18px; }
  .np .river-track .nm { font-size: 13px; }
  .np .river-track .yr { font-size: 10.5px; }
  .np .river-track .tag { display: none; }

  /* ---------- 书城 hero（旧书城首页） ---------- */
  .book-hero { padding: 26px 16px; }
  .book-hero h1 { font-size: 24px; }
  .book-hero-sub { font-size: 13px; }
  .book-search { flex-direction: row; max-width: 100%; }
  .book-search input { font-size: 16px; }
  .book-hero-tags { gap: 8px; }
  .book-hero-tags a { padding: 7px 12px; font-size: 13px; }
  .book-wrap { padding: 0 12px; margin: 18px auto; }
  .book-cate-grid { grid-template-columns: repeat(2, 1fr); }

  /* ---------- 书城浏览页：侧栏折叠为筛选抽屉 ---------- */
  .browse-wrap { display: block; padding: 0 12px; margin: 14px auto; }
  .browse-filter {
    margin: 0 0 12px; border: 1px solid var(--line); border-radius: 10px;
    background: var(--card); overflow: hidden;
  }
  .browse-filter > summary {
    list-style: none; cursor: pointer; padding: 13px 16px;
    font-size: 14.5px; font-weight: 700; color: var(--ink, #333);
    display: flex; align-items: center; justify-content: space-between;
  }
  .browse-filter > summary::-webkit-details-marker { display: none; }
  .browse-filter > summary::after { content: "▾"; font-size: 13px; color: #9a8a6a; }
  .browse-filter[open] > summary::after { transform: rotate(180deg); }
  /* 模板默认 open 保证桌面侧栏常驻；手机进入页面时强制折叠 */
  .browse-filter .browse-side { display: none; }
  .browse-filter[open] .browse-side { display: block; }
  .browse-filter .browse-side {
    position: static; max-height: 52vh; overflow-y: auto;
    border: none; border-radius: 0; padding: 6px 10px 12px;
  }
  .browse-main { min-width: 0; }
  .browse-bar { gap: 10px; }
  .browse-crumb { font-size: 14px; }
  .browse-search input { font-size: 16px; }
  .browse-sort { width: 100%; justify-content: flex-start; }

  /* 浏览页书卡两列 */
  .book-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .book-card { display: flex; flex-direction: column; }
  .book-card .book-cover { aspect-ratio: 3 / 4; flex: 0 0 auto; }
  .book-card .book-cover img { position: static; width: 100%; height: 100%; object-fit: cover; }
  .book-card .book-info { padding: 9px 10px 11px; flex: 1 1 auto; min-width: 0; }
  .book-card .book-info h3 {
    font-size: 13px; line-height: 1.4; min-height: 0; margin: 0 0 4px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .book-card .book-author { font-size: 11.5px; }
  .book-card .book-price { font-size: 16px; margin-top: auto; }

  /* ---------- 图书详情页 ---------- */
  .bd-crumb { font-size: 12px; white-space: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .bd-layout { gap: 18px; }
  .bd-cover { max-width: 172px !important; }
  .bd-title { font-size: 20px; }
  .bd-sub { font-size: 14px; }
  .bd-meta { font-size: 13px; line-height: 1.9; }
  .bd-meta span { margin-right: 14px; }
  .bd-price-card { padding: 14px 16px; margin: 14px 0; }
  .bd-sale { font-size: 27px; }
  .bd-buy { gap: 10px; }
  .bd-btn { padding: 12px 22px; font-size: 15px; }
  .bd-trust { gap: 10px 16px; font-size: 12px; }
  .bd-section { margin-top: 28px; }
  .bd-body { font-size: 14.5px; line-height: 1.85; }
  .bd-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .bd-related { margin-top: 32px; }

  /* 吸底购买条 */
  .bd-mobile-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 300;
    display: flex; align-items: center; gap: 10px;
    background: #fff; border-top: 1px solid var(--line);
    padding: 9px 12px calc(9px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(60, 40, 15, .10);
  }
  .bd-mobile-bar .mb-price { flex: 0 0 auto; }
  .bd-mobile-bar .mb-price b { color: var(--cinnabar); font-size: 20px; }
  .bd-mobile-bar .mb-price small { font-size: 12px; }
  .bd-mobile-bar .mb-cart {
    flex: 1; text-align: center; border: 1px solid var(--gold); color: var(--gold);
    border-radius: 8px; padding: 11px 0; font-size: 15px; font-weight: 700;
    text-decoration: none; background: #fff;
  }
  .bd-mobile-bar .mb-out {
    flex: 1; text-align: center; border-radius: 8px; padding: 11px 0;
    font-size: 15px; font-weight: 700; background: #d8d2c2; color: #7a7258;
  }
  /* 用吸底条后，正文里的大购买区在手机上弱化（保留客服/购物车链接区） */
  .bd-buy form { display: none; }
  body { padding-bottom: 0; }
  body:has(.bd-mobile-bar) { padding-bottom: 84px; }

  /* ---------- 文创 / 通用卡片区 ---------- */
  .cultural-grid, .cu-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }

  /* ---------- 悬浮按钮：统一收到右下一列，避开吸底购买条 ---------- */
  .chat-fab, #chatFab { width: 46px !important; height: 46px !important; bottom: 18px !important; right: 14px !important; }
  .back-top { width: 40px !important; height: 40px !important; bottom: 72px !important; right: 17px !important; }
  .ai-chat-fab { width: 48px !important; height: 48px !important; left: auto !important; right: 13px !important; bottom: 122px !important; z-index: 290 !important; }
  body:has(.bd-mobile-bar) .chat-fab,
  body:has(.bd-mobile-bar) #chatFab { bottom: 96px !important; }
  body:has(.bd-mobile-bar) .back-top { bottom: 150px !important; }
  body:has(.bd-mobile-bar) .ai-chat-fab { bottom: 200px !important; }
  .ai-chat-panel { max-width: calc(100vw - 24px) !important; right: 12px !important; }

  /* ---------- 首页「全部分类」摘要：手机端单行 ---------- */
  .np details.cattree-mob summary {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 12px 14px;
    font-size: 13px;
  }

  /* ---------- 页脚 ---------- */
  footer, .site-footer { padding: 22px 14px; }
}

/* 超窄屏（≤360px）进一步收紧 */
@media (max-width: 360px) {
  .np .book-grid, .book-grid, .bd-grid, .cultural-grid, .cu-grid { gap: 8px; }
  .np .bcard h3, .book-card .book-info h3 { font-size: 12.5px; }
  .np .hero h1 { font-size: 21px; }
}

/* v0.60.9 姓氏家族二级导航：仅 ≤768px 手机端常驻竖排（桌面走 front.css 悬停浮层） */
@media (max-width: 768px) {
  .nav-item { display: block; }
  .nav-item .nav-parent { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
  .nav-caret { transform: rotate(-90deg); }
  .nav-sub {
    position: static; display: grid !important; grid-template-columns: 1fr !important;
    min-width: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none;
    background: #fbf8f0;
  }
  .nav-sub-group { border-right: 0 !important; padding: 0; }
  .nav-sub-title {
    margin: 0; padding: 9px 20px 4px 28px; font-size: 12.5px; color: #8a6508;
    letter-spacing: 1px;
  }
  .nav-sub a { padding: 8px 20px 8px 40px !important; font-size: 14px !important; border-bottom: 1px solid #f0e9d8; }
}
