/* ------------------------------------------------------------------
   CUSP project page — stylesheet
   Based on the Academic Project Page Template (Nerfies-derived) styling,
   with the same layout rules as the CanonNav project page.
   ------------------------------------------------------------------ */

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #64748b;
  --accent-color: #0ea5e9;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --background-primary: #ffffff;
  --background-secondary: #f8fafc;
  --background-accent: #f1f5f9;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --gradient-accent: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --border-radius: 12px;
  --border-radius-lg: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 16px;
  background-color: var(--background-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Buttons ---------- */
.button {
  border-radius: var(--border-radius) !important;
  font-weight: 600 !important;
  transition: var(--transition) !important;
  border: 2px solid transparent !important;
  position: relative;
  overflow: hidden;
}
.button.is-dark {
  background: var(--text-primary) !important;
  border: none !important;
  color: white !important;
  box-shadow: var(--shadow-md);
}
.button.is-dark:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: var(--primary-color) !important;
}
.button.is-dark:active { transform: translateY(0); box-shadow: var(--shadow-md); }
.button.is-dark[disabled] { opacity: 0.55; cursor: not-allowed; }
.button.is-dark[disabled]:hover { transform: none; background: var(--text-primary) !important; box-shadow: var(--shadow-md); }
.link-block .button { margin: 8px 4px; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; }
.hero.is-light {
  background: var(--background-secondary);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}
.hero-body { padding: 4rem 1.5rem; }
.teaser .hero-body { padding-top: 2rem; padding-bottom: 4rem; }
.teaser { font-family: 'Inter', sans-serif; }

.publication-title {
  font-family: 'Inter', sans-serif !important;
  font-weight: 800 !important;
  color: var(--text-primary) !important;
  margin-bottom: 2rem !important;
  line-height: 1.1 !important;
}
.publication-authors {
  font-family: 'Inter', sans-serif !important;
  font-weight: 500;
  margin-bottom: 1.5rem;
}
.publication-authors a {
  color: var(--primary-color) !important;
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
  position: relative;
}
.publication-authors a::after {
  content: '';
  position: absolute; width: 0; height: 2px; bottom: -2px; left: 0;
  background: var(--gradient-accent);
  transition: var(--transition);
}
.publication-authors a:hover::after { width: 100%; }
.publication-authors a:hover { color: var(--primary-hover) !important; }
.author-block { display: inline-block; margin-right: 0.5rem; }
.publication-venue {
  color: var(--text-secondary);
  width: fit-content;
  font-weight: 600;
  background: var(--background-accent);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  margin-top: 0.25rem;
  display: inline-block;
}
.eql-cntrb { font-size: 0.875rem; color: var(--text-light); font-style: italic; }

/* ---------- Section titles ---------- */
.title.is-3 {
  font-family: 'Inter', sans-serif !important;
  font-weight: 700 !important;
  color: var(--text-primary);
  margin-bottom: 2rem !important;
  position: relative;
  padding-bottom: 1rem;
}
.title.is-3::after {
  content: '';
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 60px; height: 3px;
  background: var(--gradient-accent);
  border-radius: 2px;
}
.title.is-4 { font-weight: 700 !important; color: var(--text-primary); margin-top: 1rem; }

/* ---------- Body text ---------- */
.content.has-text-justified { font-size: 1.1rem; line-height: 1.8; color: var(--text-secondary); }
.content.has-text-justified p { margin-bottom: 1.5rem; }
.content.has-text-justified b { color: var(--text-primary); }

/* ---------- Footer ---------- */
.footer { background: var(--background-secondary); border-top: 1px solid var(--border-color); padding: 3rem 1.5rem; }
.footer .content { color: var(--text-secondary); line-height: 1.7; }
.footer a { color: var(--primary-color); text-decoration: none; transition: var(--transition); }
.footer a:hover { color: var(--primary-hover); text-decoration: underline; }

/* ---------- BibTeX ---------- */
pre {
  background: var(--background-accent) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--border-radius) !important;
  padding: 1.5rem !important;
  font-size: 0.9rem !important;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
