/* =========================================================================
   Groomax —— 移动端自适应覆盖样式
   仅作用于窄屏（<=767px / 触屏平板 768-1024px），不影响桌面端外观
   生成日期：2026-11-25
   ========================================================================= */

/* ---------- 平板：768px – 1024px ---------- */
@media screen and (min-width: 768px) and (max-width: 1024px) {

  /* 品牌分类卡片：一排 4 个太挤，改 2 列 */
  .wp-block-group.is-nowrap.is-layout-flex,
  .wp-container-core-group-is-layout-d05cb3ef {
    flex-wrap: wrap !important;
    gap: 14px !important;
  }
  .wp-block-woocommerce-featured-category,
  .wc-block-featured-category {
    min-height: 300px !important;
    flex: 1 1 calc(50% - 14px) !important;
    max-width: calc(50% - 14px) !important;
  }
  .wc-block-featured-category__background-image {
    object-fit: cover !important;
    width: 100% !important;
    height: 100% !important;
  }
}

/* ---------- 手机：<=767px ---------- */
@media screen and (max-width: 767px) {

  /* 0. 全局防横向溢出 */
  html, body {
    overflow-x: hidden !important;
    max-width: 100%;
    -webkit-text-size-adjust: 100%;
  }
  img, video, iframe {
    max-width: 100% !important;
    height: auto;
  }

  /* 1. 品牌分类卡片：强制换行成两列，高度从 500px 收敛 */
  .wp-block-group.is-nowrap.is-layout-flex,
  .wp-container-core-group-is-layout-d05cb3ef {
    flex-wrap: wrap !important;
    gap: 10px !important;
  }
  .wp-block-woocommerce-featured-category,
  .wc-block-featured-category {
    min-height: 190px !important;
    flex: 1 1 calc(50% - 10px) !important;
    max-width: calc(50% - 10px) !important;
    border-radius: 10px !important;
    overflow: hidden !important;
  }
  .wc-block-featured-category__wrapper {
    min-height: 190px !important;
  }
  .wc-block-featured-category__background-image {
    object-fit: cover !important;
    width: 100% !important;
    height: 100% !important;
  }
  .wc-block-featured-category__inner-blocks {
    padding: 14px 10px !important;
  }
  .wp-block-woocommerce-category-title,
  .wc-block-featured-category h2 {
    font-size: 15px !important;
    line-height: 1.25 !important;
    letter-spacing: .02em;
    word-break: break-word;
  }

  /* 2. 标题字号自适应，避免超大标题挤爆行宽 */
  h1.wp-block-heading,
  .has-x-large-font-size {
    font-size: clamp(24px, 7.5vw, 34px) !important;
    line-height: 1.15 !important;
  }
  h2.wp-block-heading {
    font-size: clamp(20px, 6vw, 26px) !important;
    line-height: 1.2 !important;
  }
  h3.wp-block-heading,
  h4.wp-block-heading {
    font-size: clamp(17px, 5vw, 22px) !important;
    line-height: 1.25 !important;
  }

  /* 3. 垂直留白收敛，去掉空段落造成的空白 */
  .wp-block-spacer {
    height: 20px !important;
  }
  p:empty,
  .wp-block-paragraph:empty {
    display: none !important;
  }
  .wp-block-group__inner-container > * + *,
  .entry-content > * + * {
    margin-block-start: 16px !important;
  }

  /* 4. 按钮：加大点击区域，适配拇指操作 */
  .wp-block-button__link,
  .wp-element-button {
    min-height: 42px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 10px 18px !important;
    font-size: 14px !important;
    line-height: 1.2 !important;
  }

  /* 5. 图片块全宽、居中、圆角 */
  .wp-block-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
  }

  /* 6. 网格布局（2 列）→ 单列 */
  .wp-block-group.is-layout-grid {
    grid-template-columns: 1fr !important;
    row-gap: 16px !important;
  }

  /* 7. 页脚三列 → 上下堆叠 */
  .wp-block-columns {
    flex-wrap: wrap !important;
    gap: 18px !important;
  }
  .wp-block-column {
    flex-basis: 100% !important;
    min-width: 100% !important;
  }

  /* 8. FAQ 折叠项：加大行高与点击区 */
  .wp-block-details {
    font-size: 15px !important;
    line-height: 1.6 !important;
    padding: 4px 0 !important;
  }
  .wp-block-details summary {
    padding: 10px 0 !important;
    font-weight: 600;
  }

  /* 9. 主题容器左右内边距，避免贴边 */
  .container,
  .site-content .container,
  .header-t .container {
    padding-left: 16px !important;
    padding-right: 16px !important;
    max-width: 100% !important;
  }
  .wp-block-group.alignwide,
  .wp-block-columns.alignwide {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
  }

  /* 10. 页头：logo 与导航等比缩小 */
  .site-header .site-branding img,
  .site-header .custom-logo {
    max-height: 48px !important;
    width: auto !important;
  }
  .site-header {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}

/* ---------- 小屏手机：<=400px ---------- */
@media screen and (max-width: 400px) {

  /* 极窄屏下分类卡片改单列，保证文字可读 */
  .wp-block-woocommerce-featured-category,
  .wc-block-featured-category {
    flex-basis: 100% !important;
    max-width: 100% !important;
    min-height: 180px !important;
  }
  .wc-block-featured-category__wrapper {
    min-height: 180px !important;
  }
  h1.wp-block-heading,
  .has-x-large-font-size {
    font-size: clamp(22px, 8vw, 30px) !important;
  }
  .wp-block-button__link,
  .wp-element-button {
    width: 100%;
  }
}

