/* UltraTex project page — white background, black text */

:root {
  --bg: #ffffff;
  --bg-alt: #f7f7f7;
  --fg: #111111;
  --fg-mid: #444444;
  --fg-soft: #6b6b6b;
  --line: #e2e2e2;
  --line-strong: #cfcfcf;
  --accent: #111111;
  --radius: 6px;
  --maxw-wide: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
               Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--fg); text-decoration: none; border-bottom: 1px solid var(--line-strong); }
a:hover { border-bottom-color: var(--fg); }

sup { font-size: 0.7em; font-weight: 400; }
.dag { font-size: 0.75em; }

.container-wide { max-width: var(--maxw-wide); margin: 0 auto; padding: 0 24px; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}
@supports (backdrop-filter: blur(8px)) {
  .nav {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: saturate(140%) blur(10px);
  }
}
.nav-inner {
  max-width: var(--maxw-wide); margin: 0 auto; padding: 0 24px;
  height: 56px; display: flex; align-items: center; justify-content: space-between;
  gap: 18px;
}
.nav-brand {
  flex: 0 0 auto;
  font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; border: 0;
}
.nav-links { display: flex; gap: 22px; }
.nav-links a {
  font-size: 0.88rem; color: var(--fg-mid); border: 0; padding: 2px 0;
  border-bottom: 1px solid transparent;
}
.nav-links a:hover { color: var(--fg); border-bottom-color: var(--fg); }

/* ---------- hero ---------- */
.hero { padding: 64px 0 36px; text-align: center; }

.venue {
  display: inline-block;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-mid);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 5px 14px;
  margin-bottom: 26px;
}

