/* =====================================================================
 * mml-responsive.css — 移动端 / 平板响应式适配
 *
 * 现有 v2 模板用固定 1440px 桌面布局 + 大量内联样式（grid/padding/font-size）。
 * 本表用 @media + 属性选择器 + !important 覆盖内联样式实现自适应：
 * 外部样式表的 !important 优先级高于非 important 的内联样式，故能在窄屏改写，
 * 桌面端（媒体查询不命中）完全不受影响。在 mml.css 之后加载。
 * ===================================================================== */

/* 页头：移动端隐藏桌面操作组（搜索/在线咨询/预约来韩），仅留汉堡 */
@media (max-width: 768px) {
  .mml-site-actions { display: none !important; }
}

/* 防横向溢出（全局） */
html, body { max-width: 100%; overflow-x: hidden; }
body, .mml-root, #page { min-width: 0 !important; }
img, video, svg { max-width: 100%; }

/* ---------- 平板 ≤1024px ---------- */
@media (max-width: 1024px) {
  /* 主区容器横向留白收窄 */
  [style*="max-width:1440px"], [style*="max-width: 1440px"] {
    padding-left: 28px !important; padding-right: 28px !important;
  }
  /* 多列栅格降列 */
  [style*="grid-template-columns:repeat(5"] { grid-template-columns: repeat(3, 1fr) !important; }
  [style*="grid-template-columns:repeat(4"] { grid-template-columns: repeat(2, 1fr) !important; }
  /* 侧栏 / 英雄等两列 → 单列堆叠 */
  [style*="grid-template-columns:260px"], [style*="grid-template-columns:320px"],
  [style*="grid-template-columns:1.05fr"], [style*="grid-template-columns:1fr 1.6fr"],
  [style*="grid-template-columns:1fr 1.4fr"], [style*="grid-template-columns:1.4fr"] {
    grid-template-columns: 1fr !important;
  }
  /* sticky 侧栏改为普通流（避免错位） */
  [style*="position:sticky"] { position: static !important; }
}

/* ---------- 手机 ≤640px ---------- */
@media (max-width: 640px) {
  /* 容器留白进一步收窄 */
  [style*="max-width:1440px"], [style*="max-width: 1440px"],
  [style*="max-width:1280px"], [style*="max-width: 1280px"] {
    padding-left: 16px !important; padding-right: 16px !important;
  }
  /* 各 section 横向 48px 留白 → 16px */
  [style*="padding:120px 48px"], [style*="padding:96px 48px"], [style*="padding:80px 48px"],
  [style*="padding:64px 48px"], [style*="padding:56px 48px"], [style*="padding:40px 48px"],
  [style*="padding:20px 48px"], [style*="padding:0 48px"] {
    padding-left: 16px !important; padding-right: 16px !important;
  }
  /* 纵向超大留白压缩 */
  [style*="padding:120px 48px"] { padding-top: 56px !important; }
  [style*="padding:96px 48px"], [style*="padding:96px"] { padding-top: 48px !important; padding-bottom: 48px !important; }

  /* 所有多列栅格 → 双列 */
  [style*="grid-template-columns:repeat(5"],
  [style*="grid-template-columns:repeat(4"],
  [style*="grid-template-columns:repeat(3"] { grid-template-columns: repeat(2, 1fr) !important; }
  /* 等分两/三列 → 单列 */
  [style*="grid-template-columns:1fr 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }

  /* 大标题字号下调 */
  [style*="font-size:66px"] { font-size: 34px !important; }
  [style*="font-size:56px"] { font-size: 30px !important; }
  [style*="font-size:48px"] { font-size: 28px !important; }
  [style*="font-size:44px"], [style*="font-size:42px"] { font-size: 26px !important; }
  [style*="font-size:36px"], [style*="font-size:34px"], [style*="font-size:32px"] { font-size: 23px !important; }

  /* 横排信息（stats/按钮组）允许换行，避免溢出 */
  [style*="display:flex"][style*="gap:32px"],
  [style*="display:flex"][style*="gap:24px"] { flex-wrap: wrap !important; }

  /* 头部两列(头像+文字)间距收窄 */
  [style*="gap:48px"] { gap: 24px !important; }
  [style*="gap:64px"] { gap: 32px !important; }
}

/* ---------- 超小屏 ≤420px：卡片网格再降为单列（图文更易读） ---------- */
@media (max-width: 420px) {
  [style*="grid-template-columns:repeat(5"],
  [style*="grid-template-columns:repeat(4"],
  [style*="grid-template-columns:repeat(3"],
  [style*="grid-template-columns:repeat(2"] { grid-template-columns: 1fr !important; }
}
