/* =====================================================
   响应式样式 v1.4.8
   mobile: < 768px  |  tablet: 768–1024px  |  wide: > 1280px
   ===================================================== */

/* ── Wide (>1280px) ───────────────────────────────── */
@media (min-width: 1280px) {
  :root { --container: 1280px; }
}

/* ── Tablet (768–1024px) ─────────────────────────── */
@media (max-width: 1024px) {
  :root { --gutter: 24px; }

  /* Layout: 单列，侧边栏横向网格 */
  .editorial-layout { grid-template-columns: 1fr; gap: 24px; }
  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }

  /* Editorial */
  .editorial { grid-template-columns: 1fr 1fr; }
  .ed-card.big { grid-column: 1 / 3; grid-row: auto; }
  .ed-card.big .ed-img  { height: 220px; }
  .ed-card.big .ed-title { font-size: var(--text-lg); }
  .ed-card.small .ed-img { height: 140px; }

  /* Grids */
  .tour-row          { grid-template-columns: repeat(3, 1fr); }
  .biz-row, .lifestyle-row { grid-template-columns: repeat(3, 1fr); }
  .nf-grid           { grid-template-columns: repeat(2, 1fr); }
  .nf-magazine       { grid-template-columns: 1.4fr 1fr; }
  .tour-grid         { grid-template-columns: repeat(3, 1fr); }
  .biz-grid          { grid-template-columns: repeat(3, 1fr); }
  .sr-card-grid      { grid-template-columns: repeat(3, 1fr); }

  /* Footer */
  .footer-body { grid-template-columns: 1fr 1fr; gap: 32px; }

  /* Page layout */
  .page-layout { grid-template-columns: 1fr 260px; gap: 28px; }
}

