/* =========================================================
   现代五金产品手册 — 现代五金产品技术手册
   响应式浅色主题 / Responsive light theme
   ========================================================= */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --ink: #1f2a37;
  --ink-soft: #5b6878;
  --line: #d9e1ec;
  --brand: #1b5e9c;
  --brand-dark: #134b7e;
  --accent: #e8743b;
  --ok: #2e8b57;
  --shadow: 0 2px 10px rgba(20,40,70,0.08);
  --radius: 12px;
  --maxw: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans", "Microsoft YaHei", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  font-size: 15px;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px; flex-wrap: wrap;
}
.brand {
  font-weight: 700; font-size: 18px; letter-spacing: .3px;
  display: flex; align-items: center; gap: 8px; color:#fff;
}
.brand .logo {
  width: 30px; height: 30px; border-radius: 7px;
  background: #fff; color: var(--brand);
  display: grid; place-items: center; font-weight: 800;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 8px; font-weight: 600; font-size: 13.5px;
  border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12); color: #fff;
  cursor: pointer; transition: .15s;
}
.btn:hover { background: rgba(255,255,255,.24); text-decoration: none; color:#fff; }
.btn.primary { background: var(--accent); border-color: var(--accent); }
.btn.primary:hover { background: #d3652e; }

.lang-select {
  position: relative;
}
.lang-select select {
  appearance: none; -webkit-appearance: none;
  padding: 7px 30px 7px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 600;
  border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12); color: #fff;
  cursor: pointer;
}
.lang-select::after {
  content: "▾"; position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
  color: #fff; pointer-events: none; font-size: 11px;
}
.lang-select select option { color: #1f2a37; }

/* ---------- Nav ---------- */
.nav {
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 52px; z-index: 90;
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 18px;
  display: flex; gap: 4px; flex-wrap: wrap;
}
.nav a {
  padding: 12px 14px; color: var(--ink-soft); font-weight: 600; font-size: 14px;
  border-bottom: 3px solid transparent;
}
.nav a:hover { color: var(--brand); text-decoration: none; background: var(--surface-2); }
.nav a.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------- Layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 26px 18px 60px; }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 26px; margin: 0 0 6px; }
.page-head p { color: var(--ink-soft); margin: 0; max-width: 880px; }

.breadcrumb { font-size: 13px; color: var(--ink-soft); margin-bottom: 14px; }
.breadcrumb a { color: var(--ink-soft); }
.breadcrumb span { margin: 0 6px; }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 620px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column;
}
.card .card-body { padding: 16px 18px; flex: 1; }
.card h3 { margin: 0 0 4px; font-size: 17px; }
.card .sub { color: var(--ink-soft); font-size: 13.5px; margin: 0 0 10px; }
.card .tag {
  display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .4px;
  background: var(--surface-2); color: var(--brand-dark); padding: 3px 8px; border-radius: 6px;
  border: 1px solid var(--line); margin: 0 6px 6px 0;
}
.cat-card { text-decoration: none; color: inherit; transition: .15s; }
.cat-card:hover { transform: translateY(-3px); text-decoration: none; box-shadow: 0 8px 22px rgba(20,40,70,.14); }
.cat-icon {
  height: 110px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--surface-2), #dfeaf6);
}
.cat-icon svg { width: 64px; height: 64px; }

