:root {
  --teal: #398c7e;
  --teal-dark: #2a6e62;
  --teal-tint: #e9f3f1;
  --terracotta: #b66a50;
  --ink: #1f2933;
  --body: #3b4754;
  --muted: #6b7785;
  --line: #e5e8ec;
  --alt-bg: #f7f8f9;
  --radius: 10px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--body);
  background: #ffffff;
  -webkit-font-smoothing: antialiased;
}

.title, .publication-title, .section-title, .sub-title,
.step-head, .pill, .seg, .link-block, .feature h3 {
  font-family: 'Google Sans', 'Noto Sans', sans-serif;
}

a { color: var(--teal-dark); }
a:hover { color: var(--teal); text-decoration: underline; }

.container.is-max-desktop { max-width: 960px !important; }
.section { padding: 3.5rem 1.5rem; }
.section.tight-top { padding-top: 0; }
.section.alt { background: var(--alt-bg); }

/* ---------------------------------------------------------- navbar */
html { scroll-padding-top: 4rem; }
.site-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 3.4rem;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 0 1rem;
}
.site-nav .navbar-item,
.site-nav .navbar-link {
  font-family: 'Google Sans', 'Noto Sans', sans-serif;
  font-size: 0.95rem;
  color: var(--body);
}
.site-nav a.navbar-item:hover,
.site-nav .navbar-link:hover,
.site-nav .navbar-item.has-dropdown:hover .navbar-link {
  background: transparent;
  color: var(--teal-dark);
}
.site-nav .navbar-start { flex-grow: 1; justify-content: center; }
.site-nav .navbar-link:not(.is-arrowless)::after { border-color: currentColor; }
.site-nav .brand { gap: 0.5rem; font-weight: 700; color: var(--ink); letter-spacing: 0.02em; }
.site-nav .navbar-dropdown {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(20, 30, 40, 0.1);
  padding: 0.4rem 0;
}
.site-nav .navbar-dropdown .navbar-item { white-space: normal; padding: 0.6rem 1.1rem; }
.research-item { display: flex; flex-direction: column; max-width: 300px; line-height: 1.4; }
.research-item b { color: var(--ink); }
.research-item small { color: var(--muted); font-size: 0.8rem; }
.navbar-burger { color: var(--ink); }

/* ---------------------------------------------------------- logo */
.cdmd-logo { display: block; width: 1em; height: 1em; }
.cdmd-logo.is-small { width: 1.7rem; height: 1.7rem; }
.title-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25em;
  height: 1.25em;
  margin-right: 0.3em;
  vertical-align: -0.22em;
  border-radius: 0.32em;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20, 30, 40, 0.06), 0 6px 18px rgba(57, 140, 126, 0.16);
  font-size: 0.82em;
}
.title-mark .cdmd-logo { width: 0.95em; height: 0.95em; }

