/* ChemDecision 项目看板 · 报告式排版，系统字体栈，无外部依赖 */

:root {
  --bg: #f2f0ee;
  --paper: #ffffff;
  --surface: #eae7e3;
  --line: #dcd8d3;
  --ink: #241d20;
  --muted: #6f6368;
  --accent: #a81145;
  --accent-soft: #fbeef2;
  --dark: #2b1420;
  --pos: #1c6b45;
  --neg: #a81145;
  --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; /* taste-skill-ignore */
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #7d0c33; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: #fff; }

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ---------- 页头 ---------- */

.masthead {
  background: var(--dark);
  color: #f5e9ee;
  padding: 56px 0 40px;
  margin-bottom: 56px;
}
.masthead .meta {
  font-size: 14px;
  color: #cf9db2;
  margin: 0 0 14px;
}
.masthead h1 {
  margin: 0 0 18px;
  font-size: clamp(40px, 7vw, 64px);
  letter-spacing: -0.03em;
  line-height: 1;
}
.masthead .lede {
  font-size: 18px;
  line-height: 1.8;
  max-width: 70ch;
  margin: 0 0 12px;
  color: #eedce5;
}
.masthead .toc {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  margin-top: 20px;
  font-size: 14px;
  font-weight: 600;
}
.masthead .toc a { color: #f5e9ee; text-decoration: none; padding: 4px 0; }
.masthead .toc a:hover { color: #fff; text-decoration: underline; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 26px;
  margin-top: 28px;
  background: var(--accent);
  color: #fff;
  border: 0;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: #7d0c33; color: #fff; }

/* ---------- 章节 ---------- */

.chapter { margin: 0 0 72px; }
.chapter h2 {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 0 0 24px;
  font-size: clamp(24px, 3.2vw, 32px);
  letter-spacing: -0.02em;
  line-height: 1.2;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--ink);
}
.chapter h2 .no {
  font-size: 0.55em;
  color: var(--accent);
  font-weight: 700;
}
.chapter h3 {
  margin: 36px 0 12px;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.chapter p { margin: 0 0 14px; max-width: 66ch; }
.chapter ul, .chapter ol { margin: 0 0 14px; padding-left: 1.4em; max-width: 64ch; }
.chapter li { margin-bottom: 8px; }
.note { color: var(--muted); font-size: 14px; }

/* ---------- 表格 ---------- */

table.grid {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 20px;
  font-size: 14px;
  background: var(--paper);
  border: 1px solid var(--line); /* taste-skill-ignore */
}
table.grid caption {
  caption-side: top;
  text-align: left;
  font-size: 14px;
  color: var(--muted);
  padding: 0 0 8px;
}
table.grid th, table.grid td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.grid thead th {
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid var(--ink);
  font-size: 14px;
  letter-spacing: 0.02em;
}
table.grid tbody th { font-weight: 600; white-space: nowrap; }
table.grid tbody tr:last-child th, table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid tbody tr:last-child { background: var(--accent-soft); }
table.grid td { font-variant-numeric: tabular-nums; }
td.pos { color: var(--pos); font-weight: 600; }
td.neg { color: var(--neg); font-weight: 600; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
.two-col table { margin-top: 0; }

/* ---------- 代码盒 ---------- */

.codebox {
  background: var(--surface);
  border-left: 4px solid var(--accent);
  padding: 16px 20px;
  margin: 16px 0 20px;
}
.codebox-bar {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 10px;
}
.codebox pre {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  overflow-x: auto;
}
.codebox pre code { background: none; padding: 0; font-size: inherit; }
.codebox ul, .codebox p { margin: 0 0 8px; }
.codebox ul:last-child, .codebox p:last-child { margin-bottom: 0; }
ul.plain { list-style: none; padding-left: 0; }
ul.plain li { padding-left: 1.2em; position: relative; }
ul.plain li::before { content: "—"; position: absolute; left: 0; color: var(--muted); }

/* ---------- 关键数字 ---------- */

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px 32px;
  margin: 28px 0 0;
}
.stat-strip > div {
  border-top: 4px solid var(--accent);
  padding: 14px 0 0;
}
.stat-strip b {
  display: block;
  font-size: 32px;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-strip span { font-size: 14px; color: var(--muted); display: block; margin-top: 6px; line-height: 1.6; }

/* ---------- 配对比较器 ---------- */

.panel {
  background: var(--paper);
  margin: 20px 0 24px;
}
.compare-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(260px, 1fr);
}
.chart-pane { padding: 22px 26px; }
.pane-title { font-size: 14px; font-weight: 600; color: var(--muted); margin: 0 0 16px; }

.chart { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.chart-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 110px 64px;
  align-items: center;
  gap: 14px;
  font-size: 14px;
}
.task-name { font-weight: 600; }
.bars { position: relative; display: block; height: 24px; background: var(--surface); }
.bar { position: absolute; left: 0; display: block; height: 10px; transition: width 300ms cubic-bezier(0.22, 1, 0.36, 1); }
.bar--left { top: 1px; background: var(--dark); }
.bar--right { bottom: 1px; background: #c396a8; }
.pair { font-variant-numeric: tabular-nums; text-align: right; color: var(--muted); white-space: nowrap; }
.delta { font-variant-numeric: tabular-nums; text-align: right; color: var(--pos); font-weight: 700; white-space: nowrap; }
.delta.is-negative { color: var(--neg); }
.chart-summary { font-size: 15px; font-weight: 600; margin: 0; line-height: 1.6; }

.controls {
  padding: 22px 24px;
  border-left: 1px solid var(--line); /* taste-skill-ignore */
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #eaedf0;
}
.controls-title { font-weight: 700; margin: 0; font-size: 16px; }
.control-label { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.control-group { display: flex; flex-wrap: wrap; gap: 6px; }
.opt {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.opt:hover { border-color: var(--accent); }
.opt[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.controls-note { font-size: 14px; color: var(--muted); line-height: 1.6; margin: 8px 0 0; }

/* ---------- 时间线 ---------- */

.timeline { display: flex; flex-direction: column; gap: 8px; }
details.tl {
  background: var(--paper);
  padding: 14px 20px;
}
details.tl summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
details.tl summary::-webkit-details-marker { display: none; }
details.tl summary::after { content: "+"; color: var(--accent); font-weight: 700; }
details.tl[open] summary::after { content: "−"; }
details.tl[open] { border-left: 4px solid var(--accent); }
details.tl p { margin: 12px 0 0; font-size: 15px; max-width: 88ch; }

/* ---------- 案例面板 ---------- */

.case-panel {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
}
.q-list {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line); /* taste-skill-ignore */
  background: #eaedf0;
}
.q-btn {
  width: 100%;
  text-align: left;
  min-height: 48px;
  padding: 12px 18px;
  border: 0;
  border-bottom: 1px solid var(--line); /* taste-skill-ignore */
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.q-btn:last-child { border-bottom: 0; }
.q-btn:hover { color: var(--ink); background: var(--surface); }
.q-btn.is-on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

.answer-pane { padding: 24px 28px; }
.answer { font-size: 18px; line-height: 1.75; font-weight: 600; margin: 0 0 10px; max-width: 66ch; }
.answer-note { font-size: 15px; color: var(--muted); margin: 0 0 18px; max-width: 66ch; }
.trace-card { margin: 0 0 16px; }
.trace-card ul.plain { font-size: 14px; color: var(--ink); }.trace-card ul.plain li { margin-bottom: 4px; }

/* ---------- 下一步 ---------- */

ol.todo { max-width: 88ch; }
ol.todo li { margin-bottom: 14px; padding-left: 6px; }
ol.todo li::marker { color: var(--accent); font-weight: 700; }

/* ---------- 页脚 ---------- */

.footer {
  background: var(--dark);
  color: #d9c2ce;
  padding: 36px 0;
  margin-top: 24px;
  font-size: 14px;
  line-height: 1.7;
}
.footer p { margin: 0; max-width: 90ch; }

/* ---------- 响应式 ---------- */

@media (max-width: 880px) {
  .compare-panel, .case-panel { grid-template-columns: 1fr; }
  .controls { border-left: 0; border-top: 1px solid var(--line); } /* taste-skill-ignore */
  .q-list { border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; } /* taste-skill-ignore */
  .q-btn { width: auto; border-bottom: 0; border-right: 1px solid var(--line); } /* taste-skill-ignore */
  .q-btn.is-on { background: var(--accent-soft); }
  .two-col { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  .wrap { padding: 0 16px; }
  .masthead { padding: 40px 0 28px; margin-bottom: 40px; }
  .chapter { margin-bottom: 48px; }
  .chapter p, .chapter ul, .chapter ol { max-width: none; }
  .chart-row { grid-template-columns: 80px minmax(0, 1fr) 60px; gap: 8px; font-size: 13px; }
  .chart-row .pair { display: none; }
  table.grid { font-size: 13.5px; }
  table.grid th, table.grid td { padding: 8px 8px; }
  .stat-strip b { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bar { transition: none; }
}
