/* ===== Top-Conf Figure Gallery ===== */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --ink: #141a2a;
  --ink-soft: #5b6478;
  --line: #e6e9f2;
  --iclr: #4f46e5;
  --icml: #0d9488;
  --neurips: #e11d48;
  --cvpr: #f97316;
  --acl: #2563eb;
  --aaai: #7c3aed;
  --accent: #4f46e5;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(28, 35, 51, .05), 0 8px 24px -12px rgba(28, 35, 51, .18);
  --shadow-hover: 0 2px 4px rgba(28, 35, 51, .06), 0 20px 44px -16px rgba(28, 35, 51, .28);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Hero (scrolls away) ---------- */
.hero {
  background:
    radial-gradient(1100px 300px at 10% -140px, rgba(79, 70, 229, .14), transparent 60%),
    radial-gradient(900px 260px at 90% -150px, rgba(225, 29, 72, .10), transparent 60%),
    linear-gradient(180deg, #ffffff 0%, #f6f7fb 100%);
  border-bottom: 1px solid var(--line);
}
.hero-inner { max-width: 1320px; margin: 0 auto; padding: 16px 28px 13px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, #4f46e5, #0d9488 55%, #e11d48);
  display: grid; place-items: center;
  box-shadow: 0 6px 18px -6px rgba(79, 70, 229, .55);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.92); display: inline-block; margin: 0 1.5px; }
h1 { margin: 0; font-size: 21px; letter-spacing: .2px; font-weight: 800; }
.tagline { margin: 1px 0 0; font-size: 12.5px; color: var(--ink-soft); }
.vn { font-weight: 700; padding: 0 1px; }
.vn.iclr { color: var(--iclr); } .vn.icml { color: var(--icml); }
.vn.neurips { color: var(--neurips); } .vn.cvpr { color: var(--cvpr); }
.vn.acl { color: var(--acl); } .vn.aaai { color: var(--aaai); }

.intro { margin: 9px 0 0; font-size: 13px; color: var(--ink-soft); max-width: 1080px; line-height: 1.62; }
.intro b { color: var(--ink); font-weight: 700; }
.hl-num {
  font-size: 16px; font-weight: 800; color: var(--accent);
  background: rgba(79, 70, 229, .09); border-radius: 6px; padding: 1px 7px; margin-right: 2px;
}