/* ============================================================
   首页产品区块：移动端保持「一整栏不折叠」
   —— 覆盖上方通用规则，仅在 body.home 生效
   ============================================================ */
@media screen and (max-width: 767px) {

  /* 第一块：产品图 + 文案，保持左右两栏 */
  body.home .wp-block-group.alignwide.is-layout-grid {
    grid-template-columns: 1.02fr 1fr !important;
    align-items: center !important;
    column-gap: 10px !important;
    row-gap: 0 !important;
  }
  body.home .wp-block-group.alignwide.is-layout-grid > .wc-block-featured-category {
    flex: none !important;
    max-width: none !important;
    width: 100% !important;
    min-height: 0 !important;
    aspect-ratio: 606 / 500 !important;
    border-radius: 8px !important;
  }
  body.home .wp-block-group.alignwide.is-layout-grid > .wc-block-featured-category .wc-block-featured-category__wrapper {
    min-height: 0 !important;
  }
  /* 产品图完整显示，不再放大裁切 */
  body.home .wc-block-featured-category__background-image {
    object-fit: contain !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
  }
  /* 左侧文案列：缩排版，保持两栏并排 */
  body.home .wp-block-group.alignwide.is-layout-grid .wp-block-columns {
    flex-wrap: nowrap !important;
    gap: 0 !important;
  }
  body.home .wp-block-group.alignwide.is-layout-grid .wp-block-column {
    flex-basis: auto !important;
    min-width: 0 !important;
  }
  body.home .wp-block-group.alignwide.is-layout-grid h1.wp-block-heading {
    font-size: clamp(15px, 4.6vw, 22px) !important;
    line-height: 1.15 !important;
    margin-bottom: 6px !important;
  }
  body.home .wp-block-group.alignwide.is-layout-grid p {
    font-size: clamp(10px, 3vw, 14px) !important;
    line-height: 1.45 !important;
  }
  body.home .wp-block-group.alignwide.is-layout-grid .wp-block-button__link {
    font-size: clamp(10px, 3vw, 14px) !important;
    min-height: 0 !important;
    padding: 7px 16px !important;
    width: auto !important;
  }

  /* 第二块：四个品牌卡片，保持一行四栏 */
  body.home .wp-block-group.is-nowrap.is-layout-flex {
    flex-wrap: nowrap !important;
    gap: 6px !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
  }
  body.home .wp-block-group.is-nowrap.is-layout-flex > .wc-block-featured-category {
    flex: 0 0 calc((100% - 18px) / 4) !important;
    flex-basis: calc((100% - 18px) / 4) !important;
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
    width: calc((100% - 18px) / 4) !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 0 !important;
    aspect-ratio: 299 / 500 !important;
    border-radius: 6px !important;
  }
  body.home .wp-block-group.is-nowrap.is-layout-flex > .wc-block-featured-category .wc-block-featured-category__wrapper {
    min-height: 0 !important;
  }
  body.home .wp-block-group.is-nowrap.is-layout-flex .wc-block-featured-category__inner-blocks {
    padding: 8px 4px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    height: 100% !important;
    gap: 4px !important;
  }
  body.home .wp-block-group.is-nowrap.is-layout-flex .wc-block-featured-category h2 {
    font-size: clamp(9px, 2.9vw, 13px) !important;
    line-height: 1.15 !important;
    letter-spacing: 0 !important;
    word-break: break-word !important;
    margin: 0 !important;
    text-shadow: 0 1px 4px rgba(0,0,0,.6);
  }
  body.home .wp-block-group.is-nowrap.is-layout-flex .wp-block-button__link {
    font-size: clamp(8px, 2.5vw, 11px) !important;
    min-height: 0 !important;
    padding: 4px 9px !important;
    width: auto !important;
    line-height: 1.2 !important;
  }
}

@media screen and (max-width: 400px) {
  /* 极窄屏同样保持一行四栏，不再改单列 */
  body.home .wp-block-group.is-nowrap.is-layout-flex > .wc-block-featured-category {
    flex: 1 1 0 !important;
    flex-basis: auto !important;
    max-width: none !important;
    min-height: 0 !important;
  }
  body.home .wp-block-group.is-nowrap.is-layout-flex > .wc-block-featured-category .wc-block-featured-category__wrapper {
    min-height: 0 !important;
  }
}


/* ============================================================
   首页 FAQ（Frequently Asked Questions）：移动/平板字号自适应收敛
   ============================================================ */
@media screen and (max-width: 1024px) {

  body.home .wp-block-details summary {
    font-size: clamp(13px, 2.9vw, 15px) !important;
    line-height: 1.45 !important;
    letter-spacing: 0 !important;
    padding: 11px 0 !important;
    font-weight: 600 !important;
  }
  body.home .wp-block-details summary strong {
    font-weight: 600 !important;
  }
  body.home .wp-block-details.is-layout-flow p,
  body.home .wp-block-details p {
    font-size: clamp(13px, 2.9vw, 15px) !important;
    line-height: 1.6 !important;
    letter-spacing: 0 !important;
    margin: 2px 0 10px !important;
  }
  body.home .wp-block-details p strong {
    font-weight: 600 !important;
  }


}


/* ============================================================
   产品主图兜底：flexslider 未初始化时图库默认 opacity:0 导致空白
   强制显示，保证产品图一定可见
   ============================================================ */
.woocommerce-product-gallery {
  opacity: 1 !important;
}
.woocommerce-product-gallery .woocommerce-product-gallery__image img,
.woocommerce-product-gallery img.wp-post-image {
  width: 100% !important;
  height: auto !important;
  display: block;
}
