/* =========================================
   MA-EgoQA Project Page – Style Sheet
   ========================================= */

:root {
  --primary:       #2563eb;
  --primary-dark:  #1d4ed8;
  --primary-light: #eff6ff;
  --accent:        #7c3aed;
  --success:       #059669;
  --warning:       #d97706;
  --danger:        #dc2626;
  --text:          #111827;
  --text-secondary:#4b5563;
  --text-tertiary: #9ca3af;
  --bg:            #ffffff;
  --bg-alt:        #f8fafc;
  --border:        #e5e7eb;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.10);
  --max-width:     960px;
  --font-sans:     'Inter', system-ui, -apple-system, sans-serif;
  --font-serif:    'Source Serif 4', Georgia, serif;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color .2s;
}
a:hover { color: var(--primary-dark); text-decoration: underline; }

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

/* ── Layout ── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Navbar ── */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, box-shadow .3s;
}
#navbar.scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
  letter-spacing: -.02em;
}
.nav-links {
  display: flex;
  gap: 4px;
}
.nav-links a {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background .2s, color .2s;
}
.nav-links a:hover,
.nav-links a.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* ── Hero ── */
.hero {
  padding: 120px 0 72px;
  text-align: center;
  background: linear-gradient(180deg, #f0f7ff 0%, #ffffff 100%);
}
.venue-tag {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 20px;
}
.paper-title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 12px;
}
.paper-subtitle {
  font-size: 1.25rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 28px;
}
.authors {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.author { margin: 0 6px; font-weight: 500; }
sup { font-size: .7em; }
.affiliations {
  font-size: .9rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.8;
}
.equal-note {
  font-size: .8rem;
  color: var(--text-tertiary);
  margin-top: 6px;
}

/* Buttons */
.hero-links {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 56px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 10px;
  font-size: .925rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.btn:hover { transform: translateY(-2px); text-decoration: none; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}
.btn-primary:hover {
  background: var(--primary-dark);
  color: #fff;
  box-shadow: 0 4px 16px rgba(37,99,235,.35);
}
.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
}
.btn-secondary:hover {
  background: var(--bg-alt);
  color: var(--text);
  border-color: var(--primary);
}
.btn-github {
  background: #f1f5f9;
  color: #111827 !important;
  border: 1.5px solid #cbd5e1;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.btn-github:hover {
  background: #e2e8f0;
  color: #111827 !important;
  border-color: #94a3b8;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
}
.btn-hf {
  background: #fef3c7;
  color: #111827 !important;
  border: 1.5px solid #fcd34d;
  box-shadow: 0 2px 8px rgba(251,191,36,.25);
}
.btn-hf:hover {
  background: #fde68a;
  color: #111827 !important;
  border-color: #f59e0b;
  box-shadow: 0 4px 16px rgba(251,191,36,.35);
}
.btn-arxiv {
  background: #fee2e2;
  color: #111827 !important;
  border: 1.5px solid #fca5a5;
  box-shadow: 0 2px 8px rgba(239,68,68,.2);
}
.btn-arxiv:hover {
  background: #fecaca;
  color: #111827 !important;
  border-color: #f87171;
  box-shadow: 0 4px 16px rgba(239,68,68,.3);
}
.btn-icon { width: 18px; height: 18px; flex-shrink: 0; }
.btn-ai-icon { font-size: 1.1rem; line-height: 1; color: #111827 !important; }
.btn-emoji { font-size: 1.1rem; line-height: 1; }

/* Teaser */
.teaser {
  max-width: 820px;
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.teaser img {
  width: 100%;
  border-bottom: 1px solid var(--border);
}
.teaser .caption {
  padding: 16px 20px;
  font-size: .9rem;
  color: var(--text-secondary);
  text-align: left;
}

/* ── TL;DR ── */
.tldr-section {
  background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
  padding: 40px 0;
  border-top: 1px solid #dbeafe;
  border-bottom: 1px solid #dbeafe;
}
.tldr-card {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  max-width: 820px;
  margin: 0 auto;
}
.tldr-label {
  background: var(--primary);
  color: #fff;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 6px;
  flex-shrink: 0;
  margin-top: 2px;
}
.tldr-card p {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.6;
  text-align: justify;
}

/* ── Sections ── */
.section {
  padding: 80px 0;
}
.section-alt {
  background: var(--bg-alt);
}
.section-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary-light);
  display: inline-block;
}
.subsection-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 48px 0 20px;
}
.section-intro {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 100%;
  margin-bottom: 40px;
  line-height: 1.7;
  text-align: justify;
}

