/* MemDreamer Project Page Styles */

:root {
  --primary: #B75E54;
  --primary-light: #d4897f;
  --primary-bg: #fdf5f4;
  --accent-green: #2d6a4f;
  --accent-green-light: #d1fae5;
  --text: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 4px 20px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.12);
  --radius: 12px;
  --radius-sm: 8px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  line-height: 1.7;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px;
}

.narrow {
  max-width: 800px;
}

section {
  padding: 64px 0;
  scroll-margin-top: 24px;
}

section.alt {
  background: var(--bg-alt);
}

/* Hero */
.hero {
  text-align: center;
  padding: 80px 0 48px;
  background: linear-gradient(165deg, #fdf5f4 0%, #ffffff 40%, #f8fafc 100%);
}

.hero-title {
  font-size: clamp(24px, 4vw, 40px);
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 24px;
  color: var(--text);
}

.hero-title .highlight {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.authors {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.8;
}

.authors sup {
  color: var(--primary);
  font-weight: 600;
}

.affiliations {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.badges {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  background: var(--bg);
  cursor: default;
  opacity: 0.7;
}

.badge.active {
  opacity: 1;
  cursor: pointer;
  border-color: var(--primary);
  color: var(--primary);
}

.badge.active:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.badge svg {
  width: 16px;
  height: 16px;
}

/* Section Headers */
.section-title {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 40px;
  color: var(--text);
}

.section-title::after {
  content: '';
  display: block;
  width: 48px;
  height: 3px;
  background: var(--primary);
  margin: 12px auto 0;
  border-radius: 2px;
}

/* TLDR Box */
.tldr {
  background: var(--primary-bg);
  border: 1px solid rgba(183, 94, 84, 0.15);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
  font-size: 15px;
}

.tldr-label {
  font-weight: 700;
  color: var(--primary);
  margin-right: 8px;
}

.abstract-text {
  font-size: 15px;
  color: var(--text-secondary);
  text-align: justify;
  line-height: 1.8;
}

/* Highlight Cards */
.highlights-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.hcard {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 24px;
  transition: all 0.2s;
}

.hcard:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.hcard-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 20px;
}

.hcard h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.hcard p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Figures */
.figure {
  margin: 32px 0;
  text-align: center;
}

.figure img {
  max-width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s;
  cursor: pointer;
}

.figure img:hover {
  box-shadow: var(--shadow-md);
  transform: scale(1.005);
}

.figure figcaption {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

/* Results Table */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
  min-width: 900px;
}

.result-table thead {
  background: var(--bg-alt);
}

.result-table th {
  padding: 10px 10px;
  font-weight: 600;
  text-align: center;
  border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
}

.result-table th:last-child {
  border-right: none;
}

.result-table th:first-child,
.result-table th:nth-child(2) {
  text-align: left;
}

.th-group {
  border-bottom: 1px solid var(--border);
}

.th-sub {
  font-weight: 400;
  font-size: 11px;
  color: var(--text-muted);
}

.result-table td {
  padding: 8px 10px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}

.result-table td:first-child,
.result-table td:nth-child(2) {
  text-align: left;
  font-weight: 500;
}

.result-table tr:hover {
  background: var(--bg-alt);
}

.result-table .group-header td {
  background: var(--bg-alt);
  font-weight: 700;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 10px;
}

.result-table .ours {
  background: var(--primary-bg);
}

.result-table .ours td {
  font-weight: 600;
}

.result-table .best {
  font-weight: 700;
  color: var(--primary);
}

.result-table .gain {
  color: var(--accent-green);
  font-size: 10px;
  font-weight: 600;
}

.result-table .human td {
  font-style: italic;
  color: var(--text-muted);
  border-bottom: none;
}

/* Case Analysis */
.cases-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

.case-item {
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.case-item:hover {
  box-shadow: var(--shadow-md);
}

.case-item img {
  width: 100%;
  display: block;
  cursor: pointer;
}

.case-item .case-caption {
  padding: 16px 20px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.case-item .case-caption strong {
  color: var(--text);
}

/* Demo Placeholder */
.demo-placeholder {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: var(--radius);
  padding: 48px;
  text-align: center;
  color: white;
  position: relative;
  overflow: hidden;
}

.demo-placeholder::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(183, 94, 84, 0.1) 0%, transparent 50%),
              radial-gradient(circle at 70% 50%, rgba(45, 106, 79, 0.1) 0%, transparent 50%);
  animation: float 8s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.demo-placeholder h3 {
  font-size: 22px;
  margin-bottom: 12px;
  position: relative;
}

.demo-placeholder p {
  font-size: 15px;
  opacity: 0.8;
  margin-bottom: 24px;
  position: relative;
}

.demo-badge {
  display: inline-block;
  padding: 8px 20px;
  border: 1.5px solid rgba(255,255,255,0.3);
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  position: relative;
}

/* BibTeX */
.bibtex-wrapper {
  position: relative;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.bibtex-wrapper pre {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
}

.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.copy-btn.copied {
  border-color: var(--accent-green);
  color: var(--accent-green);
  background: var(--accent-green-light);
}

/* Footer */
.footer {
  padding: 32px 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1000;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 32px;
  backdrop-filter: blur(4px);
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 95%;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 0 60px rgba(0,0,0,0.5);
}

/* Scroll Reveal */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(.22,1,.36,1), transform 0.6s cubic-bezier(.22,1,.36,1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
  .hero {
    padding: 56px 0 36px;
  }

  section {
    padding: 48px 0;
  }

  .highlights-grid {
    grid-template-columns: 1fr;
  }

  .badges {
    gap: 8px;
  }

  .badge {
    font-size: 13px;
    padding: 8px 14px;
  }

  .section-title {
    font-size: 22px;
  }

  .result-table {
    font-size: 11px;
  }

  .demo-placeholder {
    padding: 32px 20px;
  }
}

/* MemDreamer 渐变文字效果（向暗色/黑色渐变） */
.gradient-memdreamer {
    background: linear-gradient(
        to right,
        #B75E54 0%,   /* M: MorandiRed */
        #A5554C 11%,  /* e: 90% 红 + 10% 黑 */
        #924B43 22%,  /* m: 80% 红 + 20% 黑 */
        #81423B 33%,  /* D: 70% 红 + 30% 黑 */
        #5C2F2A 44%,  /* r: 50% 红 + 50% 黑 */
        #492622 55%,  /* e: 40% 红 + 60% 黑 */
        #371C19 66%,  /* a: 30% 红 + 70% 黑 */
        #251311 77%,  /* m: 20% 红 + 80% 黑 */
        #120908 88%,  /* e: 10% 红 + 90% 黑 */
        #000000 100%  /* r: 0% 红  + 100% 黑 */
    );
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}