/* ===========================================================================
   CoDeC Project Page — Matching leaderboard visual language
   =========================================================================== */

:root {
  --nv-green: #76b900;
  --nv-green-dim: #5a8f00;
  --nv-green-bg: rgba(118, 185, 0, 0.08);
  --bg-base: #f5f5f5;
  --bg-white: #fff;
  --bg-surface: #fafafa;
  --bg-dark: #1a1a1a;
  --bg-dark-surface: #242424;
  --border: #e0e0e0;
  --border-light: #eee;
  --text-primary: #1a1a1a;
  --text-secondary: #555;
  --text-muted: #999;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.10);
  --radius: 8px;
  --radius-lg: 12px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--nv-green-dim); }
a:hover { color: var(--nv-green); }

/* ===== Layout helpers ===== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 32px;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}
.col-half { flex: 1 1 calc(50% - 12px); min-width: 300px; }
.col-third { flex: 1 1 calc(33.33% - 16px); min-width: 260px; }
.col-two-third { flex: 1 1 calc(66.66% - 12px); min-width: 300px; }
.col-full { flex: 1 1 100%; }

/* ===== Top bar ===== */
#topbar {
  background: var(--bg-dark);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 32px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.topbar-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  letter-spacing: 0.5px;
}
.topbar-sep {
  color: #666;
  font-weight: 300;
}
.topbar-subtitle {
  font-size: 0.85rem;
  color: #aaa;
  font-weight: 400;
}
.topbar-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 20px;
}
.topbar-links a {
  font-size: 0.8rem;
  color: #aaa;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}
.topbar-links a:hover {
  color: var(--nv-green);
}

/* ===== Hero Section ===== */
.hero {
  background: linear-gradient(135deg, #fff 0%, #f8f8f8 50%, #f0f0f0 100%);
  border-bottom: 1px solid var(--border);
  padding: 72px 32px 64px;
  text-align: center;
}
.hero-badge {
  display: inline-block;
  background: var(--nv-green-bg);
  border: 1px solid rgba(118, 185, 0, 0.3);
  color: var(--nv-green-dim);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 16px;
  border-radius: 100px;
  margin-bottom: 24px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.hero h1 {
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  margin-bottom: 16px;
  line-height: 1.2;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}
.hero-tagline {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 400;
  max-width: 640px;
  margin: 0 auto 12px;
  line-height: 1.6;
}
.hero-authors {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}
/* Dark hero variant */
.hero.hero-dark {
  background: linear-gradient(135deg, #1a1a1a 0%, #222 50%, #1a1a1a 100%);
  border-bottom: 1px solid #333;
}
.hero.hero-dark h1 { color: #fff; }
.hero.hero-dark .hero-tagline { color: #bbb; }
.hero.hero-dark .hero-authors { color: #888; }
.hero.hero-dark .hero-badge {
  background: rgba(118, 185, 0, 0.12);
  border-color: rgba(118, 185, 0, 0.35);
}

.hero-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Buttons ===== */
.btn {
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--nv-green);
  color: #fff;
  border-color: var(--nv-green);
}
.btn-primary:hover {
  background: var(--nv-green-dim);
  border-color: var(--nv-green-dim);
  color: #fff;
  text-decoration: none;
}
.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-outline:hover {
  border-color: var(--nv-green);
  color: var(--nv-green-dim);
  background: var(--nv-green-bg);
  text-decoration: none;
}
.btn-outline-light {
  background: transparent;
  color: #ccc;
  border-color: #555;
}
.btn-outline-light:hover {
  border-color: var(--nv-green);
  color: var(--nv-green);
  background: rgba(118, 185, 0, 0.08);
  text-decoration: none;
}
.btn-lg {
  padding: 12px 36px;
  font-size: 0.95rem;
}

/* ===== Sections ===== */
.section {
  padding: 72px 0;
}
.section-alt {
  background: var(--bg-white);
}
.section-dark {
  background: var(--bg-dark);
  color: #fff;
}
.section-header {
  text-align: center;
  margin-bottom: 48px;
}
.section-header h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}
.section-dark .section-header h2 {
  color: #fff;
}
.section-header .accent {
  color: var(--nv-green);
}
.section-header p {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto;
}
.section-dark .section-header p {
  color: #aaa;
}

/* ===== Stat Cards ===== */
.stats-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.stat-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-left: 3px solid var(--nv-green);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--nv-green-dim);
  line-height: 1;
  margin-bottom: 2px;
}
.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ===== Insight Panels (dark section) ===== */
.insight-panel {
  background: var(--bg-dark-surface);
  border: 1px solid #333;
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.insight-panel p { flex: 1; }
.insight-panel img { margin-top: auto; }
.insight-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.insight-icon.green { background: rgba(118,185,0,0.15); }
.insight-icon.green svg { stroke: var(--nv-green); }
.insight-icon.red { background: rgba(239,68,68,0.15); }
.insight-icon.red svg { stroke: #ef4444; }
.insight-icon svg { width: 22px; height: 22px; fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

.insight-panel h4 {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 10px;
}
.insight-panel p {
  color: #bbb;
  font-size: 0.9rem;
  line-height: 1.6;
}
.insight-panel img {
  width: 100%;
  border-radius: var(--radius);
  margin-top: 16px;
  border: 1px solid #333;
}
.insight-summary {
  color: #ccc;
  font-size: 1.05rem;
  text-align: center;
  max-width: 680px;
  margin: 40px auto 0;
  line-height: 1.7;
}
.insight-summary strong { color: var(--nv-green); }

/* ===== Pipeline Steps ===== */
.pipeline {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  margin-bottom: 40px;
}
.pipeline-step {
  flex: 1;
  max-width: 230px;
  text-align: center;
  position: relative;
  padding: 0 12px;
}
.pipeline-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 24px;
  right: -10px;
  width: 20px;
  height: 2px;
  background: var(--nv-green);
}
.pipeline-step:not(:last-child)::before {
  content: '';
  position: absolute;
  top: 19px;
  right: -10px;
  border-left: 7px solid var(--nv-green);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}
.step-num {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--nv-green);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 3px 12px rgba(118,185,0,0.3);
}
.pipeline-step h5 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.pipeline-step p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.formula-box {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 28px;
  text-align: center;
  max-width: 520px;
  margin: 0 auto 40px;
  font-size: 1.05rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ===== Why Cards ===== */
.why-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  height: 100%;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
}
.why-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.why-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--nv-green-bg);
  color: var(--nv-green-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.why-icon svg { width: 22px; height: 22px; fill: none; stroke: var(--nv-green-dim); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.why-card h5 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.why-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* ===== Results ===== */
.result-block {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.result-block h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}
.result-block img {
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}
.result-caption {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 10px;
  line-height: 1.5;
}

.highlight-box {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-left: 3px solid var(--nv-green);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
}
.highlight-box p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0 0 8px 0;
}
.highlight-box .big-num {
  font-size: 2rem;
  font-weight: 700;
  color: var(--nv-green-dim);
  line-height: 1;
  margin-bottom: 6px;
}

/* ===== App Cards (dark section) ===== */
.app-card {
  background: var(--bg-dark-surface);
  border: 1px solid #333;
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  height: 100%;
  transition: background 0.15s, transform 0.15s;
}
.app-card:hover {
  background: #2a2a2a;
  transform: translateY(-2px);
}
.app-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(118,185,0,0.12);
  color: var(--nv-green);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.app-icon svg { width: 22px; height: 22px; fill: none; stroke: var(--nv-green); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.app-card h5 {
  color: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.app-card p {
  color: #999;
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 0;
}

/* ===== Teaser Table ===== */
.teaser-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-white);
  box-shadow: var(--shadow-md);
  margin-bottom: 32px;
}
.teaser-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  white-space: nowrap;
}
.teaser-table th {
  background: var(--bg-surface);
  padding: 10px 14px;
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
  text-align: center;
}
.teaser-table th:first-child { text-align: left; min-width: 200px; }
.teaser-table td {
  padding: 7px 14px;
  border-bottom: 1px solid var(--border-light);
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.teaser-table td:first-child {
  text-align: left;
  font-weight: 500;
  color: var(--text-primary);
}
.teaser-table tbody tr:hover { background: var(--nv-green-bg); }

/* ===== Citation ===== */
.citation-block {
  position: relative;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  max-width: 800px;
  margin: 0 auto;
}
.citation-block pre {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: "SF Mono", "Fira Code", Menlo, Consolas, monospace;
}
.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--nv-green);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 5px 14px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s;
}
.copy-btn:hover { background: var(--nv-green-dim); }

/* ===== Footer ===== */
footer {
  border-top: 1px solid var(--border);
  padding: 20px 32px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-white);
}
footer a {
  color: var(--text-muted);
  text-decoration: none;
  margin: 0 8px;
}
footer a:hover { color: var(--nv-green-dim); text-decoration: underline; }

/* ===== Scroll Animations ===== */
.fade-in-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.fade-in-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .hero h1 { font-size: 1.8rem; }
  .hero { padding: 48px 20px 40px; }
  .section { padding: 48px 0; }
  .container { padding: 0 20px; }
  .pipeline {
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }
  .pipeline-step { max-width: 320px; }
  .pipeline-step::after,
  .pipeline-step::before { display: none !important; }
  .col-half, .col-third, .col-two-third { flex: 1 1 100%; min-width: 0; }
  .topbar-subtitle { display: none; }
}

@media (max-width: 600px) {
  .hero h1 { font-size: 1.5rem; }
  .hero-tagline { font-size: 0.95rem; }
  .section-header h2 { font-size: 1.4rem; }
  .hero-buttons { flex-direction: column; align-items: center; }
  .btn { width: 100%; max-width: 240px; justify-content: center; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }
