/* ==========================================================================
   HERBench Project Page Styles (structure mimics time-to-move.github.io)
   ========================================================================== */

:root {
  --primary-color: #0f766e;
  --secondary-color: #0ea5e9;
  --accent-color: #115e59;
  --text-color: #1f2937;
  --text-light: #4b5563;
  --bg-color: #ffffff;
  --bg-light: #f8fafc;
  --border-color: #e5e7eb;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);
}

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

body {
  font-family: 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-light);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--secondary-color);
  text-decoration: underline;
}

.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  background-color: var(--bg-color);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.05);
}

/* Header Section */
.paper-header {
  text-align: center;
  padding: 3rem 2rem;
  background: linear-gradient(135deg, var(--secondary-color) 0%, var(--accent-color) 100%);
  border-radius: 15px;
  color: #fff;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}

.paper-title {
  font-size: clamp(32px, 5vw, 42px);
  font-weight: 700;
  margin-bottom: 1rem;
}

.authors {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.author {
  background: rgba(255, 255, 255, 0.14);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}

.affiliations {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: center;
  font-size: 0.95rem;
  color: #e5f9f4;
  margin-bottom: 0.5rem;
}

.equal-contrib {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  color: #e5f9f4;
}

.paper-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.paper-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  font-weight: 600;
  transition: all 0.2s ease;
  text-decoration: none !important;
}

.paper-btn-primary {
  background: #fff;
  color: var(--primary-color);
  border: 1px solid transparent;
  box-shadow: var(--shadow);
}

.paper-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
  color: var(--secondary-color);
}

.paper-btn-secondary {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: none;
}

.paper-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #fff;
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}

/* Teaser Section */
.teaser-section {
  margin: 1rem 0;
}

/* Task Example Boxes */
.task-example-box {
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.task-example-box:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border-color: #3b82f6;
}

.click-hint {
  font-size: 0.8rem;
  color: #3b82f6;
  font-weight: 600;
  margin-top: 0.5rem;
  opacity: 0.8;
}

.task-example-box:hover .click-hint {
  opacity: 1;
  text-decoration: underline;
}

/* Hide rows by default */
.hidden-row {
  display: none;
}