/* ---------------------------------------------------------- header */
.hero-banner {
  --hero-student: #398c7e;
  --hero-teacher: #d98a5f;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(60% 80% at 12% 0%, rgba(57, 140, 126, 0.10), transparent 70%),
    radial-gradient(55% 75% at 92% 10%, rgba(217, 138, 95, 0.10), transparent 70%),
    linear-gradient(180deg, #f7faf9 0%, #ffffff 100%);
}
.hero-flow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* fade out behind the title and toward the bottom edge */
  -webkit-mask-image: radial-gradient(48% 46% at 50% 40%, transparent 30%, #000 85%),
                      linear-gradient(180deg, #000 55%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: radial-gradient(48% 46% at 50% 40%, transparent 30%, #000 85%),
              linear-gradient(180deg, #000 55%, transparent 100%);
  mask-composite: intersect;
  opacity: 0.72;
}
.hero-banner .hero-body { position: relative; z-index: 1; }
.hero-body { padding: 4.5rem 1.5rem 2.5rem; }

.publication-title {
  color: var(--ink) !important;
  font-weight: 500;
  line-height: 1.2 !important;
  letter-spacing: -0.01em;
  font-size: 2.6rem !important;
  margin-bottom: 1.6rem !important;
}

.publication-authors {
  font-size: 1.15rem;
  color: var(--ink);
  margin-bottom: 0.35rem;
}
.publication-affiliations {
  font-size: 0.98rem;
  color: var(--muted);
}
.author-row + .author-row { margin-top: 0.15rem; }
.author-block { display: inline-block; margin: 0 0.7rem; }
.publication-affiliations .author-block { margin: 0 0.55rem; }

.publication-links {
  margin-top: 1.6rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}
.link-block {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  background: #2b2f36;
  color: #fff;
  font-size: 0.98rem;
  line-height: 1;
  text-decoration: none;
}
a.link-block:hover { background: #000; color: #fff; text-decoration: none; }
.link-block.is-soon { background: #f1f3f5; color: #7c8794; cursor: default; }
.link-block .icon { width: auto; height: auto; }
.soon-tag {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.18rem 0.42rem;
  border-radius: 999px;
  background: #e2e6ea;
  color: #67727e;
}

/* ---------------------------------------------------------- teaser */
.section.teaser { padding-top: 1.5rem; }
.teaser-figure img,
#overview-video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  background: #1c1e22;
  aspect-ratio: 16 / 9;
}
.c-student { color: var(--teal-dark); font-weight: 500; }
.c-teacher { color: var(--terracotta); font-weight: 500; }

.features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 2.4rem;
}
.feature {
  text-align: center;
  padding: 1.3rem 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.feature-icon {
  width: 2.6rem;
  height: 2.6rem;
  margin: 0 auto 0.7rem;
  border-radius: 50%;
  background: var(--teal-tint);
  color: var(--teal-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}
.feature h3 {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 0.4rem;
}
.feature p {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted);
}
.feature p b { color: var(--ink); }

/* ---------------------------------------------------------- figures */
figure { margin: 0; }
figure img { width: 100%; height: auto; display: block; }
img.rounded { border-radius: var(--radius); }
figcaption {
  margin-top: 0.7rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--muted);
  text-align: center;
}
figcaption b { color: var(--ink); }
.zoomable { cursor: zoom-in; }

/* ---------------------------------------------------------- text */
.section-title {
  color: var(--ink) !important;
  font-weight: 500 !important;
  text-align: center;
  margin-bottom: 1.8rem !important;
}
.sub-title {
  color: var(--ink) !important;
  font-weight: 500 !important;
  margin-top: 3rem !important;
  margin-bottom: 0.6rem !important;
}
.section-title + .sub-title { margin-top: 0 !important; }
.lead { color: var(--body); margin-bottom: 1.1rem; }

.content { color: var(--body); line-height: 1.75; }
.content b, .content strong { color: var(--ink); }
.abstract { font-size: 1.02rem; }

.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------- method */

.method-steps { margin-top: 0.5rem; }
.step-card {
  height: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem 0.4rem;
  font-size: 0.96rem;
  line-height: 1.65;
}
.step-card p { margin-bottom: 0.8rem; }
.step-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.08rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 0.7rem;
}
.step-num {
  flex: none;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.eq {
  overflow-x: auto;
  overflow-y: hidden;
  margin: 0.2rem 0 0.9rem;
  padding: 0.2rem 0;
}
.eq .katex-display { margin: 0.4rem 0; }

.method-text { max-width: 820px; margin: 0 auto; }

.hl-bad { color: #c4473a; font-weight: 500; }
.hl-good { color: #22785f; font-weight: 500; }

/* objectives row */
.objectives {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.1rem;
}
.objective {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem 1rem;
  font-size: 0.9rem;
  line-height: 1.6;
}
.objective.is-ours {
  border: 1.5px solid var(--teal);
  box-shadow: 0 6px 22px rgba(57, 140, 126, 0.12);
}
.obj-head { display: flex; align-items: baseline; gap: 0.55rem; flex-wrap: wrap; margin-bottom: 0.35rem; }
.obj-name { font-family: 'Google Sans', sans-serif; font-size: 1.15rem; font-weight: 500; color: var(--ink); }
.is-ours .obj-name { color: var(--teal-dark); }
.obj-div { font-size: 0.8rem; color: var(--muted); }
.obj-eq { overflow-x: auto; overflow-y: hidden; }
.obj-eq .katex-display { margin: 0.35rem 0; }
.obj-eq.small { font-size: 0.86em; }
.objective p { color: var(--body); margin: 0.3rem 0 0.9rem; }
.obj-cost {
  margin-top: auto;
  align-self: flex-start;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
}
.obj-cost i { margin-right: 0.3rem; }
.obj-cost.bad { color: #c4473a; background: #fde8e5; }
.obj-cost.good { color: #22785f; background: #e3f3ec; }

/* pipeline */
.pipeline-figure { margin: 1rem 0 1.2rem; }
.pipeline-figure img {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem;
}

/* guarantee */
.theory {
  margin-top: 1.4rem;
  background: var(--teal-tint);
  border-left: 3px solid var(--teal);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.1rem 1.4rem 0.9rem;
  font-size: 0.95rem;
  line-height: 1.65;
}
.theory-head {
  font-family: 'Google Sans', sans-serif;
  font-weight: 500;
  font-size: 1.05rem;
  color: var(--teal-dark);
  margin-bottom: 0.4rem;
}
.theory-head i { margin-right: 0.4rem; }
.theory p { margin-bottom: 0.5rem; }
.theory ol { margin: 0 0 0 1.2rem; }
.theory li { margin-bottom: 0.45rem; padding-left: 0.2rem; }
.theory b { color: var(--ink); }
.theory .eq { margin: 0.1rem 0 0.2rem; }

/* ---------------------------------------------------------- tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.data-table {
  width: 100%;
  margin: 0 !important;
  font-size: 0.92rem;
  background: transparent;
  font-variant-numeric: tabular-nums;
}
.data-table th {
  font-family: 'Google Sans', sans-serif;
  font-weight: 500;
  color: var(--ink) !important;
  background: #fafbfc;
  border-bottom: 1px solid var(--line) !important;
  white-space: nowrap;
}
.data-table td, .data-table th {
  padding: 0.5rem 0.85rem !important;
  border-color: var(--line) !important;
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table td:not(:first-child),
.data-table th:not(:first-child) { text-align: center; }
.num-table td:first-child { white-space: nowrap; }
.data-table sup { color: var(--muted); font-size: 0.7em; }
.data-table tr.ours td {
  background: var(--teal-tint);
  color: var(--ink);
  font-weight: 500;
}
.data-table tr.ours td:first-child { color: var(--teal-dark); }
.data-table tr.teacher-row td { color: var(--muted); }
.compare-table .yes { color: var(--teal-dark); font-weight: 700; }
.compare-table .no { color: #c0574a; }
.t2i-table { font-size: 0.86rem; }

.table-note {
  margin-top: 0.55rem;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.55;
}
.table-note b { color: var(--ink); }

.results-row { margin-top: 0.2rem; }
.results-row figure { margin-top: 2.6rem; }

/* ---------------------------------------------------------- controls */
.gallery-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}
.pill-group { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pill {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--body);
  border-radius: 999px;
  padding: 0.32rem 0.85rem;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pill:hover { border-color: var(--teal); color: var(--teal-dark); }
.pill.is-active { background: var(--teal); border-color: var(--teal); color: #fff; }

.segmented {
  display: inline-flex;
  padding: 3px;
  background: #eef0f2;
  border-radius: 999px;
}
.segmented.small { margin-bottom: 0.75rem; flex-wrap: wrap; border-radius: 14px; }
.seg {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.32rem 0.95rem;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.seg:hover { color: var(--ink); }
.seg.is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }

.pill:focus-visible, .seg:focus-visible, .copy-btn:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

#gallery-img { width: 100%; height: auto; display: block; background: #eef0f2; }
.gallery-caption { margin-top: 0.55rem; text-align: center; font-size: 0.88rem; color: var(--muted); }

/* ---------------------------------------------------------- bibtex */
.bibtex-box { position: relative; }
.bibtex-box pre {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--ink);
  overflow-x: auto;
}
.copy-btn {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 8px;
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.copy-btn:hover { color: var(--teal-dark); border-color: var(--teal); }

/* ---------------------------------------------------------- footer */
.footer {
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 2.2rem 1.5rem 2.6rem;
  font-size: 0.86rem;
  color: var(--muted);
}
.footer .content { color: var(--muted); line-height: 1.8; }

/* ---------------------------------------------------------- lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 20, 25, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; background: #fff; }

/* ---------------------------------------------------------- responsive */
@media (max-width: 768px) {
  .section { padding: 2.6rem 1rem; }
  .hero-body { padding: 3rem 1rem 1rem; }
  .publication-title { font-size: 1.75rem !important; }
  .site-nav { padding: 0; }
  .site-nav .navbar-menu.is-active { box-shadow: none; border-top: 1px solid var(--line); }
  .site-nav .navbar-start { justify-content: flex-start; }
  .hero-flow { opacity: 0.4; }
  .publication-title br { display: none; }
  .publication-authors { font-size: 1rem; }
  .features { grid-template-columns: repeat(2, 1fr); gap: 0.7rem; }
  .objectives { grid-template-columns: 1fr; }
  .author-block { margin: 0 0.4rem; }
  .gallery-controls { flex-direction: column; align-items: flex-start; }
  .results-row figure { margin-top: 0.5rem; }
  .lightbox { padding: 0.75rem; }
}


a.obj-name { text-decoration: none; }
a.obj-name:hover { color: var(--teal-dark); text-decoration: none; }
a.obj-name i { font-size: 0.6em; color: var(--muted); vertical-align: 0.25em; margin-left: 0.15rem; }

/* faint grid behind the hero, like the overview figure */
.hero-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(37, 48, 64, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 48, 64, 0.045) 1px, transparent 1px);
  background-size: 36px 36px;
  background-position: center top;
  -webkit-mask-image: radial-gradient(70% 90% at 50% 30%, #000 30%, transparent 85%);
  mask-image: radial-gradient(70% 90% at 50% 30%, #000 30%, transparent 85%);
  pointer-events: none;
}

.section.teaser { padding-bottom: 1rem; }
.key-features { padding-top: 2.5rem; }
.key-features .features { margin-top: 0; }
.t2i-samples { margin: 0.4rem 0 1.4rem; }

/* multi-step sampling highlight */
.multistep {
  margin-top: 2.2rem;
  padding: 1.4rem 1.6rem 1.1rem;
  background: #fff;
  border: 1.5px solid var(--teal);
  border-radius: var(--radius);
  box-shadow: 0 6px 22px rgba(57, 140, 126, 0.10);
  line-height: 1.7;
}
.multistep-head {
  font-family: 'Google Sans', sans-serif;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--teal-dark);
  margin-bottom: 0.5rem;
}
.multistep-head i { margin-right: 0.45rem; }
.multistep p { margin-bottom: 0.6rem; }
.multistep b { color: var(--ink); }

.step-ladder {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin: 1rem 0 0.3rem;
}
.rung {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.7rem 0.5rem;
  border-radius: 8px;
  background: var(--teal-tint);
}
.rung-steps { font-size: 0.82rem; color: var(--muted); text-align: center; }
.rung-fid { font-family: 'Google Sans', sans-serif; font-size: 1.6rem; font-weight: 500; color: var(--teal-dark); line-height: 1.2; }
.rung.is-teacher { background: #f3f4f6; }
.rung.is-teacher .rung-fid { color: var(--muted); }
.rung-note { font-size: 0.82rem; color: var(--muted); text-align: center; }

.scaling-figure { margin: 1.4rem 0 1rem; }
.multistep-points { margin: 0 0 0.3rem 1.1rem; list-style: disc; font-size: 0.95rem; }
.multistep-points li { margin-bottom: 0.35rem; }

@media (max-width: 768px) {
  .multistep { padding: 1.1rem 1rem 0.8rem; }
  .step-ladder { grid-template-columns: repeat(2, 1fr); }
}

/* collapsible explanation in the multi-step block */
.multistep-details {
  margin-top: 0.4rem;
  border-top: 1px solid var(--line);
  padding-top: 0.6rem;
}
.multistep-details summary {
  cursor: pointer;
  list-style: none;
  font-family: 'Google Sans', sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--teal-dark);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.multistep-details summary::-webkit-details-marker { display: none; }
.multistep-details summary::before {
  content: "\f078";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 0.75rem;
  transition: transform 0.2s;
}
.multistep-details[open] summary::before { transform: rotate(180deg); }
.multistep-details summary:hover { color: var(--teal); }
.multistep-details summary:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 4px; }
.details-body { margin-top: 0.8rem; }
