/* ==========================================================================
   雅其信 · WooCommerce 全产品目录 · 扩展样式
   依赖：assets/css/style.css（复用 --primary / --accent / --line 等变量）
   ========================================================================== */

/* 站点原有隐藏态浮层（.menu / .wa-panel）在移动端会撑出横向滚动；
   目录页范围内定向收敛，避免 390px 视口出现 710px 文档宽度 */
@media (max-width: 760px) {
  html, body { overflow-x: hidden; }
  @supports (overflow-x: clip) { html, body { overflow-x: clip; } }
}

/* 目录页 hero：原横幅图内嵌旧版英文案，会与新 H1 重叠；改用纯 CSS 渐变 */
.pagehero .pagehero__bg { display: none; }
.pagehero {
  background:
    radial-gradient(1100px 420px at 82% -20%, rgba(20, 128, 141, .60), transparent 62%),
    radial-gradient(700px 340px at 8% 120%, rgba(201, 138, 60, .16), transparent 60%),
    linear-gradient(120deg, #083940 0%, #0e5c66 48%, #14808d 100%);
}
.pagehero::after { background: linear-gradient(180deg, rgba(6, 32, 37, .30), rgba(6, 32, 37, .62)); }

.yqx-catalog { min-width: 0; }

/* 顶部工具条：数量 / 搜索 / 排序 / 每页条数 */
.yqx-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 14px 22px; padding: 16px 20px; margin-bottom: 18px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-s);
}
.yqx-count { font-size: 14px; color: var(--muted); line-height: 1.7; }
.yqx-count b { color: var(--primary-d); font-size: 16px; }
.yqx-count .yqx-live { color: #1a9c66; font-weight: 700; white-space: nowrap; }
.yqx-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.yqx-search {
  display: inline-flex; align-items: center; gap: 8px; position: relative;
  border: 1px solid var(--line); border-radius: 999px; background: #fff;
  padding: 0 8px 0 14px; transition: .2s;
}
.yqx-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-l); }
.yqx-search svg { flex: none; color: var(--muted); }
.yqx-search input {
  border: 0; outline: 0; background: transparent; font-family: inherit; font-size: 14px;
  color: var(--ink); padding: 10px 4px; width: 250px; max-width: 46vw;
}
.yqx-search input::-webkit-search-cancel-button { display: none; }
.yqx-clear {
  border: 0; background: var(--alt); color: var(--muted); cursor: pointer;
  width: 24px; height: 24px; border-radius: 50%; line-height: 1; font-size: 16px; display: none;
}
.yqx-clear.on { display: block; }
.yqx-sel { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.yqx-sel select {
  font-family: inherit; font-size: 14px; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; cursor: pointer; outline: none;
}
.yqx-sel select:focus { border-color: var(--primary); }

/* 分类筛选：沿用 .chip 视觉，但使用独立容器避免与 main.js 旧逻辑冲突 */
.yqx-chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 4px 0 30px; }
.yqx-chips .chip { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; cursor: pointer; }
.yqx-chips .chip b { font-weight: 700; font-size: 12px; opacity: .65; }
.yqx-chips .chip.active b { opacity: .9; }