.title {
  margin: 0;
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.subtitle {
  margin: 12px auto 34px;
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  font-weight: 400;
  color: var(--fg-mid);
  line-height: 1.4;
}

.authors {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 6px 22px; margin-bottom: 18px;
  font-size: 1.15rem;
}
.authors a { border-bottom: 1px solid transparent; }
.authors a:hover { border-bottom-color: var(--fg); }

.affils {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 4px 20px;
  font-size: 1.04rem; color: var(--fg-mid);
}
.note { margin-top: 11px; font-size: 0.96rem; color: var(--fg-soft); }

/* ---------- buttons ---------- */
.buttons {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 12px; margin-top: 32px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  background: var(--fg); color: #fff;
  border: 1px solid var(--fg); border-radius: 999px;
  min-width: 116px;
  padding: 10px 22px;
  font-size: 0.98rem; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.btn svg {
  width: 18px; height: 18px;
  fill: currentColor;
  flex: 0 0 auto;
}
.btn:hover { background: #fff; color: var(--fg); border-color: var(--fg); }

/* ---------- sections ---------- */
.section { padding: 62px 0; border-top: 1px solid var(--line); }
.section.alt { background: var(--bg-alt); }

.section h2 {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  font-weight: 700; letter-spacing: -0.02em;
}
.section-lead {
  margin: 0 0 34px;
  color: var(--fg-mid);
  font-size: 1.02rem;
  text-wrap: pretty;
}
.section h2 + .prose { margin-top: 24px; }

/* No measure cap: prose spans the full container so it lines up with the figure
   above it. A narrower text column next to a full-width image reads as a defect. */
.prose p { margin: 0 0 18px; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { font-weight: 650; }
.prose em { font-style: italic; }

/* ---------- teaser ---------- */
.teaser-section { padding: 8px 0 44px; }

/* ---------- figures ---------- */
.figure { margin: 0 0 8px; }
.figure img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
/* Line-art diagrams read better matted: white breathing room inside the frame
   so the drawing does not touch the border. Photos stay flush. */
.figure.matted img {
  padding: 26px 30px;
  box-sizing: border-box;
}
.figure figcaption {
  margin-top: 12px;
  font-size: 0.9rem; line-height: 1.55; color: var(--fg-soft);
  text-align: center;
}


/* ---------- stats ---------- */
.stats-section { padding: 0 0 52px; }
.stats {
  display: grid; gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.stat { background: #fff; padding: 22px 18px; text-align: center; }
.stat-num {
  font-size: clamp(1.2rem, 2.6vw, 1.6rem);
  font-weight: 700; letter-spacing: -0.02em;
}
.stat-lbl {
  margin-top: 4px;
  font-size: 0.83rem; color: var(--fg-soft); line-height: 1.4;
}

/* ---------- method cards ---------- */
.cards {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  margin-top: 42px;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 22px;
}
.card-idx {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.12em;
  color: var(--fg-soft); margin-bottom: 10px;
}
.card h3 {
  margin: 0 0 10px;
  font-size: 1.06rem; font-weight: 650; letter-spacing: -0.01em;
}
.card p { margin: 0; font-size: 0.92rem; line-height: 1.62; color: var(--fg-mid); text-wrap: pretty; }

/* Two-up variant: keep both cards on one row until they get genuinely narrow.
   min() keeps the 380px floor from overflowing viewports narrower than that. */
.cards.two { grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); }
.card h4 {
  margin: 0 0 10px;
  font-size: 1.06rem; font-weight: 650; letter-spacing: -0.01em;
}
.card-tag {
  display: inline-block;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  border: 1px solid var(--fg); border-radius: 999px;
  padding: 3px 10px; margin-bottom: 12px;
}
.card-tag.muted { border-color: var(--line-strong); color: var(--fg-soft); }

/* ---------- sub-headings inside a section ---------- */
.sub-h {
  margin: 46px 0 6px;
  font-size: 1.15rem; font-weight: 650; letter-spacing: -0.01em;
}
.sub-lead {
  margin: 0;
  font-size: 0.96rem; color: var(--fg-mid);
}
.sub-lead + .cards { margin-top: 20px; }

/* ---------- spec list ---------- */
.specs {
  margin: 18px 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}
.spec {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
}
.spec:last-child { border-bottom: 0; }
.spec dt { font-weight: 600; font-size: 0.92rem; }
.spec dd { margin: 0; font-size: 0.92rem; color: var(--fg-mid); }

/* ---------- dataset pipeline ---------- */
.pipeline-steps {
  display: flex; align-items: stretch; justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}
.pstep {
  flex: 1 1 0;              /* equal widths regardless of label length */
  min-width: 0;
  display: flex; flex-direction: column; justify-content: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
}
/* Emphasise the final count with an inset ring rather than a thicker border,
   so it stays exactly the same height as its siblings. */
.pstep.final {
  border-color: var(--fg);
  box-shadow: inset 0 0 0 1px var(--fg);
}
.parrow {
  flex: 0 0 auto;
  display: flex; align-items: center;
  color: var(--fg-soft); font-size: 1.1rem;
}
.pstep-n { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; }
.pstep-l { margin-top: 2px; font-size: 0.78rem; color: var(--fg-soft); line-height: 1.35; }


/* ---------- bibtex ---------- */
.bibtex-wrap { position: relative; margin-top: 22px; }
.bibtex-wrap pre {
  margin: 0;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--fg);
}
.copy-btn {
  position: absolute; top: 12px; right: 12px;
  background: #fff; color: var(--fg);
  border: 1px solid var(--line-strong); border-radius: 4px;
  padding: 5px 12px;
  font-size: 0.78rem; font-family: inherit; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.copy-btn:hover { background: var(--fg); color: #fff; border-color: var(--fg); }
.copy-btn.done { background: var(--fg); color: #fff; border-color: var(--fg); }

/* ---------- footer ---------- */
.footer {
  padding: 40px 0 52px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.86rem; color: var(--fg-soft);
}
.footer p { margin: 0 0 6px; }
.footer .copy { margin-top: 12px; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .hero { padding: 44px 0 28px; }
  /* Keep the nav on one row: scroll the links horizontally instead of wrapping
     them onto a second line, which would overlap the brand. */
  .nav-links {
    gap: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    mask-image: linear-gradient(to right, transparent 0, #000 10px);
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 10px);
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a { font-size: 0.82rem; white-space: nowrap; }
  .section { padding: 46px 0; }
  .figure figcaption { font-size: 0.85rem; }
  /* Stack the label above its value once 160px of gutter no longer fits. */
  .spec { grid-template-columns: 1fr; gap: 2px; }
  .sub-h { margin-top: 36px; }
}

/* The five filtering steps need ~150px each to keep their labels on one line.
   Below that, switch to a grid and drop the arrows: the descending counts already
   read as a funnel, and inline arrows cannot wrap cleanly mid-row. */
@media (max-width: 900px) {
  .pipeline-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .pstep { flex: none; }
  .parrow { display: none; }
}

@media (max-width: 560px) {
  .pipeline-steps { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
