/* Bokeh Diffusion — project page */

:root {
  color-scheme: dark;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --math: "STIX Two Text", "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --bg: #0c0b0a;
  --surface: #161412;
  --tint: #12100f;
  --text: #f1ece4;
  --muted: #a8a196;
  --faint: #6f6a62;
  --line: #2a2622;
  --accent: #f4b97a;
  --bokeh: #f3a35b;
  --bokeh-ink: #f7b878;
  --bokeh-soft: rgba(243, 163, 91, 0.13);
  --blue-soft: rgba(111, 168, 240, 0.12);
  --green-soft: rgba(95, 165, 151, 0.13);
  --yellow-soft: rgba(242, 205, 76, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 28px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.5), 0 30px 70px rgba(0, 0, 0, 0.6);
  --radius: 14px;

  --maxw: 1080px;
  --prosew: 760px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  font-feature-settings: "cv05" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

button { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--bokeh); outline-offset: 2px; }

/* ---------- Top nav ---------- */

.topnav {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: calc(100% - 24px);
  padding: 8px 10px 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  box-shadow: var(--shadow);
  transform: translate(-50%, -140%);
  transition: transform 0.45s cubic-bezier(.2, .8, .2, 1);
  overflow: hidden;
}
.topnav.is-visible { transform: translate(-50%, 0); }

.topnav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-style: italic;
  color: var(--text);
  white-space: nowrap;
}
.topnav-brand:hover { text-decoration: none; }
.topnav-brand .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffd9a8, var(--bokeh) 60%, transparent 72%);
  box-shadow: 0 0 10px var(--bokeh);
}

.topnav-links { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.topnav-links::-webkit-scrollbar { display: none; }
.topnav-links a {
  padding: 5px 11px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.topnav-links a:hover { color: var(--text); text-decoration: none; background: var(--tint); }
.topnav-links a.is-active { color: var(--bokeh-ink); background: var(--bokeh-soft); }


/* ---------- Scroll progress (left edge) ---------- */

.progress {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 50;
  width: 3px;
  background: var(--line);
  opacity: 0;
  transition: opacity 0.4s;
}
.progress.is-visible { opacity: 1; }
.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(180deg, #f6c98f, var(--bokeh));
  transform-origin: top;
  transform: scaleY(0);
  box-shadow: 0 0 10px var(--bokeh);
}
.compare-hint { margin: 10px 0 0; color: var(--faint); font-size: 0.84rem; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 72px 24px 88px;
  overflow: hidden;
}

.hero-orbs {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 56px;
  align-items: center;
}

.venue { margin: 0 0 18px; }
.venue span {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--bokeh) 45%, transparent);
  background: var(--bokeh-soft);
  color: var(--bokeh-ink);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.title {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(3.4rem, 8.6vw, 6.6rem);
  line-height: 0.95;
  letter-spacing: -0.015em;
}
.title .word { display: inline-block; }
/* Each letter gets padding (cancelled by negative margin) so italic overhangs
   are not clipped while the blur/scale layer is active. */
.title .ch {
  display: inline-block;
  padding: 0.12em 0.16em;
  margin: -0.12em -0.16em;
  opacity: 0;
}
.title.is-go .ch { animation: rackfocus 1.6s cubic-bezier(.2, .7, .2, 1) both; }
.title .ch.is-done { opacity: 1; animation: none; }
@keyframes rackfocus {
  0% { filter: blur(14px); opacity: 0; transform: scale(1.08); }
  45% { filter: blur(5px); opacity: 0.7; }
  100% { filter: blur(0); opacity: 1; transform: none; }
}

.subtitle {
  margin: 18px 0 22px;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.4vw, 1.7rem);
  line-height: 1.35;
  color: var(--muted);
}
@media (min-width: 901px) { .subtitle { white-space: nowrap; font-size: clamp(1.1rem, 1.75vw, 1.6rem); } }

.authors { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-weight: 500; }
.authors a { color: var(--text); border-bottom: 1px solid var(--line); }
.authors a:hover { text-decoration: none; border-color: var(--bokeh); }

.buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--text);
  color: #14110e;
  font-size: 0.92rem;
  font-weight: 500;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}
