/* ===========================================================
   LongLive-RAG — project page
   =========================================================== */

:root {
  --bg: #060912;
  --bg-2: #0a1020;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-strong: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.09);
  --text: #e8edf7;
  --text-dim: #9aa6bf;
  --text-faint: #6b7793;
  --blue: #2d7dff;
  --cyan: #19c7d4;
  --teal: #18a6b8;
  --accent-grad: linear-gradient(100deg, #2d7dff 0%, #21b3e6 50%, #19c7d4 100%);
  --maxw: 1120px;
  --radius: 18px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(45, 125, 255, 0.35); color: #fff; }

a { color: inherit; text-decoration: none; }

.nowrap { white-space: nowrap; }
.mono { font-family: 'JetBrains Mono', monospace; font-size: 0.9em; color: var(--cyan); }

/* ---------------- animated background ---------------- */
.bg-aurora {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(1200px 700px at 70% -10%, rgba(45,125,255,0.16), transparent 60%),
    radial-gradient(1000px 800px at 10% 0%, rgba(25,199,212,0.10), transparent 55%),
    var(--bg);
  overflow: hidden;
}
.blob {
  position: absolute; border-radius: 50%;
  filter: blur(90px); opacity: 0.5;
  will-change: transform;
}
.blob-1 { width: 540px; height: 540px; top: -120px; left: -100px;
  background: radial-gradient(circle, #2d7dff, transparent 70%);
  animation: drift1 22s ease-in-out infinite; }
.blob-2 { width: 480px; height: 480px; top: 30%; right: -120px;
  background: radial-gradient(circle, #19c7d4, transparent 70%);
  animation: drift2 26s ease-in-out infinite; }
.blob-3 { width: 600px; height: 600px; bottom: -200px; left: 30%;
  background: radial-gradient(circle, #1862c9, transparent 70%);
  animation: drift3 30s ease-in-out infinite; }

@keyframes drift1 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(120px,80px) scale(1.15)} }
@keyframes drift2 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(-90px,120px) scale(1.1)} }
@keyframes drift3 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(60px,-100px) scale(0.9)} }

.bg-lattice { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; opacity: 0.5; }

/* ---------------- nav ---------------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(18px, 4vw, 46px);
  transition: background 0.3s, backdrop-filter 0.3s, border-color 0.3s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(8, 12, 22, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.nav-brand { display: flex; align-items: center; gap: 9px; }
.brand-mark { display: block; flex-shrink: 0; filter: drop-shadow(0 2px 8px rgba(33,179,230,0.35)); }
.brand-text {
  font-family: 'Space Grotesk', sans-serif; font-weight: 700;
  font-size: 1.14rem; letter-spacing: -0.01em; color: var(--text);
}
.brand-rag { color: var(--cyan); }
.nav-links { display: flex; gap: 26px; }
.nav-links a {
  font-size: 0.92rem; color: var(--text-dim); font-weight: 500;
  position: relative; transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }
.nav-links a::after {
  content: ''; position: absolute; left: 0; bottom: -6px; height: 2px; width: 0;
  background: var(--accent-grad); transition: width 0.25s;
}
.nav-links a:hover::after { width: 100%; }

/* ---------------- hero ---------------- */
.hero {
  min-height: 100vh; padding: 130px clamp(20px, 5vw, 40px) 60px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  position: relative;
}
.hero-inner { max-width: 980px; width: 100%; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.8rem; letter-spacing: 0.04em; color: var(--text-dim);
  border: 1px solid var(--border); background: var(--panel);
  padding: 7px 16px; border-radius: 999px; margin-bottom: 30px;
  backdrop-filter: blur(8px);
}
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.35} }

