/* Microsoft Research / Fluent-inspired theme */
:root {
  --bg: #ffffff;
  --bg-alt: #faf9f8;
  --surface: #ffffff;
  --surface-alt: #f3f2f1;
  --border: #e1dfdd;
  --text: #201f1e;
  --heading: #17253d;
  --muted: #605e5c;
  --accent: #0078d4;
  --accent-hover: #106ebe;
  --accent-dark: #005a9e;
  --accent-soft: #eff6fc;
  --radius: 4px;
  --radius-lg: 8px;
  --maxw: 1120px;
  --shadow: 0 1.6px 3.6px rgba(0,0,0,0.08), 0 0.3px 0.9px rgba(0,0,0,0.06);
  --shadow-lg: 0 6.4px 14.4px rgba(0,0,0,0.10), 0 1.2px 3.6px rgba(0,0,0,0.07);
}

/* ---------- Dark theme (MSR blue accent) ---------- */
[data-theme="dark"] {
  --bg: #1b1a19;
  --bg-alt: #201f1e;
  --surface: #252423;
  --surface-alt: #2d2c2b;
  --border: #3b3a39;
  --text: #f3f2f1;
  --heading: #ffffff;
  --muted: #a19f9d;
  --accent: #479ef5;
  --accent-hover: #62abf5;
  --accent-dark: #2886de;
  --accent-soft: rgba(71, 158, 245, 0.14);
  --shadow: 0 1.6px 3.6px rgba(0,0,0,0.34), 0 0.3px 0.9px rgba(0,0,0,0.28);
  --shadow-lg: 0 6.4px 14.4px rgba(0,0,0,0.40), 0 1.2px 3.6px rgba(0,0,0,0.30);
}
[data-theme="dark"] .hero {
  background: linear-gradient(180deg, rgba(71,158,245,0.10) 0%, var(--bg) 62%);
}
[data-theme="dark"] tbody tr:nth-child(even) { background: rgba(255,255,255,0.02); }
[data-theme="dark"] .fig-row.equal-contain img { background: var(--surface); }
[data-theme="dark"] figure img { background: #2d2c2b; }

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Segoe UI Variable", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.5rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav-brand {
  color: var(--heading);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.01em;
}
.nav-links { display: flex; gap: 1.6rem; flex-wrap: wrap; align-items: center; }
.nav-links a { color: var(--muted); font-size: 0.92rem; font-weight: 400; }
.nav-links a:hover { color: var(--accent); text-decoration: none; }

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-icon { width: 16px; height: 16px; display: block; position: relative; }
/* Moon (shown in light mode -> click for dark) */
.theme-icon::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset -4px -3px 0 0 currentColor;
  transform: rotate(-40deg);
}
/* Sun (shown in dark mode -> click for light) */
[data-theme="dark"] .theme-icon::before {
  box-shadow: none;
  inset: 3px;
  background: currentColor;
}
[data-theme="dark"] .theme-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% -12%, currentColor 0 1.4px, transparent 2px),
    radial-gradient(circle at 50% 112%, currentColor 0 1.4px, transparent 2px),
    radial-gradient(circle at -12% 50%, currentColor 0 1.4px, transparent 2px),
    radial-gradient(circle at 112% 50%, currentColor 0 1.4px, transparent 2px);
}

body { transition: background 0.2s ease, color 0.2s ease; }

/* ---------- Hero ---------- */
.hero {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--accent-soft) 0%, #ffffff 62%);
}
.hero-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 3.5rem 1.5rem 1.5rem;
  text-align: center;
}
.venue {
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 600;
}
.venue:empty { display: none; }
.hero h1 {
  color: var(--heading);
  font-size: clamp(1.7rem, 3.6vw, 2.7rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.authors {
  max-width: 800px;
  margin: 1.5rem auto 0.35rem;
  color: var(--text);
  font-size: 1.05rem;
}
.affiliation { color: var(--muted); font-size: 0.98rem; }

.btn-row {
  display: flex;
  gap: 0.7rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.7rem;
}
.btn {
  display: inline-block;
  padding: 0.6rem 1.3rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--accent);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; text-decoration: none; box-shadow: var(--shadow); }
.btn-ghost {
  background: #ffffff;
  color: var(--accent);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-dark); }

