/*
Theme Name: MNW Factory Directory
Theme URI: https://example.com/
Author: MNW
Description: 工厂名录门户主题，支持一二级分类，无 Banner 轮播。
Version: 1.0.0
License: GNU General Public License v2 or later
Text Domain: mnw-factory-theme
*/

:root {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --text: #1a2332;
  --muted: #5c6b7a;
  --line: #dde3ea;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --nav-bg: #1e293b;
  --nav-text: #e2e8f0;
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  --radius: 10px;
  --container: 1200px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

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

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

.container {
  width: min(var(--container), calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar {
  background: var(--nav-bg);
  color: var(--nav-text);
  font-size: 13px;
}

.topbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  gap: 16px;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0;
  flex-wrap: wrap;
}

.site-branding h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

.site-branding h1 a { color: var(--nav-bg); }
.site-branding h1 a:hover { color: var(--brand); }

.site-branding p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.site-search form {
  display: flex;
  gap: 8px;
}

.site-search input[type="search"] {
  width: min(280px, 60vw);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
}

.site-search button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

.site-search button:hover,
.btn:hover {
  background: var(--brand-dark);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--brand);
  color: var(--brand);
}

.btn-outline:hover {
  background: var(--brand);
  color: #fff;
}

.main-nav {
  background: var(--nav-bg);
}

.main-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.nav-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-menu > li {
  position: relative;
}

.nav-menu > li > a {
  display: block;
  padding: 14px 18px;
  color: var(--nav-text);
  font-size: 15px;
  font-weight: 500;
}

.nav-menu > li > a:hover,
.nav-menu > li.current-menu-item > a,
.nav-menu > li.current-menu-ancestor > a {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-menu .sub-menu {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 180px;
  margin: 0;
  padding: 8px 0;
  list-style: none;
  background: #334155;
  box-shadow: var(--shadow);
  border-radius: 0 0 var(--radius) var(--radius);
  z-index: 50;
}

.nav-menu li:hover > .sub-menu,
.nav-menu li:focus-within > .sub-menu {
  display: block;
}

.nav-menu .sub-menu a {
  display: block;
  padding: 10px 16px;
  color: #e2e8f0;
  font-size: 14px;
  white-space: nowrap;
}

.nav-menu .sub-menu a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.content-area {
  padding: 28px 0 48px;
}

.layout-full .main-column {
  width: 100%;
}

.layout-with-sidebar {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 28px;
  align-items: start;
}

.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb span.sep { margin: 0 8px; opacity: 0.5; }

.page-title {
  margin: 0 0 8px;
  font-size: 28px;
  color: var(--nav-bg);
}

.page-desc {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 15px;
}

.section-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--brand);
}

.section-header h2 {
  margin: 0;
  font-size: 20px;
  color: var(--nav-bg);
}

.section-header h2 a { color: inherit; }
.section-header h2 a:hover { color: var(--brand); }

.cat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.cat-tabs a {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
}

.cat-tabs a:hover,
.cat-tabs a.is-active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.factory-title-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.factory-title-list__item {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  line-height: 1.5;
}

.factory-title-list__item:first-child {
  padding-top: 0;
}

.factory-title-list__item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.factory-title-list__item a {
  color: var(--text);
  font-size: 15px;
}

.factory-title-list__item a:hover {
  color: var(--brand);
}

.mnw-factory-infinite .infinite-status {
  margin: 16px 0 0;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  min-height: 1.4em;
}

.infinite-sentinel {
  height: 1px;
  width: 100%;
}

.factory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.factory-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.factory-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow);
}

.factory-card__thumb {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
}

.factory-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.factory-card__body {
  padding: 16px;
}

.factory-card__title {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.4;
}

.factory-card__title a {
  color: var(--text);
}

.factory-card__title a:hover {
  color: var(--brand);
}

.factory-card__meta {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.factory-card__excerpt {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.factory-card__cats {
  margin-top: 10px;
  font-size: 12px;
}

.factory-card__cats a {
  color: var(--brand);
  margin-right: 8px;
}

.pagination {
  margin-top: 28px;
  text-align: center;
}

.pagination .nav-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.pagination a,
.pagination span {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
}

.pagination .current {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.single-factory .entry-header {
  margin-bottom: 24px;
}

.single-factory .entry-title {
  margin: 0 0 12px;
  font-size: 30px;
  color: var(--nav-bg);
}

.entry-cats {
  font-size: 14px;
  color: var(--muted);
}

.entry-cats a { margin-right: 10px; }

.meta-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 15px;
}

.meta-table th,
.meta-table td {
  padding: 12px 16px;
  border: 1px solid var(--line);
  text-align: left;
}

.meta-table th {
  width: 120px;
  background: var(--bg);
  color: var(--muted);
  font-weight: 500;
}

.entry-content {
  font-size: 16px;
  line-height: 1.75;
}

.entry-content p { margin: 0 0 1em; }

.widget {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.widget-title {
  margin: 0 0 14px;
  font-size: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--brand);
  color: var(--nav-bg);
}

.widget ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.widget li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.widget li:last-child { border-bottom: none; }

.widget li a { color: var(--text); }

.cat-tree li.child {
  padding-left: 14px;
  font-size: 13px;
}

.site-footer {
  background: var(--nav-bg);
  color: #94a3b8;
  padding: 18px 0 12px;
  margin-top: 32px;
  font-size: 14px;
  line-height: 1.4;
}

.site-footer a { color: #cbd5e1; }

.site-footer a:hover { color: #fff; }

.footer-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px 28px;
  align-items: start;
}

.footer-brand {
  display: block;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  color: #e2e8f0;
  margin-bottom: 4px;
}

.footer-tagline {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.4;
  color: #94a3b8;
}

.footer-contact {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
  line-height: 1.4;
}

.footer-contact li {
  margin: 2px 0;
}

.footer-label {
  display: inline-block;
  min-width: 3em;
  margin-right: 8px;
  color: #64748b;
}

.footer-heading {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.4;
  color: #e2e8f0;
  font-weight: 600;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  line-height: 1.4;
}

.footer-bottom {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  font-size: 13px;
  line-height: 1.4;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}

.footer-copyright,
.footer-icp {
  margin: 0;
}

@media (max-width: 768px) {
  .footer-inner {
    grid-template-columns: 1fr;
  }
}

.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

@media (max-width: 992px) {
  .factory-grid { grid-template-columns: repeat(2, 1fr); }
  .layout-with-sidebar { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .nav-toggle { display: inline-block; }

  .nav-menu-wrap {
    display: none;
    width: 100%;
  }

  .nav-menu-wrap.is-open {
    display: block;
  }

  .main-nav .container {
    flex-wrap: wrap;
    padding: 8px 0;
  }

  .nav-menu {
    flex-direction: column;
    width: 100%;
  }

  .nav-menu .sub-menu {
    position: static;
    display: block;
    background: #0f172a;
    box-shadow: none;
    padding-left: 16px;
  }

  .factory-grid { grid-template-columns: 1fr; }
}