.hero-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: clamp(3rem, 9vw, 6.5rem);
  line-height: 1.02; letter-spacing: -0.03em; margin-bottom: 14px;
}
.grad-text {
  background: linear-gradient(100deg, #5b9bff 0%, #36c9e6 45%, #19c7d4 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  background-size: 200% auto; animation: shine 6s linear infinite;
}
@keyframes shine { to { background-position: 200% center; } }

.hero-subtitle {
  font-size: clamp(1.05rem, 2.4vw, 1.6rem); font-weight: 500;
  color: var(--text); max-width: 720px; margin: 0 auto 34px;
  font-family: 'Space Grotesk', sans-serif;
}

.authors {
  display: flex; flex-wrap: wrap; gap: 6px 22px; justify-content: center;
  font-size: 1.05rem; margin-bottom: 12px;
}
.author a { color: var(--text); transition: color 0.2s; font-weight: 500; }
.author a:hover { color: var(--cyan); }
.author sup { color: var(--text-faint); font-size: 0.7em; }

.affils {
  display: flex; flex-wrap: wrap; gap: 6px 22px; justify-content: center;
  color: var(--text-dim); font-size: 0.95rem;
}
.affils sup { color: var(--cyan); }
.affils.note { font-size: 0.85rem; color: var(--text-faint); margin-top: 4px; }

.cta {
  display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 36px;
}
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 22px; border-radius: 12px;
  font-weight: 600; font-size: 0.95rem;
  border: 1px solid var(--border); background: var(--panel-strong);
  color: var(--text); backdrop-filter: blur(8px);
  transition: transform 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.btn:hover { transform: translateY(-3px); border-color: rgba(45,125,255,0.6);
  background: rgba(45,125,255,0.12); }
.btn-primary {
  background: var(--accent-grad); border-color: transparent; color: #04101f;
  box-shadow: 0 10px 30px -8px rgba(33,179,230,0.6);
}
.btn-primary:hover { background: var(--accent-grad); color: #04101f;
  box-shadow: 0 14px 36px -8px rgba(33,179,230,0.8); }

/* teaser */
.teaser {
  margin: 64px auto 0; max-width: var(--maxw); width: 100%;
  border-radius: var(--radius); padding: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(45,125,255,0.06), var(--panel));
  box-shadow: var(--shadow); backdrop-filter: blur(6px);
}
.teaser img {
  width: 100%; display: block; background: #fff;
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 18px 44px -18px rgba(0,0,0,0.7);
}
.teaser figcaption {
  padding: 16px 10px 4px; font-size: 0.9rem; color: var(--text-dim);
  text-align: left;
}
.teaser figcaption strong { color: var(--text); }

/* video teaser variant */
.teaser-video { padding: 16px; }
.teaser-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.teaser-pair .vcard video { width: 100%; display: block; aspect-ratio: 832 / 480; object-fit: cover; }
.teaser-cap {
  padding: 16px 10px 4px; font-size: 0.92rem; color: var(--text-dim); text-align: left;
}
.teaser-cap strong { color: var(--text); }

.scroll-hint {
  margin-top: 44px; width: 26px; height: 42px; border: 2px solid var(--text-faint);
  border-radius: 14px; display: flex; justify-content: center; padding-top: 7px;
}
.scroll-hint span { width: 4px; height: 8px; border-radius: 2px; background: var(--cyan);
  animation: scrolldot 1.6s infinite; }
@keyframes scrolldot { 0%{transform:translateY(0);opacity:1} 70%{transform:translateY(14px);opacity:0} 100%{opacity:0} }

/* ---------------- sections ---------------- */
.section {
  max-width: var(--maxw); margin: 0 auto; padding: 80px clamp(20px, 5vw, 40px);
}
.kicker {
  font-family: 'JetBrains Mono', monospace; color: var(--cyan);
  font-size: 0.85rem; letter-spacing: 0.18em; text-transform: uppercase; margin-bottom: 16px;
}
.section-title {
  font-family: 'Space Grotesk', sans-serif; font-weight: 700;
  font-size: clamp(1.7rem, 4vw, 2.6rem); letter-spacing: -0.02em;
  margin-bottom: 28px; display: flex; align-items: baseline; gap: 16px;
}
.section-title .num {
  font-family: 'JetBrains Mono', monospace; font-size: 0.5em;
  color: var(--cyan); -webkit-text-fill-color: var(--cyan);
}
.section-sub { color: var(--text-dim); max-width: 800px; margin-bottom: 36px; font-size: 1.02rem; }

