/* ========================================================================
   DiffusionOPD Project Page
   ======================================================================== */

:root {
  --bg:          #f7f8fb;
  --surface:    #ffffff;
  --surface-2:  #f1f3f9;
  --ink:        #0f1222;
  --ink-soft:   #38415a;
  --muted:      #6b7390;
  --line:       #e5e7f0;
  --line-2:     #d8dbe7;

  --brand:        #4f46e5;   /* indigo-600 */
  --brand-2:      #7c3aed;   /* violet-600 */
  --brand-3:      #06b6d4;   /* cyan-500   */
  --brand-soft:   #eef2ff;
  --accent:       #f59e0b;   /* amber-500  */
  --good:         #10b981;

  --radius:    14px;
  --radius-sm: 10px;
  --shadow:    0 10px 28px rgba(20, 22, 60, 0.07);
  --shadow-sm: 0 4px 14px rgba(20, 22, 60, 0.05);

  --container-w: 1180px;
  --narrow-w:    880px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

img { max-width: 100%; height: auto; display: block; }

.container {
  width: 100%;
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 28px;
}
.container.narrow { max-width: var(--narrow-w); }

/* ========================== HERO ========================== */
.hero {
  position: relative;
  padding: 88px 0 56px;
  color: var(--ink);
  overflow: hidden;
  text-align: center;
  background:
    radial-gradient(1200px 600px at 75% -10%, rgba(124,58,237,0.18), transparent 60%),
    radial-gradient(900px 500px at 10% -20%, rgba(79,70,229,0.20), transparent 55%),
    radial-gradient(900px 600px at 50% 110%, rgba(6,182,212,0.14), transparent 60%),
    linear-gradient(180deg, #ffffff 0%, #f4f5fa 100%);
}

.hero-bg {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(15,18,34,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15,18,34,0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse at center top, #000 30%, transparent 75%);
          mask-image: radial-gradient(ellipse at center top, #000 30%, transparent 75%);
  opacity: 0.55;
  pointer-events: none;
}
.hero .container { position: relative; z-index: 1; }

.badges {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 22px;
  flex-wrap: wrap;
  justify-content: center;
}
.badge {
  display: inline-block;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(79,70,229,0.25);
}
.badge.badge-soft {
  background: var(--brand-soft);
  color: var(--brand);
  box-shadow: none;
  border: 1px solid rgba(79,70,229,0.18);
}

.title {
  font-family: "Newsreader", "Inter", serif;
  font-weight: 600;
  font-size: clamp(34px, 4.4vw, 58px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
}
.title-mark {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 50%, var(--brand-3) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
  font-style: italic;
}
.title-sep { color: var(--ink); margin: 0 4px 0 -4px; font-weight: 600; }
.title-sub {
  display: block;
  margin-top: 6px;
  font-size: clamp(22px, 2.6vw, 34px);
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: -0.01em;
}

.authors, .affiliations {
  list-style: none;
  padding: 0;
  margin: 0 auto 8px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  max-width: 980px;
  font-size: 17px;
}
.authors li { white-space: nowrap; }
.authors .author-break {
  flex-basis: 100%;
  height: 0;
  margin: 0;
  padding: 0;
}
.authors a {
  color: var(--ink);
  font-weight: 500;
  border-bottom: 1px dashed transparent;
  transition: border-color .2s;
}
.authors a:hover { text-decoration: none; border-bottom-color: var(--brand); }
.authors sup { color: var(--brand); font-weight: 600; }

.affiliations {
  font-size: 15.5px;
  color: var(--muted);
  margin-top: 10px;
}
.affiliations sup { color: var(--brand); margin-right: 2px; }

.notes {
  margin: 14px 0 30px;
  font-size: 13.5px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 20px;
}
.notes sup { color: var(--brand); margin-right: 1px; }

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 20px;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: 0.01em;
  transition: transform .15s ease, box-shadow .2s ease, background-color .2s ease;
  box-shadow: var(--shadow-sm);
}
.btn:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(20,22,60,0.18);
  background: #1a1f3d;
}
.btn svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

/* ========================= SECTIONS ========================= */
.section { padding: 72px 0; }
.section.section-alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section.teaser { padding-top: 24px; padding-bottom: 8px; }

.section-title {
  position: relative;
  font-family: "Newsreader", "Inter", serif;
  font-weight: 600;
  font-size: clamp(26px, 3vw, 34px);
  letter-spacing: -0.01em;
  margin: 0 0 28px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 16px;
}
.section-title span { position: relative; }
.section-title span::before {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 9px;
  background: linear-gradient(90deg, rgba(79,70,229,0.18), rgba(124,58,237,0.10) 70%, transparent);
  border-radius: 4px;
  z-index: -1;
}
.section-title.centered {
  justify-content: center;
  text-align: center;
}

.sub-title {
  font-family: "Newsreader", "Inter", serif;
  font-weight: 600;
  font-size: clamp(20px, 2.2vw, 24px);
  color: var(--ink);
  margin: 32px 0 12px;
  letter-spacing: -0.01em;
}
.sub-title.centered { text-align: center; }

.centered-text { text-align: center; max-width: 820px; margin: 0 auto 22px; color: var(--ink-soft); }

.abstract {
  font-size: 17.5px;
  line-height: 1.78;
  color: var(--ink-soft);
}
.abstract b { color: var(--ink); }
.abstract em { font-style: italic; color: var(--brand); font-weight: 500; }

/* ========================= FIGURES ========================= */
.figure {
  margin: 24px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.figure img {
  width: 100%;
  border-radius: var(--radius-sm);
  cursor: zoom-in;
  transition: transform .2s ease;
}
.figure img:hover { transform: scale(1.005); }
.figure figcaption {
  margin-top: 14px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--muted);
  text-align: center;
}
.figure figcaption b { color: var(--ink); }

.ablation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 820px) {
  .ablation-grid { grid-template-columns: 1fr; }
}

/* ========================= CARDS ========================= */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
@media (max-width: 880px) { .cards { grid-template-columns: 1fr; } }

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 26px 26px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--brand-3));
  opacity: 0.85;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(20,22,60,0.10);
  border-color: var(--line-2);
}
.card-num {
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  color: var(--brand);
  font-size: 13px;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}