.btn svg { width: 15px; height: 15px; fill: currentColor; }
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--surface); }

.hero-demo { margin: 0; }
.sweep-hero {
  aspect-ratio: 1;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  cursor: ew-resize;
  touch-action: pan-y;
}
.hero-demo-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}
.hero-demo-bar strong { color: var(--text); font-weight: 600; }
.hero-demo-bar .iris { width: 40px; height: 40px; flex: none; }

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 24px;
  width: 24px;
  height: 38px;
  margin-left: -12px;
  border: 1.5px solid var(--faint);
  border-radius: 12px;
}
.scroll-cue span {
  position: absolute;
  left: 50%;
  top: 7px;
  width: 4px;
  height: 7px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--faint);
  animation: cue 1.8s ease-in-out infinite;
}
@keyframes cue { 0%, 100% { transform: translateY(0); opacity: 1; } 60% { transform: translateY(12px); opacity: 0; } }

/* ---------- Sweep (frame sprite) ---------- */

.sweep {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--tint) center / cover no-repeat;
  user-select: none;
  -webkit-user-select: none;
}
.sweep > i {
  position: absolute;
  inset: 0;
  background-size: 800% 400%;
  background-repeat: no-repeat;
  opacity: 0;
}
.sweep.is-ready > i.a { opacity: 1; }

/* ---------- Iris ---------- */

.iris .ring { fill: none; stroke: var(--faint); stroke-width: 2; }
.iris .blades { fill: color-mix(in srgb, var(--text) 82%, transparent); fill-rule: evenodd; }
.iris .edges { stroke: color-mix(in srgb, var(--bg) 55%, transparent); stroke-width: 1.2; fill: none; }
.iris .glow { fill: var(--bokeh); opacity: 0.35; }

/* ---------- Sections ---------- */

.section { padding: 72px 24px; }
.section > * { max-width: var(--maxw); margin-left: auto; margin-right: auto; }
.section-tint { background: var(--tint); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.prose p { max-width: var(--prosew); }
.prose p { margin: 0 0 1em; color: color-mix(in srgb, var(--text) 88%, var(--muted)); }
.prose em { font-style: italic; }

.h2 {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 0 0 18px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.h2 .num {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--bokeh-ink);
  letter-spacing: 0.05em;
  transform: translateY(-0.35em);
}

.tldr {
  position: relative;
  margin-bottom: 48px !important;
  padding: 22px 26px 22px 26px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--bokeh-soft), transparent 70%), var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.tldr p { margin: 0; font-size: 1.12rem; line-height: 1.6; }
.tldr-tag {
  display: inline-block;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--bokeh-ink);
}

