/* Wavelet Flow Matching — project page */
:root {
  --ink: #1d1b2b;
  --ink-soft: #4a4760;
  --muted: #77738c;
  --bg: #ffffff;
  --bg-alt: #f6f5fb;
  --line: #e4e1ef;
  --accent: #5b3fc4;
  --accent-dark: #3b2a7a;
  --accent-soft: #ece8fb;
  --best: #1d1b2b;
  --second-line: #9d8ae6;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 10px;
  --text-width: 780px;
  --tbl-head: #F0E9F1;
  --tbl-head-2: #ece5ee;
  --tbl-line: #cfc4d4;
  --second-green: #3a7a00;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { margin-left: auto; margin-right: auto; }
section { padding: 28px 16px 36px; }
section.container { padding: 28px 16px 36px; }

h1, h2, h3 { font-family: var(--serif); line-height: 1.2; color: var(--ink); }
h2 {
  font-size: 2rem; margin: 0 0 18px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
h2 a { color: var(--line); margin-right: 10px; font-weight: 400; }
h2 a:hover { color: var(--accent); text-decoration: none; }
h3 { font-size: 1.3rem; margin: 30px 0 8px; }
p { margin: 0 0 14px; color: var(--ink-soft); }
main p, figcaption, caption, .footer p {
  text-align: justify; text-justify: inter-word; hyphens: auto; -webkit-hyphens: auto;
}
.small { font-size: 0.92rem; }

/* text column: narrower than the figures, centred */
main p, main h2, main h3, .tldr, .tabs, .figure-details > summary, .table-note, .bibtex, figcaption, .two-col {
  max-width: var(--text-width); margin-left: auto; margin-right: auto;
}

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--accent-soft) 0%, #fff 100%);
  padding: 64px 0 40px; text-align: center;
}
.hero-motif {
  position: absolute; left: 0; right: 0; top: 18px; width: 100%; height: 90px;
  fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: 0.13;
}
.hero-inner { position: relative; }
.venue {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin: 0 0 16px; font-family: var(--sans); font-size: 1.05rem; font-weight: 500;
  color: var(--accent-dark);
}
.venue-wave { width: 96px; height: 20px; flex: none; }
.venue-wave path { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.venue-wave.flip { transform: scaleX(-1); }
.hero h1 { font-size: clamp(2.3rem, 6vw, 3.8rem); margin: 0; letter-spacing: -0.01em; }
.subtitle { font-family: var(--serif); font-size: clamp(1.2rem, 3vw, 1.7rem); color: var(--ink-soft); margin: 4px 0 26px; }
.authors { font-size: 1.08rem; color: var(--ink); margin: 0 0 6px; }
.authors span { display: inline-block; margin: 0 9px; white-space: nowrap; }
.affiliations { font-size: 0.88rem; color: var(--muted); margin: 0 auto 26px; max-width: 900px; }
.affiliations span { display: inline-block; margin: 0 8px; white-space: nowrap; }
sup { font-size: 0.68em; color: var(--accent); }

.buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 20px; border-radius: 999px;
  background: var(--ink); color: #fff; font-weight: 500; font-size: 0.95rem;
  transition: background .15s, transform .15s;
}
.btn svg { width: 18px; height: 18px; }
.btn-emoji { font-size: 17px; line-height: 1; }
.btn:hover { background: var(--accent); text-decoration: none; transform: translateY(-1px); }
.btn.disabled { background: #b9b5c9; cursor: default; pointer-events: none; }

/* ---------- teaser ---------- */
.teaser { padding-top: 20px; }
.tldr {
  margin-top: 0; margin-bottom: 30px; padding: 18px 24px;
  background: var(--bg-alt); border-left: 4px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0;
}
.tldr-label { font-weight: 700; font-size: 0.8rem; letter-spacing: 0.1em; color: var(--accent); }
.tldr p { margin: 4px 0 0; color: var(--ink); }

/* ---------- video ---------- */
.video-figure { margin: 0 auto 34px; }
.video-frame {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: #fff; border: 1px solid var(--line);
}
.video-frame img { width: 100%; display: block; }
.video-missing {
  display: none; position: absolute; top: 10px; right: 10px;
  padding: 4px 12px; font-size: 0.8rem; font-weight: 500; color: #fff;
  background: rgba(29, 27, 43, .78); border-radius: 999px;
}
.video-frame.missing { background: #fff; }
.video-frame.missing .video-missing { display: block; }

/* ---------- figures ---------- */
.figure { margin: 22px 0; }
.figure img { margin: 0 auto; border-radius: 6px; background: #fff; }
figcaption { font-size: 0.92rem; color: var(--muted); margin-top: 10px; line-height: 1.55; }
figcaption strong { color: var(--ink); }
.figure-grid { display: grid; grid-template-columns: 1fr; gap: 6px; }
.figure-details { margin-top: 20px; }
.figure-details summary {
  cursor: pointer; font-weight: 600; color: var(--accent); font-size: 0.95rem;
}

/* ---------- math ---------- */
mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; padding: 4px 0; margin: 14px 0 !important; }

/* ---------- tabs ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 20px 0 18px; border-bottom: 1px solid var(--line); }
.tab {
  font: inherit; font-size: 0.95rem; font-weight: 500;
  background: none; border: none; cursor: pointer; color: var(--muted);
  padding: 10px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- tables (Flowers-style) ---------- */
.table-wrap {
  width: fit-content; max-width: 100%; margin: 18px auto; overflow-x: auto;
  border: 1px solid var(--tbl-line); border-radius: 12px; background: #fff;
}
table { border-collapse: collapse; font-size: 0.86rem; font-variant-numeric: tabular-nums; }
caption {
  caption-side: top; text-align: left; font-size: 0.84rem; color: var(--muted); line-height: 1.5;
  padding: 10px 14px; border-bottom: 1px solid var(--tbl-line);
}
th, td { padding: 5px 14px; text-align: center; border-bottom: 1px solid var(--tbl-line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th {
  font-weight: 600; color: var(--ink); background: var(--tbl-head);
  border-bottom: 2px solid var(--tbl-line); padding-top: 8px; padding-bottom: 8px;
}
tbody tr:last-child td { border-bottom: none; }
tr.ours td:first-child { color: var(--accent-dark); font-weight: 600; }
tr.ours td { background: rgba(91, 63, 196, 0.035); }
tr.sep td { border-top: 2px solid var(--tbl-line); }
td small { color: var(--muted); }
.best { font-weight: 700; color: var(--best); }
.second { color: var(--second-green); }
table.compact th, table.compact td { padding: 4px 12px; }
.table-grid {
  display: grid; grid-template-columns: auto auto; justify-content: center; align-items: start; gap: 24px;
}
.table-grid .table-wrap { margin: 18px 0; }
.table-note { font-size: 0.85rem; color: var(--muted); text-align: center !important; }

/* ---------- two-column ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: center; }
.stack > .table-wrap { margin-top: 6px; }
.two-col p, .two-col h3 { max-width: none; }
.two-col .table-wrap { margin: 0 auto; }
.two-col h3:first-child { margin-top: 0; }

/* ---------- bibtex ---------- */
.bibtex { position: relative; }
.bibtex pre {
  margin: 0; padding: 18px 20px; overflow-x: auto;
  background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius);
  font-family: var(--mono); font-size: 0.85rem; line-height: 1.6; color: var(--ink);
}
.copy-btn {
  position: absolute; top: 10px; right: 10px;
  font: inherit; font-size: 0.8rem; padding: 4px 12px; cursor: pointer;
  color: var(--accent-dark); background: #fff; border: 1px solid var(--line); border-radius: 6px;
}
.copy-btn:hover { border-color: var(--accent); }

/* ---------- footer ---------- */
.footer { margin-top: 30px; padding: 26px 0; background: var(--bg-alt); border-top: 1px solid var(--line); }
.footer p { font-size: 0.85rem; color: var(--muted); margin: 0; }
.footer p { text-align: center; }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .venue-wave { width: 56px; }
  body { font-size: 16px; }
  .hero { padding-top: 48px; }
  .table-grid, .two-col { grid-template-columns: 1fr; }
  .two-col { gap: 10px; }
  h2 { font-size: 1.65rem; }
}
