/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 1.5rem;
}

body {
  /* font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif; */
  /* font-family: 'Titillium Web', 'Helvetica Neue', Arial, sans-serif; */
  /* font-family: 'Rajdhani', 'Helvetica Neue', Arial, sans-serif; */
  font-family: 'Exo 2', 'Helvetica Neue', Arial, sans-serif;
  /* font-family: 'Chakra Petch', 'Helvetica Neue', Arial, sans-serif; */
  font-size: 1.15rem;
  color: #1a1a2e;
  background: #fdfdfd;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background 0.5s, color 0.5s;
}

/* ── Layout ── */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Hero ── */
.hero {
  text-align: center;
  padding: 3rem 0 2rem;
}

.hero h1 {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 1.2rem;
}

.title-accent {
  background: linear-gradient(135deg, #8b0000, #dc2626);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.authors {
  font-size: 1.05rem;
  color: #333;
  margin-bottom: 0.4rem;
  transition: color 0.5s;
}

.authors a {
  color: #dc2626;
  text-decoration: none;
}
.authors a:hover { text-decoration: underline; }

.affiliations {
  font-size: 0.92rem;
  color: #555;
  margin-bottom: 1.5rem;
  transition: color 0.5s;
}

sup {
  font-size: 0.75em;
  color: #888;
}

/* ── Resource buttons ── */
.resource-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.resource-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: #fff;
  background: #1a1a2e;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.5s, color 0.5s;
}
.resource-links a:hover { background: #dc2626; }
.resource-links a i { font-size: 1rem; }
.resource-links a img.icon { height: 1.45rem; width: auto; vertical-align: -0.25em; }
.resource-links a img.icon-white { filter: brightness(0) invert(1); }

/* ── TL;DR ── */
.tldr {
  text-align: center;
  font-size: 1.05rem;
  color: #444;
  padding: 0.8rem 1.2rem;
  margin-bottom: 1.5rem;
  background: #f3f4f6;
  border-left: 3px solid #dc2626;
  border-radius: 6px;
  transition: background 0.5s, color 0.5s, border-left-color 0.5s;
}

body.dark .tldr {
  background: #1e1e1e;
  color: #ccc;
  border-left-color: #f87171;
}

/* ── Highlights ── */
.highlights {
  margin-bottom: 1.5rem;
  padding: 1rem 1.2rem;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  transition: background 0.5s, border-color 0.5s, color 0.5s;
}

.highlights ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.highlights li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: 0.45rem;
  font-size: 0.98rem;
  line-height: 1.55;
}

.highlights li:last-child {
  margin-bottom: 0;
}

.highlights li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #dc2626;
  font-weight: 700;
}

body.dark .highlights {
  background: #2a1a1a;
  border-color: #7f1d1d;
  color: #e0e0e0;
}

body.dark .highlights li::before {
  color: #f87171;
}

/* ── Teaser ── */
.teaser {
  text-align: center;
  margin: 1.5rem 0 2rem;
}

.teaser img, .teaser video {
  max-width: 100%;
  border-radius: 10px;
  border: 2px solid #e5e7eb;
  transition: border-color 0.5s;
}

.caption {
  font-size: 0.88rem;
  color: #666;
  margin-top: 0.5rem;
  text-align: left;
  transition: color 0.5s;
}

/* ── Abstract ── */
.abstract {
  margin-bottom: 2rem;
}

.abstract h2 {
  font-size: 1.4rem;
  margin-bottom: 0.6rem;
}

.abstract p {
  text-align: justify;
}

/* ── Section navigation ── */
.section-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.2rem 0;
  margin-bottom: 2rem;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  transition: border-color 0.5s;
}

