/*
Theme Name: WIREMFG
Theme URI: https://wiremfg.com/
Author: WIREMFG
Description: WIREMFG 官网主题。设计沿用 site/ 静态稿，样式主体在 /assets/css/style.css，这里只补充产品、文章、详情页需要的新组件。
Version: 1.1.2
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: wiremfg
*/

/* ============================================================
   基础：新组件都基于 /assets/css/style.css 里的 CSS 变量
   ============================================================ */

/*
 * 站点的 .container 是为页头写的 display:flex。
 * 内容区一旦把网格放进去，flex 子项的 min-width:auto 会撑破视口（移动端横向溢出），
 * 所以内容区统一回到 block 布局。
 */
.section > .container:not(.wm-single__grid),
.wm-catstrip > .container,
.wm-insights > .container,
.wm-crumb > .container,
.wm-404 > .container,
.wm-article > .container,
.wm-postnav > .container {
  display: block;
  width: 100%;
  min-width: 0;
}

.wm-prods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  min-width: 0;
}

.wm-prod {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}

.wm-prod:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(36, 29, 22, .09);
}

.wm-prod__media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--bg-2);
  overflow: hidden;
}

.wm-prod__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s ease;
}

.wm-prod:hover .wm-prod__media img {
  transform: scale(1.04);
}

.wm-prod__ph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.wm-prod__body {
  padding: 20px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.wm-prod__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.wm-prods,
.wm-posts,
.wm-post,
.wm-prod {
  min-width: 0;
}

.wm-prod__body p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.wm-prod__specs {
  margin: 4px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--line-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wm-prod__specs > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
}

.wm-prod__specs dt {
  color: var(--muted);
  margin: 0;
}

.wm-prod__specs dd {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
  text-align: right;
}

/* ---------- 分类快捷条 ---------- */

.wm-catstrip {
  padding-top: 0;
}

.wm-catstrip__row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.wm-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  transition: border-color .2s ease, background .2s ease;
}

.wm-chip span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.wm-chip:hover {
  border-color: var(--accent);
  background: var(--accent-tint);
}

/* ---------- 文章卡片 ---------- */

.wm-posts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.wm-posts--list {
  grid-template-columns: repeat(2, 1fr);
}

.wm-post {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}

.wm-post:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(36, 29, 22, .09);
}

.wm-post__media {
  aspect-ratio: 16 / 10;
  background: var(--bg-2);
  overflow: hidden;
}

.wm-post__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wm-post__ph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: .3em;
  color: var(--accent);
  opacity: .5;
}

.wm-post__body {
  padding: 20px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.wm-post__date {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.wm-post__body h2,
.wm-post__body h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--ink);
}

.wm-post__body p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.wm-post__more {
  margin-top: auto;
  padding-top: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}

.wm-insights__all {
  margin: 34px 0 0;
  text-align: center;
}

/* ---------- 产品详情 ---------- */

/* 页头是 position:fixed，首个元素必须自己让出 --header-h，否则会被盖住 */
.wm-crumb {
  padding: calc(var(--header-h) + 16px) 0 0;
  font-size: 12px;
  color: var(--muted);
}

.wm-crumb a {
  color: var(--muted);
  text-decoration: none;
}

.wm-crumb a:hover {
  color: var(--accent);
}

.wm-crumb .container {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.wm-single,
.wm-article {
  padding-top: 34px;
}

.wm-single__grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 56px;
  align-items: start;
}

.wm-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.wm-gallery__item {
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-2);
  aspect-ratio: 1 / 1;
}

.wm-gallery__item.is-main {
  grid-column: 1 / -1;
  aspect-ratio: 4 / 3;
}

.wm-gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wm-gallery__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
}

.wm-single__info h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(30px, 3.6vw, 44px);
  line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--ink);
}

.wm-single__info .lead {
  margin: 16px 0 0;
}

.wm-spec {
  width: 100%;
  margin: 26px 0 0;
  border-collapse: collapse;
  font-size: 14px;
}

.wm-spec th,
.wm-spec td {
  padding: 11px 0;
  border-bottom: 1px solid var(--line-2);
  text-align: left;
  vertical-align: top;
}

.wm-spec th {
  color: var(--muted);
  font-weight: 500;
  width: 46%;
}

.wm-spec td {
  color: var(--ink);
  font-weight: 600;
}

.wm-single__acts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.wm-single__note {
  margin: 16px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
}

.wm-sec-alt {
  background: var(--bg-2);
}

.wm-body__inner {
  max-width: 780px;
  margin-top: 28px;
}

.wm-body__inner h2,
.wm-body__inner h3 {
  font-family: var(--font-display);
  color: var(--ink);
  letter-spacing: -.01em;
}

.wm-body__inner p,
.wm-body__inner li {
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--text);
}

.wm-body__inner img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

/* ---------- 文章详情 ---------- */

.wm-article__inner {
  max-width: 780px;
}

.wm-article__head h1 {
  margin: 14px 0 0;
  font-family: var(--font-display);
  font-size: clamp(30px, 3.6vw, 46px);
  line-height: 1.12;
  letter-spacing: -.02em;
  color: var(--ink);
}

