/* Prompt2Effect — project page styles.
   Adapted from the OmniMem project-page template, tuned for portrait (9:16)
   effect videos and N-way side-by-side comparisons. */

:root {
  --bg: #ffffff;
  --panel: #f7f8fb;
  --fg: #14161c;       /* headings / strong text */
  --body: #3f4448;     /* body copy */
  --muted: #6b7280;
  --accent: #4f46e5;   /* indigo */
  --accent-2: #7c3aed; /* violet */
  --accent-soft: #ede9fe;
  --border: #e6e8ee;
  --grad: linear-gradient(120deg, #4f46e5 0%, #7c3aed 55%, #2563eb 100%);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Space Grotesk", "Inter", -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
section { scroll-margin-top: 1rem; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 5rem 1.5rem 3rem;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(58rem 26rem at 12% -12%, rgba(79, 70, 229, 0.10), transparent 60%),
    radial-gradient(52rem 26rem at 92% -6%, rgba(124, 58, 237, 0.10), transparent 60%),
    linear-gradient(180deg, #fbfbff 0%, #ffffff 70%);
}
.hero::before, .hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(64px);
  opacity: 0.35;
  z-index: 0;
  pointer-events: none;
}
.hero::before {
  width: 30rem; height: 30rem;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.9), transparent 70%);
  top: -12rem; left: -8rem;
  animation: blob1 16s ease-in-out infinite;
}
.hero::after {
  width: 26rem; height: 26rem;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.85), transparent 70%);
  top: -8rem; right: -7rem;
  animation: blob2 18s ease-in-out infinite;
}
.hero > * { position: relative; z-index: 1; }
@keyframes blob1 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(2.5rem, 1.5rem); } }
@keyframes blob2 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-2rem, 1rem); } }

.venue-badge {
  display: inline-block;
  margin: 0 0 1.2rem;
  padding: 0.38rem 1rem;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #fff;
  background: var(--grad);
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.32);
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.9rem, 7vw, 4.7rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.02;
  margin: 0 0 0.7rem 0;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.subtitle {
  font-size: clamp(1.2rem, 2.6vw, 1.7rem);
  font-weight: 600;
  max-width: 56rem;
  margin: 0 auto 1.6rem;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.authors { margin: 0.5rem auto 0.4rem; font-size: 1.15rem; line-height: 1.95; max-width: 60rem; }
.authors a { color: var(--fg); border-bottom: 1px solid transparent; }
.authors a:hover { color: var(--accent); border-bottom-color: var(--accent); text-decoration: none; }
.authors sup { color: var(--muted); font-weight: 500; }
.affiliations { color: var(--muted); margin: 0.45rem 0 0.3rem; font-size: 1.05rem; }
.affiliations sup { font-weight: 600; }
.notes { color: var(--muted); margin: 0 0 1.4rem; font-size: 0.95rem; }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
  margin-top: 1.8rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.68rem 1.35rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--fg);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  box-shadow: 0 4px 14px rgba(20, 22, 28, 0.16);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { background: #000; text-decoration: none; transform: translateY(-2px); box-shadow: 0 10px 24px rgba(20, 22, 28, 0.24); }
.btn.primary { background: var(--grad); box-shadow: 0 8px 20px rgba(79, 70, 229, 0.38); }
.btn.primary:hover { background: var(--grad); box-shadow: 0 12px 28px rgba(79, 70, 229, 0.5); }
.btn .sub { font-weight: 400; opacity: 0.78; font-size: 0.82em; }
.repro-note {
  max-width: 46rem;
  margin: 1.3rem auto 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- Full-width alternating bands ---------- */
.band { padding: 3.5rem 1.5rem; }
.band-alt { background: var(--panel); }
.container { max-width: 1100px; margin: 0 auto; }
.container.wide { max-width: 1320px; }
h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.02em;
  margin: 0 0 1.6rem;
  color: var(--fg);
}
h2::after {
  content: "";
  display: block;
  width: 3rem;
  height: 3px;
  margin: 0.75rem auto 0;
  border-radius: 3px;
  background: var(--grad);
}
.subhead {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: -0.01em;
  margin: 3rem 0 1.2rem;
  color: var(--fg);
}
.section-lead {
  max-width: 56rem;
  margin: -0.5rem auto 2rem;
  text-align: center;
  color: var(--muted);
}
.abstract p {
  max-width: 52rem;
  margin: 0 auto;
  text-align: justify;
  color: var(--body);
  font-size: 1.05rem;
}
.body-text {
  max-width: 60rem;
  margin: 0 auto;
  color: var(--body);
}

.tldr {
  max-width: 54rem;
  margin: 0 auto;
  text-align: left;
  font-size: 1.2rem;
  line-height: 1.65;
  color: var(--fg);
}
.tldr strong, .tldr b { color: var(--accent); font-weight: 700; }

/* ---------- In-page gallery nav ---------- */
.gallery-error {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--muted);
  text-align: center;
}
.gallery-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin: 0 0 2.5rem;
}
.gallery-nav a {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--body);
  font-size: 0.9rem;
  font-weight: 500;
}
.gallery-nav a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ---------- Video sections ---------- */
.video-section { margin-bottom: 3.5rem; scroll-margin-top: 1rem; }
.video-section:last-child { margin-bottom: 0; }
.video-section h2 { text-align: center; font-size: 1.55rem; margin: 0 0 0.6rem; }
.video-section h2::after { width: 2.5rem; }
.video-section .lead {
  color: var(--muted);
  max-width: 60rem;
  margin: 0 auto 1.6rem;
  font-size: 1rem;
  text-align: center;
}
.video-section .prompt-hint {
  margin: 0 0 1rem;
  color: var(--fg);
  font-size: 0.95rem;
  font-weight: 500;
}

