:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #eef1f7;
  --text: #151923;
  --muted: #5d6678;
  --border: #dfe4ee;
  --accent: #355cde;
  --accent-strong: #213fa6;
  --shadow: 0 20px 60px rgba(23, 33, 57, 0.10);
  --radius: 24px;
  --max-width: 1080px;
}

[data-theme="dark"] {
  --bg: #0c1019;
  --surface: #141a27;
  --surface-2: #1d2636;
  --text: #f2f5fb;
  --muted: #aeb8ca;
  --border: #2b3548;
  --accent: #8ca2ff;
  --accent-strong: #b6c4ff;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, var(--surface-2), transparent 32rem), var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: inherit; }
img, video { max-width: 100%; display: block; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem max(1.2rem, calc((100vw - var(--max-width)) / 2));
  background: color-mix(in srgb, var(--bg), transparent 16%);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-start {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  flex: 1;
}

.home-link {
  flex-shrink: 0;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  background: var(--surface);
  white-space: nowrap;
}

.home-link:hover { color: var(--accent); }

.brand {
  font-weight: 800;
  text-decoration: none;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav { display: flex; flex-wrap: wrap; gap: 0.8rem; color: var(--muted); font-size: 0.95rem; }
.nav a { text-decoration: none; }
.nav a:hover { color: var(--accent); }
.theme-toggle, .small-button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.55rem 0.8rem;
  cursor: pointer;
}

main { max-width: var(--max-width); margin: 0 auto; padding: 2rem 1.2rem 1rem; }
.section { margin: 4rem 0; }
.hero { text-align: center; margin-top: 2rem; }
.eyebrow { color: var(--accent); font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
h1 { font-size: clamp(2.3rem, 6vw, 4.8rem); line-height: 1.02; margin: 0.4rem 0 1rem; letter-spacing: -0.05em; }
br.title-break-desktop { display: none; }
h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); line-height: 1.1; margin: 0 0 1.2rem; letter-spacing: -0.03em; }
.subtitle { max-width: 780px; margin: 0 auto 1.2rem; color: var(--muted); font-size: 1.2rem; }
.authors { font-size: 1.05rem; margin: 0.7rem auto; }
.authors a { color: var(--accent); font-weight: 700; text-decoration: none; }
.affiliation { color: var(--muted); margin-top: 0; }
.button-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin: 2rem 0; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.8rem 1.1rem;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(0,0,0,0.05);
}
.button-icon {
  width: 1.05em;
  height: 1.05em;
  flex-shrink: 0;
}

.button-icon-arxiv {
  color: #b31b1b;
}

