/*
Theme Name: Zhongxin Data
Theme URI: https://producta.zhongxindata.hk
Author: Zhongxin Data
Description: 自建独立站主题。零第三方依赖，输出干净语义化 HTML 与内联结构化数据，面向 AI 搜索引擎（GEO）优化。商品使用自定义文章类型 zxd_product + 分类法 zxd_category。
Version: 1.0.0
Requires at least: 6.5
Tested up to: 6.9
Requires PHP: 8.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: zhongxin
Tags: e-commerce, blog, custom-menu, custom-logo, featured-images, translation-ready
*/

/* ==========================================================================
   Zhongxin Data — WordPress 主题样式
   与静态站版本保持一致；无外部字体/CDN 依赖
   ========================================================================== */

:root {
  --ink: #12161c;
  --ink-2: #444d59;
  --ink-3: #6b7580;
  --line: #e3e7ec;
  --line-2: #eef1f4;
  --bg: #ffffff;
  --bg-2: #f7f9fb;
  --brand: #0b5fff;
  --brand-ink: #06337f;
  --brand-wash: #eef4ff;
  --wa: #25d366;
  --ok: #1a7f37;
  --radius: 10px;
  --maxw: 1200px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--sans); font-size: 16px; line-height: 1.65;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 650; letter-spacing: -.011em; }