/* ---------- Product detail ---------- */
.product {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 26px; overflow: hidden;
}
.product-head {
  display: flex; align-items: center; gap: 16px; padding: 16px 20px;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.product-head .ph-illu { width: 70px; height: 70px; flex: none; background:#fff; border:1px solid var(--line); border-radius:10px; display:grid; place-items:center; }
.head-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.product-head h2 { margin: 0; font-size: 20px; }
.product-head .std { color: var(--ink-soft); font-size: 13.5px; }
.product-body { padding: 18px 20px; display: grid; gap: 18px; grid-template-columns: 280px 1fr; }
@media (max-width: 760px) { .product-body { grid-template-columns: 1fr; } }
.illu-box {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; text-align: center;
}
.illu-box .cap { font-size: 12px; color: var(--ink-soft); margin-top: 8px; }
.product-text p { margin: 0 0 12px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table.spec {
  border-collapse: collapse; width: 100%; font-size: 13.5px; background: var(--surface);
}
table.spec th, table.spec td { border: 1px solid var(--line); padding: 8px 11px; text-align: left; white-space: nowrap; }
table.spec thead th { background: var(--brand); color: #fff; font-weight: 700; position: sticky; top: 0; }
table.spec tbody tr:nth-child(even) { background: var(--surface-2); }
table.spec td.num { text-align: right; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--ink-soft); font-weight: 600; }
.kv dd { margin: 0; }

/* ---------- Chart ---------- */
.chart-box {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 22px;
}
.chart-box h3 { margin: 0 0 4px; font-size: 17px; }
.chart-box .note { color: var(--ink-soft); font-size: 13px; margin: 0 0 12px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin: 7px 0; font-size: 13px; }
.bar-row .bar-label { width: 130px; flex: none; color: var(--ink-soft); }
.bar-track { flex: 1; background: var(--surface-2); border-radius: 5px; overflow: hidden; height: 22px; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--brand), #3a8ad0); border-radius: 5px; }
.bar-row .bar-val { width: 80px; flex: none; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- Callout / note ---------- */
.note-box {
  background: #fff8ef; border: 1px solid #f3d9b8; border-left: 4px solid var(--accent);
  border-radius: 8px; padding: 12px 16px; font-size: 13.5px; color: #7a4a1c; margin: 14px 0;
}
.std-box {
  background: #eef6ff; border: 1px solid #cfe2f7; border-left: 4px solid var(--brand);
  border-radius: 8px; padding: 12px 16px; font-size: 13.5px; margin: 14px 0;
}

/* ---------- Footer ---------- */
footer.site {
  background: var(--brand-dark); color: #cfe0f0; padding: 26px 18px; font-size: 13.5px;
}
footer.site .inner { max-width: var(--maxw); margin: 0 auto; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
footer.site a { color: #fff; }
footer.site h4 { color: #fff; margin: 0 0 8px; font-size: 14px; }

/* ---------- Search ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.search-input {
  flex: 1; min-width: 220px; padding: 10px 14px; border: 1px solid var(--line);
  border-radius: 9px; font-size: 14px; background: var(--surface);
}
.filter-chip {
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface);
  font-size: 13px; cursor: pointer; font-weight: 600; color: var(--ink-soft);
}
.filter-chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.section-title { font-size: 20px; margin: 30px 0 14px; display:flex; align-items:center; gap:10px; }
.section-title .bar { width: 5px; height: 22px; background: var(--accent); border-radius: 3px; display:inline-block; }

.hidden { display: none !important; }

/* =========================================================
   Dark theme (data-theme="dark" on <html>)
   ========================================================= */
[data-theme="dark"] {
  --bg: #10151d;
  --surface: #1a2230;
  --surface-2: #232e3f;
  --ink: #e8eef5;
  --ink-soft: #9fb0c4;
  --line: #33415a;
  --brand: #5ea2e0;
  --brand-dark: #2b6cae;
  --accent: #f0884f;
  --ok: #4cae7c;
  --shadow: 0 2px 10px rgba(0,0,0,0.35);
}
[data-theme="dark"] .topbar { background: linear-gradient(180deg, #153a63 0%, #0e2c4e 100%); }
[data-theme="dark"] .brand .logo { color: #1b5e9c; }
[data-theme="dark"] .btn:hover { background: rgba(255,255,255,.2); }
[data-theme="dark"] .cat-icon { background: linear-gradient(135deg, var(--surface-2), #1c2a3d); }
[data-theme="dark"] .product-head .ph-illu { background: var(--surface); }
[data-theme="dark"] .illu-box svg, [data-theme="dark"] .cat-icon svg,
[data-theme="dark"] .product-head .ph-illu svg, [data-theme="dark"] .gal-tile svg,
[data-theme="dark"] .gallery svg { filter: invert(0.86) hue-rotate(180deg); }
[data-theme="dark"] .note-box { background: #2a2118; border-color: #6b4f2a; color: #e8c99a; }
[data-theme="dark"] .std-box { background: #16263a; border-color: #27496e; color: #cfe2f7; }
[data-theme="dark"] table.spec tbody tr:nth-child(even) { background: #1c2637; }
[data-theme="dark"] footer.site { background: #0b2038; }
[data-theme="dark"] .lang-select select option { color: #1f2a37; }

/* ---------- Back to top ---------- */
#toTop {
  position: fixed; right: 22px; bottom: 26px; z-index: 200;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--brand);
  font-size: 18px; font-weight: 700; cursor: pointer;
  box-shadow: var(--shadow); display: none; place-items: center;
}
#toTop.show { display: grid; }
#toTop:hover { background: var(--surface-2); }

/* ---------- Theme toggle ---------- */
.theme-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 34px; border-radius: 8px; font-size: 15px;
  border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12); color: #fff;
  cursor: pointer;
}
.theme-btn:hover { background: rgba(255,255,255,.24); }

/* ---------- Compare bar ---------- */
.compare-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 150;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.18); padding: 10px 16px;
  display: none; align-items: center; gap: 12px; font-size: 13.5px; max-width: 92vw;
}
.compare-bar.show { display: flex; }
.compare-bar .cb-count { color: var(--ink-soft); }
.compare-pick {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-2); cursor: pointer;
}
.compare-pick:checked { accent-color: var(--brand); }
.overlay {
  position: fixed; inset: 0; background: rgba(10,18,30,.55); z-index: 180;
  display: grid; place-items: center; padding: 20px; overflow: auto;
}
.overlay-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  max-width: 1060px; width: 100%; padding: 20px 22px; box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
.overlay-panel .ov-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.overlay-panel .ov-head h3 { margin: 0; font-size: 18px; }
.ov-close {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 13px;
}
table.compare { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.compare th, table.compare td { border: 1px solid var(--line); padding: 8px 10px; vertical-align: top; }
table.compare thead th { background: var(--brand); color: #fff; }
table.compare td.rowname { width: 130px; font-weight: 600; color: var(--ink-soft); background: var(--surface-2); }
table.compare td.cell { min-width: 200px; }
table.compare td.cell .cmp-illu { text-align: center; background: var(--surface-2); border-radius: 8px; padding: 6px; margin-bottom: 8px; }
table.compare td.cell .cmp-illu svg { width: 56px; height: 56px; }

/* ---------- Calculator ---------- */
.calc-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
@media (max-width: 900px) { .calc-grid { grid-template-columns: 1fr; } }
.calc {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px;
}
.calc h3 { margin: 0 0 4px; font-size: 17px; }
.calc .calc-note { color: var(--ink-soft); font-size: 12.5px; margin: 0 0 12px; }
.calc label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin: 10px 0 4px; }
.calc input, .calc select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; background: var(--surface); color: var(--ink);
}
.calc .btn-calc {
  margin-top: 14px; padding: 9px 18px; border: none; border-radius: 8px;
  background: var(--brand); color: #fff; font-weight: 700; cursor: pointer; font-size: 14px;
}
.calc .btn-calc:hover { background: var(--brand-dark); }
.calc .result {
  margin-top: 12px; padding: 12px 14px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 14.5px; min-height: 44px; font-variant-numeric: tabular-nums;
}
.calc .result b { color: var(--brand); font-size: 17px; }

/* ---------- Gallery ---------- */
.gal-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.gal-tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; text-align: center; cursor: zoom-in; transition: .15s;
}
.gal-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.gal-tile svg { width: 74px; height: 74px; }
.gal-tile .gal-name { font-size: 11.5px; color: var(--ink-soft); margin-top: 6px; word-break: break-all; }
.gallery.lightbox { position: fixed; inset: 0; background: rgba(10,18,30,.72); z-index: 190; display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.gallery.lightbox .lb-box { background: var(--surface); border-radius: 14px; padding: 26px; max-width: 460px; width: 100%; text-align: center; }
.gallery.lightbox svg { width: 240px; height: 240px; }

/* ---------- Print (single product A4) ---------- */
@media print {
  body * { visibility: hidden; }
  #printArea, #printArea * { visibility: visible; }
  #printArea { position: absolute; left: 0; top: 0; width: 100%; }
  .no-print { display: none !important; }
  .print-block { border: 1px solid #999; padding: 14px; page-break-inside: avoid; }
}
.print-block { border: 1px dashed var(--line); border-radius: 10px; padding: 14px; margin: 10px 0; }
.print-block h4 { margin: 0 0 8px; }

/* ---------- Misc ---------- */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.result-count { color: var(--ink-soft); font-size: 13px; margin-bottom: 12px; }