.figure { margin: 0 auto 56px; }
.figure img { width: 100%; height: auto; border-radius: 10px; cursor: zoom-in; }
.figure-wide { padding: 18px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.figure-wide img { border-radius: 4px; }
.figure-card { padding: 22px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; }
.figure-card img { border-radius: 0; }
.figure-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: end; }
.figure-pair > div + div { border-left: 1px dashed #ccc; padding-left: 28px; }
.figure-pair span { display: block; margin-top: 10px; text-align: center; color: #555; font-family: var(--serif); font-size: 1.05rem; }
@media (max-width: 640px) { .figure-pair { grid-template-columns: 1fr; } .figure-pair > div + div { border-left: 0; padding-left: 0; border-top: 1px dashed #ccc; padding-top: 18px; } }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.8s ease, transform 0.8s cubic-bezier(.2, .8, .2, 1), filter 0.8s ease; filter: blur(6px); }
.reveal.is-in { opacity: 1; transform: none; filter: none; }

/* ---------- Tabs & cards ---------- */

.tablist {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 20px;
  border-radius: 999px;
  background: var(--tint);
  border: 1px solid var(--line);
}
.tablist button {
  padding: 7px 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.25s, color 0.25s, box-shadow 0.25s;
}
.tablist button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.tabpanel { animation: fadein 0.45s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card {
  padding: 20px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}
.card h3 { margin: 0 0 6px; font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 9px; }
.card h3::before { content: ""; width: 12px; height: 12px; border-radius: 3px; background: var(--c); }
.card p { margin: 0; color: var(--muted); font-size: 0.94rem; }
.card-orange { --c: #f6b26b; background: linear-gradient(160deg, var(--bokeh-soft), transparent 60%), var(--surface); }
.card-blue { --c: #6fa8f0; background: linear-gradient(160deg, var(--blue-soft), transparent 60%), var(--surface); }
.card-green { --c: #5fa597; background: linear-gradient(160deg, var(--green-soft), transparent 60%), var(--surface); }
.card-yellow { --c: #f2cd4c; background: linear-gradient(160deg, var(--yellow-soft), transparent 60%), var(--surface); }

/* ---------- Chips ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.chip {
  padding: 6px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.chip:hover { color: var(--text); border-color: var(--faint); }
.chip.is-active { background: var(--bokeh); border-color: var(--bokeh); color: #1d1004; }

/* ---------- Gallery ---------- */

.masonry { display: flex; align-items: flex-start; gap: 16px; }
.masonry-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.masonry figure { margin: 0; }
.masonry figure.is-hidden { display: none; }
.masonry figure.is-entering { animation: fadein 0.45s ease both; }
.masonry .ph { position: relative; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); transform: translateZ(0); }
.masonry img { width: 100%; height: auto; cursor: zoom-in; backface-visibility: hidden; transition: transform 0.6s cubic-bezier(.2, .8, .2, 1); }
.masonry .ph:hover img { transform: scale(1.035); }
.masonry figcaption { margin-top: 8px; color: var(--muted); font-size: 0.84rem; line-height: 1.45; font-style: italic; font-family: var(--serif); }

.badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  min-width: 30px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bokeh);
  color: #2a1606;
  font-family: var(--mono);
  font-size: 0.86rem;
  font-weight: 500;
  text-align: center;
  pointer-events: none;
}
.model {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 18, 21, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  pointer-events: none;
}

/* ---------- Dial (shared range control) ---------- */

.dial {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 720px !important;
  margin-bottom: 26px !important;
  margin-left: max(0px, (100% - var(--maxw)) / 2) !important;
  padding: 10px 16px 10px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.dial .iris { width: 38px; height: 38px; flex: none; }
.dial-end { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }

.play {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
}
.play svg { width: 16px; height: 16px; fill: currentColor; }
.play .i-play { display: none; }
.play[aria-pressed="false"] .i-play { display: block; }
.play[aria-pressed="false"] .i-pause { display: none; }

.range {
  flex: 1;
  min-width: 80px;
  height: 28px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  --p: 0%;
}
.range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--bokeh) var(--p), var(--line) var(--p));
}
.range::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line); }
.range::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--bokeh); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -7px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--bokeh);
  box-shadow: 0 0 0 5px var(--bokeh-soft), 0 2px 6px rgba(0, 0, 0, 0.2);
}
.range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--bokeh);
  box-shadow: 0 0 0 5px var(--bokeh-soft), 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ---------- Sweep grid ---------- */

