/* ==========================================================
   力学计算工具站 — 全局样式
   浅色 / 工程仪表盘风格
   ========================================================== */

:root {
  --ink: #0f151b;
  --ink-2: #3b4753;
  --muted: #6d7885;
  --faint: #96a0ab;
  --line: #e3e7ec;
  --line-2: #eef1f4;
  --bg: #f7f9fb;
  --surface: #ffffff;
  --surface-2: #fafbfc;

  --blue: #12557f;
  --blue-600: #0e4a70;
  --blue-soft: #eaf2f8;
  --blue-line: #cfe2ee;

  --amber: #b45309;
  --amber-soft: #fdf6ec;

  --green: #15803d;
  --green-soft: #eefaf1;
  --red: #b42318;
  --red-soft: #fdf1f0;

  --font-sans: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --font-mono: "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(15, 21, 27, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 21, 27, 0.06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

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

h1, h2, h3, h4 { color: var(--ink); margin: 0; line-height: 1.35; font-weight: 600; }
h1 { font-size: 26px; letter-spacing: -0.01em; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono { font-family: var(--font-mono); font-size: 0.92em; }

/* ---------- 顶部导航 ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  color: var(--ink);
  font-size: 15.5px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--blue);
  display: grid;
  place-items: center;
  flex: none;
}
.brand-mark svg { display: block; }
.nav-links { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.nav-links a {
  color: var(--ink-2);
  font-size: 14px;
  padding: 4px 0;
  border-bottom: 1.5px solid transparent;
}
.nav-links a:hover { color: var(--blue); text-decoration: none; }
.nav-links a.on { color: var(--blue); border-bottom-color: var(--blue); }

/* ---------- 容器 ---------- */
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 880px; margin: 0 auto; padding: 0 24px; }

main { padding: 34px 0 72px; }

/* ---------- 首页 hero ---------- */
.hero {
  position: relative;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(to right, rgba(18, 85, 127, 0.05) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(to bottom, rgba(18, 85, 127, 0.05) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--surface);
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0) 30%, rgba(255,255,255,0.92) 100%);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; padding: 62px 24px 54px; max-width: 1140px; margin: 0 auto; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 500; letter-spacing: 0.04em;
  color: var(--blue); background: var(--blue-soft);
  border: 1px solid var(--blue-line);
  padding: 4px 10px; border-radius: 999px;
  margin-bottom: 18px;
}
.hero h1 { font-size: 34px; letter-spacing: -0.02em; max-width: 720px; }
.hero .lede { margin-top: 14px; font-size: 16px; color: var(--ink-2); max-width: 620px; }
.hero-stats { display: flex; gap: 34px; margin-top: 30px; flex-wrap: wrap; }
.hero-stat .v {
  font-family: var(--font-mono);
  font-size: 22px; font-weight: 600; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.hero-stat .k { font-size: 12.5px; color: var(--muted); }

/* ---------- 工具卡片网格 ---------- */
.section-head {
  display: flex; align-items: baseline; gap: 12px;
  margin: 46px 0 18px;
}
.section-head h2 { font-size: 17px; }
.section-head .hint { font-size: 13px; color: var(--muted); }

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

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 20px 18px;
  color: inherit;
  transition: border-color .15s, box-shadow .15s, transform .15s;
  position: relative;
}
.card:hover {
  text-decoration: none;
  border-color: var(--blue-line);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card-ico {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--blue-soft);
  color: var(--blue);
  display: grid; place-items: center;
  margin-bottom: 13px;
}
.card h3 { font-size: 15px; margin-bottom: 5px; }
.card p { font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag {
  font-size: 11.5px; color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  padding: 1px 7px; border-radius: 4px;
}

/* ---------- 工具页布局 ---------- */
.tool-head { margin-bottom: 26px; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--blue); }
.tool-head h1 { font-size: 24px; }
.tool-head .desc { margin-top: 8px; color: var(--muted); font-size: 14px; max-width: 700px; }

