.paper-head { padding: 140px 0 40px; }
.crumbs {
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.crumbs a { color: inherit; text-decoration: none; }
.crumbs .sep { margin: 0 10px; }
.paper-type {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 4px 10px;
  border-radius: 2px;
  margin-bottom: 24px;
}
.paper-title {
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1.05;
  max-width: 17ch;
  margin-bottom: 24px;
}
.authors { font-size: 18px; color: var(--text); }
.affiliation { font-size: 15px; color: var(--text-dim); margin-top: 4px; }
.meta-row {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.meta-row a,
.meta-row span {
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-dim);
  text-decoration: none;
}
.meta-row .primary {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

.paper-grid {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 60px;
  padding: 56px 0 100px;
  border-top: 1px solid var(--border);
  margin-top: 36px;
}
.toc {
  position: sticky;
  top: 100px;
  align-self: start;
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.toc-label { color: var(--text-muted); margin-bottom: 14px; }
.toc ol { list-style: none; }
.toc li { padding: 8px 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding-left: 14px; color: var(--text-dim); text-decoration: none; }

.paper-body {
  max-width: 72ch;
  min-width: 0;
  font-size: 19px;
  line-height: 1.7;
}
.paper-body section {
  margin-bottom: 56px;
  scroll-margin-top: 100px;
}
.paper-body h2 {
  font-family: var(--font-ui);
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 18px;
}
.paper-body h3 {
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 30px 0 12px;
}
.paper-body p,
.paper-body li { margin-bottom: 16px; }
.paper-body ol,
.paper-body ul { padding-left: 24px; margin-bottom: 22px; }

.abstract {
  border-left: 2px solid var(--accent);
  padding-left: 22px;
  color: var(--text-dim);
  font-size: 20px;
}

figure.pipeline {
  margin: 30px 0 36px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 24px;
  border-radius: 7px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}
.mermaid-shell { min-width: 100%; }
.mermaid {
  font-family: var(--font-ui);
  color: var(--text);
  font-size: 18px;
  line-height: 1.35;
  text-align: center;
}
.mermaid svg {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}
.mermaid svg text,
.mermaid svg .nodeLabel { font-size: 18px !important; }
.mermaid svg .edgeLabel,
.mermaid svg .edgeLabel tspan { font-size: 14px !important; }
.mermaid svg .source rect,
.mermaid svg .source polygon,
.mermaid svg .source circle,
.mermaid svg .source ellipse { stroke: var(--accent) !important; }
.mermaid svg .output rect,
.mermaid svg .output polygon,
.mermaid svg .output circle,
.mermaid svg .output ellipse {
  stroke: var(--accent-2) !important;
  stroke-dasharray: 4 3 !important;
}
figcaption {
  font-family: var(--font-ui);
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .paper-grid { grid-template-columns: 1fr; gap: 28px; }
  .toc { position: static; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
  .toc ol { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 16px; }
}
@media (max-width: 768px) {
  .paper-head { padding: 104px 0 30px; }
  .paper-title { font-size: clamp(42px, 12vw, 58px); }
  .paper-body { font-size: 18px; line-height: 1.75; }
  .paper-body h2 { font-size: 14px; }
  .paper-body h3 { font-size: 22px; }
  .crumbs { font-size: 13px; }
  .paper-type { font-size: 13px; }
  .affiliation { font-size: 16px; }
  .meta-row a,
  .meta-row span { font-size: 14px; padding: 11px 16px; }
  .toc { font-size: 13px; }
  .abstract { font-size: 19px; }
  figcaption { font-size: 13px; }
}
@media (max-width: 480px) {
  .paper-body { font-size: 17px; }
  .toc ol { grid-template-columns: 1fr; }
  figure.pipeline { padding: 16px; }
}