.sweep-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.sweep-tile {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: none;
  cursor: zoom-in;
  box-shadow: var(--shadow);
  transition: transform 0.3s cubic-bezier(.2, .8, .2, 1), box-shadow 0.3s;
}
.sweep-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.sweep-tile .sweep { aspect-ratio: 1; }
.tile-label {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(16, 18, 21, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.25s, transform 0.25s;
}
.sweep-tile:hover .tile-label, .sweep-tile:focus-visible .tile-label { opacity: 1; transform: none; }

/* ---------- Comparison ---------- */

.compare-input { margin: 0; }
.compare-input figcaption { margin-top: 8px; font-size: 0.84rem; color: var(--muted); }

.compare {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  cursor: ew-resize;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  --x: 50%;
}
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.compare-a-clip { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--x)) 0 0); }
.compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--x);
  width: 2px;
  margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.35);
}
.compare-handle span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.compare-handle span::before, .compare-handle span::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 0;
  height: 0;
  margin-top: -5px;
  border: 5px solid transparent;
}
.compare-handle span::before { left: 7px; border-right-color: #333; }
.compare-handle span::after { right: 7px; border-left-color: #333; }
.compare-tag {
  position: absolute;
  top: 12px;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(16, 18, 21, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 500;
  pointer-events: none;
}
.compare-tag-a { left: 12px; }
.compare-tag-b { right: 12px; background: var(--bokeh); color: #2a1606; }
.compare.is-swapping img { animation: swapin 0.45s ease; }
@keyframes swapin { from { filter: blur(10px); opacity: 0.4; } to { filter: none; opacity: 1; } }

.compare-note {
  max-width: var(--prosew);
  margin: 18px 0 0 !important;
  padding-left: 14px;
  border-left: 3px solid var(--bokeh);
  color: var(--muted);
  min-height: 3.2em;
}


/* ---------- BibTeX ---------- */

.bibtex { position: relative; }
.bibtex pre {
  margin: 0;
  padding: 22px 24px;
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.6;
}
.copy {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
}
.copy svg { width: 13px; height: 13px; fill: currentColor; }
.copy:hover { color: var(--text); }
.copy.is-done { color: var(--bokeh-ink); border-color: var(--bokeh); }

/* ---------- Footer ---------- */

.footer {
  max-width: var(--prosew);
  margin: 0 auto;
  padding: 24px 24px 64px;
  color: var(--faint);
  font-size: 0.84rem;
  text-align: center;
}

/* ---------- Lightbox ---------- */

.lightbox {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #eee;
}
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox::backdrop { background: rgba(8, 9, 11, 0.86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.lightbox figure { margin: 0; max-width: min(1200px, 88vw); animation: fadein 0.3s ease; }
.lb-media img { max-height: 82vh; width: auto; margin: 0 auto; border-radius: 10px; background: #fff; }
.lb-media .lb-sweep { width: min(78vh, 88vw); }
.lb-media .lb-sweep .sweep { aspect-ratio: 1; border-radius: 12px; cursor: ew-resize; touch-action: pan-y; }
.lb-media .lb-sweep .dial { margin: 14px auto 0 !important; background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.12); box-shadow: none; }
.lb-media .lb-sweep .dial-end { color: #bbb; }
.lightbox figcaption { margin-top: 12px; text-align: center; font-size: 0.92rem; color: #ccc; font-family: var(--serif); font-style: italic; }
.lb-close, .lb-nav {
  position: fixed;
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: background 0.2s;
}
.lb-close:hover, .lb-nav:hover { background: rgba(255, 255, 255, 0.2); }
.lb-close { top: 18px; right: 18px; width: 40px; height: 40px; font-size: 1.6rem; line-height: 1; }
.lb-nav { top: 50%; width: 46px; height: 46px; margin-top: -23px; font-size: 1.8rem; line-height: 1; }
.lb-prev { left: 18px; }
.lb-next { right: 18px; }
.lightbox.is-single .lb-nav { display: none; }

/* ---------- Logos ---------- */

.logos { display: flex; align-items: center; gap: 22px; margin: 18px 0 28px; }
.logos a { display: block; opacity: 0.88; transition: opacity 0.2s, transform 0.2s; }
.logos a:hover { opacity: 1; transform: translateY(-1px); }
.logos img { display: block; width: auto; }
.logo-mmlab { height: 40px; border-radius: 4px; }
.logo-ntu { height: 42px; }

/* ---------- Segmented control ---------- */

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 999px;
  background: var(--tint);
  border: 1px solid var(--line);
}
.seg button {
  padding: 5px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.seg button:hover { color: var(--text); }
.seg button.is-active { background: var(--bokeh); color: #1d1004; }

/* ---------- Method blocks ---------- */

.method-block + .method-block { margin-top: 36px !important; }
.method-sub {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bokeh-ink);
}

/* ---------- Architecture diagram ---------- */

.arch { --c-txt: #b48cf2; --c-bca: #f6a95e; --c-gsa: #6fa8f0; --c-grey: #8d877e; }
.arch { display: grid; grid-template-columns: minmax(0, 0.5fr) minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: stretch; }
.arch-top { display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 18px; }
.arch-top .unet { max-width: 220px; margin: 0 auto; }
.unet { width: 100%; height: auto; display: block; }
.hourglass { fill: rgba(255, 255, 255, 0.035); stroke: var(--faint); stroke-width: 1.5; }
.blk { transition: opacity 0.3s, filter 0.3s; }
.blk-txt { fill: var(--c-txt); }
.blk-bca { fill: var(--c-bca); }
.blk-gsa { fill: var(--c-gsa); }
.dots { fill: var(--muted); font-size: 20px; text-anchor: middle; }
.arch[data-hl] .blk { opacity: 0.18; }
.arch[data-hl="txt"] .blk-txt, .arch[data-hl="bca"] .blk-bca, .arch[data-hl="gsa"] .blk-gsa { opacity: 1; filter: drop-shadow(0 0 6px currentColor); }

.arch-legend h3 { margin: 0 0 10px; font-family: var(--serif); font-weight: 400; font-size: 1.1rem; text-align: center; white-space: nowrap; }
.arch-legend ul { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 7px; }
.arch-legend li { display: grid; grid-template-columns: 14px 1fr; align-items: center; gap: 1px 8px; font-size: 0.82rem; line-height: 1.3; cursor: default; }
.arch-legend .muted { grid-column: 2; color: var(--faint); font-size: 0.74rem; }
.sw { width: 14px; height: 14px; border-radius: 3px; flex: none; }
.sw-txt { background: var(--c-txt); }
.sw-bca { background: var(--c-bca); }
.sw-gsa { background: var(--c-gsa); }
.arch-dial { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 12px; border-radius: 14px; background: var(--tint); border: 1px solid var(--line); }
.arch-dial .dial-end { flex-basis: 100%; font-size: 0.76rem; }
.arch-dial .range { min-width: 0; }
.arch-dial .iris { width: 30px; height: 30px; flex: none; }

.arch-cards { display: contents; }
.arch-card { padding: 18px; }
.arch-card h3 { font-size: 0.95rem; }
.arch-card p { font-size: 0.86rem; }
.arch-card { display: flex; flex-direction: column; transition: border-color 0.3s; }
.arch-card:hover { border-color: color-mix(in srgb, var(--c) 55%, var(--line)); }
.arch-card .flow { width: 100%; height: auto; margin: 6px 0 12px; }
.arch-card p { margin-top: 4px; }
.arch-card .flow { flex: 1; }

.flow text { fill: var(--text); font-family: var(--sans); }
.flow .lbl { font-size: 20px; font-weight: 500; font-style: italic; text-anchor: middle; dominant-baseline: central; font-family: var(--math); }
.flow .lbl.sm { font-size: 17px; font-style: normal; }
.flow .opl { font-size: 17px; font-weight: 500; text-anchor: middle; dominant-baseline: central; font-family: var(--math); }
.flow .sub { font-size: 12px; font-weight: 500; }
.flow .ksub { font-size: 13px; font-weight: 500; }
.flow .cap { fill: var(--muted); font-size: 15px; }
.flow .cap.c { text-anchor: middle; font-family: var(--math); font-style: italic; font-size: 17px; fill: var(--text); }
.flow .cap.c .sub { font-size: 12px; }
.flow .lam { font-family: var(--math); font-style: italic; font-size: 17px; }
.flow .legend-c { font-size: 15px; fill: var(--muted); text-anchor: end; }
.flow .ar { fill: none; stroke: var(--faint); stroke-width: 1.4; }
.flow .mk { fill: var(--faint); }
.flow .fl { stroke-dasharray: 5 5; animation: flow 1.2s linear infinite; }
.flow .fl-orange { stroke: var(--c-bca); }
.flow .fl-blue { stroke: var(--c-gsa); }
@keyframes flow { to { stroke-dashoffset: -20; } }
.flow .bx { stroke-width: 1.5; }
.flow .bx-grey { fill: #2a2622; stroke: var(--c-grey); }
.flow .bx-orange { fill: rgba(246, 169, 94, 0.22); stroke: var(--c-bca); }
.flow .bx-blue { fill: rgba(111, 168, 240, 0.22); stroke: var(--c-gsa); }
.flow .tok { fill: rgba(180, 140, 242, 0.35); stroke: var(--c-txt); stroke-width: 1.3; }
.flow .op { fill: var(--tint); stroke: var(--c-grey); stroke-width: 1.3; stroke-dasharray: 4 3; }
.flow .op-orange { stroke: var(--c-bca); }
.flow .node { fill: var(--surface); stroke: var(--muted); stroke-width: 1.4; }
.flow .bk-box { fill: none; stroke: var(--c-bca); stroke-width: 1.5; }
.flow .bk-fill { fill: var(--c-bca); }

/* ---------- Data pipeline ---------- */

.pipe { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 3fr); gap: 14px; align-items: stretch; }
.pipe-track {
  padding: 18px 18px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, var(--soft), transparent 50%), var(--surface);
}
.pipe-green { --c: #6fbfae; --soft: var(--green-soft); }
.pipe-yellow { --c: #f2cd4c; --soft: var(--yellow-soft); }
.pipe-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.pipe-head h3 { margin: 0; font-size: 0.95rem; font-weight: 600; line-height: 1.3; }
.pipe-head p { margin: 2px 0 0; color: var(--muted); font-size: 0.82rem; }
.pipe-tag {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--c);
  color: var(--c);
  font-family: var(--mono);
  font-size: 0.75rem;
}
.pipe-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
.pipe-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.step { position: relative; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
/* chevron between tiles, vertically centred on the tile */
.step + .step::before {
  content: "";
  position: absolute;
  left: -15px;
  top: calc(28px + (100% - 70px) / 2);
  width: 7px;
  height: 7px;
  border-top: 1.5px solid var(--c);
  border-right: 1.5px solid var(--c);
  transform: translateY(-50%) rotate(45deg);
  opacity: 0.8;
}
.step-k {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 20px;
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}
.step-k b {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--c) 22%, transparent);
  color: var(--c);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 500;
}
.step p { margin: 0; min-height: 2.8em; color: var(--muted); font-size: 0.76rem; line-height: 1.4; }

.tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--tint);
}
.tile > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 78% 50%; }
.tile-plain { border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); }

.exif {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(12, 11, 10, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #e6e0d6;
  font-family: var(--mono);
  font-size: 0.6rem;
  line-height: 1.45;
}

.annot-tile { position: absolute; inset: 0; opacity: 0; transition: opacity 0.6s ease; }
.annot-tile.is-on { opacity: 1; }
.annot img.annot-tile { width: 100%; height: 100%; object-fit: cover; object-position: 78% 50%; }
.annot-txt {
  display: flex;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1rem;
  line-height: 1.3;
}
.annot-txt q { quotes: "“" "”"; }
.annot-keys span { transition: color 0.3s; }
.annot-keys span.is-on { color: var(--text); font-weight: 600; }

.checks { list-style: none; margin: 0; padding: 0 12px; height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 7px; }
.checks li { display: flex; align-items: center; gap: 7px; font-size: 0.76rem; white-space: nowrap; opacity: 0.25; transform: translateX(-4px); transition: opacity 0.4s, transform 0.4s; }
.checks li::before { content: "✓"; color: #f2cd4c; font-weight: 600; }
.checks.is-on li { opacity: 1; transform: none; }

.hist { position: absolute; inset: 14px 12px 12px; display: flex; align-items: flex-end; gap: 3px; border-bottom: 1.5px solid var(--faint); }
.hist i { flex: 1; border-radius: 2px 2px 0 0; background: linear-gradient(180deg, #8fb1ea, #5b7fc4); transition: height 1.1s cubic-bezier(.4, 0, .2, 1); }
.hist-label span { transition: color 0.4s; }
.pipe-track[data-hist="a"] .h-a, .pipe-track[data-hist="b"] .h-b { color: var(--text); font-weight: 600; }

.fan { cursor: pointer; }
.fan img {
  position: absolute;
  inset: auto;
  width: 62%;
  height: 62%;
  object-fit: cover;
  object-position: 78% 50%;
  border-radius: 7px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  transition: transform 0.5s cubic-bezier(.2, .8, .2, 1);
}
.fan img:nth-child(1) { right: 7%; top: 7%; }
.fan img:nth-child(2) { right: 19%; top: 19%; }
.fan img:nth-child(3) { right: 31%; top: 31%; }
.fan:hover img:nth-child(1), .fan:focus img:nth-child(1) { transform: translate(6%, -6%) rotate(5deg); }
.fan:hover img:nth-child(3), .fan:focus img:nth-child(3) { transform: translate(-6%, 6%) rotate(-5deg); }

.tile-dial {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(12, 11, 10, 0.68);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #e6e0d6;
  font-family: var(--serif);
}
.tile-dial .range { height: 22px; }
.tile-dial .range::-webkit-slider-thumb { width: 14px; height: 14px; margin-top: -4px; box-shadow: 0 0 0 3px var(--bokeh-soft); }
.tile-dial .range::-moz-range-thumb { width: 11px; height: 11px; }

/* ---------- Comparison: scene tabs, depth, zoom ---------- */

.cmp-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.cmp-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.cmp-tab .kind { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); }
.cmp-tab:hover { border-color: var(--faint); }
.cmp-tab.is-active { border-color: var(--bokeh); background: linear-gradient(160deg, var(--bokeh-soft), transparent 70%), var(--surface); }
.cmp-tab.is-active .kind { color: var(--bokeh-ink); }

.compare-layout { display: grid; grid-template-columns: 1fr 2fr; gap: 18px; align-items: start; }
.compare-side { display: grid; gap: 14px; }
.compare-input img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; box-shadow: var(--shadow); }
.compare-input figcaption .muted { color: var(--faint); }
.compare-kind {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(16, 18, 21, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .hero { padding-top: 56px; }
  .hero-inner { grid-template-columns: 1fr; gap: 36px; }
  .hero-demo { max-width: 520px; }
  .topnav-brand { display: none; }
  .topnav { padding-left: 8px; }
  .compare-layout { grid-template-columns: 1fr; }
  .compare-side { grid-template-columns: 1fr 1fr; order: 2; }
  .arch { grid-template-columns: 1fr 1fr; }
  .arch-top { grid-column: 1 / -1; flex-direction: row; align-items: center; }
  .arch-top .unet { max-width: 200px; flex: none; }
  .sweep-grid { grid-template-columns: repeat(2, 1fr); }
  .pipe { grid-template-columns: 1fr; }
  .cmp-tabs { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .section { padding: 56px 16px; }
  .hero { padding: 48px 16px 80px; }
  .cards { grid-template-columns: 1fr; }
  .sweep-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .masonry, .masonry-col { gap: 10px; }
  .figure-card { padding: 10px; }
  .dial { gap: 10px; }
  .dial-end { display: none; }
  .lb-nav { display: none; }
  .tldr { padding: 18px 18px; }
  .pipe-steps, .pipe-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .pipe-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .pipe-3 .step-k { font-size: 0.74rem; }
  .tile-dial { padding: 0 6px; gap: 4px; }
  .tile-dial i { display: none; }
  .pipe-steps .step::before { display: none; }
  .logos img { height: 34px; }
  .arch { grid-template-columns: 1fr; }
  .arch-top { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 6px 14px; align-items: center; }
  .arch-top .unet { max-width: none; grid-row: 1; }
  .arch-legend { display: contents; }
  .arch-legend h3 { grid-column: 1; grid-row: 2; margin: 0; font-size: 1rem; }
  .arch-legend ul { grid-column: 2; grid-row: 1 / 3; margin: 0; }
  .arch-dial { grid-column: 1 / -1; grid-row: 3; margin-top: 8px; flex-wrap: nowrap; }
  .arch-dial .dial-end { display: inline; flex-basis: auto; white-space: nowrap; }
  .bibtex pre { padding-top: 52px; font-size: 0.78rem; }
  .subtitle { font-size: 1.12rem; text-wrap: balance; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .title .ch, .title.is-go .ch, .scroll-cue span { animation: none; }
  .title .ch { opacity: 1; }
  .reveal { opacity: 1; transform: none; filter: none; transition: none; }
}
