/*
 * Shared overlay for all project pages.
 * Load AFTER bulma.min.css and static/css/index.css:
 *   <link rel="stylesheet" href="../assets/project.css">
 */

:root {
  --ink: #111827;
  --body: #2f3542;
  --muted: #6b7280;
  --line: #e6e8ec;
  --surface: #f6f7f9;
  --accent: #1f5fbf;
  --accent-hover: #174a96;
  --ours: #eef4fd;
  --prose: 720px;
  --wide: 1000px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

body {
  color: var(--body);
  background: #fff;
  font-size: 17px;
  line-height: 1.7;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

/* ---------- Top bar ---------- */

.navbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 3.25rem;
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.navbar .navbar-item,
.navbar .navbar-link { color: var(--muted); font-size: 0.9rem; font-weight: 500; }
.navbar .navbar-item:hover,
.navbar .navbar-link:hover { color: var(--ink); background: transparent; }
.navbar-dropdown {
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(17, 24, 39, 0.1);
  padding: 0.4rem;
}
.navbar-dropdown .navbar-item { border-radius: 6px; padding: 0.45rem 0.9rem; color: var(--body); }
.navbar-dropdown .navbar-item:hover { background: var(--surface); }
.navbar-dropdown .navbar-item.is-current { color: var(--ink); font-weight: 600; }

/* ---------- Header ---------- */

.hero:first-of-type .hero-body { padding-top: 3.5rem; padding-bottom: 1.5rem; }

.publication-title.title {
  color: var(--ink);
  font-size: clamp(2rem, 4.2vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.022em;
  text-wrap: balance;
  max-width: 900px;
  margin: 0 auto 1.4rem !important;
}

.publication-authors { color: var(--muted); line-height: 1.6; }
.publication-authors.is-size-5 { font-size: 1.05rem !important; }
.publication-authors.is-size-6 { font-size: 0.875rem !important; }
.publication-authors + .publication-authors { margin-top: 0.35rem; }
.publication-authors a { color: var(--ink) !important; font-weight: 500; }
.publication-authors a:hover { color: var(--accent) !important; text-decoration: none; }
.publication-authors sup { color: var(--muted); font-size: 0.68em; margin-left: 1px; }
.publication-authors b { color: var(--ink); }
.author-block { margin: 0 0.15rem; }

.publication-links { margin-top: 1.25rem; }
.publication-links .button.is-dark {
  background: var(--ink);
  border: none;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  height: auto;
  padding: 0.55rem 1.15rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.publication-links .button.is-dark:hover {
  background: #000;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(17, 24, 39, 0.18);
}
.publication-links .button .icon:first-child:not(:last-child) { margin-right: 0.35em; }

/* ---------- Teaser ---------- */

.hero.teaser .hero-body { padding-top: 1rem; padding-bottom: 0; }
.hero.teaser .subtitle.has-text-centered { margin-bottom: 0 !important; }
.hero.teaser img, .hero.teaser video { display: block; margin: 0 auto; }

/* ---------- Sections & prose ---------- */

.section { padding: 2.5rem 1.25rem; }
.section + .section { padding-top: 0.5rem; }
.section .columns { margin-bottom: 0 !important; }
.section .columns > .column { padding-bottom: 0; }

/* Centered reading column; figures and tables keep the full width. */
.section .title.is-3,
.section .title.is-4,
.section .content > p,
.section p.content,
.section .column > p,
.section .content > ul,
.section .content > ol,
.section .content > h3,
.section .content > h4,
.section .content > blockquote,
.section .content > .katex-display,
.subtitle.has-text-centered {
  max-width: var(--prose);
  margin-left: auto !important;
  margin-right: auto !important;
}

.section .title.is-3 {
  color: var(--ink);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.018em;
  line-height: 1.25;
  text-align: left !important;
  margin-top: 2.75rem;
  margin-bottom: 1rem !important;
}
.section .title.is-4 {
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 650;
  text-align: left !important;
  margin-top: 1.75rem;
}
/* Section padding already separates blocks; skip the extra gap on a section's first heading. */
.section .container > .columns:first-child > .column > .title.is-3:first-child { margin-top: 0.5rem; }

.content { color: var(--body); font-size: 1rem; }
.content p, .content li { text-wrap: pretty; }
.content p:not(:last-child) { margin-bottom: 1.1em; }
.content b, .content strong { color: var(--ink); font-weight: 600; }
.content ul { margin-left: 1.15em; }
.content li + li { margin-top: 0.45em; }
.content li::marker { color: var(--muted); }

/* Justified text leaves uneven gaps between words; set prose ragged-right. */
.has-text-justified { text-align: left !important; }

/* ---------- Figures ---------- */

.section img, .hero.teaser img { border-radius: 6px; }
.section .column > img,
.section .column > video { margin-top: 0.75rem; }

.subtitle.has-text-centered {
  text-align: left !important;
  color: var(--muted) !important;
  font-size: 0.9rem !important;
  line-height: 1.6;
  margin-top: 0.9rem !important;
  margin-bottom: 1.5rem !important;
}
.subtitle.has-text-centered b { color: var(--ink) !important; font-weight: 600; }

.publication-video { border-radius: 12px !important; box-shadow: 0 8px 30px rgba(17, 24, 39, 0.12); }

/* ---------- Tables (booktabs style) ---------- */

.table-container { margin: 1.25rem 0 1.75rem; }
.table {
  font-size: 0.85rem !important;
  color: var(--body);
  border-top: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
}
.table.is-bordered td,
.table.is-bordered th,
.table td,
.table th {
  border-width: 0 !important;
  border-bottom: 1px solid var(--line) !important;
  padding: 0.5em 0.7em;
}
.table thead th {
  color: var(--ink);
  font-weight: 600;
  background: transparent;
  border-bottom: 1px solid #c9ced6 !important;
  white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: 0 !important; }
/* Tabular figures only on number cells: Inter's tnum also widens hyphens in labels. */
.table td:not(:first-child) { font-variant-numeric: tabular-nums; }
.table.is-hoverable tbody tr:not(.is-selected):hover { background: var(--surface) !important; }
.table b, .table strong { color: var(--ink); }

/* ---------- BibTeX ---------- */

#BibTeX .container { max-width: var(--prose); }
#BibTeX .title {
  color: var(--ink);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.018em;
}
#BibTeX pre {
  position: relative;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.6;
  padding: 1.1rem 1.25rem;
  tab-size: 4;
  overflow-x: auto;
}
#BibTeX pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.copy-bibtex {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  font: 500 0.75rem/1 'Inter', sans-serif;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.copy-bibtex:hover { color: var(--ink); border-color: #c9ced6; }

/* ---------- Footer ---------- */

.footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 2.5rem 1.5rem 3rem;
  margin-top: 3rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.footer .content { color: var(--muted); }
.footer .icon-link { color: var(--muted); }
.footer .icon-link:hover { color: var(--ink); }

/* ---------- On-page contents (wide screens only; built by project.js) ---------- */

.page-toc {
  position: fixed;
  top: 6rem;
  left: max(1.5rem, calc((100vw - 960px) / 2 - 230px));
  width: 190px;
  font-size: 0.8rem;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.page-toc.is-visible { opacity: 1; pointer-events: auto; }
.page-toc-label {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}
.page-toc a {
  display: block;
  color: var(--muted);
  border-left: 2px solid var(--line);
  padding: 0.3rem 0 0.3rem 0.8rem;
}
.page-toc a:hover { color: var(--ink); }
.page-toc a.is-active { color: var(--ink); border-left-color: var(--accent); font-weight: 500; }
@media (max-width: 1439px) { .page-toc { display: none; } }

/* ---------- Small screens ---------- */

@media (max-width: 768px) {
  body { font-size: 16px; }
  .hero:first-of-type .hero-body { padding: 2rem 1rem 1rem; }
  .section { padding: 2rem 1rem; }
  .section .title.is-3 { font-size: 1.35rem; margin-top: 2rem; }
  .publication-authors.is-size-5 { font-size: 0.95rem !important; }
}