h1 { font-size: clamp(1.85rem, 1.2rem + 2.4vw, 2.9rem); }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); margin-top: 1.4em; }
h3 { font-size: 1.2rem; margin-top: 1.3em; }
p { margin: 0 0 1.05em; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 780px; margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: #fff; padding: 10px 14px; border-radius: 8px; z-index: 100; border: 2px solid var(--brand); }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.94); backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 28px; height: 66px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.06rem; color: var(--ink); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; flex: 0 0 auto; background: linear-gradient(135deg, #0b5fff, #06337f); display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 700; }
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--ink-3); letter-spacing: .02em; }
.nav { display: flex; align-items: center; gap: 22px; margin-left: auto; flex-wrap: wrap; }
.nav a { color: var(--ink-2); font-size: .93rem; font-weight: 500; }
.nav a:hover { color: var(--ink); text-decoration: none; }
.cta-wa { display: inline-flex; align-items: center; gap: 7px; background: var(--wa); color: #06311a; font-weight: 600; font-size: .9rem; padding: 9px 15px; border-radius: 8px; white-space: nowrap; }
.cta-wa:hover { text-decoration: none; filter: brightness(.96); }
.cta-wa svg { width: 16px; height: 16px; fill: currentColor; }
@media (max-width: 900px) { .nav { display: none; } .header-inner { gap: 12px; } }

/* Hero */
.hero { padding: 76px 0 64px; border-bottom: 1px solid var(--line-2); background: var(--bg-2); }
.hero h1 { max-width: 17ch; }
.hero .lede { font-size: 1.13rem; color: var(--ink-2); max-width: 60ch; margin-bottom: 1.8em; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: 9px; font-weight: 600; font-size: .96rem; border: 1px solid transparent; cursor: pointer; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); color: #fff; }
.btn-ghost { border-color: var(--line); color: var(--ink); background: #fff; }
.btn-ghost:hover { border-color: var(--ink-3); }
.btn-wa { background: var(--wa); color: #06311a; }
.btn-wa:hover { background: #1eb856; color: #06311a; }
.btn-wa svg { width: 16px; height: 16px; fill: currentColor; }
.eyebrow { display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--brand-ink); background: var(--brand-wash); padding: 5px 11px; border-radius: 100px; margin-bottom: 18px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 48px; }
.stat { background: #fff; padding: 20px 22px; }
.stat-value { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.stat-label { font-size: .84rem; color: var(--ink-3); margin-top: 2px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* Sections */
.section { padding: 64px 0; }
.section-alt { background: var(--bg-2); border-block: 1px solid var(--line-2); }
.section-head { margin-bottom: 34px; max-width: 66ch; }
.section-head p { color: var(--ink-2); font-size: 1.03rem; margin-bottom: 0; }

/* Cards */
.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1000px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 8px; }
.card:hover { border-color: #c9d1da; }
.card h3 { margin: 0; font-size: 1.06rem; }
.card p { margin: 0; color: var(--ink-2); font-size: .93rem; }
.card-meta { margin-top: auto; padding-top: 10px; font-size: .84rem; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.card-link { color: var(--brand-ink); font-weight: 600; font-size: .9rem; }

/* Product cards */
.p-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s; }
.p-card:hover { border-color: #c9d1da; }
.p-thumb { aspect-ratio: 4/3; background: var(--bg-2); display: grid; place-items: center; border-bottom: 1px solid var(--line-2); overflow: hidden; }
.p-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 14px; }
.p-thumb-empty { color: var(--ink-3); font-size: .8rem; text-align: center; padding: 20px; }
.p-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.p-type { font-size: .74rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--brand-ink); }
.p-title { font-size: .95rem; font-weight: 600; line-height: 1.4; margin: 0; }
.p-title a { color: var(--ink); }
.p-title a:hover { color: var(--brand-ink); }
.p-foot { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.p-ask { font-size: .87rem; font-weight: 600; color: var(--wa); }
.badge-used { display: inline-block; font-size: .7rem; font-weight: 600; letter-spacing: .04em; color: #0b5a2b; background: #e6f6ec; padding: 2px 7px; border-radius: 4px; }
.badge-stock { display: inline-flex; align-items: center; gap: 5px; font-size: .76rem; font-weight: 600; color: var(--ok); }
.badge-stock::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

/* Breadcrumb */
.crumbs { padding: 16px 0; font-size: .84rem; color: var(--ink-3); border-bottom: 1px solid var(--line-2); }
.crumbs a { color: var(--ink-3); }
.crumbs span { margin: 0 7px; opacity: .55; }

/* Product detail */
.pd { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; padding: 44px 0 64px; align-items: start; }
@media (max-width: 900px) { .pd { grid-template-columns: 1fr; gap: 30px; } }
.pd-gallery { position: sticky; top: 90px; }
.pd-main { aspect-ratio: 4/3; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); display: grid; place-items: center; overflow: hidden; }
.pd-main img { width: 100%; height: 100%; object-fit: contain; padding: 22px; }
.pd-thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.pd-thumb { width: 72px; height: 72px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.pd-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.pd-info h1 { font-size: clamp(1.45rem, 1.1rem + 1.4vw, 2.05rem); margin-bottom: 12px; }
.pd-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.pd-desc { color: var(--ink-2); font-size: 1rem; }
.pd-block { margin: 26px 0; padding: 22px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius); }
.pd-block h3 { margin-top: 0; font-size: 1rem; }
.pd-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.spec-table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.spec-table th, .spec-table td { text-align: left; padding: 9px 0; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.spec-table th { width: 40%; color: var(--ink-3); font-weight: 500; }
.spec-table tr:last-child th, .spec-table tr:last-child td { border-bottom: 0; }
.ref-note { font-size: .88rem; color: var(--ink-3); background: var(--bg-2); padding: 12px 15px; border-radius: 8px; border-left: 3px solid var(--line); margin-top: 16px; }
.ref-note code { font-family: var(--mono); font-size: .85em; background: #fff; padding: 2px 6px; border-radius: 4px; border: 1px solid var(--line); }

/* Article */
.article { padding: 44px 0 70px; }
.article-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: .87rem; color: var(--ink-3); margin-bottom: 26px; padding-bottom: 20px; border-bottom: 1px solid var(--line-2); }
.article-body h2 { margin-top: 2em; }
.article-body h3 { margin-top: 1.6em; }
.article-body table { width: 100%; border-collapse: collapse; margin: 1.6em 0; font-size: .93rem; }
.article-body th, .article-body td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; vertical-align: top; }
.article-body th { background: var(--bg-2); font-weight: 600; }
.article-body blockquote { margin: 1.6em 0; padding: 14px 20px; border-left: 3px solid var(--brand); background: var(--brand-wash); border-radius: 0 8px 8px 0; color: var(--ink-2); }
.article-body blockquote p:last-child { margin-bottom: 0; }
.article-body ul, .article-body ol { margin: 0 0 1.05em; padding-left: 1.4em; }
.article-body li { margin-bottom: .45em; }
.article-body code { font-family: var(--mono); font-size: .88em; background: var(--bg-2); padding: 2px 6px; border-radius: 4px; }
.article-body pre { background: var(--ink); color: #e6edf3; padding: 16px; border-radius: 8px; overflow-x: auto; font-size: .87rem; line-height: 1.55; }
.article-body pre code { background: none; padding: 0; color: inherit; }

/* Pagination */
.pagination { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 40px; }
.pagination .page-numbers { display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; font-size: .92rem; }
.pagination .page-numbers.current { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination .page-numbers.dots { border-color: transparent; }

/* CTA band */
.cta-band { background: var(--ink); color: #fff; padding: 52px 0; }
.cta-band h2 { color: #fff; margin-top: 0; }
.cta-band p { color: #b9c3cf; max-width: 60ch; }

/* Footer */
.site-footer { background: var(--bg-2); border-top: 1px solid var(--line); padding: 46px 0 30px; font-size: .91rem; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 36px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; gap: 26px; } }
.footer-col h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 12px; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 7px; }
.footer-col a { color: var(--ink-2); }
.footer-bottom { margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: .85rem; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* WordPress 核心类覆盖 */
.alignwide { max-width: 1200px; }
.alignfull { max-width: none; }
.wp-caption { max-width: 100%; }
.wp-caption-text, .gallery-caption { font-size: .85rem; color: var(--ink-3); }
.sticky, .gallery-caption, .bypostauthor { }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.alignleft { float: left; margin-right: 1.5em; }
.alignright { float: right; margin-left: 1.5em; }
.wp-block-image img { border-radius: var(--radius); }