.card h3 {
  font-family: "Newsreader", "Inter", serif;
  font-size: 21px;
  font-weight: 600;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.card p {
  font-size: 15px;
  color: var(--ink-soft);
  margin: 0;
}
.card p em { color: var(--brand); font-style: italic; }

/* ========================= EQUATIONS ========================= */
.equation {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 18px 0;
  overflow-x: auto;
  font-size: 17px;
}

/* ========================= CALLOUT ========================= */
.callout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: linear-gradient(135deg, #f5f3ff 0%, #ecfeff 100%);
  border: 1px solid #ddd6fe;
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 24px 0 6px;
}
.callout-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  color: var(--brand);
  display: grid;
  place-items: center;
}
.callout-icon svg { width: 22px; height: 22px; }
.callout b { color: var(--ink); }
.callout em { color: var(--brand); font-style: italic; }

/* ========================= RECIPE ========================= */
.recipe {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
@media (max-width: 820px) { .recipe { grid-template-columns: 1fr; } }
.recipe-step {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 26px;
  box-shadow: var(--shadow-sm);
}
.recipe-step-num {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  padding: 4px 10px;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 6px;
  margin-bottom: 12px;
}
.recipe-step h3 {
  font-family: "Newsreader", "Inter", serif;
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.recipe-step p {
  margin: 0;
  font-size: 15.5px;
  color: var(--ink-soft);
}

/* ========================= TABLE ========================= */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px;
  box-shadow: var(--shadow-sm);
}
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  min-width: 920px;
}
.results-table th, .results-table td {
  padding: 10px 12px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.results-table thead th {
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--surface-2);
  font-size: 13.5px;
  letter-spacing: 0.02em;
}
.results-table thead th.group {
  border-bottom: 1px solid var(--line-2);
  color: var(--ink);
  font-weight: 700;
}
.results-table thead th.indomain { background: #f5f3ff; }
.results-table tbody td:first-child { text-align: left; font-weight: 500; color: var(--ink); }
.results-table tbody tr:hover td { background: rgba(79,70,229,0.04); }
.results-table tbody tr.teacher-row td {
  color: var(--muted);
  font-style: italic;
}
.results-table tbody tr.ours-row td {
  background: linear-gradient(90deg, rgba(79,70,229,0.08), rgba(124,58,237,0.05));
  color: var(--ink);
}
.results-table tbody tr.ours-row td:first-child {
  border-left: 3px solid var(--brand);
}
.caption-note {
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
  text-align: center;
}

/* ========================= BIBTEX ========================= */
.bibtex-wrap {
  position: relative;
  margin-top: 14px;
}
.bibtex-wrap pre {
  background: #0f1222;
  color: #e6e7ee;
  border-radius: var(--radius);
  padding: 22px 24px;
  overflow-x: auto;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13.8px;
  line-height: 1.65;
  margin: 0;
  box-shadow: var(--shadow);
}
.bibtex-wrap code { font-family: inherit; }

.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.08);
  color: #e6e7ee;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
  transition: background .2s, transform .15s;
}
.copy-btn:hover { background: rgba(255,255,255,0.16); }
.copy-btn:active { transform: scale(0.97); }
.copy-btn svg { width: 14px; height: 14px; }
.copy-btn.copied { background: var(--good); border-color: var(--good); color: #fff; }

/* ========================= FOOTER ========================= */
.footer {
  padding: 28px 0 36px;
  background: var(--bg);
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.footer p { margin: 0; display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }

/* ========================= LIGHTBOX ========================= */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(8,10,22,0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 30px;
  z-index: 100;
  opacity: 0;
  transition: opacity .2s ease;
}
.lightbox.active {
  display: flex;
  opacity: 1;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-sm);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  font-size: 28px;
  line-height: 1;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .2s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.22); }

/* ========================= RESPONSIVE ========================= */
@media (max-width: 640px) {
  .section { padding: 56px 0; }
  .container { padding: 0 20px; }
  body { font-size: 16px; }
  .btn { padding: 10px 16px; font-size: 14px; }
  .authors, .affiliations { font-size: 15px; }
}