/* 产品网格：按容器宽度智能调整列数 */
.yqx-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; align-items: stretch; }
.yqx-grid .p-card__media { aspect-ratio: 1 / 1; }
.yqx-grid .p-card__media img { object-fit: cover; }
.yqx-grid .p-card__body { padding: 18px 20px 16px; display: flex; flex-direction: column; flex: 1; }
.yqx-grid .p-card__body h3 {
  font-size: 16px; line-height: 1.45; margin: 0 0 9px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.yqx-grid .p-card__body h3 a { color: var(--ink); text-decoration: none; }
.yqx-grid .p-card__body h3 a:hover { color: var(--primary); }
.yqx-grid .p-card__body p {
  font-size: 13.5px; line-height: 1.65; color: var(--muted); margin: 0 0 14px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.yqx-grid .p-card__meta {
  margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 13px; color: var(--muted);
}
.yqx-grid .p-card__meta .yqx-price { color: var(--accent-d); font-weight: 700; white-space: nowrap; }
.yqx-grid .p-card__meta .more { white-space: nowrap; }
.yqx-sku { display: block; font-size: 11.5px; color: #8a9ba1; letter-spacing: .02em; margin-top: -6px; margin-bottom: 10px; }
.yqx-hl { background: #fff0c9; color: inherit; border-radius: 2px; padding: 0 1px; }

/* 搜索建议 */
.yqx-suggest {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60; width: min(420px, 88vw);
  max-height: 340px; overflow: auto; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 6px;
}
.yqx-suggest a { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: 13.5px; }
.yqx-suggest a:hover { background: var(--primary-l); }
.yqx-suggest img { width: 38px; height: 38px; object-fit: cover; border-radius: 6px; flex: none; background: var(--alt); }
.yqx-suggest span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.yqx-suggest .yqx-sg-all { display: block; text-align: center; color: var(--primary); font-weight: 700; border-top: 1px solid var(--line); margin-top: 4px; padding: 10px; }
.cat-search { position: relative; }
.cat-suggest { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 90; }

/* 状态提示 */
.yqx-state { text-align: center; padding: 54px 20px; color: var(--muted); font-size: 15px; }
.yqx-state h3 { color: var(--ink); font-size: 20px; margin: 0 0 10px; }
.yqx-state .btn { margin-top: 16px; }
.yqx-loading { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--primary-l); border-top-color: var(--primary); border-radius: 50%; animation: yqx-spin .8s linear infinite; vertical-align: -3px; margin-right: 8px; }
@keyframes yqx-spin { to { transform: rotate(360deg); } }

/* 智能分页 */
.yqx-pager {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 8px; margin: 36px 0 8px;
}
.yqx-pager a, .yqx-pager button, .yqx-pager span.yqx-dots {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 40px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font-family: inherit; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: .18s;
}
.yqx-pager a:hover, .yqx-pager button:hover { border-color: var(--primary); color: var(--primary); }
.yqx-pager a.yqx-active, .yqx-pager a[aria-current="page"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.yqx-pager a.yqx-disabled { opacity: .42; pointer-events: none; }
.yqx-pager span.yqx-dots { border: 0; background: transparent; color: var(--muted); min-width: 24px; padding: 0; }
.yqx-jump { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--muted); margin-left: 8px; }
.yqx-jump input {
  width: 66px; padding: 9px 8px; text-align: center; font-family: inherit; font-size: 14px;
  border: 1px solid var(--line); border-radius: 9px; outline: none; color: var(--ink);
}
.yqx-jump input:focus { border-color: var(--primary); }
.yqx-jump button { height: 38px; min-width: 38px; }

/* 分类云 / 旧版精选链接 */
.yqx-cloud { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; }
.yqx-cloud a {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff;
  color: #33454c; font-size: 13.5px; font-weight: 600; text-decoration: none; transition: .2s;
}
.yqx-cloud a:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-l); }
.yqx-cloud a b { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.yqx-legacy { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); text-align: center; }
.yqx-legacy h4 { font-size: 14px; color: var(--muted); margin: 0 0 12px; font-weight: 600; }
.yqx-legacy-links { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; }
.yqx-legacy-links a { font-size: 13px; color: var(--primary); text-decoration: none; }
.yqx-legacy-links a:hover { text-decoration: underline; }

@media (max-width: 860px) {
  .yqx-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
  .yqx-toolbar { padding: 14px; }
  .yqx-search input { width: 190px; }
}
@media (max-width: 600px) {
  .yqx-grid { grid-template-columns: 1fr; }
  .yqx-controls { width: 100%; }
  .yqx-search { width: 100%; }
  .yqx-search input { flex: 1; width: auto; max-width: none; }
  .yqx-pager a, .yqx-pager button { min-width: 34px; height: 36px; padding: 0 9px; font-size: 13px; }
  .yqx-jump { width: 100%; justify-content: center; margin: 6px 0 0; }
}
