/* ============================================================
   3DGS × Surface — 学术综述网站
   清爽风：参考 distill.pub / The Gradient
   ============================================================ */

:root {
  --bg: #faf8f3;
  --bg-soft: #f3efe6;
  --paper: #fffdf8;
  --ink: #1a1a1a;
  --ink-soft: #4a4a4a;
  --ink-muted: #888;
  --line: #d8d1c0;
  --line-soft: #ebe5d4;
  --accent: #8b3a3a;          /* 砖红：route highlight & 重点 callout */
  --accent-soft: #f3e3e0;
  --accent-2: #2c5f7d;        /* 深蓝：key insight callout */
  --accent-2-soft: #dfeaf0;
  --accent-3: #2d6e4e;        /* 墨绿：与前作对比 */
  --accent-3-soft: #d9eadd;
  --route-a: #b8743a;         /* 路线色 */
  --route-b: #c45a5a;
  --route-c: #4a78a8;
  --route-d: #7a6aa8;
  --route-e: #3d8a5a;
  --route-f: #a87a3a;
  --route-v: #6b6b6b;
  --serif: 'Source Serif Pro', 'Source Serif 4', 'Noto Serif SC', 'Songti SC',
           'STSong', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
}

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

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

/* ===== 整体布局：左侧目录 + 中央正文 ===== */

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 0;
  max-width: 1280px;
  margin: 0 auto;
}

.toc {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 32px 16px 32px 32px;
  border-right: 1px solid var(--line-soft);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.55;
  background: var(--bg);
}

.toc-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.02em;
  margin: 0 0 18px 0;
  color: var(--ink);
}

.toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc;
}

.toc li {
  counter-increment: toc;
  margin: 4px 0;
}

.toc a {
  color: var(--ink-soft);
  text-decoration: none;
  display: block;
  padding: 3px 8px;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}

.toc a:hover { color: var(--ink); border-left-color: var(--line); }
.toc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.toc a::before {
  content: counter(toc, decimal-leading-zero) "  ";
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 11px;
}

.toc-sub {
  list-style: none;
  padding-left: 16px;
  margin: 2px 0 6px 0;
  font-size: 12px;
}

.toc-sub li { counter-increment: none; margin: 1px 0; }
.toc-sub a::before { content: "·  "; color: var(--ink-muted); }

.toc-meta {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  color: var(--ink-muted);
  font-size: 11px;
  line-height: 1.6;
}

.toc-meta code {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--bg-soft);
  padding: 1px 4px;
  border-radius: 2px;
}

/* ===== 正文 ===== */

main {
  padding: 56px 64px 120px 64px;
  max-width: 880px;
}

main h1 {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 12px 0;
  line-height: 1.2;
}

main h2 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 72px 0 18px 0;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  line-height: 1.25;
  scroll-margin-top: 24px;
}

main h2 .ord {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
  margin-right: 12px;
  vertical-align: 0.18em;
}

main h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 40px 0 12px 0;
  scroll-margin-top: 24px;
}

main h4 {
  font-size: 17px;
  font-weight: 600;
  margin: 28px 0 8px 0;
  font-family: var(--sans);
  letter-spacing: 0.01em;
}

main p { margin: 14px 0; }
main p + p { margin-top: 16px; }

main a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  transition: border-color 0.15s;
}
main a:hover { border-bottom-color: var(--accent); }

main strong { font-weight: 600; color: var(--ink); }

main code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-soft);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--line-soft);
}

main blockquote {
  margin: 20px 0;
  padding: 14px 22px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  font-style: italic;
  color: var(--ink-soft);
}

.subtitle {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 400;
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 0 0 8px 0;
}

.byline {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
  margin: 32px 0 0 0;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line-soft);
}

.lede {
  font-size: 19px;
  line-height: 1.7;
  color: var(--ink-soft);
  font-weight: 400;
  margin-top: 36px;
}

.lede:first-letter {
  font-size: 56px;
  float: left;
  line-height: 0.85;
  margin: 6px 8px 0 0;
  font-weight: 700;
  color: var(--accent);
}

/* ===== Callout 卡片 ===== */

.callout {
  margin: 20px 0;
  padding: 16px 22px;
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
}

.callout-title {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
  opacity: 0.8;
}

.callout.insight {
  background: var(--accent-2-soft);
  border-left: 3px solid var(--accent-2);
}
.callout.insight .callout-title { color: var(--accent-2); }

.callout.contrast {
  background: var(--accent-3-soft);
  border-left: 3px solid var(--accent-3);
}
.callout.contrast .callout-title { color: var(--accent-3); }

.callout.warn {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
}
.callout.warn .callout-title { color: var(--accent); }

/* ===== Paper card ===== */

.paper {
  margin: 28px 0;
  padding: 22px 26px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  position: relative;
}

.paper.lead {
  border-left: 4px solid var(--accent);
  background: linear-gradient(to right, var(--accent-soft) 0%, var(--paper) 6%);
}

.paper-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line-soft);
}

.paper-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 21px;
  margin: 0;
  letter-spacing: -0.005em;
  flex: 1 1 auto;
  line-height: 1.3;
}

.paper-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.paper-meta .venue {
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  padding: 2px 7px;
  border-radius: 3px;
  margin-right: 4px;
}

.paper-meta a {
  margin-left: 8px;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent-soft);
}

.paper p { margin: 10px 0; font-size: 16px; }

.tldr {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  margin: 6px 0 14px 0;
  padding: 10px 16px;
  background: var(--bg-soft);
  border-radius: 3px;
  color: var(--ink-soft);
}