.section-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: #1a1a2e;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
body.theme-transition .section-nav a {
  transition-duration: 0.5s;
}
.section-nav a:hover {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

/* ── Content sections ── */
section {
  margin-bottom: 2.5rem;
}

section h2 {
  font-size: 1.4rem;
  margin-bottom: 0.8rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid #e5e7eb;
  transition: border-bottom-color 0.5s;
}

section a:not(.back-to-nav) {
  color: #dc2626;
  text-decoration: none;
}
section a:not(.back-to-nav):hover { text-decoration: underline; }

body.dark section a:not(.back-to-nav) { color: #f87171; }

section p, section ul, section ol {
  margin-bottom: 0.8rem;
}

section ul, section ol {
  padding-left: 1.5rem;
}

section li {
  margin-bottom: 0.4rem;
}

/* ── Collapsible details ── */
details {
  margin-bottom: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.5s;
}

details summary {
  padding: 0.75rem 1rem;
  font-weight: 600;
  cursor: pointer;
  background: #f9fafb;
  transition: background 0.5s;
  list-style: none;
}

details summary::before {
  content: '▸ ';
  font-size: 0.85em;
  color: #888;
  transition: transform 0.2s;
}

details[open] summary::before {
  content: '▾ ';
}

details summary:hover {
  background: #f3f4f6;
}

details .details-content {
  padding: 1rem;
}

/* ── Back-to-nav link ── */
.back-to-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: #6b7280;
  text-decoration: none;
  margin-top: 0.5rem;
  transition: color 0.2s;
}
.back-to-nav:hover { color: #dc2626; }

/* ── Figures ── */
.figure {
  text-align: center;
  margin: 1.5rem 0;
}

.figure img {
  max-width: 100%;
  border-radius: 8px;
  background: #fff;
  padding: 0.2rem;
  border: 1px solid #e5e7eb;
  transition: background 0.5s, border-color 0.5s;
}

body.dark .figure img {
  background: #f9fafb;
  border-color: #444;
}



/* ── Code blocks ── */
section:not(.bibtex) pre {
  background: #1e1e2e;
  color: #cdd6f4;
  border: 1px solid #313244;
  border-radius: 8px;
  padding: 1rem 1.2rem;
  font-size: 0.82rem;
  font-family: 'Fira Code', 'Consolas', monospace;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.6;
  margin-bottom: 0.8rem;
}

section:not(.bibtex) pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

.code-comment { color: #6c7086; }
.code-keyword { color: #cba6f7; }
.code-string { color: #a6e3a1; }
.code-number { color: #fab387; }

/* ── Demo table ── */
.demo-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8rem 0 1.2rem;
  font-size: 0.95rem;
}

.demo-table th,
.demo-table td {
  padding: 0.55rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
  transition: border-bottom-color 0.5s;
}

.demo-table th {
  font-weight: 600;
  background: #f3f4f6;
  border-bottom: 2px solid #d1d5db;
  transition: background 0.5s, border-bottom-color 0.5s;
}

.demo-table a {
  color: #dc2626;
  text-decoration: none;
}
.demo-table a:hover { text-decoration: underline; }

body.dark .demo-table th {
  background: #1a1a1a;
  border-bottom-color: #444;
}

body.dark .demo-table td {
  border-bottom-color: #333;
}

body.dark .demo-table a {
  color: #f87171;
}

/* ── Results table ── */
.table-scroll {
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  -webkit-overflow-scrolling: touch;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
  white-space: nowrap;
}

.results-table th,
.results-table td {
  padding: 0.38rem 0.58rem;
  text-align: center;
  border-bottom: 1px solid #e5e7eb;
  transition: border-bottom-color 0.5s;
}

.results-table thead th {
  font-weight: 600;
  background: #f9fafb;
  border-bottom: 2px solid #d1d5db;
  transition: background 0.5s, border-bottom-color 0.5s;
}

.results-table td:first-child {
  text-align: left;
  font-style: italic;
}

.results-table .model-header td {
  text-align: left;
  font-weight: 700;
  font-style: italic;
  background: #f0f0f0;
  border-top: 2px solid #999;
  transition: background 0.5s, border-top-color 0.5s;
}

.results-table .method-ours {
  background: #fee2e2;
  transition: background 0.5s;
}

.results-table .method-ours td:first-child {
  font-weight: 600;
}

body.dark .results-table th {
  background: #1a1a1a;
  border-bottom-color: #444;
}

body.dark .results-table td {
  border-bottom-color: #333;
}

body.dark .results-table .model-header td {
  background: #252525;
  border-top-color: #555;
}

body.dark .results-table .method-ours {
  background: #4a1a1a;
}

/* ── Latency table ── */
.latency-table {
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Section h3 ── */
section h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 1.2rem 0 0.5rem;
}

/* ── BibTeX ── */
.bibtex {
  margin-bottom: 2rem;
}

.bibtex pre {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.82rem;
  font-family: 'Fira Code', 'Consolas', monospace;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  transition: background 0.5s, border-color 0.5s, color 0.5s;
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 2rem 0;
  font-size: 0.82rem;
  color: #999;
  border-top: 1px solid #e5e7eb;
  transition: color 0.5s, border-top-color 0.5s;
}

/* ── Theme toggle switch ── */
.theme-switch {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  display: inline-block;
  width: 3.2rem;
  height: 1.7rem;
}

.theme-switch input { display: none; }

.theme-switch .slider {
  position: absolute;
  inset: 0;
  background: #e5e7eb;
  border-radius: 1rem;
  cursor: pointer;
  transition: background 0.5s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* knob */
.theme-switch .slider::after {
  content: '';
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1.3rem;
  height: 1.3rem;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.5s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* icons inside the track */
.theme-switch .slider i {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  line-height: 1;
}
.theme-switch .slider .fa-sun {
  right: 0.38rem;
  color: #f59e0b;
  opacity: 1;
  transition: opacity 0.5s;
}
.theme-switch .slider .fa-moon {
  left: 0.38rem;
  color: #6b7280;
  opacity: 0;
  transition: opacity 0.5s;
}

/* checked state */
.theme-switch input:checked + .slider {
  background: #334155;
}
.theme-switch input:checked + .slider::after {
  transform: translateX(1.5rem);
}
.theme-switch input:checked + .slider .fa-sun  { opacity: 0; }
.theme-switch input:checked + .slider .fa-moon { opacity: 1; }

/* ── Dark mode ── */
body.dark {
  background: #121212;
  color: #e0e0e0;
}

body.dark .authors { color: #ccc; }
body.dark .authors a { color: #f87171; }
body.dark .affiliations { color: #aaa; }
body.dark sup { color: #888; }

body.dark .resource-links a {
  background: #2a2a2a;
  color: #e0e0e0;
}
body.dark .resource-links a:hover { background: #dc2626; }

body.dark .teaser img, body.dark .teaser video {
  border-color: #333;
}
body.dark .caption { color: #999; }

body.dark .section-nav {
  border-color: #333;
}
body.dark .section-nav a {
  color: #e0e0e0;
  background: #1e1e1e;
  border-color: #444;
}
body.dark .section-nav a:hover {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

body.dark section h2 { border-bottom-color: #333; }

body.dark details {
  border-color: #333;
}
body.dark details summary {
  background: #1a1a1a;
}
body.dark details summary:hover {
  background: #222;
}

body.dark .back-to-nav { color: #888; }
body.dark .back-to-nav:hover { color: #f87171; }

body.dark .bibtex pre {
  background: #1a1a1a;
  border-color: #333;
  color: #d4d4d4;
}

body.dark footer {
  color: #666;
  border-top-color: #333;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .hero h1 { font-size: 1.5rem; }
  .resource-links a { font-size: 0.82rem; padding: 0.4rem 0.75rem; }
  .section-nav a { font-size: 0.8rem; padding: 0.35rem 0.7rem; }
  .container { padding: 0 1rem; }
}
