/* ===========================================================
   Collaborative Manipulation Using Density Functions on the Go2
   Project page stylesheet
   =========================================================== */

:root {
  --max-width: 980px;
  --bg: #ffffff;
  --bg-alt: #f6f7f9;
  --text: #1c1e21;
  --text-muted: #55595f;
  --border: #e3e5e8;
  --accent: #8a3ffc;
  --accent-dark: #6929c4;
  --accent-bg: #f3ecff;
  --code-bg: #f0f0f3;
  --table-head-bg: #efeafd;
  --shadow: 0 1px 3px rgba(20, 20, 30, 0.08), 0 1px 2px rgba(20, 20, 30, 0.06);
  --radius: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16171a;
    --bg-alt: #1e2024;
    --text: #e7e8ea;
    --text-muted: #a3a7ad;
    --border: #303338;
    --accent: #b18cff;
    --accent-dark: #cbb1ff;
    --accent-bg: #2a2440;
    --code-bg: #232529;
    --table-head-bg: #2a2440;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

:root[data-theme="dark"] {
  --bg: #16171a;
  --bg-alt: #1e2024;
  --text: #e7e8ea;
  --text-muted: #a3a7ad;
  --border: #303338;
  --accent: #b18cff;
  --accent-dark: #cbb1ff;
  --accent-bg: #2a2440;
  --code-bg: #232529;
  --table-head-bg: #2a2440;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent-dark); text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }

/* ---------- Top nav ---------- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topnav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 12px;
  padding-bottom: 12px;
}
.topnav .brand {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  text-decoration: none;
}
.topnav nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 0.92rem;
}
.topnav nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
}
.topnav nav a:hover { color: var(--accent-dark); }

/* ---------- Hero ---------- */
.hero {
  padding: 64px 0 32px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.6rem, 3.2vw, 2.35rem);
  line-height: 1.28;
  margin: 0 auto 22px;
  max-width: 820px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.hero-videos {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 18px;
  max-width: 920px;
  margin: 28px auto 8px;
}
.hero-videos figure { margin: 0; }
.hero-videos video {
  width: 100%;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.hero-videos figcaption {
  margin-top: 8px;
  font-size: 0.92rem;
  color: var(--text-muted);
  text-align: center;
}
@media (max-width: 680px) {
  .hero-videos { grid-template-columns: 1fr; }
}
.authors {
  font-size: 1.05rem;
  margin: 0 0 6px;
}
.authors a { color: var(--text); text-decoration: none; border-bottom: 1px dotted var(--text-muted); }
.affiliation {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0 0 8px;
}
.venue {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-dark);
  background: var(--accent-bg);
  padding: 5px 12px;
  border-radius: 999px;
}

.link-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 26px 0 8px;
}
.hero .section-kicker { text-align: center; }
.contrib-list {
  text-align: justify;
  text-align-last: left;
  max-width: 760px;
  margin: 14px auto 8px;
  padding-left: 22px;
  color: var(--text);
}
.contrib-list li {
  margin-bottom: 10px;
  line-height: 1.55;
  font-size: 0.98rem;
}
.contrib-list li:last-child { margin-bottom: 0; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.btn:hover {
  border-color: var(--accent);
  color: var(--text);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

/* ---------- Sections ---------- */
section {
  padding: 44px 0;
  border-top: 1px solid var(--border);
}
section:first-of-type { border-top: none; }

h2.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
  text-align: left;
}
.section-kicker {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: 8px;
  text-align: left;
}
.section-lede {
  color: var(--text-muted);
  margin: 0 0 28px;
  text-align: justify;
  text-align-last: left;
}

/* ---------- Abstract ---------- */
.abstract-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  font-family: var(--serif);
  font-size: 1.03rem;
  line-height: 1.75;
  color: var(--text);
}
.abstract-card strong { font-family: var(--sans); }

/* ---------- Figure blocks ---------- */
figure { margin: 0; }
figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
}
figcaption {
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: left;
  line-height: 1.5;
}
figcaption b { color: var(--text); }

.arch-figure { max-width: 620px; margin: 0 auto; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 760px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ---------- Headline result blocks ---------- */
.headline-block {
  margin-bottom: 48px;
}
.headline-block:last-child { margin-bottom: 0; }
.headline-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.headline-head h3 {
  font-size: 1.2rem;
  margin: 0;
  font-weight: 800;
}
.stat-pill {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-dark);
  background: var(--accent-bg);
  border-radius: 999px;
  padding: 4px 12px;
}
.headline-media {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 800px) {
  .headline-media { grid-template-columns: 1fr; }
}
video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #000;
}
.headline-side figure + figure { margin-top: 14px; }
.headline-note {
  margin-top: 14px;
  font-size: 0.94rem;
  color: var(--text-muted);
}
.headline-note b { color: var(--text); }

/* ---------- Gallery ---------- */
.gallery-group { margin-bottom: 36px; }
.gallery-group:last-child { margin-bottom: 0; }
.gallery-group h3 {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 4px;
}
.gallery-group .gallery-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 16px;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
@media (max-width: 900px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .gallery-grid { grid-template-columns: 1fr; }
}
.gallery-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-alt);
  box-shadow: var(--shadow);
}
.gallery-card video { border-radius: 0; border: none; display: block; }
.gallery-card .card-body { padding: 12px 14px 14px; }
.gallery-card h4 {
  margin: 0 0 4px;
  font-size: 0.96rem;
  font-weight: 700;
}
.gallery-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent-dark);
  background: var(--accent-bg);
  border-radius: 6px;
  padding: 2px 7px;
}

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 560px;
  font-size: 0.92rem;
}
caption {
  caption-side: top;
  text-align: left;
  font-size: 0.88rem;
  color: var(--text-muted);
  padding: 10px 14px 0;
}
thead th {
  background: var(--table-head-bg);
  color: var(--text);
  text-align: left;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-alt); }
td.num, th.num { text-align: right; font-family: var(--mono); }
.table-note {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---------- Baseline section ---------- */
.baseline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
@media (max-width: 760px) { .baseline-grid { grid-template-columns: 1fr; } }
.baseline-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-alt);
}
.baseline-card video { border-radius: 0; border: none; }
.baseline-card .card-body { padding: 14px 16px; }
.baseline-card h4 { margin: 0 0 6px; font-size: 1rem; }
.baseline-card p { margin: 0; font-size: 0.88rem; color: var(--text-muted); }

.callout {
  border-left: 3px solid var(--accent);
  background: var(--accent-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
  font-size: 0.94rem;
  margin-top: 8px;
}
.callout b { color: var(--text); }

/* ---------- Limitations ---------- */
.limitation-box {
  border: 1px solid var(--border);
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 20px 24px;
  font-size: 0.96rem;
  color: var(--text);
}
.limitation-box p:first-child { margin-top: 0; }
.limitation-box p:last-child { margin-bottom: 0; }

/* ---------- BibTeX ---------- */
.bibtex-wrap {
  position: relative;
}
pre.bibtex {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--text);
}
.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent-dark); }

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 0 60px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}
footer a { color: var(--text-muted); }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 14, 0.86);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.lightbox.open { display: flex; }
.lightbox video, .lightbox img {
  max-width: min(92vw, 1100px);
  max-height: 86vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lightbox-close {
  position: absolute;
  top: 22px;
  right: 26px;
  color: #fff;
  font-size: 1.8rem;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
}

.zoomable { cursor: zoom-in; }