.tool-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .tool-layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.panel + .panel { margin-top: 20px; }
.panel-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  background: var(--surface-2);
}
.panel-head h2 { font-size: 14px; font-weight: 600; color: var(--ink); }
.panel-body { padding: 18px; }
.panel-body + .panel-body { border-top: 1px solid var(--line-2); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > label {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 6px;
  font-weight: 500;
}
.field .unit-hint { color: var(--faint); font-weight: 400; }

.input-row { display: flex; align-items: stretch; }
.input-row input, .input-row select { min-width: 0; }
input[type="number"], input[type="text"], select {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 11px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
  font-variant-numeric: tabular-nums;
}
select { font-family: var(--font-sans); cursor: pointer; }
input[type="number"]:focus, input[type="text"]:focus, select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(18, 85, 127, 0.1);
}
.input-unit {
  display: grid; place-items: center;
  padding: 0 11px;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: none;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  white-space: nowrap;
  font-family: var(--font-mono);
}
.input-row input { border-radius: var(--r-sm) 0 0 var(--r-sm); }

.field-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

fieldset {
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 14px;
  margin: 0 0 14px;
  background: var(--surface-2);
}
fieldset legend {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  padding: 0 6px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: var(--font-sans);
  font-size: 14px; font-weight: 500;
  padding: 10px 18px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-600); }
.btn-ghost {
  background: var(--surface); color: var(--ink-2);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--faint); }
.btn-row { display: flex; gap: 10px; margin-top: 18px; }
.btn-row .btn { flex: 1; }

/* ---------- 结果 ---------- */
.res-hero {
  display: flex; align-items: flex-end; gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 2px;
}
.res-hero .val {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.res-hero .unit { font-size: 14px; color: var(--muted); padding-bottom: 4px; font-family: var(--font-mono); }
.res-hero .cap { font-size: 12.5px; color: var(--muted); padding-bottom: 5px; margin-left: auto; }

.res-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(146px, 1fr));
  gap: 8px;
}
.res-cell {
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 11px 13px;
}
.res-cell .k { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.res-cell .v {
  font-family: var(--font-mono);
  font-size: 16px; font-weight: 600; color: var(--ink);
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}
.res-cell .u { font-size: 11.5px; color: var(--faint); font-weight: 400; margin-left: 2px; }

.verdict {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 500;
  margin-top: 14px;
  border: 1px solid;
}
.verdict.ok { background: var(--green-soft); border-color: #cfe9d8; color: var(--green); }
.verdict.no { background: var(--red-soft); border-color: #f3d3d0; color: var(--red); }
.verdict .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

.formula {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  margin-top: 14px;
  line-height: 1.9;
  overflow-x: auto;
}
.formula b { color: var(--blue); font-weight: 600; }

.note {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
  background: var(--amber-soft);
  border-left: 2px solid #e8b872;
  padding: 10px 13px;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  margin-top: 14px;
}

/* ---------- 图表 ---------- */
.charts { display: grid; gap: 16px; }
.chart-box {
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 12px 12px 6px;
}
.chart-title {
  font-size: 12.5px; color: var(--muted);
  display: flex; justify-content: space-between; gap: 10px;
  margin-bottom: 6px;
  padding: 0 3px;
}
.chart-title b { color: var(--ink); font-family: var(--font-mono); font-weight: 600; }
.chart-box svg { display: block; width: 100%; height: auto; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; background: var(--surface); }
th, td {
  padding: 9px 13px;
  text-align: left;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
th {
  font-size: 12px; font-weight: 500; color: var(--muted);
  background: var(--surface-2);
  position: sticky; top: 0;
}
td { color: var(--ink-2); }
td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); }
tbody tr:hover td { background: #f9fbfc; }
tbody tr:last-child td { border-bottom: none; }

/* ---------- 提示条 ---------- */
.tip {
  display: flex; gap: 10px;
  font-size: 13px;
  color: var(--ink-2);
  background: var(--blue-soft);
  border: 1px solid var(--blue-line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin-bottom: 20px;
}
.tip svg { flex: none; margin-top: 2px; }

/* ---------- 页脚 ---------- */
footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 26px 0;
  font-size: 13px;
  color: var(--muted);
}
.foot-inner {
  max-width: 1140px; margin: 0 auto; padding: 0 24px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}

/* ---------- 工具类 ---------- */
.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;
}
.mt-0 { margin-top: 0; }
.mt-16 { margin-top: 16px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

@media (max-width: 860px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 27px; }
  .nav-links { gap: 16px; }
  .nav-links a.hide-sm { display: none; }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .wrap, .wrap-narrow, .nav-inner, .hero-inner, .foot-inner { padding-left: 16px; padding-right: 16px; }
  .hero-inner { padding-top: 40px; padding-bottom: 36px; }
  .field-2, .field-3 { grid-template-columns: 1fr; }
  .res-hero .val { font-size: 25px; }
}
