/*
Theme Name: AllwinChina B2B
Theme URI: https://allwinchina.org/
Author: AllwinKey Team
Author URI: https://allwinkey.com/
Description: Lightweight B2B theme for allwinchina.org — China keyboard manufacturing supply chain insights. No jQuery, no webfonts, single CSS file, semantic HTML5.
Version: 1.0.1
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: allwinchina-b2b
*/

:root {
  --ink: #17212b;
  --ink-2: #33404d;
  --muted: #5c6b7a;
  --line: #e3e8ee;
  --paper: #ffffff;
  --bg: #f5f7f9;
  --accent: #e8590c;
  --accent-dark: #c44e07;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; margin: 1.6em 0 0.6em; font-weight: 700; }
h1 { font-size: 2rem; letter-spacing: -0.02em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 780px; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: #fff; padding: 8px 16px; z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- Header ---------- */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 60px; gap: 16px;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand a { color: var(--ink); font-weight: 800; font-size: 1.15rem; letter-spacing: -0.01em; }
.brand a:hover { text-decoration: none; color: var(--accent-dark); }
.brand .tag { font-size: 0.72rem; color: var(--muted); font-family: var(--mono); display: none; }
@media (min-width: 760px) { .brand .tag { display: inline; } }

.nav-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 12px; font-size: 0.85rem; color: var(--ink-2); cursor: pointer;
}
.nav-toggle .bar { display: block; width: 16px; height: 2px; background: var(--ink-2); position: relative; }
.nav-toggle .bar::before, .nav-toggle .bar::after {
  content: ""; position: absolute; left: 0; width: 16px; height: 2px; background: var(--ink-2);
}
.nav-toggle .bar::before { top: -5px; }
.nav-toggle .bar::after { top: 5px; }
@media (min-width: 860px) { .nav-toggle { display: none; } }

.primary-nav ul {
  list-style: none; margin: 0; padding: 0;
  display: none; flex-direction: column;
}
.primary-nav.open ul { display: flex; }
.primary-nav a {
  display: block; padding: 10px 14px; color: var(--ink-2);
  font-size: 0.95rem; font-weight: 500;
}
.primary-nav a:hover { color: var(--accent-dark); text-decoration: none; }
.primary-nav .current-menu-item > a { color: var(--accent-dark); }

@media (max-width: 859px) {
  .primary-nav {
    position: absolute; top: 61px; left: 0; right: 0;
    background: var(--paper); border-bottom: 1px solid var(--line);
  }
  .primary-nav ul { padding: 8px 20px 16px; }
}
@media (min-width: 860px) {
  .primary-nav ul { display: flex; flex-direction: row; }
  .primary-nav { position: static; }
}

/* ---------- Hero (front page) ---------- */
.hero {
  background: linear-gradient(180deg, #17212b 0%, #1f2c3a 100%);
  color: #eaf0f5; padding: 72px 0 64px;
}
.hero h1 {
  color: #fff; font-size: clamp(1.7rem, 4vw, 2.6rem);
  margin: 0 0 16px; max-width: 20ch;
}
.hero p.sub { font-size: 1.1rem; color: #b9c6d2; max-width: 60ch; margin: 0 0 28px; }
.hero .cta-row { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 12px 22px; border-radius: 6px;
  font-weight: 600; font-size: 0.95rem; border: 1px solid transparent;
}
.btn-solid { background: var(--accent); color: #fff; }
.btn-solid:hover { background: var(--accent-dark); text-decoration: none; color: #fff; }
.btn-ghost { border-color: #45566a; color: #d7e0e8; }
.btn-ghost:hover { border-color: var(--accent); color: #fff; text-decoration: none; }

/* ---------- Sections ---------- */
.section { padding: 56px 0; }
.section + .section { padding-top: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-head h2 { margin: 0; font-size: 1.5rem; }
.section-head .more { font-size: 0.9rem; white-space: nowrap; }

.card-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  padding: 22px; display: flex; flex-direction: column; gap: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.card:hover { border-color: #c9d4de; box-shadow: 0 4px 18px rgba(23,33,43,.06); }
.card .meta { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); display: flex; gap: 14px; }
.card .meta .cat { color: var(--accent-dark); text-transform: uppercase; letter-spacing: 0.04em; }
.card h3 { margin: 0; font-size: 1.08rem; }
.card h3 a { color: var(--ink); }
.card h3 a:hover { color: var(--accent-dark); text-decoration: none; }
.card p { margin: 0; font-size: 0.92rem; color: var(--ink-2); }

/* Topics */
.topic-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.topic {
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px 20px; display: block; color: var(--ink);
}
.topic:hover { border-color: var(--accent); text-decoration: none; }
.topic .count { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }
.topic .name { font-weight: 700; display: block; margin-top: 4px; }

/* CTA band */
.cta-band {
  background: #17212b; color: #dbe4ec; border-radius: 12px;
  padding: 40px; display: flex; flex-wrap: wrap; gap: 20px;
  align-items: center; justify-content: space-between;
}
.cta-band h2 { color: #fff; margin: 0; font-size: 1.35rem; }
.cta-band p { margin: 6px 0 0; color: #aebdca; font-size: 0.95rem; max-width: 56ch; }

/* ---------- Content (single/page) ---------- */
.site-main { padding: 48px 0 64px; }
.entry-header { margin-bottom: 28px; }
.entry-header h1 { margin-top: 0; }
.entry-meta { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 16px; }
.entry-meta .cat { color: var(--accent-dark); text-transform: uppercase; letter-spacing: .04em; }
.breadcrumbs { font-size: 0.8rem; color: var(--muted); margin-bottom: 18px; font-family: var(--mono); }

.entry-content { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 32px; }
@media (min-width: 760px) { .entry-content { padding: 44px 52px; } }
.entry-content > :first-child { margin-top: 0; }
.entry-content p { margin: 0 0 1.15em; }
.entry-content ul, .entry-content ol { margin: 0 0 1.15em; padding-left: 1.4em; }
.entry-content li { margin-bottom: 0.35em; }
.entry-content table { width: 100%; border-collapse: collapse; margin: 0 0 1.4em; font-size: 0.92rem; }
.entry-content th, .entry-content td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; vertical-align: top; }
.entry-content th { background: var(--bg); font-family: var(--mono); font-size: 0.8rem; }
.entry-content blockquote {
  margin: 0 0 1.4em; padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent); color: var(--ink-2);
}
.entry-content code { font-family: var(--mono); font-size: 0.88em; background: var(--bg); padding: 2px 6px; border-radius: 4px; }
.entry-content pre { background: #17212b; color: #dbe4ec; padding: 18px; border-radius: 8px; overflow-x: auto; }
.entry-content pre code { background: none; padding: 0; color: inherit; }
.entry-content img { border-radius: 8px; }
.entry-content .wp-caption, .entry-content figcaption { font-size: 0.82rem; color: var(--muted); }

/* CF7 */
.wpcf7 form p { margin-bottom: 1em; }
.wpcf7 input[type="text"], .wpcf7 input[type="email"], .wpcf7 textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px;
  font: inherit; background: #fff;
}
.wpcf7 input[type="submit"] {
  background: var(--accent); color: #fff; border: 0; border-radius: 6px;
  padding: 12px 26px; font-weight: 600; cursor: pointer;
}
.wpcf7 input[type="submit"]:hover { background: var(--accent-dark); }

/* Related */
.related { margin-top: 40px; }
.related h2 { font-size: 1.25rem; margin-bottom: 18px; }

/* Pagination */
.pagination { margin: 36px 0 0; display: flex; gap: 8px; flex-wrap: wrap; }
.pagination .page-numbers {
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--paper); color: var(--ink-2); font-size: 0.9rem;
}
.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Search form */
.search-form { display: flex; gap: 8px; margin: 0 0 24px; }
.search-form input[type="search"] {
  flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; font: inherit;
}
.search-form button {
  background: var(--ink); color: #fff; border: 0; border-radius: 6px;
  padding: 10px 20px; font-weight: 600; cursor: pointer;
}

/* ---------- Footer ---------- */
.site-footer {
  background: #101820; color: #93a3b3; margin-top: 0;
  padding: 44px 0 28px; font-size: 0.88rem;
}
.site-footer .cols { display: flex; flex-wrap: wrap; gap: 32px; justify-content: space-between; }
.site-footer .col { max-width: 420px; }
.site-footer h4 { color: #fff; margin: 0 0 12px; font-size: 0.95rem; }
.site-footer a { color: #c3cfda; }
.site-footer a:hover { color: #fff; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 18px; flex-wrap: wrap; }
.footer-line {
  border-top: 1px solid #22303e; margin-top: 32px; padding-top: 20px;
  font-family: var(--mono); font-size: 0.75rem; color: #5f7182;
  display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between;
}