/* ── Mobile (<768px) ─────────────────────────────── */
@media (max-width: 767px) {
  :root { --gutter: 16px; }

  /* ── 防溢出兜底：任何带内联 grid-template-columns 的模块强制 2 列，
     固定宽度广告/嵌入内容不允许超出屏幕 ── */
  [style*="grid-template-columns"] { grid-template-columns: 1fr 1fr !important; }
  .mxh-ad, .mxh-ad > div { max-width: 100%; overflow: hidden; }
  .container, .mw { max-width: 100%; }

  /* ── Header ── */
  .nav-primary    { display: none; }
  .btn-line,
  .btn-solid,
  .btn-logout     { display: none !important; }   /* 隐藏所有桌面端按钮 */
  .mobile-menu-btn { display: flex; }
  .header-inner   { height: 56px; gap: 12px; }
  .logo-sub       { display: none; }

  /* ── Announcement bar ── */
  .announcement-links { display: none; }

  /* ── Alert strip ── */
  .as-chips       { display: none; }
  .as-cta span    { display: none; }
  .as-cta         { padding: 6px 10px; font-size: var(--text-xs); flex-shrink: 0; }
  .as-label       { flex-shrink: 0; }
  .as-text        { min-width: 0; overflow: hidden; }
  .as-divider     { flex-shrink: 0; }

  /* ── 汇率 & 天气条：通栏紧凑版 ── */
  .mxh-ucard { padding: 10px 8px; gap: 8px; justify-content: center; }
  .ub-ic { font-size: 18px; }
  .ub-body b { font-size: 13px; }
  .ub-sub small, .ub-up, .ub-down { font-size: 10px; }

  /* ── 快捷宫格：手机 4 列两排 ── */
  .mxh-qgrid { grid-template-columns: repeat(4, 1fr); padding: 13px 4px; }
  .qg-ic { width: 45px; height: 45px; font-size: 21px; }
  .qg-label { font-size: 12px; }

  /* ── City tabs ── */
  .city-tabs-inner { gap: 0; padding-bottom: 0; }
  .ctab            { padding: 10px 12px; font-size: 12px; }
  .ctab-all        { display: none; }

  /* ── Editorial grid（v1.5.1 手机改版）──
     大卡：沉浸式大图 + 文字压图；小卡：独立圆角卡 2 列
  */
  .editorial-layout { grid-template-columns: 1fr; gap: 20px; }
  .editorial {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 10px;
    background: transparent; border: none;
    border-radius: 0; overflow: visible;
  }
  .ed-card {
    border: 1px solid var(--line);
    border-radius: 12px; overflow: hidden;
    box-shadow: var(--elev-1);
  }

  /* 大卡：文字覆盖在图片上 */
  .ed-card.big {
    grid-column: 1 / 3;
    grid-row: 1;
    position: relative;
  }
  .ed-card.big .ed-img { height: 235px; display: block; }
  .ed-card.big .ed-img::after {
    content: '';
    position: absolute; inset: 0; z-index: 1;
    background: linear-gradient(to top, rgba(6,9,18,.88) 0%, rgba(6,9,18,.35) 52%, rgba(6,9,18,.05) 100%);
  }
  .ed-card.big .ed-body {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
    padding: 14px 15px 15px; background: none;
  }
  .ed-card.big .ed-kicker { display: none; } /* 分类已有图上角标 */
  .ed-card.big .ed-title,
  .ed-card.big:hover .ed-title { color: #fff; font-size: 17.5px; font-weight: 800; line-height: 1.4; letter-spacing: -.2px; }
  .ed-card.big .ed-meta { color: rgba(255,255,255,.7); padding-top: 7px; }
  .ed-card.big .ed-meta-sep { background: rgba(255,255,255,.5); }

  /* 小卡：独立卡片 */
  .ed-card.small .ed-img { height: 120px; }
  .ed-card.small .ed-body { padding: 10px 12px 12px; }
  .ed-card.small .ed-title { font-size: 12.5px; font-weight: 600; line-height: 1.45; }
  .ed-excerpt            { display: none; }

  /* ── 内嵌最新资讯 ── */
  .ed-newsfeed { margin-top: 16px; }
  .ed-newsfeed .nf-item { padding: 10px 12px; gap: 10px; }
  .ed-newsfeed .nf-thumb { width: 64px; height: 46px; }
  .ed-newsfeed .nf-idx   { display: none; }

  /* ── Sidebar: 单列 ── */
  .sidebar {
    position: static;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .risk-bar .rb-n { font-size: 20px; }

  /* ── News feed（列表默认布局）── */
  .news-feed      { border-radius: 0; border-left: none; border-right: none; }
  .nf-thumb       { width: 72px; height: 50px; }
  .nf-idx         { display: none; }

  /* Grid 布局：手机单列 */
  .nf-grid { grid-template-columns: 1fr; padding: 10px; gap: 10px; }

  /* Magazine 布局：手机单列 */
  .nf-magazine    { grid-template-columns: 1fr; }
  .nf-mag-sidebar { display: none; } /* 手机只保留大图头条 */

  /* ── Tourism（v1.5.3：压图标题需要足够图高）── */
  .tour-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tour-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .t-img    { height: 148px; }
  .t-name   { font-size: 13.5px; }
  .t-place  { font-size: 10.5px; }
  .t-head   { left: 10px; right: 10px; bottom: 10px; }
  .t-intro  { font-size: 11.5px; min-height: 36px; }
  .t-body   { padding: 10px 12px 11px; }

  /* ── Business + Lifestyle ──
     !important 覆盖 PHP 内联 style="grid-template-columns:repeat(N,1fr)"
     防止多列溢出撑宽 body → 修复左右边距不对称 */
  .biz-row,
  .lifestyle-row  { grid-template-columns: 1fr 1fr !important; gap: 10px; margin-top: 12px; }
  .biz-grid       { grid-template-columns: 1fr 1fr; gap: 12px; }
  .biz-img,
  .ls-img         { aspect-ratio: 4/3; }

  /* ── Search results（v1.5.4：手机样式后台三选一）──
     full   = 现有大卡（<480 单列）
     grid2  = 始终一行 2 个紧凑卡
     hscroll= 横向滑动 */
  .sr-card-grid   { grid-template-columns: 1fr 1fr; gap: 10px; }

  .sr-card-grid.sr-m-grid2 { grid-template-columns: 1fr 1fr !important; gap: 9px; }
  .sr-m-grid2 .sr-card-img { aspect-ratio: 4/3; height: auto; }
  .sr-m-grid2 .sr-card-title { font-size: 12.5px; line-height: 1.45; }
  .sr-m-grid2 .sr-card-body { padding: 9px 10px 11px; }
  .sr-m-grid2 .sr-card-excerpt { display: none; }

  .sr-card-grid.sr-m-hscroll {
    display: flex !important;
    overflow-x: auto; gap: 10px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
    margin-right: calc(-1 * var(--gutter)); padding-right: var(--gutter);
    padding-bottom: 6px;
  }
  .sr-card-grid.sr-m-hscroll::-webkit-scrollbar { display: none; }
  .sr-m-hscroll .sr-card { flex: 0 0 62%; max-width: 240px; scroll-snap-align: start; }
  .sr-m-hscroll .sr-card-img { aspect-ratio: 4/3; height: auto; }
  .sr-m-hscroll .sr-card-excerpt { display: none; }

  /* ── Classifieds tabs ── */
  .cl-tabs        { gap: 4px; }
  .cl-tab         { padding: 5px 12px; font-size: 12px; }

  /* ── Page layout (single/archive) ── */
  .page-layout    { grid-template-columns: 1fr; gap: 20px; padding: 20px 0; }
  .archive-thumb  { width: 100px; }
  .archive-item   { gap: 12px; }

  /* ── Single post ── */
  .post-title     { font-size: var(--text-xl); }
  .post-featured-img { border-radius: 0; margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); }
  .post-featured-img img { max-height: 240px; }
  .post-nav       { grid-template-columns: 1fr; gap: 12px; }
  .post-nav-next  { text-align: left; }

  /* ── 侧边栏面板手机端开关（v1.5.3，后台「侧边栏」Tab 配置）── */
  .sidebar .sb-hide-mobile { display: none !important; }

  /* ── Footer（v1.5.3 手机紧凑版：品牌居中 + 双列导航 + 横排联系方式）── */
  .footer-body {
    grid-template-columns: 1fr 1fr;
    gap: 26px 18px;
    padding: 32px 18px 22px;
  }
  .fc-brand-col { grid-column: 1 / -1; text-align: center; }
  .fc-brand-col .fb-desc {
    font-size: 12.5px; line-height: 1.7;
    max-width: 420px; margin: 10px auto 0;
  }
  .fc-brand-col .fb-pill { margin-top: 14px; }
  .fc-head { margin-bottom: 12px; }
  .footer-menu, .fc-links { gap: 9px; }
  .footer-menu a, .fc-links a { font-size: 13px; }
  /* 联系方式横跨两列、条目横排 */
  .footer-body .fc-col:last-child { grid-column: 1 / -1; }
  .footer-contact { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 12.5px; }
  .footer-contact p { margin-bottom: 0; }
  .footer-bar-inner {
    flex-direction: column; align-items: center;
    gap: 8px; text-align: center; padding: 14px 16px;
  }

  /* ── Auth ── */
  .auth-card  { padding: 28px 20px; }
  .auth-title { font-size: var(--text-lg); }

  /* ── Search ── */
  .search-form-inline { flex-direction: column; }
  .search-page   { padding: 18px 0 36px; }
  .search-header { margin-bottom: 22px; }
  .search-hero   { padding-left: 14px; }
  .search-hero input  { font-size: 14px; }
  .search-hero button { padding: 8px 18px; font-size: 13px; }
  .search-kicker { margin-bottom: 10px; }

  /* ── Related posts ── */
  .related-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

  /* ── Module section padding ── */
  .module-business,
  .module-lifestyle,
  .module-classifieds { padding: 20px 0; }
  .module-tourism     { padding: 0 0 20px; }
  .module-editorial   { padding: 20px 0; }

  /* ── sl label ── */
  .sl-count { display: none; }

  /* ── Ad ── */
  .mxh-ad-mobile_sticky { display: flex; }
  .mxh-ad-mobile_sticky:not(:empty) ~ footer { padding-bottom: 60px; }

  /* ── Share buttons ── */
  .post-share     { gap: 6px; }
  .share-btn      { padding: 6px 10px; font-size: 11px; }
  .share-text     { display: none; } /* 只显示图标 */

  /* ── Comments ── */
  .comment-form-author,
  .comment-form-email { display: block; width: 100%; }
  .comment-form-author { margin-right: 0; }
  .comment-content,
  .comment-awaiting   { padding-left: 0; margin-top: 10px; }

  /* ── Biz filter bar ── */
  .biz-filter-bar { flex-direction: column; }
  .biz-filter-bar input,
  .biz-filter-bar select { width: 100%; }

  /* ── Trip detail page ── */
  .trip-hero      { height: 240px !important; }
  .trip-layout    { grid-template-columns: 1fr !important; gap: 20px !important; }
  .trip-sidebar   { position: static !important; order: -1; }
  .trip-tabs      { gap: 4px !important; }
  .trip-tab       { padding: 8px 12px !important; font-size: 12px !important; }
  .trip-info-card { grid-template-columns: 1fr !important; }
}

/* ── Small mobile (<480px) ─────────────────────── */
@media (max-width: 480px) {
  .tour-row, .tour-grid { grid-template-columns: 1fr; }
  .biz-row,
  .lifestyle-row  { grid-template-columns: 1fr 1fr !important; }
  .biz-grid       { grid-template-columns: 1fr; }
  /* 小屏保持双列小卡（沉浸大卡 + 2列，与设计稿一致） */
  .ed-card.big .ed-img   { height: 210px; }
  .ed-card.small .ed-img { height: 105px; }
  .nf-grid        { grid-template-columns: 1fr; }
  .sr-card-grid.sr-m-full { grid-template-columns: 1fr; } /* 仅默认样式 <480 转单列 */
  .related-grid   { grid-template-columns: 1fr; }
}

/* ── Reduced motion ──────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  .alert-ticker { animation: none; }
}

/* ── Print ───────────────────────────────────────── */
@media print {
  .site-header, .site-footer, .sidebar, .module-city-tabs,
  .module-alert-strip, .mobile-menu-btn, .header-search-btn { display: none !important; }
  .editorial-layout { grid-template-columns: 1fr; }
  .page-layout      { grid-template-columns: 1fr; }
  body { font-size: 12pt; color: #000; }
  a    { color: #000; text-decoration: underline; }
}
