/* ==========================================================================
   CLEAR project page
   Visual language follows the KC Machine Learning Lab project pages
   (e.g. jude.kc-ml2.com): Poppins for body text, Source Sans 3 for headings,
   #df3079 accent, 900px container, light-grey cover, square uppercase buttons.
   ========================================================================== */

:root {
  --font-body: "Poppins", "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-head: "Source Sans 3", "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, Monaco, monospace;

  --fg: #222;
  --fg-muted: #666;
  --fg-faint: #999;
  --primary: #df3079;
  --primary-soft: #fdf1f7;
  --em: #f0506e;
  --border: #e5e5e5;
  --bg-alt: #f5f5f5;
  --bg-soft: #f8f8f8;

  --maxw: 900px;
  --radius: 0;
  --shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--fg);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; cursor: pointer; }
a:hover { color: var(--primary); text-decoration: underline; }
b, strong { font-weight: 600; }
em { color: var(--em); }
code { font-family: var(--font-mono); font-size: 0.875rem; color: var(--em); background: var(--bg-soft); padding: 2px 6px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- cover / hero ---------- */
.hero {
  background: var(--bg-alt);
  padding: 40px 0 48px;
  text-align: center;
}
.hero .title {
  font-family: var(--font-head);
  font-size: 2rem;
  line-height: 1.3;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 20px;
}
.venue-label {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border-radius: 100px;
  padding: 3px 14px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.hero .authors {
  font-size: 1rem;
  margin: 0 0 4px;
  color: var(--fg);
}
.hero .authors sup, .hero .affiliation sup { font-size: 0.7em; }
.hero .affiliation { font-size: 0.95rem; color: var(--fg-muted); margin: 0 0 26px; }

.buttons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 0; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 30px;
  height: 38px;
  line-height: 38px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn:hover { color: var(--primary); border-color: var(--primary); text-decoration: none; background: #fff; }
.btn svg { width: 18px; height: 18px; fill: currentColor; flex: none; }

figure.teaser { margin: 0 auto; max-width: 100%; }
figure.teaser img {
  display: block;
  width: 100%;
  background: #fff;
  box-shadow: var(--shadow);
}
figure.teaser figcaption {
  font-size: 0.8125rem;
  color: var(--fg-muted);
  margin-top: 12px;
  text-align: center;
}

/* ---------- top navigation ---------- */
.toc {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.toc .wrap { display: flex; gap: 26px; justify-content: center; padding: 10px 20px; flex-wrap: wrap; }
.toc a {
  color: var(--fg-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 0;
  border-bottom: 2px solid transparent;
}
.toc a:hover { color: var(--primary); text-decoration: none; }
.toc a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- section headings (line style) ---------- */
.section { padding: 40px 0; }
.section.alt { background: var(--bg-alt); }
.section h2 {
  font-family: var(--font-head);
  font-size: 2rem;
  line-height: 1.3;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 24px;
  text-align: center;
  overflow: hidden;
}
.section h2 > span { display: inline-block; position: relative; padding: 0 18px; }
.section h2 > span::before,
.section h2 > span::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 2000px;
  border-bottom: 1px solid var(--border);
}
.section h2 > span::before { right: 100%; margin-right: 12px; }
.section h2 > span::after { left: 100%; margin-left: 12px; }
.section h3 {
  font-family: var(--font-head);
  font-size: 1.5rem;
  line-height: 1.4;
  font-weight: 700;
  margin: 36px 0 14px;
}
.lead { font-size: 1rem; color: var(--fg-muted); }
.abstract-text { font-size: 1rem; }
.small { font-size: 0.8125rem; color: var(--fg-muted); }
.caption { font-size: 0.8125rem; color: var(--fg-muted); margin: 12px 2px 0; }

/* ---------- figures ---------- */
.fig { margin: 28px 0 8px; }
.fig img {
  display: block;
  width: 100%;
  background: #fff;
  padding: 12px;
  box-shadow: var(--shadow);
}
.fig figcaption { font-size: 0.8125rem; color: var(--fg-muted); margin-top: 14px; }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin: 26px 0 6px; }
.card { background: #fff; padding: 20px 22px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 8px; font-size: 1.125rem; }
.card p { margin: 0; font-size: 0.9375rem; color: var(--fg-muted); }

.feature-list { font-size: 1rem; }
.feature-list li { margin-bottom: 8px; }

/* ---------- wipe slider ---------- */
.gallery-toolbar { margin: 22px 0 26px; }
.wipe {
  position: relative;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  aspect-ratio: 3 / 2;
  background: #eee;
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
}
/* both halves use the same geometry, so the seam is exactly on the divider */
.wipe img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}
.wipe .wipe-base { z-index: 1; }
.wipe .wipe-overlay { z-index: 2; clip-path: inset(0 50% 0 0); }
.wipe-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  z-index: 3;
}
.wipe-handle span {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  color: var(--fg);
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wipe-label {
  position: absolute;
  bottom: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(34, 34, 34, 0.8);
  padding: 4px 10px;
  pointer-events: none;
  z-index: 4;
}
.wipe-label.left { left: 12px; }
.wipe-label.right { right: 12px; }

/* ---------- gallery ---------- */
.gallery { margin-top: 18px; }
.scene-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; justify-content: center; }
.scene-tab {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--fg-muted);
  border-radius: 100px;
  padding: 6px 16px;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.scene-tab:hover { border-color: var(--primary); color: var(--primary); }
.scene-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }


.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.method-card {
  position: relative;
  margin: 0;
  background: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.method-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14); }