/* Speed toggle */
.speed-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.3rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.speed-btn {
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--body);
  font-weight: 500;
  transition: all 0.15s ease;
}
.speed-btn:hover { border-color: #bbb; }
.speed-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- Grid ---------- */
.grid { display: grid; gap: 1.1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) {
  .grid.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .grid.cols-4, .grid.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .grid.cols-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Video card ---------- */
.vcard { display: flex; flex-direction: column; }
.vmedia {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.06);
  aspect-ratio: 9 / 16; /* default; overridden inline per section */
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.vcard:hover .vmedia { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16); }
.vcard.is-ours .vmedia {
  box-shadow: 0 0 0 2px var(--accent), 0 8px 24px rgba(79, 70, 229, 0.22);
}
.vcard.is-ours:hover .vmedia { transform: translateY(-3px); box-shadow: 0 0 0 2px var(--accent), 0 14px 32px rgba(79, 70, 229, 0.30); }
.vcard video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.col-label {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 11px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.68);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  z-index: 3;
  pointer-events: none;
  max-width: calc(100% - 20px);
}
.col-label.ours { background: var(--accent); }
.prompt-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  padding: 14px 15px;
  opacity: 0;
  transition: opacity 0.25s ease;
  text-align: left;
  font-size: 0.75rem;
  line-height: 1.5;
  overflow-y: auto;
  z-index: 4;
  pointer-events: auto;
}
.prompt-overlay .prompt-inner { margin: auto 0; width: 100%; } /* vertical centering */
.vmedia:hover .prompt-overlay { opacity: 1; }

/* Shared row prompt: one shadow bar across every video in a comparison row,
   shown when hovering any video in that row (used for OOD effects). */
.grid.has-row-prompt { position: relative; }
.row-prompt {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  max-height: calc(100% - 1.5rem);
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.8);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  color: #fff;
  padding: 1.1rem 1.5rem;
  font-size: 0.92rem;
  line-height: 1.55;
  text-align: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.grid.has-row-prompt:hover .row-prompt { opacity: 1; }
.row-prompt-title { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; margin-bottom: 0.45rem; }
.row-prompt-text { font-size: 0.88rem; line-height: 1.55; }

/* Comparison row (one example, N synced variants) */
.compare-row { margin-bottom: 2.6rem; }
.compare-row:last-child { margin-bottom: 0; }
.compare-row .row-title {
  font-size: 1rem;
  color: var(--fg);
  font-weight: 600;
  margin: 0 auto 0.75rem;
  text-align: center;
}
.compare-row .row-caption {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0.8rem auto 0;
  max-width: 60rem;
  text-align: center;
}

/* Teaser: two synchronized pairs in one row, split by a vertical divider */
.teaser-row {
  display: flex;
  gap: 1.6rem;
  align-items: flex-start;
  justify-content: center;
}
.teaser-pair { flex: 1 1 0; min-width: 0; }
.pair-title {
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--fg);
  margin: 0 0 0.85rem;
}
.teaser-divider {
  align-self: stretch;
  width: 1px;
  background: var(--border);
  flex: 0 0 auto;
}
@media (max-width: 760px) {
  .teaser-row { flex-direction: column; gap: 2rem; }
  .teaser-divider { width: auto; height: 1px; }
}

/* ---------- Figures ---------- */
.figure { margin: 0 auto; display: flex; flex-direction: column; }
.figure img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  transition: box-shadow 0.2s ease;
}
.figure:hover img { box-shadow: 0 10px 28px rgba(0, 0, 0, 0.10); }
.figure figcaption {
  margin-top: 0.7rem;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
  overflow-wrap: anywhere;
}
.fig-grid { align-items: start; }
@media (max-width: 820px) { .fig-grid.cols-3 { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .fig-grid.cols-2 { grid-template-columns: 1fr; } }

/* ---------- BibTeX ---------- */
.bibtex pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-size: 0.85rem;
}
.bibtex code { color: var(--body); font-family: "SFMono-Regular", Consolas, monospace; }

/* ---------- Footer ---------- */
footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--muted);
  font-size: 0.875rem;
  border-top: 1px solid var(--border);
}
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }

/* ---------- Teaser OOD note ---------- */
.teaser-note {
  margin: 1.5rem auto 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}
.ood-tag {
  display: inline-block;
  padding: 0.14rem 0.65rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.82em;
  letter-spacing: 0.02em;
}

/* ---------- Scroll reveal (set by JS via .reveal-on; respects reduced motion) ---------- */
.reveal-on main > section {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal-on main > section.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .hero::before, .hero::after { animation: none; }
  .reveal-on main > section { opacity: 1; transform: none; transition: none; }
}
