/* ============================================================
   Nerfies-style project page — local overrides on top of Bulma
   Keep this file small. Most layout is handled by Bulma.
   ============================================================ */

:root {
  --fg: #2b2b2b;
  --fg-muted: #6b6b6b;
  --bg: #ffffff;
  --bg-soft: #f7f7f7;
  --rule: #ececec;
  --accent: #0b6cf2;          /* link color */
  --accent-soft: #eaf1ff;     /* table highlight row */
  --max-width: 980px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans', 'Google Sans', system-ui, -apple-system, BlinkMacSystemFont,
               'Segoe UI', Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Titles use Google Sans (Nerfies default). */
.title, .subtitle, h1, h2, h3, h4, h5, h6 {
  font-family: 'Google Sans', 'Noto Sans', system-ui, sans-serif;
  color: var(--fg);
}

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

/* ---------------- HERO ---------------- */
.hero { background: transparent; }
.hero-body { padding-top: 3rem; padding-bottom: 1.5rem; }

.conference {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 0.75rem;
}

.publication-title {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1.4rem !important;
}

@media (max-width: 768px) {
  .publication-title { font-size: 1.7rem; }
}

.publication-authors {
  margin-top: 0.4rem;
  line-height: 1.7;
}
.publication-authors .author-block { margin-right: 0.3rem; }
.publication-authors a { color: var(--fg); border-bottom: 1px solid transparent; }
.publication-authors a:hover { border-bottom-color: var(--accent); color: var(--accent); }

/* ---------------- BUTTONS ---------------- */
.publication-links {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}
.publication-links .link-block { display: inline-block; }
.publication-links .button.is-dark {
  background-color: #1f1f1f;
  border-color: #1f1f1f;
  color: #fff;
  transition: transform 0.08s ease, background-color 0.15s ease;
}
.publication-links .button.is-dark:hover {
  background-color: #000;
  transform: translateY(-1px);
}

/* ---------------- TEASER ---------------- */
.hero.teaser .hero-body { padding-top: 1rem; padding-bottom: 2rem; }
.teaser-media {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}
.hero.teaser .subtitle {
  margin-top: 1.2rem;
  color: var(--fg-muted);
  font-size: 1.05rem;
}

/* ---------------- SECTION RHYTHM ---------------- */
.section { padding: 2.5rem 1.5rem; }
.section + .section { border-top: 1px solid var(--rule); }
.section .title.is-3 {
  margin-bottom: 1.25rem !important;
  font-size: 1.8rem;
}

.content p, .content li { font-size: 1.02rem; }
.content em { color: #8a6d3b; } /* visually flag TODO placeholder copy */

/* ---------------- FIGURES ---------------- */
.figure-block {
  margin: 0 auto;
  max-width: var(--max-width);
}
.figure-block img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  background: var(--bg-soft);
}
.figure-block figcaption {
  margin-top: 0.75rem;
  font-size: 0.92rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

/* ---------------- RESULTS TABLE ---------------- */
.results-table {
  font-size: 0.95rem;
}
.results-table th {
  font-weight: 600;
  border-bottom: 2px solid #d8d8d8 !important;
}
.results-table tr.is-selected-row td {
  background-color: var(--accent-soft);
}
.results-table .ref {
  color: var(--fg-muted);
  font-size: 0.85em;
  margin-left: 0.15rem;
}

/* ---------------- BF16 vs OrbitQuant HERO COMPARISON ---------------- */
.hero-badge {
  display: inline-flex;
  align-items: stretch;
  font-family: 'Google Sans', 'Noto Sans', system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 999px;
  overflow: hidden;
  margin: 0.4rem 0 1.3rem;
  border: 1px solid rgba(11, 108, 242, 0.40);
  box-shadow: 0 1px 3px rgba(11, 108, 242, 0.10);
  user-select: none;
}
.hero-badge-name,
.hero-badge-claim {
  padding: 0.38rem 0.85rem;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.hero-badge-name {
  background: #fff;
  color: var(--accent);
  border-right: 1px solid rgba(11, 108, 242, 0.30);
}
.hero-badge-claim {
  background: var(--accent);
  color: #fff;
  letter-spacing: 0.05em;
}

.hero-vid-intro {
  max-width: 820px;
  margin: 0 auto 2rem;
  color: var(--fg-muted);
}
.hero-vid-headline {
  margin: 0 0 0.6rem;
  color: var(--fg);
  font-size: 1.08rem;
  font-weight: 500;
  line-height: 1.5;
}
.hero-vid-note {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.93rem;
  line-height: 1.55;
}
.hero-vid-footnote {
  max-width: 820px;
  margin: 2rem auto 0;
  color: var(--fg-muted);
  font-size: 0.96rem;
}

.hero-vid-row { margin-top: 2.5rem; }
.hero-vid-row:first-of-type { margin-top: 0.5rem; }

/* Override the 5-up grid to a 2-up grid for the hero comparison; videos
   render noticeably larger than the wider 5-method gallery below. */
.hero-vid-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 1rem !important;
  max-width: 1280px;
  margin: 0 auto;
}
.hero-vid-row .vid-cell {
  border-radius: 12px;
}
.hero-vid-row .vid-cell-label {
  top: 0.65rem;
  left: 0.75rem;
  font-size: 0.78rem;
  padding: 0.22rem 0.55rem;
}
.hero-vid-row .vid-clip {
  /* Native Wan 2.1-14B is 832x480; this stays at the same ratio just bigger. */
  aspect-ratio: 832 / 480;
}

@media (max-width: 720px) {
  /* On mobile the hero pair stacks vertically so each clip stays large
     enough to read motion artifacts. Horizontal scroll is reserved for
     the 5-method gallery below. */
  .hero-vid-grid {
    grid-template-columns: 1fr !important;
    grid-auto-flow: row !important;
    overflow: visible !important;
  }
}

/* ---------------- VIDEO GENERATION RESULTS ---------------- */
.vid-intro {
  max-width: 760px;
  margin: 0 auto 1.5rem;
  color: var(--fg-muted);
}
.vid-row {
  margin: 2.5rem auto 0;
  max-width: 100%;
}
.vid-row:first-of-type { margin-top: 0.5rem; }
.vid-row-header {
  margin-bottom: 0.6rem;
  padding: 0 0.25rem;
}
.vid-row-prompt {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--fg);
  font-style: italic;
}

/* Desktop / tablet: 5 equal columns. Mobile: horizontal scroll. */
.vid-row-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
}
.vid-cell {
  position: relative;
  background: #0f1115;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--rule);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.vid-cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 1;
}
.vid-cell-ours {
  border-color: rgba(11, 108, 242, 0.55);
  box-shadow: 0 0 0 1px rgba(11, 108, 242, 0.25) inset;
}
.vid-cell-ours:hover {
  box-shadow: 0 8px 24px rgba(11, 108, 242, 0.20),
              0 0 0 1px rgba(11, 108, 242, 0.55) inset;
}
.vid-cell-label {
  position: absolute;
  top: 0.45rem;
  left: 0.55rem;
  z-index: 2;
  font-family: 'Google Sans', 'Noto Sans', system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  padding: 0.18rem 0.45rem;
  border-radius: 4px;
  pointer-events: none;
}
.vid-cell-ours .vid-cell-label {
  background: rgba(11, 108, 242, 0.85);
}
.vid-clip {
  display: block;
  width: 100%;
  aspect-ratio: 832 / 480;   /* matches Wan 2.1-14B native ratio */
  object-fit: cover;
  background: #0f1115;
  cursor: zoom-in;
}