.wm-article__cover {
  margin: 32px 0 0;
  border-radius: 14px;
  overflow: hidden;
}

.wm-article__cover img {
  width: 100%;
  height: auto;
  display: block;
}

.wm-article__body {
  margin-top: 32px;
}

.wm-article__body h2 {
  margin: 40px 0 12px;
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--ink);
}

.wm-article__body h3 {
  margin: 30px 0 10px;
  font-family: var(--font-display);
  font-size: 21px;
  color: var(--ink);
}

.wm-article__body p,
.wm-article__body li {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text);
}

.wm-article__body img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.wm-article__body blockquote {
  margin: 26px 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.wm-article__body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

.wm-article__body th,
.wm-article__body td {
  padding: 10px 12px;
  border: 1px solid var(--line);
  text-align: left;
}

.wm-article__foot {
  margin-top: 44px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.wm-article__foot p {
  color: var(--muted);
  font-size: 14.5px;
}

.wm-postnav__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.wm-postnav__item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color .2s ease;
}

.wm-postnav__item:hover {
  border-color: var(--accent);
}

.wm-postnav__item span {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.wm-postnav__item strong {
  font-size: 15px;
  color: var(--ink);
  line-height: 1.4;
}

.wm-postnav__item--next {
  text-align: right;
  align-items: flex-end;
}

/* ---------- 分页 / 空状态 ---------- */

.wm-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 48px;
}

.wm-pager a,
.wm-pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
}

.wm-pager .current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.wm-empty {
  padding: 60px 0;
  max-width: 560px;
}

.wm-empty h2 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  color: var(--ink);
}

.wm-empty p {
  color: var(--text);
  margin: 0 0 22px;
}

/* ---------- 404 ---------- */

.wm-404 {
  padding: calc(var(--header-h) + 60px) 0 100px;
}

.wm-404__no {
  font-family: var(--font-display);
  font-size: clamp(90px, 16vw, 180px);
  line-height: .9;
  font-weight: 800;
  color: var(--accent);
  margin: 0;
}

.wm-404 h1 {
  margin: 12px 0 0;
  font-family: var(--font-display);
  font-size: clamp(26px, 3.4vw, 38px);
  color: var(--ink);
}

.wm-404 p {
  margin: 14px 0 0;
  max-width: 520px;
  color: var(--text);
  line-height: 1.7;
}

.wm-404__acts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.wm-404__cats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 36px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

/* ============================================================
   响应式
   ============================================================ */

@media (max-width: 1024px) {
  .wm-prods,
  .wm-posts,
  .wm-posts--list {
    grid-template-columns: repeat(2, 1fr);
  }

  .wm-single__grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

@media (max-width: 760px) {
  .wm-prods,
  .wm-posts,
  .wm-posts--list {
    grid-template-columns: 1fr;
  }

  .wm-gallery {
    grid-template-columns: 1fr;
  }

  .wm-gallery__item.is-main {
    aspect-ratio: 4 / 3;
  }

  .wm-postnav__row {
    grid-template-columns: 1fr;
  }

  .wm-postnav__item--next {
    text-align: left;
    align-items: flex-start;
  }

  .wm-404 {
    padding: 56px 0 64px;
  }
}

/* ================================================================
   静态内页迁移到 WordPress 后的窄屏修正
   ================================================================ */

/*
 * support 页的流程条写成了 <div class="steps" style="grid-template-columns:repeat(4,1fr)">，
 * 行内样式的优先级高于媒体查询，所以主样式表里 `.steps { grid-template-columns: 1fr }`
 * 在 900px 以下根本盖不住它 —— 390px 下四列各约 120px，整条被撑到 464px，右侧内容被裁掉。
 * 这里用 !important 把窄屏改回单列（!important 可以压过普通行内声明，反过来不行）。
 * 桌面端不动，仍是 4 列。
 */
@media (max-width: 900px) {
  .steps[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
}

/* ================================================================
   产品分类「预留态」
   ----------------------------------------------------------------
   分类先建好、URL 先占位，产品后补。空分类页不写「暂无产品」，
   而是变成一张「按图纸报价」的落地页：能力区间 + 两个出口。
   有产品之后这段自动消失，页面回到正常的商品网格。
   ================================================================ */

.wm-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: clamp(28px, 3.4vw, 44px) 0 clamp(24px, 2.8vw, 34px);
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.wm-facts > div {
  background: var(--surface);
  padding: 22px clamp(16px, 1.8vw, 26px);
}

.wm-facts b {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(17px, 1.8vw, 26px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -.01em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.wm-facts b i {
  font-style: normal;
  font-size: .56em;
  margin-left: 4px;
  vertical-align: .14em;
  color: var(--muted);
}

.wm-facts span {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

.wm-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.wm-also {
  margin-top: clamp(34px, 4vw, 52px);
  padding-top: clamp(22px, 2.4vw, 30px);
  border-top: 1px solid var(--line-2);
}

.wm-also__label {
  margin: 0 0 14px;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

@media (min-width: 900px) {
  .wm-facts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* 窄屏两个按钮宽度不一致会显得散，撑满更整齐 */
@media (max-width: 600px) {
  .wm-acts .btn {
    flex: 1 1 100%;
    justify-content: center;
  }
}