.show-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1.5rem auto;
  padding: 0.65rem 1.5rem;
  background-color: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.show-more-btn:hover {
  background-color: var(--accent-color);
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.teaser-video-container {
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #000;
}

.teaser-video,
.teaser-img {
  width: 100%;
  height: auto;
  display: block;
  /* Fix for random whitespace below video */
  vertical-align: middle;
}

/* Section Base */
section {
  margin: 2.5rem 0;
}

section h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.section-description {
  color: var(--text-light);
  margin-bottom: 1rem;
}

.abstract-section {
  background: #f0f9f7;
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.abstract-text {
  font-size: 1rem;
  color: var(--text-color);
}

/* Method / Figure */
.method-section {
  background: var(--bg-light);
  padding: 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.method-figure {
  margin: 1rem 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.method-img {
  width: 100%;
  display: block;
}

.method-description {
  color: var(--text-light);
}

/* Results / Tables */
.results-section {
  background: var(--bg-color);
  padding: 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

.table-wrapper {
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

th {
  background: #eef2f7;
  font-weight: 700;
}

tbody tr:nth-child(even) {
  background: #f9fafb;
}

.baseline-row {
  text-align: center;
  font-weight: 700;
  color: var(--text-light);
}

.highlight-card {
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 1rem;
  color: #166534;
  box-shadow: var(--shadow);
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.card {
  background: #f9fafb;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.card h3 {
  margin-bottom: 0.35rem;
}

.card ul {
  margin-top: 0.35rem;
  padding-left: 1.25rem;
  color: var(--text-light);
}

/* Code Blocks */
.code-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.code-block {
  background: #0b172a;
  color: #e5e7eb;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: var(--shadow);
  border: 1px solid #1f2937;
}

.code-block pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
}

/* Comparison Grid */
.comparison-section {
  background: var(--bg-color);
  padding: 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.comparison-item {
  background: #f9fafb;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.text-card h3 {
  margin-bottom: 0.4rem;
}

.text-card p {
  color: var(--text-light);
}

.figure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.figure-card {
  background: #f9fafb;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.75rem;
  box-shadow: var(--shadow);
}

.figure-card h3 {
  margin-bottom: 0.5rem;
}

.pdf-embed {
  width: 100%;
  height: 640px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

/* BibTeX */
.bibtex-section {
  background: #eef2f7;
  padding: 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.bibtex {
  background: #0b172a;
  color: #e5e7eb;
  padding: 1rem;
  border-radius: 10px;
  overflow-x: auto;
  box-shadow: var(--shadow);
}

/* Footer */
.page-footer {
  margin-top: 2rem;
  padding: 1.5rem;
  text-align: center;
  color: var(--text-light);
  background: #f9fafb;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
  .paper-header {
    padding: 2.25rem 1.25rem;
  }

  .paper-links {
    gap: 0.5rem;
  }
}

/* Placeholder Box */
.placeholder-box {
  width: 100%;
  height: 300px;
  background-color: #e2e8f0;
  border: 2px dashed #94a3b8;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  font-weight: 700;
  font-size: 1.5rem;
  text-transform: uppercase;
}

/* Task Tags */
.task-tags {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.task-tag {
  background: #e0f2fe;
  color: #0369a1;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid #bae6fd;
}

.task-tag:hover {
  background: #0ea5e9;
  color: #fff;
  transform: translateY(-1px);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 1 !important;
}

.modal-content {
  background-color: #fefefe;
  margin: 10% auto;
  padding: 2rem;
  border: 1px solid #888;
  width: 90%;
  max-width: 600px;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  position: relative;
}

.close-modal {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
}

.close-modal:hover,
.close-modal:focus {
  color: #000;
  text-decoration: none;
  cursor: pointer;
}

/* Bar Chart Styles */
.bar-chart-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
  width: 100%;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.bar-label {
  width: 140px;
  font-weight: 600;
  color: var(--text-color);
  text-align: right;
  flex-shrink: 0;
}

.bar-track {
  flex-grow: 1;
  background-color: #e2e8f0;
  height: 24px;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  background-color: #94a3b8;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0.5rem;
  color: white;
  font-size: 0.85rem;
  font-weight: 700;
  transition: width 0.6s ease-out;
}

.bar-fill.highlight {
  background-color: var(--primary-color);
}

/* Task Explorer Redesign */
.task-explorer {
  display: flex;
  gap: 2rem;
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 500px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.task-menu {
  flex: 0 0 280px;
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.task-family-group h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 0.75rem;
  font-weight: 700;
}

.task-menu-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.task-menu-btn {
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  color: #334155;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.task-menu-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.task-menu-btn.active {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 2px 4px rgba(15, 118, 110, 0.2);
}

/* Task Viewer (Right Side) */
.task-viewer {
  flex: 1;
  padding: 2rem;
  display: flex;
  flex-direction: column;
}

.task-header {
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.task-title {
  font-size: 1.5rem;
  color: var(--text-color);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.task-badge {
  background: #e0f2fe;
  color: #0369a1;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 700;
}

.task-desc {
  color: #475569;
  line-height: 1.6;
  font-size: 1.05rem;
  margin-bottom: 0.8rem;
}

.task-abilities-box {
  background: #f1f5f9;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  color: #334155;
  border: 1px solid #e2e8f0;
}

.abilities-label {
  font-weight: 700;
  color: #0f172a;
  margin-right: 0.4rem;
}

.task-content {
  flex: 1;
  background: #f1f5f9;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  position: relative;
  overflow: hidden;
}

.task-placeholder-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* or cover depending on assets */
  display: block;
}

.task-qa-box {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.qa-item {
  margin-bottom: 0.5rem;
}

.qa-label {
  font-weight: 700;
  color: #334155;
  margin-right: 0.5rem;
}

@media (max-width: 768px) {
  .task-explorer {
    flex-direction: column;
    min-height: auto;
  }

  .task-menu {
    flex: none;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
  }

  /* Make groups flow horizontally */
  .task-family-group {
    display: flex;
    flex-direction: column;
    min-width: max-content;
  }

  .task-menu-items {
    flex-direction: row;
    gap: 0.5rem;
  }

  .task-menu-btn {
    white-space: nowrap;
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
  }
}

.contribution-note {
  font-size: 0.9rem;
  color: #334155;
  margin-top: 0.25rem;
  font-style: normal;
}

/* Force white text in header for readability on gradient */
.paper-header .author,
.paper-header .affiliation,
.paper-header .contribution-note {
  color: #ffffff !important;
}

.mrfs-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 4px;
}

.mrfs-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
}

.mrfs-number {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.1;
}

.mrfs-label {
  margin-top: 6px;
  color: #475569;
  font-size: 0.95rem;
}

@media (max-width: 900px) {
  .mrfs-cards {
    grid-template-columns: 1fr;
  }
}

/* Stats Layout */
.stats-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stats-top-row {
  display: flex;
  gap: 1rem;
}

.stats-img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid #f1f5f9;
}

.stats-img-half {
  flex: 1;
}

@media (max-width: 600px) {
  .stats-top-row {
    flex-direction: column;
  }
}

/* Mobile Optimization */
@media (max-width: 768px) {
  .paper-header {
    padding: 1.5rem 1rem;
    margin-bottom: 1.5rem;
    border-radius: 12px;
  }

  .paper-title {
    font-size: 1.5rem !important;
    /* Force smaller title on mobile */
    line-height: 1.3;
  }

  .authors {
    gap: 0.5rem;
    font-size: 0.9rem;
  }

  .author {
    padding: 0.25rem 0.6rem;
  }

  .affiliations {
    font-size: 0.85rem;
    gap: 0.25rem 1rem;
  }

  .paper-links {
    gap: 0.5rem;
    margin-top: 1rem;
  }

  .paper-btn {
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
    flex: 1 1 auto;
    justify-content: center;
  }

  .teaser-section {
    margin: 1rem 0;
  }

  .teaser-video-container {
    border-radius: 10px;
  }

  /* Additionally compact page container */
  .page-container {
    padding: 1rem;
  }

  /* Task Viewer Mobile Optimization */
  .task-viewer {
    padding: 1rem;
  }

  .task-header {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
  }

  .task-title {
    font-size: 1.25rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .task-desc {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  .task-abilities-box {
    padding: 0.75rem;
    font-size: 0.9rem;
  }

  .task-content {
    min-height: auto;
    /* Let image dictate height */
    height: auto;
    background: transparent;
    /* Remove grey box if image fills it */
    display: block;
    /* Remove centering flex to let img flow */
  }

  .task-placeholder-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    max-height: 500px;
    /* Cap super tall images */
    border-radius: 8px;
  }
}

/* Benchmark Statistics Section */
#benchmark-statistics .stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 14px 0 18px;
  padding: 0;
}

#benchmark-statistics .stat {
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  padding: 12px 12px 10px;
  background: rgba(0, 0, 0, 0.02);
}

#benchmark-statistics .stat dt {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-bottom: 6px;
}

#benchmark-statistics .stat dd {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

#benchmark-statistics figure {
  margin: 18px 0;
}

#benchmark-statistics figcaption {
  font-size: 0.9rem;
  opacity: 0.85;
  margin-top: 8px;
}

#benchmark-statistics img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.10);
}

/* User customization for stats text */
.bench-note {
  margin: 0.75rem 0 0.5rem;
  line-height: 1.5;
  opacity: 0.9;
}

.bench-bullets {
  margin: 0.25rem 0 1rem;
  padding-left: 1.1rem;
}

.bench-bullets li {
  margin: 0.35rem 0;
  line-height: 1.45;
}

.bench-label {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.method-img {
  width: 100%;
  max-height: 700px;
  object-fit: contain;
  display: block;
}

/* Footer redesign */
.page-footer {
  padding: 32px 0;
  margin-top: 48px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  text-align: center;
  font-size: 0.95rem;
  color: #666;
  background-color: #f8f9fa;
  /* Matches target site body/footer bg */
}

.page-footer a {
  color: #4a90e2;
  font-weight: 600;
  text-decoration: none;
}

.page-footer a:hover {
  text-decoration: underline;
}

/* Logos Section */
.publication-logos {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1.5rem 0;
  gap: 2rem;
}

.publication-logos img {
  height: 80px;
  width: auto;
  object-fit: contain;
}