:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --text: #1a1a1a;
  --body: #3f3f3f;
  --muted: #8a8a8a;
  --line: #ececec;
  --line-strong: #d6d6d6;
  --accent: #2a4f75;
  --accent-soft: #eaf0f5;
  --accent-bdr: #cfdce8;
  --code-bg: #f6f7f8;
  --code-border: #e9eaec;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 6px 22px rgba(0, 0, 0, 0.045);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: "IBM Plex Sans", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

a:hover { color: #1f3d5d; }

.container {
  width: min(720px, calc(100% - 36px));
  margin: 0 auto;
}

/* Sticky top bar with back link */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: transparent;
  padding-top: 14px;
  pointer-events: none;
}

.top-bar-inner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 16px;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid transparent;
  border-radius: 12px;
  box-shadow: none;
  transition:
    background 0.28s ease,
    backdrop-filter 0.28s ease,
    -webkit-backdrop-filter 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease;
}

.top-bar.scrolled .top-bar-inner {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-color: rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 6px 20px rgba(0, 0, 0, 0.05);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}

.back-arrow {
  font-size: 17px;
  line-height: 1;
  font-weight: 600;
  display: inline-block;
  transition: transform 0.18s ease;
}

.back-link:hover { color: var(--accent); }
.back-link:hover .back-arrow { transform: translateX(-2px); }

.top-bar-meta {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

/* Project header */
.paper-header {
  padding: 48px 0 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}

.paper-eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 14px;
}

.paper-title {
  margin: 0 0 18px;
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--text);
}

.paper-authors {
  margin: 0 0 6px;
  font-size: 15px;
  color: var(--body);
  line-height: 1.55;
}

.paper-supervisor {
  margin: 0 0 22px;
  font-size: 14px;
  color: var(--muted);
}

.paper-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.15s ease;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}

.btn-primary:hover {
  background: #1f3d5d;
  color: #fff;
  text-decoration: none;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line-strong);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* TL;DR / callout */
.callout {
  background: var(--accent-soft);
  border: 1px solid var(--accent-bdr);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 28px 0;
}

.callout-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 8px;
}

.callout p {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
}

/* Sections */
.paper-section {
  margin: 36px 0;
}

.paper-section h2 {
  margin: 0 0 14px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.paper-section h3 {
  margin: 28px 0 10px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.paper-section p {
  margin: 0 0 14px;
  color: var(--body);
  font-size: 15.5px;
  line-height: 1.75;
}

.paper-section ul,
.paper-section ol {
  margin: 0 0 16px;
  padding-left: 24px;
  color: var(--body);
  font-size: 15.5px;
}

.paper-section li {
  margin: 7px 0;
  line-height: 1.7;
}

.paper-section strong { color: var(--text); }

/* Code blocks */
pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.6;
  margin: 14px 0 22px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: #1a1a1a;
}

p code, li code {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.86em;
  color: var(--accent);
}

pre code { background: none; border: 0; padding: 0; color: inherit; }

.tok-comment { color: #6a737d; font-style: italic; }
.tok-keyword { color: #c0392b; font-weight: 500; }
.tok-string  { color: #1e7e4e; }
.tok-fn      { color: #6f42c1; }
.tok-num     { color: #005cc5; }
.tok-cls     { color: #b08800; font-weight: 500; }

/* Figures */
.figure {
  margin: 24px 0 28px;
}

.figure svg,
.figure img,
.figure video {
  display: block;
  width: 100%;
  height: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.figure img {
  padding: 12px;
  object-fit: contain;
}

.figure video {
  padding: 0;
  background: #000;
}

.figcaption {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  line-height: 1.55;
}

/* Footer */
.paper-footer {
  margin: 48px 0 32px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.paper-footer a { color: var(--muted); }
.paper-footer a:hover { color: var(--accent); }

@media (max-width: 760px) {
  body { font-size: 15px; }
  .paper-title { font-size: 26px; }
  .paper-section h2 { font-size: 19px; }
  .paper-section h3 { font-size: 16px; }
  .paper-section p,
  .paper-section ul,
  .paper-section ol { font-size: 14.5px; }
  pre { font-size: 12.5px; padding: 14px; }
  .top-bar-meta { display: none; }
}
