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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #7c3aed;
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
}

/* ===== Layout ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
section { padding: 72px 0; }
section:nth-child(even) { background: var(--bg-alt); }

/* ===== Nav ===== */
nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.nav-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo { font-weight: 700; font-size: 1.1rem; color: var(--primary); text-decoration: none; }
.nav-links { display: flex; gap: 24px; list-style: none; }
.nav-links a { color: var(--text-muted); text-decoration: none; font-size: 0.9rem; transition: color .2s; }
.nav-links a:hover { color: var(--primary); }

/* ===== Hero ===== */
#hero {
  background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
  padding: 80px 0 64px;
  text-align: center;
}
.venue-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 999px;
  letter-spacing: 0.05em;
  margin-bottom: 20px;
}
#hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.authors {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.affiliation {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 32px;
}
.hero-links { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all .2s;
  cursor: pointer;
  border: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-outline { background: #fff; color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }

/* ===== Section Titles ===== */
.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}
.section-sub {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 48px;
  font-size: 0.95rem;
}

/* ===== Abstract ===== */
.abstract-text {
  max-width: 780px;
  margin: 0 auto 40px;
  font-size: 1.05rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.8;
}
.overview-img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }

/* ===== Stats (redesigned) ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 48px;
}
.stat-card {
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.07;
  background: radial-gradient(circle at 70% 30%, currentColor 0%, transparent 70%);
}
.stat-card--blue   { background: linear-gradient(135deg, #eff6ff, #dbeafe); border: 1.5px solid #bfdbfe; }
.stat-card--indigo { background: linear-gradient(135deg, #eef2ff, #e0e7ff); border: 1.5px solid #c7d2fe; }
.stat-card--violet { background: linear-gradient(135deg, #f5f3ff, #ede9fe); border: 1.5px solid #ddd6fe; }
.stat-card--sky    { background: linear-gradient(135deg, #f0f9ff, #e0f2fe); border: 1.5px solid #bae6fd; }

.stat-card--blue   .stat-number { color: #1d4ed8; }
.stat-card--indigo .stat-number { color: #4338ca; }
.stat-card--violet .stat-number { color: #6d28d9; }
.stat-card--sky    .stat-number { color: #0369a1; }

.stat-number {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; letter-spacing: 0.02em; }

/* ===== Language Coverage ===== */
.lang-coverage {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  align-items: start;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.lang-group { padding: 24px 28px; }
.lang-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1.5px solid var(--border);
}
.lang-group-header--blue   { color: #1d4ed8; border-color: #bfdbfe; }
.lang-group-header--violet { color: #6d28d9; border-color: #ddd6fe; }
.lang-group-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #2563eb;
  flex-shrink: 0;
}
.lang-group-dot--violet { background: #7c3aed; }

.lang-rows { display: flex; flex-direction: column; gap: 6px; }
.lang-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  transition: background .15s;
}
.lang-row:hover { background: #f8fafc; }
.lang-row--low:hover { background: #faf5ff; }

.lang-code {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 5px;
  padding: 2px 7px;
  min-width: 36px;
  text-align: center;
}
.lang-code--violet {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}
.lang-name { font-size: 0.88rem; font-weight: 500; color: var(--text); flex: 1; }
.lang-sample { font-size: 0.95rem; color: var(--text-muted); }

.lang-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
  gap: 8px;
  align-self: stretch;
  background: #f8fafc;
  border-left: 1.5px solid var(--border);
  border-right: 1.5px solid var(--border);
}
.lang-divider-line {
  flex: 1;
  width: 1.5px;
  background: linear-gradient(to bottom, transparent, #cbd5e1, transparent);
  min-height: 40px;
}
.lang-divider-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #94a3b8;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  white-space: nowrap;
}

/* ===== Key Findings (redesigned) ===== */
.findings-groups { display: flex; flex-direction: column; gap: 24px; }
.findings-group {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.findings-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.findings-group-header--blue   { background: linear-gradient(90deg, #eff6ff, #f0f9ff); color: #1d4ed8; border-bottom: 1.5px solid #bfdbfe; }
.findings-group-header--violet { background: linear-gradient(90deg, #f5f3ff, #fdf4ff); color: #6d28d9; border-bottom: 1.5px solid #ddd6fe; }

.findings-rows { display: flex; flex-direction: column; }
.finding-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid #f1f5f9;
  transition: background .15s;
}
.finding-row:last-child { border-bottom: none; }
.finding-row:hover { background: #fafbfc; }
.finding-row-text { flex: 1; }
.finding-row-title { font-size: 0.9rem; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.finding-row-desc  { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; }

.finding-pill {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.finding-pill--green  { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.finding-pill--blue   { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.finding-pill--orange { background: #ffedd5; color: #c2410c; border: 1px solid #fed7aa; }
.finding-pill--red    { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

/* ===== Responsive updates ===== */
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .lang-coverage { grid-template-columns: 1fr; }
  .lang-divider { flex-direction: row; padding: 0 24px; border-left: none; border-right: none; border-top: 1.5px solid var(--border); border-bottom: 1.5px solid var(--border); }
  .lang-divider-line { flex: 1; height: 1.5px; width: auto; min-height: unset; background: linear-gradient(to right, transparent, #cbd5e1, transparent); }
  .lang-divider-label { writing-mode: horizontal-tb; }
  .finding-row { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* ===== Tabs ===== */
.tab-bar {
  display: flex;
  gap: 4px;
  background: var(--bg-alt);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  width: fit-content;
  margin: 0 auto 32px;
}
.tab-btn {
  padding: 8px 20px;
  border-radius: 7px;
  border: none;
  background: transparent;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
}
.tab-btn.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 6px rgba(0,0,0,0.1);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== Heatmap ===== */
.heatmap-wrap { overflow-x: auto; }
.heatmap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 700px;
}
.heatmap-table th {
  padding: 8px 10px;
  text-align: center;
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.heatmap-table th.row-header { text-align: left; }
.heatmap-table td {
  padding: 7px 10px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 500;
  border-bottom: 1px solid #f1f5f9;
  transition: opacity .15s;
}
.heatmap-table td.row-label {
  text-align: left;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  padding-right: 16px;
}
.heatmap-table td.type-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 400;
}
.heatmap-table td.best { font-weight: 800; }
.heatmap-table tr:hover td { opacity: 0.85; }

/* ===== Chart containers ===== */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}
@media (max-width: 768px) { .chart-grid { grid-template-columns: 1fr; } }

.chart-card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.chart-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}
.chart-wrap { position: relative; }

/* ===== Case Studies (redesigned) ===== */
.cases-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 32px;
}
.cases-filter-btn {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.cases-filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.cases-filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.cases-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.case-item {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.case-item:hover { transform: translateY(-3px); box-shadow: 0 8px 32px rgba(0,0,0,0.12); }
.case-item.hidden { display: none; }

.case-img-wrap {
  position: relative;
  aspect-ratio: 4/3;
  background: #f1f5f9;
  overflow: hidden;
}
.case-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.case-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.case-lang-tag {
  position: absolute; top: 10px; left: 10px;
  background: rgba(30,41,59,0.82);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.case-skill-tag {
  position: absolute; top: 10px; right: 10px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}
.skill-recognize { background: #dbeafe; color: #1d4ed8; }
.skill-compute   { background: #dcfce7; color: #15803d; }
.skill-compare   { background: #ffedd5; color: #c2410c; }
.skill-logic     { background: #fce7f3; color: #9d174d; }
.skill-spatial   { background: #f3e8ff; color: #6d28d9; }

/* When used in legend (not absolute) */
.skill-legend .case-skill-tag { position: static; }

.case-meta { padding: 14px 16px; }
.case-domain {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 10px;
  letter-spacing: 0.03em;
}
.case-qa {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 6px;
}
.qa-label {
  flex-shrink: 0;
  width: 18px; height: 18px;
  border-radius: 4px;
  background: #e2e8f0;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.qa-label--a { background: #dbeafe; color: #1d4ed8; }
.qa-text { font-size: 0.82rem; color: var(--text); line-height: 1.5; }
.qa-ans { color: var(--primary); font-weight: 600; }

.skill-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}
.skill-legend-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }

/* ===== Pipeline ===== */
.pipeline-img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }
.pipeline-caption {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 16px;
}

/* ===== BibTeX ===== */
.bibtex-wrap { position: relative; max-width: 720px; margin: 0 auto; }
.bibtex-box {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: var(--radius);
  padding: 24px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.82rem;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
}
.copy-btn {
  position: absolute; top: 12px; right: 12px;
  background: rgba(255,255,255,0.1);
  color: #e2e8f0;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background .2s;
}
.copy-btn:hover { background: rgba(255,255,255,0.2); }
.copy-btn.copied { background: #16a34a; border-color: #16a34a; }

/* ===== Footer ===== */
footer {
  background: #1e293b;
  color: #94a3b8;
  text-align: center;
  padding: 32px 24px;
  font-size: 0.85rem;
}
footer a { color: #60a5fa; text-decoration: none; }

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-grid { grid-template-columns: 1fr; }
  .findings-grid { grid-template-columns: 1fr; }
  .cases-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }

  /* Hero */
  #hero { padding: 48px 0 40px; }
  #hero h1 { font-size: 1.5rem; }
  .authors { font-size: 0.85rem; line-height: 1.8; }
  .affiliation { font-size: 0.78rem; }
  .hero-links { gap: 8px; }
  .btn { padding: 8px 14px; font-size: 0.82rem; }

  /* Section padding */
  section { padding: 48px 0; }

  /* Stats */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-number { font-size: 2rem; }

  /* Tab bar */
  .tab-bar { width: 100%; justify-content: center; }
  .tab-btn { padding: 7px 12px; font-size: 0.82rem; }

  /* Cases filter — wrap nicely */
  .cases-filter { gap: 6px; }
  .cases-filter-btn { padding: 5px 10px; font-size: 0.76rem; }

  /* Cases gallery — 1 column on very small, 2 on medium mobile */
  .cases-gallery { grid-template-columns: repeat(2, 1fr); gap: 12px; }

  /* Heatmap font */
  .heatmap-table { font-size: 0.72rem; }
  .heatmap-table th, .heatmap-table td { padding: 5px 6px; }

  /* Chart cards */
  .chart-card { padding: 16px; }

  /* BibTeX */
  .bibtex-box { font-size: 0.72rem; padding: 16px; }
}

@media (max-width: 400px) {
  .cases-gallery { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