.button-arxiv {
  background: color-mix(in srgb, #b31b1b 14%, var(--surface));
  border-color: color-mix(in srgb, #b31b1b 45%, var(--border));
  color: #8f1515;
}

.button-arxiv:hover {
  background: color-mix(in srgb, #b31b1b 22%, var(--surface));
  border-color: #b31b1b;
}

[data-theme="dark"] .button-arxiv {
  background: color-mix(in srgb, #b31b1b 28%, var(--surface));
  border-color: color-mix(in srgb, #b31b1b 55%, var(--border));
  color: #f0a3a3;
}

[data-theme="dark"] .button-icon-arxiv {
  color: #f0a3a3;
}

[data-theme="dark"] .button-arxiv:hover {
  background: color-mix(in srgb, #b31b1b 38%, var(--surface));
  border-color: #d94a4a;
}
.button.primary { background: var(--accent); color: white; border-color: var(--accent); }
.button:hover { transform: translateY(-1px); }
.button-soon {
  cursor: default;
  opacity: 0.72;
  box-shadow: none;
}
.button-soon:hover { transform: none; }
.button-soon.primary {
  background: color-mix(in srgb, var(--accent), var(--surface) 35%);
  border-color: color-mix(in srgb, var(--accent), var(--border) 40%);
}
.authors sup { font-size: 0.72em; margin-left: 0.05em; }
.affiliation sup { font-size: 0.78em; margin-right: 0.2em; }
.media-frame {
  margin: 2rem auto;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.media-frame video, .media-frame img { width: 100%; }
.hero-caption, .figure-caption {
  max-width: 900px;
  margin: 1rem auto 0;
  color: var(--muted);
  font-size: 1.05rem;
  text-align: center;
}
.figure-card img {
  width: 100%;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.figure-caption { text-align: left; margin-top: 1rem; }

.method-figure-mobile {
  display: none;
  flex-direction: column;
  gap: 0.85rem;
}

.method-figure-mobile img {
  background: #ffffff;
}
.tldr {
  max-width: 900px;
  margin: 1.5rem auto 0;
  padding: 1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 8px);
  background: var(--surface);
  font-size: 1.08rem;
}
.card {
  padding: clamp(1.2rem, 3vw, 2rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.grid { display: grid; gap: 1rem; }
.cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.highlight-card, .gallery-card {
  padding: 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 6px);
}
.highlight-card h3 { margin-top: 0; margin-bottom: 0.4rem; }
.gallery-card h3 { margin-top: 1.25rem; margin-bottom: 0.4rem; }
.highlight-card p, .gallery-card p { color: var(--muted); margin-bottom: 0; }
.gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gallery-stack { grid-template-columns: 1fr; }
.gallery-card img { border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); }

.result-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.85rem;
  align-items: center;
}

.result-plot,
.result-gifs {
  min-width: 0;
}

.result-gifs {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.result-gifs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  align-content: center;
}

.result-plot img,
.result-gifs img {
  width: 100%;
  height: auto;
  display: block;
}

.result-gif-row {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.result-gif-tabs {
  display: none;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.result-gif-tab {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.result-gif-tab[aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.result-gif-row-items {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.result-gif-item {
  margin: 0;
  min-width: 0;
}

.result-gif-item img {
  width: 100%;
  height: auto;
  display: block;
}
.findings-list { padding-left: 1.3rem; }
.findings-list li { margin: 0.65rem 0; }
.section-title-row { display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
pre {
  overflow-x: auto;
  padding: 1rem;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.muted-section { color: var(--muted); }
.footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.25rem 1.2rem 1rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.footer p {
  margin: 0.35rem 0;
}

.footer p:last-child {
  margin-bottom: 0;
}

.footer-logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.25rem 2rem;
  margin: 0 0 1.75rem;
}

.footer-logos a {
  display: inline-flex;
  line-height: 0;
  text-decoration: none;
  opacity: 1;
  transition: opacity 0.15s ease;
}

.footer-logos a:hover { opacity: 0.75; }

.footer-logos img {
  height: 3.25rem;
  width: auto;
  max-width: 13rem;
  object-fit: contain;
}

[data-theme="dark"] .footer-logos a {
  background: #ffffff;
  border-radius: 10px;
  padding: 0.35rem 0.55rem;
}

[data-theme="dark"] .footer-logos img {
  background: transparent;
  border-radius: 0;
  padding: 0;
  box-sizing: content-box;
}

.footer-home-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.footer-home-link:hover { text-decoration: underline; }

.footer #contact a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.footer #contact a:hover { text-decoration: underline; }

.back-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 1.25rem;
  line-height: 1;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.4rem);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover { color: var(--accent); }

@media (min-width: 821px) {
  br.title-break-desktop { display: block; }
}

@media (max-width: 820px) {
  .site-header {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "start toggle"
      "nav nav";
    align-items: center;
    gap: 0.55rem 1rem;
  }
  .header-start { grid-area: start; }
  .theme-toggle { grid-area: toggle; }
  .nav {
    grid-area: nav;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    gap: 0.85rem 1.15rem;
    font-size: 0.9rem;
  }
  .cards-3, .gallery { grid-template-columns: 1fr; }
  .section { margin: 2.7rem 0; }
  .method-figure-desktop { display: none; }
  .method-figure-mobile { display: flex; }
  .result-panels { grid-template-columns: 1fr; }
  .result-gif-tabs {
    display: flex;
    justify-content: center;
  }
  .result-gif-row-items {
    grid-template-columns: 1fr;
  }
  .result-gif-item { display: none; }
  .result-gif-item.is-active { display: block; }
  .footer-logos {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-items: center;
    align-items: center;
    gap: 1rem 1.25rem;
  }
  .footer-logos img {
    height: 2.75rem;
    max-width: 100%;
  }
}