.hero-figs {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.2rem 1.5rem 3rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}

/* ---------- Sections ---------- */
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 3.2rem 1.5rem;
}
.section.alt {
  max-width: none;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.section.alt > * { max-width: calc(var(--maxw) - 3rem); margin-left: auto; margin-right: auto; }
.section h2 {
  color: var(--heading);
  font-size: 1.55rem;
  font-weight: 600;
  margin-bottom: 1rem;
  position: relative;
  padding-left: 0.85rem;
}
.section h2::before {
  content: "";
  position: absolute;
  left: 0; top: 0.18em; bottom: 0.18em;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
}
.section p { color: var(--text); max-width: 840px; }
.section .sub {
  color: var(--heading);
  margin: 2.2rem auto 1rem;
  font-size: 1.15rem;
  font-weight: 600;
  position: relative;
  padding-left: 0.85rem;
}
.section .sub::before {
  content: "";
  position: absolute;
  left: 0; top: 0.2em; bottom: 0.2em;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.55;
}
.note {
  margin-top: 1.2rem;
  padding: 0.9rem 1.1rem;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.96rem;
  color: var(--text);
}
.muted { color: var(--muted); }

/* ---------- Cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
  margin-top: 1.5rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card-num {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.card h3 { margin: 0.5rem 0 0.4rem; font-size: 1.1rem; color: var(--heading); font-weight: 600; }
.card p { color: var(--muted); font-size: 0.95rem; }

/* ---------- Figures ---------- */
figure {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
figure img { display: block; width: 100%; height: auto; background: #f3f2f1; }
figcaption {
  padding: 0.7rem 0.9rem;
  font-size: 0.86rem;
  color: var(--muted);
}
.fig-row { display: grid; gap: 1.2rem; margin-top: 1.5rem; }
.fig-row.two { grid-template-columns: repeat(2, 1fr); }
.fig-row.three { grid-template-columns: repeat(3, 1fr); }
.fig-row.four { grid-template-columns: repeat(4, 1fr); }
.fig-row.align-top { align-items: start; }
.fig-row.equal img { height: 240px; object-fit: cover; }
.fig-row.equal-contain img { height: 300px; object-fit: contain; background: #ffffff; }
figure.single {
  max-width: 640px;
  margin: 1.5rem auto 0;
}

/* ---------- Policies ---------- */
.policy-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
  margin-top: 1rem;
}
.policy {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  font-size: 0.97rem;
  color: var(--text);
  box-shadow: var(--shadow);
}
.tag {
  display: inline-block;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  border-radius: var(--radius);
  padding: 0.05rem 0.5rem;
  margin-right: 0.6rem;
  font-size: 0.9rem;
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin-top: 1rem; }
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-size: 0.96rem;
  box-shadow: var(--shadow);
}
th, td {
  padding: 0.75rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
th {
  background: var(--surface-alt);
  color: var(--heading);
  font-weight: 600;
}
td:first-child, th:first-child { text-align: left; font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) { background: #fafafa; }
tr.best { background: var(--accent-soft) !important; }
tr.best td { color: var(--accent-dark); font-weight: 700; }

/* ---------- Callout / Video ---------- */
.callout {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 1.3rem 1.4rem;
  align-self: center;
}
.callout p { color: var(--text); }
.video-placeholder {
  margin-top: 1rem;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: var(--surface-alt);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}
.video {
  display: block;
  width: 100%;
  max-width: 900px;
  margin: 1.4rem auto 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #000;
  box-shadow: var(--shadow);
}

/* ---------- BibTeX ---------- */
.bibtex {
  margin-top: 1rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  overflow-x: auto;
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 2.2rem 1.5rem;
  background: var(--bg-alt);
}
.footer p { margin: 0.2rem 0; font-size: 0.9rem; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .hero-figs { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .fig-row.two, .fig-row.three, .fig-row.four { grid-template-columns: 1fr; }
  .policy-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}