/* each tile is one pre-composited image: input (left) | result (right), 50/50 */
.method-card img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: #eee;
}
.method-card.selected { box-shadow: 0 0 0 2px var(--primary), var(--shadow); }
.method-card .overlay {
  position: absolute;
  top: 0;
  right: 0;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(34, 34, 34, 0.8);
  display: flex;
  align-items: center;
  gap: 7px;
}
.method-card .overlay .tag {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 3px;
  padding: 0 4px;
}
.method-card .expand {
  position: absolute;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  color: #fff;
  background: rgba(34, 34, 34, 0.8);
  border: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.method-card:hover .expand { opacity: 1; }
.method-card .expand:hover { background: var(--primary); }

/* ---------- tables ---------- */
.table-card {
  background: #fff;
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin: 16px 0 8px;
  overflow-x: auto;
}
.data-table { border-collapse: collapse; width: 100%; font-size: 0.8125rem; }
.data-table th, .data-table td { padding: 6px 10px; text-align: center; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table thead th { font-weight: 600; color: var(--fg); border-bottom: 1px solid var(--fg); }
.data-table th.left, .data-table td.left { text-align: left; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .ours { color: var(--primary); font-weight: 600; }
.data-table tbody tr.hi { background: var(--primary-soft); font-weight: 600; color: var(--primary); }
.data-table .ds-row td { background: var(--bg-alt); font-weight: 700; text-align: left; }
.data-table.compact { font-size: 0.8125rem; }
.data-table b { font-weight: 700; }
.data-table u { text-decoration-color: var(--fg-faint); text-underline-offset: 3px; }
.data-table .num { font-variant-numeric: tabular-nums; }

/* ---------- bibtex ---------- */
.bibtex { position: relative; }
.bibtex pre {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 18px 20px;
  overflow-x: auto;
  white-space: pre-wrap;
}
.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #fff;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px 14px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
}
.copy-btn:hover { color: var(--primary); border-color: var(--primary); }
.copy-btn.done { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 18, 0.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  z-index: 100;
  padding: 28px;
}
.lightbox[hidden] { display: none; }
.lightbox #lightboxFigure { max-width: 1200px; width: 100%; }
.lightbox .lb-split {
  display: flex;
  gap: 3px;
  align-items: stretch;
  justify-content: center;
}
.lightbox .lb-split figure { margin: 0; flex: 1 1 0; min-width: 0; }
.lightbox .lb-split img {
  display: block;
  width: 100%;
  max-height: 76vh;
  object-fit: contain;
  background: #fff;
}
.lightbox .lb-split figcaption {
  color: #cfd8e4;
  font-size: 0.8125rem;
  margin-top: 10px;
  text-align: center;
}
.lightbox .lb-single img {
  display: block;
  max-width: 94vw;
  max-height: 80vh;
  background: #fff;
}
.lightbox #lightboxCap {
  color: #8f9bab;
  font-size: 0.8125rem;
  margin: 14px 0 0;
  text-align: center;
}
.lightbox-close {
  position: absolute;
  top: 14px;
  right: 22px;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
}

/* ---------- footer ---------- */
footer {
  background: var(--bg-alt);
  color: var(--fg-muted);
  text-align: center;
  padding: 30px 0 36px;
  font-size: 0.875rem;
}
footer a { color: var(--primary); }
footer p { margin: 4px 0; }
footer .small { font-size: 0.8125rem; }

@media (max-width: 640px) {
  .section { padding: 32px 0; }
  .hero { padding: 30px 0 36px; }
  .section h2 { font-size: 1.7rem; }
  .method-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .btn { padding: 0 18px; }
}