code {
  background: var(--background-accent) !important;
  color: var(--text-primary) !important;
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace !important;
}
.bibtex-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.copy-bibtex-btn {
  background: var(--primary-color); color: white; border: none;
  border-radius: var(--border-radius); padding: 0.75rem 1rem;
  font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: var(--transition);
  display: inline-flex; align-items: center; gap: 0.5rem;
}
.copy-bibtex-btn:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.copy-bibtex-btn.copied { background: #10b981; }

/* ---------- Scroll to top ---------- */
.scroll-to-top {
  position: fixed; bottom: 2rem; right: 2rem; width: 50px; height: 50px;
  background: var(--primary-color); color: white; border: none; border-radius: 50%;
  cursor: pointer; opacity: 0; visibility: hidden; transition: var(--transition); z-index: 999;
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem; box-shadow: var(--shadow-lg);
}
.scroll-to-top:hover { background: var(--primary-hover); transform: translateY(-3px); box-shadow: var(--shadow-xl); }
.scroll-to-top.visible { opacity: 1; visibility: visible; }

/* ---------- Page-load animation ---------- */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.hero, .section { animation: fadeInUp 0.6s ease-out; }

.button:focus, a:focus { outline: 2px solid var(--primary-color); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero, .section { animation: none; }
  .button, .copy-bibtex-btn, .scroll-to-top { transition: none !important; }
}

/* ------------------------------------------------------------------
   Figures, tables and videos (same breakout layout as CanonNav)
   ------------------------------------------------------------------ */

/* Bulma's .hero is a flex column, so let the container take its full width */
.hero .container.is-max-desktop { width: 100%; }

/* teaser (Fig. 1): wide figure, breaks out of the 960px column up to 1200px */
.teaser-figure {
  width: min(1200px, calc(100vw - 2rem));
  position: relative; left: 50%; transform: translateX(-50%);
  margin: 0;
}
.teaser-figure img { width: 100%; height: auto; display: block; border-radius: 8px; }
.teaser-figure figcaption { max-width: 960px; margin: 0.9rem auto 0; font-size: 0.95rem; line-height: 1.6; color: #4a5568; text-align: justify; }

/* wide figures (method overview, qualitative results): break out of the 960px column up to 1200px */
.method-figure, .wide-figure {
  width: min(1200px, calc(100vw - 2rem));
  position: relative; left: 50%; transform: translateX(-50%);
  margin: 0 0 2rem;
}
.method-figure img, .wide-figure img { width: 100%; height: auto; display: block; border-radius: 8px; }
.method-figure figcaption, .wide-figure figcaption {
  margin: 0.9rem auto 0; font-size: 0.95rem; line-height: 1.6; color: #4a5568; text-align: justify;
}

/* medium figure (FAR curve) */
.medium-figure { max-width: 720px; margin: 0 auto 2.5rem; }
.medium-figure img { width: 100%; height: auto; display: block; border-radius: 8px; }
.medium-figure figcaption { margin-top: 0.9rem; font-size: 0.95rem; line-height: 1.6; color: #4a5568; text-align: justify; }

/* results table */
.results-table-block {
  width: min(1100px, calc(100vw - 2rem));
  position: relative; left: 50%; transform: translateX(-50%);
  margin: 0 0 2.5rem;
}
.results-table { width: 100%; font-size: 0.9rem; }
.results-table th, .results-table td { text-align: center; vertical-align: middle; white-space: nowrap; padding: 0.45em 0.7em; }
.table.results-table th:not([align]), .table.results-table td { text-align: center; }
.table.results-table thead th:first-child, .table.results-table tbody td:first-child { text-align: left; }
.results-table thead th { border-bottom-width: 2px; }
.results-table tr.group-row td {
  text-align: left; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-light); background: var(--background-secondary); padding-top: 0.55em; padding-bottom: 0.35em;
}
.results-table tr.is-selected-ours td { background: #eef3ff; font-weight: 700; }
.results-table tr.is-ablation td { color: var(--text-secondary); }
.results-table td.sub { font-size: 0.8rem; color: var(--text-light); font-weight: 400; }
.table-caption { max-width: none; margin: 0.6rem auto 0; font-size: 0.9rem; line-height: 1.6; color: #4a5568; text-align: justify; }

/* real-world experiment videos: 2x2 grid, missed cases centred below */
.video-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.75rem 1.5rem;
  width: min(1200px, calc(100vw - 2rem));
  position: relative; left: 50%; transform: translateX(-50%);
  margin: 0.5rem 0 0;
}
.video-grid figure { margin: 0; min-width: 0; }
.video-grid video { width: 100%; height: auto; display: block; border-radius: 8px; background: #000; }
.video-grid figcaption { margin-top: 0.6rem; font-size: 0.95rem; line-height: 1.6; color: #4a5568; text-align: justify; }
.video-grid figcaption b { color: var(--text-primary); }
.video-grid .is-centered-half { grid-column: 1 / -1; width: calc(50% - 0.75rem); margin: 0 auto; }

/* unfinished content marker: remove the class once the real text is in */
.todo { text-decoration: underline dashed #d9480f; text-underline-offset: 4px; }

/* ---------- Responsive ---------- */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .hero-body { padding: 3rem 2rem; }
}
@media screen and (max-width: 768px) {
  .hero-body { padding: 2rem 1rem; }
  .publication-title { font-size: 2.5rem !important; line-height: 1.2 !important; margin-bottom: 1.5rem !important; }
  .publication-authors { font-size: 1rem !important; }
  .button { margin: 0.25rem !important; font-size: 0.875rem !important; padding: 0.75rem 1rem !important; }
  .teaser .hero-body { padding: 1rem; }
  .content.has-text-justified { font-size: 1rem; }
  .results-table { font-size: 0.8rem; }
  .video-grid { grid-template-columns: 1fr; }
  .video-grid .is-centered-half { width: 100%; }
}
@media screen and (max-width: 480px) {
  .publication-title { font-size: 2rem !important; }
  .hero-body { padding: 1.5rem 0.75rem; }
  .link-block { display: block; margin-bottom: 0.5rem; }
  .button { width: 100%; justify-content: center; }
}

@media print {
  .hero, .section { animation: none; }
  .scroll-to-top { display: none; }
  .button { background: transparent !important; color: var(--text-primary) !important; box-shadow: none !important; }
}
