/* =========================================================================
 * style.css — Industrial Pump Selection Handbook
 * Responsive, light, professional engineering look. No build step.
 * ========================================================================= */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #1c2733;
  --ink-soft: #56646f;
  --line: #d9e0e6;
  --brand: #0b5fa5;
  --brand-dark: #084a80;
  --accent: #e8730c;
  --accent-soft: #fff3e8;
  --ok: #1f8a4c;
  --warn: #b8860b;
  --shadow: 0 1px 3px rgba(16, 32, 48, .08), 0 4px 16px rgba(16, 32, 48, .06);
  --radius: 10px;
  --maxw: 1120px;
  --topbar-h: 112px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    "Noto Sans", "Noto Sans CJK SC", "Microsoft YaHei", "Hiragino Sans", "Malgun Gothic", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---- Top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.topbar-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 18px; max-width: var(--maxw); margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.logo {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; font-weight: 800; letter-spacing: .5px;
  padding: 6px 9px; border-radius: 8px; font-size: 15px;
}
.brand-text strong { display: block; font-size: 15px; line-height: 1.2; }
.brand-text span { font-size: 12px; color: var(--ink-soft); }

.actions { display: flex; align-items: center; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 14px;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-outline { background: #fff; border-color: var(--brand); color: var(--brand); }
.btn-outline:hover { background: #eef5fb; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }

.lang-wrap { display: inline-flex; align-items: center; }
.lang-select {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); font-size: 14px; cursor: pointer;
}
.menu-toggle {
  display: none; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  font-size: 18px; line-height: 1; padding: 6px 10px; cursor: pointer; color: var(--ink);
}
.mainnav {
  display: flex; flex-wrap: wrap; gap: 4px; max-width: var(--maxw); margin: 0 auto;
  padding: 0 18px 10px;
}
.mainnav a {
  color: var(--ink-soft); padding: 7px 12px; border-radius: 8px; font-size: 14px; font-weight: 600;
}
.mainnav a:hover { background: #eef5fb; color: var(--brand); text-decoration: none; }
.mainnav a.active { background: var(--brand); color: #fff; }

/* ---- Layout ---- */
main.container {
  max-width: var(--maxw); margin: 0 auto; padding: 28px 18px 48px;
}
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 28px; margin: 0 0 6px; }
.page-head p.lead { color: var(--ink-soft); max-width: 760px; margin: 0; }

.section { margin: 26px 0; }
.section h2 { font-size: 20px; margin: 0 0 10px; border-left: 4px solid var(--brand); padding-left: 10px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.grid .card h3 { margin: 0 0 6px; font-size: 17px; }
.grid .card p { margin: 0; color: var(--ink-soft); }
.grid .card .more { margin-top: 12px; display: inline-block; font-weight: 600; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; min-width: 640px; }
th, td { text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: #eef3f7; color: var(--ink); font-size: 14px; position: sticky; top: var(--topbar-h); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: #fafcfd; }
td .range { color: var(--ink-soft); font-size: 14px; }

/* ---- Steps ---- */
.steps { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.step h3 { margin: 0 0 6px; font-size: 16px; color: var(--brand-dark); }
.step p { margin: 0; color: var(--ink-soft); }

/* ---- Calculators ---- */
.calc-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.calc {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.calc h3 { margin: 0 0 4px; font-size: 18px; }
.calc .note { color: var(--ink-soft); font-size: 13px; margin: 0 0 14px; }
.field { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.field label { flex: 1 1 55%; font-size: 14px; }
.field input {
  flex: 1 1 45%; width: 100%; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 15px; background: #fff; color: var(--ink);
}
.field .unit { color: var(--ink-soft); font-size: 13px; min-width: 52px; text-align: right; }
.calc .row { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.calc button.compute {
  background: var(--accent); color: #fff; border: 0; padding: 9px 16px; border-radius: 8px;
  font-weight: 700; cursor: pointer; font-size: 14px;
}
.calc button.compute:hover { background: #cf6509; }
.result {
  margin-top: 14px; padding: 12px 14px; background: var(--accent-soft);
  border: 1px solid #f3c69d; border-radius: 8px;
}
.result .big { font-size: 22px; font-weight: 800; color: var(--accent); }
.result .sub { color: var(--ink-soft); font-size: 13px; }
.formula {
  margin-top: 12px; padding: 10px 12px; background: #f3f6f9; border-radius: 8px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px; color: var(--ink-soft); word-break: break-word;
}

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--line); background: var(--surface);
  text-align: center; padding: 22px 18px; color: var(--ink-soft); font-size: 13px;
}
.site-footer .foot-brands { margin: 6px 0 0; }
.site-footer a { color: var(--brand); }

/* ---- Responsive ---- */
@media (max-width: 820px) {
  .brand-text span { display: none; }
  .menu-toggle { display: inline-block; }
  .mainnav { display: none; flex-direction: column; padding: 8px 18px 12px; }
  .mainnav.open { display: flex; }
  .mainnav a { padding: 10px 12px; }
  .btn-outline, .btn-primary { padding: 8px 10px; font-size: 13px; }
  .lang-select { padding: 7px 8px; }
  thead th { position: static; }
}
@media (max-width: 480px) {
  .actions .btn-outline span, .actions .btn-primary span { }
  .topbar-row { flex-wrap: wrap; }
}

/* ---- Toolbar (search + category filter) ---- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.search-input {
  flex: 1 1 260px; max-width: 360px; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; background: #fff; color: var(--ink);
}
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.chip-btn:hover { background: #eef5fb; color: var(--brand); }
.chip-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---- Recommendation page ---- */
.form-card { max-width: 560px; margin-bottom: 22px; }
.form-card h3 { margin: 0 0 16px; font-size: 18px; }
.form-row { display: flex; align-items: center; gap: 12px; margin: 14px 0; }
.form-row > label { flex: 0 0 130px; font-size: 14px; font-weight: 600; }
.form-row input[type="number"] {
  flex: 1 1 auto; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 15px; background: #fff; color: var(--ink); min-width: 0;
}
.form-row .unit { color: var(--ink-soft); font-size: 13px; min-width: 48px; }
.form-row-col { flex-direction: column; align-items: flex-start; }
.form-row-col > label { margin-bottom: 8px; }
.chk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 14px; width: 100%; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--brand); }
.form-card .btn-primary { margin-top: 18px; }

.reco-result { max-width: 760px; }
.reco-result h3 { font-size: 19px; margin: 0 0 12px; }
.reco-list { display: grid; gap: 14px; }
.reco-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.reco-head { display: flex; align-items: center; gap: 10px; font-size: 17px; margin-bottom: 10px; }
.reco-head .score { margin-left: auto; font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.badge {
  background: var(--ok); color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .3px;
}
.bar { height: 8px; background: #e9eef2; border-radius: 999px; overflow: hidden; margin-bottom: 10px; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); }
.reco-line { font-size: 14px; color: var(--ink); margin-top: 4px; }
.reco-line b { color: var(--ink-soft); font-weight: 600; }
.chip {
  display: inline-block; background: #eef5fb; color: var(--brand-dark);
  border: 1px solid #d3e3f2; border-radius: 999px; padding: 3px 10px; font-size: 12px;
  margin: 4px 6px 0 0;
}
.disclaimer {
  max-width: 760px; margin-top: 22px; padding: 12px 14px; background: #f3f6f9;
  border-left: 3px solid var(--warn); border-radius: 6px; color: var(--ink-soft); font-size: 13px;
}
.muted { color: var(--ink-soft); }

/* ---- Performance curves ---- */
.perf-result { max-width: 980px; }
.ns-box { margin: 6px 0 18px; }
.ns-badge {
  display: inline-block; background: #eef5fb; color: var(--brand-dark);
  border: 1px solid #d3e3f2; border-radius: 8px; padding: 8px 14px; font-weight: 600; font-size: 14px;
}
.charts { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); margin-top: 8px; }
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.chart-card h3 { margin: 0 0 10px; font-size: 16px; color: var(--brand-dark); }
.chart-card canvas { width: 100%; display: block; }

/* ---- PDF report (off-screen render target) ---- */
.report-offscreen {
  position: fixed; left: -99999px; top: 0; width: 760px;
  background: #fff; padding: 24px; box-sizing: border-box;
}
.report { font-family: -apple-system, "Segoe UI", Roboto, "Noto Sans", "Microsoft YaHei", Arial, sans-serif; color: #1c2733; font-size: 14px; line-height: 1.5; }
.report h2 { font-size: 22px; margin: 0 0 6px; }
.report h3 { font-size: 16px; margin: 18px 0 8px; border-left: 4px solid var(--brand); padding-left: 8px; }
.report .rmeta { color: #56646f; margin: 2px 0; }
.report .rtable { width: 100%; border-collapse: collapse; margin-top: 6px; }
.report .rtable th, .report .rtable td { border: 1px solid #d9e0e6; padding: 8px 10px; text-align: left; vertical-align: top; }
.report .rtable thead th { background: #eef3f7; }
.report .rchip { display: inline-block; background: #eef5fb; color: #084a80; border: 1px solid #d3e3f2; border-radius: 999px; padding: 2px 8px; font-size: 12px; margin: 2px 4px 0 0; }
.report .rbest { display: inline-block; background: var(--ok); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; margin-left: 6px; text-transform: uppercase; letter-spacing: .3px; }
.report .rdisc { margin-top: 14px; font-size: 12px; color: #56646f; border-left: 3px solid var(--warn); padding: 6px 10px; background: #f3f6f9; }
.report .rcanvas { width: 100%; max-width: 540px; height: 240px; display: block; background: #fff; border: 1px solid var(--line); border-radius: 8px; margin: 4px 0; }
.report .rnote { font-size: 12px; color: #56646f; margin: 6px 0 0; }

/* ---- Print optimisation ---- */
@media print {
  .topbar, .site-footer, .menu-toggle, .lang-wrap,
  .toolbar, .btn, .btn-primary, .btn-outline, .disclaimer { display: none !important; }
  .mainnav { display: none !important; }
  body { background: #fff; }
  .container { max-width: 100%; padding: 0; }
  .page-head { margin-top: 0; }
  .grid { display: block; }
  .card, .reco-card, .chart-card, tr, .report { break-inside: avoid; }
  thead { display: table-header-group; }
  h1, h2, h3 { break-after: avoid; }
  table { width: 100%; border-collapse: collapse; }
  a[href]::after { content: ""; }
  .reco-result, .perf-result { max-width: 100%; }
}

/* ---- Selection wizard (guide.html) ---- */
.wiz-progress { font-weight: 600; color: var(--brand-dark); margin-bottom: 14px; }
.step {
  display: none; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.step.active { display: block; }
.step h4 { margin: 14px 0 6px; font-size: 15px; color: var(--brand-dark); }
.wiz-nav { display: flex; gap: 12px; margin-top: 8px; }
.wiz-preview { display: grid; gap: 10px; margin-top: 6px; }
.wiz-prev-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff; }
.wiz-prev-card .score { float: right; font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.wiz-prev-card .badge { margin-left: 6px; }