/* ── Stats Banner ── */
.stats-banner {
  background: var(--primary);
  padding: 48px 0;
}
.stats-grid {
  display: flex;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
}
.stat-item {
  text-align: center;
  color: #fff;
}
.stat-number {
  display: block;
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.04em;
  margin-bottom: 6px;
}
.stat-label {
  font-size: .85rem;
  font-weight: 500;
  opacity: .8;
  letter-spacing: .03em;
  text-transform: uppercase;
}

/* ── Abstract ── */
.abstract-text {
  max-width: 780px;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
  text-align: justify;
}
.abstract-text p + p { margin-top: 16px; }

/* ── Categories Grid ── */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 16px;
}
.category-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  position: relative;
}
.category-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.category-card[data-color="blue"]   { border-top: 4px solid #3b82f6; }
.category-card[data-color="green"]  { border-top: 4px solid #10b981; }
.category-card[data-color="purple"] { border-top: 4px solid #8b5cf6; }
.category-card[data-color="orange"] { border-top: 4px solid #f59e0b; }
.category-card[data-color="red"]    { border-top: 4px solid #ef4444; }
.cat-icon { font-size: 2rem; margin-bottom: 12px; }
.category-card h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}
.category-card p {
  font-size: .9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.category-card em { color: var(--primary); font-style: normal; font-weight: 600; }

/* ── Figures ── */
.figure-block {
  margin: 0 auto 40px;
  max-width: 860px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.figure-block img {
  width: 100%;
  border-bottom: 1px solid var(--border);
}
.figure-block .caption {
  padding: 14px 20px;
  font-size: .875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.caption strong { color: var(--text); }

/* ── Pipeline Steps ── */
.pipeline-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 760px;
  margin-top: 12px;
}
.pipeline-step {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
}
.step-number {
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
}
.step-content h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}
.step-content p {
  font-size: .9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── EgoMAS Method Cards ── */
.method-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 12px;
}
.method-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.method-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.method-icon { font-size: 1.4rem; }
.method-card p {
  font-size: .9rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 12px;
  text-align: justify;
}
.four-w1h {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1px solid var(--border);
  font-size: .875rem;
  color: var(--text-secondary);
}
.four-w1h strong { color: var(--primary); }
.retrieval-steps {
  padding-left: 18px;
  margin: 10px 0;
  font-size: .9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}
.retrieval-steps li { margin-bottom: 6px; }

/* ── Results Table ── */
.results-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 40px;
}
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  background: var(--bg);
  white-space: nowrap;
}
.results-table th {
  background: #f1f5f9;
  padding: 12px 14px;
  text-align: center;
  font-weight: 700;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  letter-spacing: .02em;
}
.results-table th:first-child { text-align: left; }
.results-table td {
  padding: 9px 14px;
  text-align: center;
  color: var(--text-secondary);
  border-bottom: 1px solid #f1f5f9;
}
.results-table td:first-child { text-align: left; color: var(--text); }
.results-table tr:hover td { background: #fafafa; }

.group-header td {
  background: #f8fafc;
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 8px 14px;
  text-align: left !important;
  border-top: 2px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.group-header-ours td {
  background: #eff6ff;
  color: var(--primary);
  border-top: 2px solid #bfdbfe;
}
.row-best td {
  background: #fafffe;
  font-weight: 500;
}
.row-second td {
  background: #fdfffe;
}
.row-random td {
  color: var(--text-tertiary);
  font-style: italic;
}
.row-oracle td {
  color: var(--text-tertiary);
  font-style: italic;
  background: #fafafa;
}
.col-best {
  color: var(--primary) !important;
  font-weight: 700 !important;
}
.best-in-group {
  font-weight: 700;
  color: var(--text) !important;
}

/* ── Takeaways ── */
.takeaways {
  margin-top: 12px;
}
.takeaways h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
}
.takeaway-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.takeaway-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
}
.takeaway-icon { font-size: 1.6rem; }
.takeaway-item p { font-size: .875rem; color: var(--text-secondary); line-height: 1.6; }
.takeaway-item p strong { color: var(--text); }
.takeaway-warning  { background: #fffbeb; border-color: #fde68a; }
.takeaway-insight  { background: #eff6ff; border-color: #bfdbfe; }
.takeaway-success  { background: #f0fdf4; border-color: #bbf7d0; }
.takeaway-gap      { background: #fdf4ff; border-color: #e9d5ff; }

/* ── Analysis ── */
.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-bottom: 36px;
}
.analysis-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.analysis-block-wide {
  grid-column: 1 / -1;
}
.analysis-block h3 {
  font-size: 1rem;
  font-weight: 700;
  padding: 16px 20px 0;
  color: var(--text);
}
.analysis-content {
  padding: 16px 20px;
}
.analysis-content img {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}
.analysis-content p {
  font-size: .875rem;
  color: var(--text-secondary);
  line-height: 1.65;
  text-align: justify;
}

/* ── Callouts ── */
.callout {
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 24px;
  border-left: 4px solid;
}
.callout h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.callout p {
  font-size: .9rem;
  line-height: 1.65;
}
.callout-purple {
  background: #faf5ff;
  border-color: #8b5cf6;
  color: var(--text);
}
.callout-purple h4 { color: #6d28d9; }
.callout-purple p  { color: #4c1d95; }
.callout-orange {
  background: #fffbeb;
  border-color: #f59e0b;
  color: var(--text);
}
.callout-orange h4 { color: #b45309; }
.callout-orange p  { color: #78350f; }

/* ── BibTeX ── */
.bibtex-block {
  position: relative;
  max-width: 760px;
  background: #1e293b;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.bibtex-block pre {
  padding: 28px 28px 28px 28px;
  font-size: .875rem;
  line-height: 1.7;
  color: #e2e8f0;
  white-space: pre;
  overflow-x: auto;
  font-family: 'Fira Code', 'Cascadia Code', 'Menlo', monospace;
}
.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255,255,255,.1);
  color: #e2e8f0;
  border: 1px solid rgba(255,255,255,.15);
  padding: 5px 14px;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}
.copy-btn:hover { background: rgba(255,255,255,.2); }

/* ── Footer ── */
.footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 40px 0;
  text-align: center;
}
.footer p { font-size: .9rem; line-height: 1.8; }
.footer a { color: #60a5fa; }
.footer a:hover { color: #93c5fd; }
.footer-note { font-size: .8rem; margin-top: 6px; opacity: .7; }

/* ── Related Works Table ── */
.relworks-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  max-width: 860px;
  margin-bottom: 14px;
}
.relworks-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  background: var(--bg);
  white-space: nowrap;
}
.relworks-table th {
  background: #f1f5f9;
  padding: 11px 16px;
  text-align: center;
  font-weight: 700;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  letter-spacing: .02em;
}
.relworks-table th:first-child { text-align: left; }
.relworks-table td {
  padding: 9px 16px;
  text-align: center;
  color: var(--text-secondary);
  border-bottom: 1px solid #f1f5f9;
}
.relworks-table td:first-child { text-align: left; color: var(--text); }
.relworks-table tr:hover td { background: #fafafa; }
.relworks-table .check {
  color: #059669;
  font-size: 1rem;
  font-weight: 700;
}
.relworks-table .cross {
  color: #d1d5db;
  font-size: 1rem;
}
.relworks-ours td {
  background: #eff6ff;
  border-top: 2px solid #bfdbfe;
  border-bottom: 1px solid #bfdbfe;
}
.relworks-ours td:first-child { color: var(--primary); }
.relworks-ours .check { color: var(--primary); }

/* ── Stats Figures Grid ── */
.stats-figures-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 860px;
  margin-bottom: 14px;
}
.stats-figure-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stats-figure-item img {
  width: 100%;
  border-bottom: 1px solid var(--border);
}
.stats-fig-label {
  padding: 8px 12px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.stats-figures-caption {
  max-width: 860px;
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 40px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .hero { padding: 90px 0 56px; }
  .paper-title { font-size: 1.8rem; }
  .method-columns { grid-template-columns: 1fr; }
  .analysis-grid { grid-template-columns: 1fr; }
  .stats-grid { gap: 28px; }
  .stat-number { font-size: 2rem; }
  .categories-grid { grid-template-columns: 1fr; }
  .stats-figures-grid { grid-template-columns: 1fr 1fr; }
  .takeaway-grid { grid-template-columns: 1fr 1fr; }
  .tldr-card { flex-direction: column; gap: 10px; }
  .four-w1h { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .takeaway-grid { grid-template-columns: 1fr; }
  .hero-links { flex-direction: column; align-items: center; }
  .results-table { font-size: .78rem; }
  .section { padding: 56px 0; }
}