.lead {
  font-size: clamp(1.2rem, 2.6vw, 1.7rem); font-weight: 500; line-height: 1.55;
  max-width: 880px; font-family: 'Space Grotesk', sans-serif; color: var(--text);
}
.hl { color: var(--cyan); }
.lead .hl { background: linear-gradient(transparent 62%, rgba(25,199,212,0.18) 0); padding: 0 2px; }

/* stats */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 54px;
}
.stat {
  border: 1px solid var(--border); background: var(--panel); border-radius: var(--radius);
  padding: 26px 22px; backdrop-filter: blur(6px); transition: transform 0.3s, border-color 0.3s;
}
.stat:hover { transform: translateY(-4px); border-color: rgba(45,125,255,0.5); }
.stat-num {
  font-family: 'Space Grotesk', sans-serif; font-weight: 700;
  font-size: 2.8rem; line-height: 1;
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-sub { font-size: 0.6em; }
.stat-label { color: var(--text-dim); font-size: 0.92rem; margin-top: 12px; }
.stat-label span { color: var(--text-faint); font-size: 0.82rem; }

/* abstract */
.abstract-card {
  border: 1px solid var(--border); background: var(--panel); border-radius: var(--radius);
  padding: clamp(26px, 4vw, 44px); backdrop-filter: blur(6px); box-shadow: var(--shadow);
}
.abstract-card p { color: var(--text-dim); margin-bottom: 18px; font-size: 1.04rem; }
.abstract-card p:last-child { margin-bottom: 0; }
.abstract-card strong { color: var(--text); font-weight: 600; }
.abstract-card em { color: var(--cyan); font-style: normal; }

/* method steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 44px; }
.step-card {
  border: 1px solid var(--border); background: var(--panel); border-radius: var(--radius);
  padding: 30px 26px; position: relative; overflow: hidden;
  transition: transform 0.3s, border-color 0.3s;
}
.step-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent-grad); transform: scaleX(0); transform-origin: left; transition: transform 0.4s;
}
.step-card:hover { transform: translateY(-5px); border-color: rgba(45,125,255,0.45); }
.step-card:hover::before { transform: scaleX(1); }
.step-index {
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.1rem;
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(45,125,255,0.14); color: var(--cyan); border: 1px solid rgba(45,125,255,0.3);
  margin-bottom: 18px;
}
.step-card h3 { font-size: 1.12rem; font-family: 'Space Grotesk', sans-serif; margin-bottom: 10px; }
.step-card p { color: var(--text-dim); font-size: 0.96rem; }
.step-card strong { color: var(--text); }

.method-fig {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(45,125,255,0.06), var(--panel));
  padding: 16px; box-shadow: var(--shadow); margin-bottom: 36px;
}
.method-fig img {
  width: 100%; display: block; background: #fff; border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 18px 44px -18px rgba(0,0,0,0.7);
}
.method-fig figcaption { padding: 16px 10px 4px; font-size: 0.9rem; color: var(--text-dim); }
.method-fig figcaption strong { color: var(--text); }

.delta-callout {
  display: flex; gap: 24px; align-items: flex-start;
  border: 1px solid rgba(25,199,212,0.3); border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(25,199,212,0.08), rgba(45,125,255,0.05));
  padding: 32px; backdrop-filter: blur(6px);
}
.delta-icon {
  flex-shrink: 0; font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 2rem;
  width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center;
  background: var(--accent-grad); color: #04101f;
}
.delta-callout h3 { font-family: 'Space Grotesk', sans-serif; font-size: 1.25rem; margin-bottom: 8px; }
.delta-callout p { color: var(--text-dim); }
.delta-callout strong { color: var(--text); }

/* comparison */
.video-controls {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  justify-content: flex-start;
}
.compare-controls { margin-bottom: 26px; }
.vbtn {
  font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; cursor: pointer;
  padding: 9px 18px; border-radius: 10px; color: var(--text);
  border: 1px solid var(--border); background: var(--panel-strong);
  transition: border-color 0.2s, background 0.2s;
}
.vbtn:hover { border-color: rgba(45,125,255,0.6); background: rgba(45,125,255,0.12); }

/* speed selector (segmented) */
.speed-select {
  display: inline-flex; align-items: center; gap: 3px; padding: 4px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--panel);
}
.speed-label {
  font-family: 'JetBrains Mono', monospace; font-size: 0.74rem;
  color: var(--text-faint); padding: 0 8px 0 7px; letter-spacing: 0.05em;
}
.speed-opt {
  font-family: 'JetBrains Mono', monospace; font-size: 0.82rem; cursor: pointer;
  padding: 6px 12px; border-radius: 8px; border: none; background: transparent;
  color: var(--text-dim); transition: color 0.2s, background 0.2s;
}
.speed-opt:hover { color: var(--text); }
.speed-opt.active { background: var(--accent-grad); color: #04101f; font-weight: 600; }

.teaser-controls { padding: 14px 2px 0; }
.gallery-controls { margin-bottom: 20px; }

.compare-grid { display: flex; flex-direction: column; gap: 30px; }
/* comparison: three example columns per backbone (2 rows x 3 cols), centered */
.cmp-trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.cmp-col { display: flex; flex-direction: column; gap: 14px; }
#comparison .cmp-trio,
#comparison .cmp-group,
#comparison .compare-controls { max-width: 1080px; margin-inline: auto; }
#comparison .cmp-group,
#comparison .compare-controls { width: 100%; }
.cmp-group {
  font-family: 'JetBrains Mono', monospace; font-size: 0.82rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--cyan); margin: 30px 0 16px;
  padding-bottom: 8px; border-bottom: 1px solid rgba(45,125,255,0.18);
}
.cmp-group:first-of-type { margin-top: 0; }
.compare-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.vcard {
  position: relative; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); background: #000; box-shadow: var(--shadow);
}
.vcard.ours { border-color: rgba(25,199,212,0.5); box-shadow: 0 0 0 1px rgba(25,199,212,0.25), var(--shadow); }
.vcard video { width: 100%; display: block; aspect-ratio: 832 / 480; object-fit: cover; }
.tag {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.03em;
  padding: 5px 12px; border-radius: 8px; backdrop-filter: blur(6px);
}
.tag-base { background: rgba(20,24,38,0.78); color: var(--text-dim); border: 1px solid var(--border); }
.tag-ours { background: var(--accent-grad); color: #04101f; }

/* results table */
.len-tabs { display: inline-flex; gap: 4px; padding: 5px; margin-bottom: 22px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
.len-tab {
  font-family: 'JetBrains Mono', monospace; font-size: 0.88rem; cursor: pointer;
  padding: 8px 20px; border-radius: 8px; border: none; background: transparent;
  color: var(--text-dim); transition: color 0.2s, background 0.2s;
}
.len-tab:hover { color: var(--text); }
.len-tab.active { background: var(--accent-grad); color: #04101f; font-weight: 600; }

.table-wrap {
  overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); backdrop-filter: blur(6px); box-shadow: var(--shadow);
}
table.results { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 720px; }
.results th, .results td { padding: 13px 14px; text-align: center; }
.results th {
  font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 0.82rem;
  color: var(--text-dim); border-bottom: 1px solid var(--border);
}
.results td:first-child, .results th:first-child { text-align: left; white-space: nowrap; }
.results tbody tr { border-bottom: 1px solid rgba(255,255,255,0.05); }
.results tbody tr:last-child { border-bottom: none; }
.results td { color: var(--text-dim); }
.results td b { color: var(--text); font-weight: 700; }
.group-head td {
  font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--cyan); text-align: left;
  background: rgba(45,125,255,0.06); padding-top: 16px; padding-bottom: 10px;
}
.row-ours { background: linear-gradient(90deg, rgba(25,199,212,0.10), transparent); }
.row-ours td:first-child { color: var(--text); font-weight: 600; }
.ours-pill {
  font-size: 0.68rem; font-weight: 700; background: var(--accent-grad); color: #04101f;
  padding: 2px 8px; border-radius: 6px; margin-left: 8px; vertical-align: middle;
}
.table-foot { color: var(--text-faint); font-size: 0.88rem; margin-top: 18px; max-width: 880px; }

/* gallery */
.gallery-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.g-item {
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  background: var(--panel); box-shadow: var(--shadow); transition: transform 0.3s, border-color 0.3s;
}
.g-item:hover { transform: translateY(-4px); border-color: rgba(25,199,212,0.5); }
.g-item video { width: 100%; display: block; aspect-ratio: 832 / 480; object-fit: cover; background: #000; }
.g-item p { padding: 14px 18px; color: var(--text-dim); font-size: 0.92rem; }
.gallery-grid:has(.gallery-placeholder) { grid-template-columns: 1fr; }
.gallery-placeholder {
  grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; min-height: 220px;
  border: 1px dashed var(--border); border-radius: var(--radius);
  background: var(--panel); color: var(--text-faint); text-align: center;
}
.gallery-placeholder .ph-icon {
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  font-size: 1.2rem; color: var(--cyan);
  border: 1px solid rgba(25,199,212,0.4); background: rgba(25,199,212,0.08);
}

/* bibtex */
.bib-wrap {
  position: relative; border: 1px solid var(--border); border-radius: var(--radius);
  background: #070b16; overflow: hidden; box-shadow: var(--shadow);
}
.bib-wrap pre {
  font-family: 'JetBrains Mono', monospace; font-size: 0.86rem; color: #c9d6ef;
  padding: 26px 28px; overflow-x: auto; line-height: 1.7;
}
.copy-btn {
  position: absolute; top: 14px; right: 14px; cursor: pointer;
  font-family: 'JetBrains Mono', monospace; font-size: 0.8rem;
  padding: 7px 14px; border-radius: 9px; color: var(--text);
  border: 1px solid var(--border); background: var(--panel-strong); transition: all 0.2s;
}
.copy-btn:hover { border-color: rgba(45,125,255,0.6); background: rgba(45,125,255,0.14); }
.copy-btn.copied { background: var(--accent-grad); color: #04101f; border-color: transparent; }

/* footer */
.footer {
  text-align: center; padding: 60px 20px 50px; border-top: 1px solid var(--border);
  margin-top: 40px; color: var(--text-faint);
}
.footer-brand { justify-content: center; margin-bottom: 16px; }
.footer-brand .brand-text { font-size: 1.3rem; }
.footer p { font-size: 0.9rem; }
.footer-note { font-size: 0.8rem; margin-top: 8px; max-width: 560px; margin-left: auto; margin-right: auto; }

/* reveal animation */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.7s cubic-bezier(.2,.7,.2,1), transform 0.7s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }

/* ---------------- responsive ---------------- */
@media (max-width: 860px) {
  .nav-links { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .compare-pair { grid-template-columns: 1fr; }
  .cmp-trio { grid-template-columns: 1fr; }
  .teaser-pair { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: 1fr; }
  .delta-callout { flex-direction: column; gap: 16px; }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr; }
  .cta { gap: 10px; }
  .btn { padding: 10px 16px; font-size: 0.88rem; }
}

@media (prefers-reduced-motion: reduce) {
  .blob, .grad-text, .badge-dot, .scroll-hint span { animation: none; }
  .reveal { transition: none; opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