.tldr::before {
  content: "一句话 → ";
  font-weight: 700;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-right: 4px;
}

.paper-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line-soft);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-muted);
}

.paper-foot .limit {
  flex: 1 1 100%;
  font-family: var(--sans);
  font-style: italic;
  color: var(--ink-soft);
  font-size: 13px;
}

.paper-foot .limit::before {
  content: "局限 · ";
  font-style: normal;
  font-weight: 700;
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ===== Section intro ===== */

.section-intro {
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink-soft);
  margin: 12px 0 32px 0;
  padding: 0 0 0 16px;
  border-left: 3px solid var(--line);
  font-style: italic;
}

.route-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  color: white;
  margin-right: 6px;
}

.route-a-bg { background: var(--route-a); }
.route-b-bg { background: var(--route-b); }
.route-c-bg { background: var(--route-c); }
.route-d-bg { background: var(--route-d); }
.route-e-bg { background: var(--route-e); }
.route-f-bg { background: var(--route-f); }
.route-v-bg { background: var(--route-v); }

/* ===== Family tree SVG ===== */

.family-tree {
  margin: 28px 0;
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  overflow-x: auto;
}

.family-tree svg {
  display: block;
  min-width: 720px;
  width: 100%;
  height: auto;
}

.family-tree text {
  font-family: var(--sans);
  font-size: 13px;
  fill: var(--ink);
}

.family-tree .route-label {
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.family-tree .work-node {
  cursor: pointer;
  transition: opacity 0.15s;
}
.family-tree .work-node:hover { opacity: 0.7; }

.family-tree .work-node text {
  font-family: var(--mono);
  font-size: 11px;
}

.family-tree .branch { stroke-width: 1.5; fill: none; }

/* ===== Timeline ===== */

.timeline-wrap {
  margin: 28px 0 8px 0;
  padding: 18px 0;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  position: relative;
}

.timeline-scroll {
  overflow-x: auto;
  padding: 8px 24px;
  scroll-behavior: smooth;
}

.timeline-track {
  position: relative;
  min-width: 1800px;
  height: 200px;
  padding: 24px 0;
}

.timeline-axis {
  position: absolute;
  left: 0; right: 0;
  top: 110px;
  height: 2px;
  background: linear-gradient(to right, var(--line), var(--accent) 50%, var(--line));
}

.timeline-tick {
  position: absolute;
  top: 100px;
  width: 1px;
  height: 22px;
  background: var(--ink-muted);
}

.timeline-tick-label {
  position: absolute;
  top: 130px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-muted);
  transform: translateX(-50%);
  white-space: nowrap;
}

.timeline-node {
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--ink);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  z-index: 2;
  top: 105px;
  transform: translate(-50%, -50%);
}

.timeline-node:hover {
  transform: translate(-50%, -50%) scale(1.5);
  box-shadow: 0 0 0 4px rgba(0,0,0,0.06);
}

.timeline-node.above { top: 80px; }
.timeline-node.below { top: 130px; }

.timeline-label {
  position: absolute;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-soft);
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
  max-width: 110px;
  text-align: center;
  line-height: 1.2;
}

.timeline-label.above { top: 55px; }
.timeline-label.below { top: 155px; }

.timeline-help {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-muted);
  text-align: center;
  margin-top: 6px;
}

/* ===== Benchmark table ===== */

.benchmark-wrap {
  margin: 24px 0;
  overflow-x: auto;
}

table.benchmark {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 14px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
}

table.benchmark thead {
  background: var(--bg-soft);
  border-bottom: 2px solid var(--line);
}

table.benchmark th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
  border-right: 1px solid var(--line-soft);
}

table.benchmark th:hover { background: var(--line-soft); }
table.benchmark th.sorted-asc::after  { content: " ↑"; color: var(--accent); }
table.benchmark th.sorted-desc::after { content: " ↓"; color: var(--accent); }

table.benchmark td {
  padding: 9px 14px;
  border-top: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums;
}

table.benchmark td.work {
  font-family: var(--mono);
  font-size: 13px;
}

table.benchmark td.route {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}

table.benchmark td.num {
  text-align: right;
  font-family: var(--mono);
  font-size: 13px;
}

table.benchmark td.num.best { color: var(--accent); font-weight: 700; }

table.benchmark caption {
  text-align: left;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-muted);
  padding: 8px 0;
  caption-side: bottom;
}

/* ===== 图示 (SVG diagram) ===== */

figure.diagram {
  margin: 28px 0;
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  text-align: center;
}

figure.diagram svg { max-width: 100%; height: auto; }

figure.diagram figcaption {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 12px;
  text-align: left;
  line-height: 1.55;
}

figure.diagram figcaption strong { color: var(--ink); }

/* ===== 列表 ===== */

main ul, main ol {
  padding-left: 22px;
  margin: 14px 0;
}

main li { margin: 6px 0; }
main li > strong:first-child { color: var(--accent-2); }

/* ===== Footer ===== */

footer {
  margin-top: 80px;
  padding: 28px 0;
  border-top: 1px solid var(--line-soft);
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-muted);
  line-height: 1.65;
}

footer a { color: var(--ink-soft); text-decoration: underline; text-decoration-color: var(--line); }
footer a:hover { color: var(--accent); }

/* ===== Responsive ===== */

@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; }
  .toc {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line-soft);
    padding: 24px;
  }
  main { padding: 32px 28px 80px 28px; }
  main h1 { font-size: 30px; }
  main h2 { font-size: 24px; }
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  main h1 { font-size: 26px; }
  main h2 { font-size: 21px; }
  .paper { padding: 16px; }
  .paper-title { font-size: 18px; }
}