@media (max-width: 900px) {
  .vid-row-grid {
    grid-template-columns: repeat(5, 78vw);
    grid-auto-flow: column;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding-bottom: 0.5rem;
  }
  .vid-cell { scroll-snap-align: start; }
  .vid-row-prompt { font-size: 0.92rem; }
}

/* Shared video-row comparison modal */
.vid-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(8, 9, 12, 0.92);
  z-index: 1000;
  padding: 1.5rem;
}
.vid-modal.is-open { display: flex; }
.vid-modal-close {
  position: absolute;
  top: 0.9rem;
  right: 1.2rem;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 2.2rem;
  line-height: 1;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
}
.vid-modal-close:hover { background: rgba(255, 255, 255, 0.1); }
.vid-modal-body {
  width: min(98vw, 1600px);
  max-height: 92vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.vid-modal-prompt {
  margin: 0;
  text-align: center;
  color: #e7ecf2;
  font-size: 1rem;
  line-height: 1.5;
  font-style: italic;
}
.vid-modal-grid {
  /* `auto-flow: column` + `auto-columns: 1fr` lets the modal render whatever
     number of cells the source row had (2 for the BF16-vs-OrbitQuant hero,
     5 for the full method gallery) with cells evenly dividing the width. */
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 0.85rem;
}
.vid-modal-cell {
  position: relative;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.vid-modal-cell-ours {
  border-color: rgba(11, 108, 242, 0.6);
  box-shadow: 0 0 0 1px rgba(11, 108, 242, 0.35) inset;
}
.vid-modal-cell .vid-cell-label {
  background: rgba(0, 0, 0, 0.7);
}
.vid-modal-cell-ours .vid-cell-label {
  background: rgba(11, 108, 242, 0.9);
}
.vid-modal-cell video {
  display: block;
  width: 100%;
  aspect-ratio: 832 / 480;
  object-fit: contain;
  background: #000;
  cursor: auto;
}

@media (max-width: 900px) {
  .vid-modal { padding: 0.5rem; }
  .vid-modal-grid {
    grid-auto-columns: 82vw;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }
  .vid-modal-cell { scroll-snap-align: start; }
}

/* ---------------- QUALITATIVE RESULTS TABLE ---------------- */
.qual-subsection + .qual-subsection { margin-top: 3.5rem; }
.qual-subsection-title {
  margin-bottom: 0.6rem !important;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}

.qual-intro {
  max-width: 760px;
  margin: 0 auto 1.5rem;
  color: var(--fg-muted);
}
.qual-table-wrap {
  /* Horizontal scroll on tablet / mobile while keeping desktop static. */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--bg);
}
.qual-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
  table-layout: fixed;
  /* Force-min so columns don't squash below thumbnail size on narrow screens. */
  min-width: 920px;
}
.qual-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fafafa;
  border-bottom: 1px solid var(--rule);
  padding: 0.7rem 0.5rem;
  font-weight: 600;
  text-align: center;
  color: var(--fg);
  font-family: 'Google Sans', 'Noto Sans', system-ui, sans-serif;
  letter-spacing: 0.01em;
}
.qual-th-prompt {
  width: 220px;
  text-align: left !important;
  padding-left: 1rem !important;
}
.qual-th-method { width: 1fr; }
.qual-th-ours { color: var(--accent); }