/* ---------- Sticky control bar ---------- */
.stickbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(1.25) blur(10px);
  -webkit-backdrop-filter: saturate(1.25) blur(10px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 18px -14px rgba(28, 35, 51, .35);
}
.stickbar-inner { max-width: 1320px; margin: 0 auto; padding: 9px 28px 8px; display: flex; flex-direction: column; gap: 6px; }
.stick-row { display: flex; align-items: center; gap: 14px; }
.search-box {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 0 11px; color: #8a93a8;
}
.search-box:focus-within { border-color: rgba(79, 70, 229, .55); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.search-box input {
  flex: 1; border: 0; outline: 0; background: transparent;
  padding: 8px 0; font-size: 13.5px; color: var(--ink); min-width: 0;
}
.clear-btn { border: 0; background: #eef0f7; color: #6b7488; width: 20px; height: 20px; border-radius: 50%; font-size: 14px; line-height: 1; cursor: pointer; flex-shrink: 0; }
.clear-btn:hover { background: #e2e5ef; color: var(--ink); }
.result-count { font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; }
.result-count b { color: var(--ink); font-size: 13.5px; }
.sort-wrap { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #98a0b3; white-space: nowrap; }
.sort-wrap select {
  border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font-size: 12.5px;
  background: var(--surface); color: var(--ink); cursor: pointer;
}

.filter-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.filter-label { font-size: 11px; color: #98a0b3; width: auto; flex-shrink: 0; letter-spacing: .3px; font-weight: 600; }
.filter-label.sep { margin-left: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  padding: 3px 11px; border-radius: 999px; font-size: 12px; cursor: pointer;
  transition: all .15s ease; user-select: none; line-height: 1.5;
}
.chip:hover { border-color: #c6ccdd; color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.active[data-venue="iclr"] { background: var(--iclr); border-color: var(--iclr); }
.chip.active[data-venue="icml"] { background: var(--icml); border-color: var(--icml); }
.chip.active[data-venue="neurips"] { background: var(--neurips); border-color: var(--neurips); }
.chip.active[data-venue="cvpr"] { background: var(--cvpr); border-color: var(--cvpr); }
.chip.active[data-venue="acl"] { background: var(--acl); border-color: var(--acl); }
.chip.active[data-venue="aaai"] { background: var(--aaai); border-color: var(--aaai); }
.chip .n { opacity: .65; font-size: 10.5px; margin-left: 3px; }

/* ---------- Gallery ---------- */
.container { max-width: 1320px; margin: 0 auto; padding: 20px 28px 60px; }
.masonry { column-count: 4; column-gap: 18px; }
@media (max-width: 1180px) { .masonry { column-count: 3; } }
@media (max-width: 860px)  { .masonry { column-count: 2; } }
@media (max-width: 540px)  { .masonry { column-count: 1; } .hero-inner { padding: 13px 16px 10px; } .stickbar-inner { padding: 8px 16px 7px; } .container { padding: 14px 16px 40px; } .filter-label.sep { margin-left: 0; } }

.card {
  break-inside: avoid; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; cursor: zoom-in;
  box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  display: block;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: #d6dbe9; }

/* image slot: reserved aspect ratio + shimmer while loading */
.img-slot {
  position: relative; width: 100%;
  background:
    linear-gradient(100deg, #eef1f7 30%, #f7f9fc 45%, #eef1f7 60%);
  background-size: 220% 100%;
  animation: tc-shimmer 1.5s linear infinite;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
@keyframes tc-shimmer { to { background-position: -120% 0; } }
.card-img {
  width: 100%; display: block; position: absolute; inset: 0;
  opacity: 0; transition: opacity .35s ease;
}
.card-img.loaded { opacity: 1; }
.img-slot.loaded { animation: none; background: #fff; }
.img-slot.img-failed { animation: none; background: #f3f4f8; }
.img-failed::after {
  content: "Image unavailable · 点击重试"; position: absolute; inset: 0;
  display: grid; place-items: center; font-size: 12px; color: #98a0b3;
}
.card-body { padding: 12px 14px 13px; }
.card-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 7px; }
.badge {
  font-size: 11px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase;
  padding: 2.5px 9px; border-radius: 999px; color: #fff;
}
.badge.iclr { background: var(--iclr); }
.badge.icml { background: var(--icml); }
.badge.neurips { background: var(--neurips); }
.badge.cvpr { background: var(--cvpr); }
.badge.acl { background: var(--acl); }
.badge.aaai { background: var(--aaai); }
.badge.year { background: #eef0f7; color: #59617a; text-transform: none; letter-spacing: 0; }
.badge.pattern { background: #fff4e6; color: #b45309; text-transform: none; letter-spacing: .3px; font-weight: 600; }
.card-title { margin: 0; font-size: 13.5px; line-height: 1.45; font-weight: 600; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-authors { margin: 6px 0 0; font-size: 11.5px; color: #8a93a8;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-link { margin-top: 8px; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.card:hover .card-link { text-decoration: underline; }

.empty-state { text-align: center; padding: 90px 20px; color: var(--ink-soft); }
.empty-emoji { font-size: 42px; margin-bottom: 10px; }
.ghost-btn, .primary-btn {
  display: inline-block; border-radius: 10px; padding: 9px 18px; font-size: 13.5px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600;
}
.ghost-btn:hover { border-color: #c6ccdd; text-decoration: none; }
.primary-btn { background: var(--accent); border-color: var(--accent); color: #fff; }
.primary-btn:hover { text-decoration: none; filter: brightness(1.07); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: #fff; margin-top: 20px; }
.footer-inner { max-width: 1320px; margin: 0 auto; padding: 30px 28px 40px; display: grid; grid-template-columns: 1.7fr 1fr; gap: 40px; }
.site-footer h3 { font-size: 14px; margin: 0 0 10px; }
.site-footer p { font-size: 12.5px; color: var(--ink-soft); margin: 0 0 10px; }
.pattern-legend { list-style: none; padding: 0; margin: 0; font-size: 12.5px; color: var(--ink-soft); }
.pattern-legend li { padding: 2.5px 0; }
.pattern-legend b { color: var(--ink); font-family: ui-monospace, Consolas, monospace; }
.repo-note code { background: #f1f3f9; border-radius: 5px; padding: 1px 6px; font-size: 11.5px; }
@media (max-width: 760px) { .footer-inner { grid-template-columns: 1fr; gap: 22px; } }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 30px; }
.lightbox[hidden] { display: none; }
.lightbox-backdrop { position: absolute; inset: 0; background: rgba(20, 24, 36, .66); backdrop-filter: blur(3px); }
.lightbox-dialog {
  position: relative; background: #fff; border-radius: 18px; max-width: 1080px; width: 100%;
  max-height: 92vh; overflow: auto; box-shadow: 0 40px 90px -20px rgba(0,0,0,.5);
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr);
}
.lightbox-close {
  position: absolute; top: 10px; right: 12px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.92); color: #333; font-size: 20px; line-height: 1;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
}
.lightbox-img-wrap { background: #fbfbfd; display: grid; place-items: center; padding: 18px; border-right: 1px solid var(--line); }
.lightbox-img-wrap img { max-width: 100%; max-height: 78vh; object-fit: contain; border-radius: 8px; }
.lightbox-meta { padding: 26px 24px; display: flex; flex-direction: column; gap: 12px; }
.lb-badges { display: flex; gap: 7px; flex-wrap: wrap; }
.lightbox-meta h2 { margin: 0; font-size: 17px; line-height: 1.4; }
.lb-authors { margin: 0; font-size: 13px; color: var(--ink-soft); }
.lb-actions { margin-top: auto; display: flex; gap: 10px; flex-wrap: wrap; padding-top: 14px; }
@media (max-width: 860px) {
  .lightbox { padding: 12px; }
  .lightbox-dialog { grid-template-columns: 1fr; max-height: 94vh; }
  .lightbox-img-wrap { border-right: 0; border-bottom: 1px solid var(--line); }
  .lightbox-img-wrap img { max-height: 52vh; }
}

/* ===== infinite scroll + lightbox nav (v2) ===== */
.sentinel { text-align: center; padding: 28px 0 8px; color: var(--muted, #7a8196); font-size: 14px; }
.spinner {
  display: inline-block; width: 15px; height: 15px; margin-right: 8px; vertical-align: -2px;
  border: 2px solid #d7dbec; border-top-color: #5b6ee1; border-radius: 50%;
  animation: tc-spin .8s linear infinite;
}
@keyframes tc-spin { to { transform: rotate(360deg); } }
.end-hint { text-align: center; padding: 22px 0 40px; color: #9aa1b5; font-size: 13px; letter-spacing: .04em; }
.lightbox-nav {
  position: fixed; top: 50%; transform: translateY(-50%); z-index: 1001;
  width: 48px; height: 48px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.92); color: #23294a; font-size: 30px; line-height: 1;
  box-shadow: 0 6px 22px rgba(20,24,60,.28);
}
.lightbox-nav:hover { background: #fff; }
.lightbox-nav.prev { left: 18px; }
.lightbox-nav.next { right: 18px; }