.qual-table tbody tr + tr td { border-top: 1px solid var(--rule); }
.qual-table tbody tr:hover td { background: #fafbfd; }

.qual-prompt {
  vertical-align: middle;
  padding: 0.75rem 1rem;
  color: var(--fg);
  background: #fcfcfc;
  border-right: 1px solid var(--rule);
}
.qual-prompt-text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--fg);
  white-space: normal;
  overflow-wrap: anywhere;
}

.qual-cell {
  padding: 0.5rem;
  text-align: center;
  vertical-align: middle;
}
.qual-cell-ours { background: rgba(11, 108, 242, 0.04); }
.qual-table tbody tr:hover .qual-cell-ours { background: rgba(11, 108, 242, 0.07); }

.qual-thumb-btn {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  cursor: zoom-in;
  border-radius: 8px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.qual-thumb-btn:hover,
.qual-thumb-btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
  outline: none;
}
.qual-thumb {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--rule);
}

.qual-footnote {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--fg-muted);
}

/* ---------------- LIGHTBOX ---------------- */
.qual-lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 17, 21, 0.88);
  z-index: 1000;
  padding: 2rem;
}
.qual-lightbox.is-open { display: flex; }
.qual-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 2.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}
.qual-lightbox-close:hover { background: rgba(255, 255, 255, 0.1); }
.qual-lightbox-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  max-width: min(94vw, 1100px);
  max-height: 92vh;
}
.qual-lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  background: #000;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.qual-lightbox-caption {
  color: #e7ecf2;
  font-size: 0.95rem;
  text-align: center;
  max-width: 92ch;
  line-height: 1.5;
}
.qual-lightbox-caption .qual-lightbox-method {
  display: inline-block;
  font-weight: 600;
  color: #fff;
  margin-right: 0.5rem;
  padding: 0.1rem 0.5rem;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

@media (max-width: 768px) {
  .qual-table { font-size: 0.85rem; min-width: 760px; }
  .qual-th-prompt { width: 180px; }
  .qual-prompt-text { font-size: 0.86rem; }
  .qual-lightbox { padding: 1rem; }
}
@media (max-width: 480px) {
  .qual-table { min-width: 640px; }
  .qual-th-prompt { width: 150px; }
}

/* ---------------- BIBTEX ---------------- */
.bibtex-wrapper {
  position: relative;
  background: #0f1115;
  border-radius: 8px;
  padding: 1.1rem 1.2rem;
  overflow: hidden;
}
.bibtex-wrapper pre {
  background: transparent;
  color: #e7ecf2;
  padding: 0;
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  overflow-x: auto;
}
.bibtex-wrapper pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-family: 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace;
}
.copy-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  background: rgba(255, 255, 255, 0.08);
  color: #e7ecf2;
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.copy-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}
.copy-btn.is-copied {
  background: #1d8a4b;
  border-color: #1d8a4b;
  color: #fff;
}

/* ---------------- FOOTER ---------------- */
.footer {
  background: var(--bg-soft);
  padding: 1.5rem 1rem;
  margin-top: 1rem;
  color: var(--fg-muted);
}
.footer a { color: var(--fg); border-bottom: 1px solid var(--rule); }
.footer a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------------- SMALL SCREENS ---------------- */
@media (max-width: 600px) {
  .section { padding: 2rem 1rem; }
  .publication-links { gap: 0.4rem; }
  .publication-links .button { font-size: 0.9rem; }
  .bibtex-wrapper { padding: 1rem 0.85rem; }
  .copy-btn { top: 0.4rem; right: 0.4rem; }
}
