:root {
  --bg: #ffffff;
  --text: #172033;
  --muted: #667085;
  --primary: #0f4c81;
  --accent: #1ca7a8;
  --light: #f5f8fb;
  --panel: #fbfdff;
  --border: #dbe4ee;
  --display: "Source Serif 4", Georgia, "Iowan Old Style", "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}
.container-wide {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header / nav ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.site-header .container,
.site-header .container-wide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  padding-bottom: 18px;
}
.site-header .brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  color: var(--primary);
  letter-spacing: -0.012em;
}
.site-nav a {
  color: var(--text);
  margin-left: 24px;
  font-size: 15px;
}
.site-nav a:hover { color: var(--primary); text-decoration: none; }
.site-nav a.active { color: var(--primary); font-weight: 600; }

/* ---------- Hero ---------- */

.hero {
  background:
    linear-gradient(180deg, rgba(245, 248, 251, 0.92) 0%, rgba(255, 255, 255, 0.98) 100%),
    linear-gradient(90deg, rgba(15, 76, 129, 0.07) 0%, rgba(28, 167, 168, 0.08) 100%),
    var(--light);
  border-bottom: 1px solid var(--border);
  padding: 68px 0 58px;
  text-align: center;
}
.hero-inner {
  position: relative;
}
.hero h1 {
  font-family: var(--display);
  font-size: 64px;
  margin: 0 0 14px;
  letter-spacing: -0.025em;
  color: var(--primary);
  font-weight: 700;
}
.hero .tagline {
  font-size: 22px;
  margin: 0 auto 8px;
  color: var(--text);
  font-weight: 500;
}
.hero .subtagline {
  font-size: 17px;
  color: var(--muted);
  margin: 0 auto 24px;
  font-style: italic;
}
.hero-kpis {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0;
  margin: 0 auto 28px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  max-width: 620px;
}
.hero-kpi {
  min-width: 150px;
  padding: 14px 22px;
  text-align: center;
}
.hero-kpi + .hero-kpi {
  border-left: 1px solid var(--border);
}
.hero-kpi strong {
  display: block;
  color: var(--primary);
  font-family: var(--display);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
}
.hero-kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.hero-affiliation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 20px 28px;
  max-width: 680px;
  margin: 0 auto;
  padding-top: 2px;
}
.hero-affiliation img {
  display: block;
  width: auto;
  max-width: min(260px, 78vw);
  object-fit: contain;
}
.hero-affiliation .daplab-logo {
  height: 56px;
}
.hero-affiliation .vida-logo {
  height: 42px;
}
.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--primary);
  color: #fff;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 500;
  border: 1px solid var(--primary);
  transition: background 0.12s ease;
}
.btn:hover {
  background: #0d3f6b;
  color: #fff;
  text-decoration: none;
}
.btn.btn-secondary {
  background: #fff;
  color: var(--primary);
}
.btn.btn-secondary:hover {
  background: var(--light);
  color: var(--primary);
}

/* ---------- Sections ---------- */

section {
  padding: 56px 0;
  border-bottom: 1px solid var(--border);
}
section:last-of-type { border-bottom: none; }
section h2 {
  font-family: var(--display);
  font-size: 30px;
  margin: 0 0 20px;
  color: var(--primary);
  letter-spacing: -0.012em;
  font-weight: 600;
}

/* Cap reading width inside the wide container on long-form pages
   (Details, Get started). Header / hero / leaderboard grid stay full-width. */
section > .container-wide > p,
section > .container-wide > ol,
section > .container-wide > ul,
section > .container-wide > h2,
section > .container-wide > h3,
section > .container-wide > .table-wrap,
section > .container-wide > .json-viewer,
section > .container-wide > .json-caption,
section > .container-wide > pre,
section > .container-wide > .banner,
section > .container-wide > .task-copy-panel,
section > .container-wide > .metric-groups,
section > .container-wide > .challenge-grid {
  max-width: 920px;
}
.page-title-strip > .container-wide > h1,
.page-title-strip > .container-wide > p {
  max-width: 920px;
}
section h3 {
  font-size: 19px;
  margin: 24px 0 8px;
  color: var(--text);
}
section p { margin: 0 0 16px; }

/* ---------- Task definition ---------- */

.task-copy-panel {
  margin: 20px 0 30px;
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  background: var(--panel);
}
.task-copy-panel p {
  color: #2e3a4d;
  font-size: 16px;
  line-height: 1.72;
}
.task-copy-panel p:last-child {
  margin-bottom: 0;
}

/* ---------- Challenge cards ---------- */

.challenge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 24px;
}
.challenge {
  background: var(--light);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 20px;
  border-radius: 4px;
}
.challenge .num {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 6px;
}
.challenge h4 {
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--text);
}
.challenge p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

/* ---------- Workflow ---------- */

.workflow-showcase {
  position: relative;
  display: grid;
  gap: 0;
  margin: 18px 0 10px;
  padding: 4px 0 4px 18px;
}
.workflow-showcase::before {
  content: "";
  position: absolute;
  left: 33px;
  top: 18px;
  bottom: 18px;
  width: 2px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  opacity: 0.28;
}
.workflow-step {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 0;
}
.workflow-index {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(15, 76, 129, 0.20);
  border-radius: 50%;
  background: #fff;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 4px #fff;
}
.workflow-step h4 {
  margin: 1px 0 3px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}
.workflow-step p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.workflow-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.workflow-note code {
  background: var(--light);
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 12px;
}

/* ---------- Stat cards ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 24px;
}
.stat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px;
  text-align: center;
}
.stat .value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.01em;
  display: block;
  margin-bottom: 4px;
}
.stat .label {
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th {
  background: var(--light);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--border);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--light); }
td.num { font-variant-numeric: tabular-nums; text-align: right; }
th.num { text-align: right; }
td.rank {
  font-weight: 700;
  color: var(--muted);
  width: 40px;
}
td.model { font-weight: 500; }

/* Sortable column headers */
th.sortable {
  cursor: pointer;
  user-select: none;
}
th.sortable:hover { color: var(--primary); }
th.sortable .sort-arrow {
  display: inline-block;
  width: 10px;
  margin-left: 4px;
  color: var(--muted);
  font-size: 10px;
}
th.sortable.sort-asc .sort-arrow::after  { content: "▲"; color: var(--primary); }
th.sortable.sort-desc .sort-arrow::after { content: "▼"; color: var(--primary); }

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
}
.tab {
  padding: 10px 20px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab:hover { color: var(--primary); }

/* ---------- Banner / callout ---------- */

.banner {
  background: var(--light);
  border-left: 3px solid var(--accent);
  padding: 14px 18px;
  margin: 16px 0;
  font-size: 14px;
  border-radius: 0 4px 4px 0;
}
.banner strong { color: var(--text); }

.placeholder {
  display: inline-block;
  background: #fff4cc;
  color: #8a6d00;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 13px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

/* ---------- Citation ---------- */

.bibtex {
  background: #0e1822;
  color: #e6edf3;
  padding: 18px;
  border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-x: auto;
}

.paper-meta {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 12px;
}
.paper-meta strong {
  color: var(--text);
}
.paper-meta.author-list {
  line-height: 1.55;
}

/* ---------- Metric groups (evaluation page) ---------- */

.metric-groups {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
}
.metric-group {
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 18px;
}
.metric-group h4 {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--primary);
}
.metric-group ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.metric-group li {
  font-size: 14px;
  color: var(--text);
  padding: 4px 0;
}
.metric-group li code {
  background: #fff;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 12px;
}

/* ---------- Domain bars ---------- */

.domain-bars {
  margin-top: 16px;
}
.domain-row {
  display: grid;
  grid-template-columns: 220px 1fr 60px;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  font-size: 14px;
}
.domain-row .name { color: var(--text); }
.domain-row .bar {
  height: 14px;
  background: var(--light);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.domain-row .bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}
.domain-row .pct {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}
.site-footer a { color: var(--muted); }

/* ---------- Two-column home grid ---------- */

.home-section { padding: 40px 0 64px; border-bottom: none; }

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 28px;
  align-items: start;
}

.card {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 30px 30px 26px;
  box-shadow:
    0 1px 0 rgba(15, 76, 129, 0.05),
    0 12px 28px -24px rgba(15, 76, 129, 0.35);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover {
  box-shadow:
    0 1px 0 rgba(15, 76, 129, 0.05),
    0 16px 34px -24px rgba(15, 76, 129, 0.42);
}
.card h3:first-child { margin-top: 0; }
.card h3 {
  font-family: var(--display);
  font-size: 24px;
  color: var(--primary);
  margin: 28px 0 12px;
  letter-spacing: -0.012em;
  font-weight: 600;
}
.card p {
  color: #2e3a4d;
}

.card-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 30px 0;
}

.right-col {
  position: sticky;
  top: 24px;
}

.lb-footnote {
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
}
.lb-footnote code {
  background: var(--light);
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 11px;
}

/* Inline links inside the "What is LakeQA?" card */
.inline-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 12px 0 4px;
  font-size: 14px;
}
.inline-links a {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 1px;
}
.inline-links a:hover { color: var(--accent); }

/* ---------- JSON viewer (Details > Example task) ---------- */

.json-viewer {
  background: #0e1822;
  color: #e6edf3;
  padding: 22px 24px;
  border-radius: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
  overflow-x: auto;
  margin: 16px 0;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: break-word;
  tab-size: 2;
}
.json-viewer code {
  font-family: inherit;
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: inherit;
}
.json-viewer .key      { color: #79c0ff; }
.json-viewer .str      { color: #a5d6ff; }
.json-viewer .num      { color: #ffa657; }
.json-viewer .bool,
.json-viewer .null     { color: #ff7b72; }
.json-viewer .punct    { color: #768390; }
.json-viewer .comment  { color: #8b949e; font-style: italic; }
.json-viewer .py-kw    { color: #ff7b72; }
.json-viewer .py-fn    { color: #d2a8ff; }
.json-viewer .py-str   { color: #a5d6ff; }
.json-viewer .py-com   { color: #8b949e; font-style: italic; }
.json-viewer .py-builtin { color: #ffa657; }

.json-caption {
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
  font-style: italic;
}
.json-caption code {
  font-style: normal;
  background: var(--light);
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 12px;
}

/* ---------- Page-load fade ---------- */

@keyframes lakeqa-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.hero h1            { animation: lakeqa-rise 0.55s ease-out both; }
.hero .tagline      { animation: lakeqa-rise 0.55s 0.10s ease-out both; }
.hero .subtagline   { animation: lakeqa-rise 0.55s 0.20s ease-out both; }
.hero .hero-kpis    { animation: lakeqa-rise 0.55s 0.26s ease-out both; }
.hero-affiliation   { animation: lakeqa-rise 0.55s 0.32s ease-out both; }
.home-grid > .card  { animation: lakeqa-rise 0.55s 0.30s ease-out both; }
.home-grid > .right-col { animation-delay: 0.40s; }

@media (prefers-reduced-motion: reduce) {
  .hero h1, .hero .tagline, .hero .subtagline,
  .hero .hero-kpis, .hero-affiliation,
  .home-grid > .card { animation: none; }
}

/* Secondary-page header band — same vertical rhythm as .hero,
   left-aligned content (vs centered on the home hero). */
.page-title-strip {
  background:
    radial-gradient(ellipse 60% 80% at 50% 0%,
      rgba(28, 167, 168, 0.10), transparent 70%),
    var(--light);
  border-bottom: 1px solid var(--border);
  padding: 72px 0 64px;
}
.page-title-strip h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 48px;
  color: var(--primary);
  letter-spacing: -0.018em;
  font-weight: 700;
}
.page-title-strip p {
  margin: 8px 0 0;
  font-size: 17px;
  color: var(--muted);
}

/* ---------- Mobile ---------- */

@media (max-width: 980px) {
  .home-grid { grid-template-columns: 1fr; }
  .right-col { position: static; }
}

@media (max-width: 720px) {
  .hero { padding: 40px 0 36px; }
  .hero h1 { font-size: 38px; }
  .hero .tagline { font-size: 18px; }
  .hero .subtagline { font-size: 15px; }
  .hero-kpis {
    max-width: 340px;
  }
  .hero-kpi {
    min-width: 113px;
    padding: 12px 10px;
  }
  .hero-kpi strong { font-size: 22px; }
  .hero-affiliation { gap: 14px 20px; }
  .hero-affiliation .daplab-logo { height: 46px; }
  .hero-affiliation .vida-logo { height: 34px; }
  section { padding: 36px 0; }
  section h2 { font-size: 22px; }

  .challenge-grid,
  .metric-groups { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  .site-header .container,
  .site-header .container-wide {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
  .site-nav a { margin-left: 0; margin-right: 16px; }

  .card { padding: 20px 18px; }

  .json-viewer {
    font-size: 12px;
    padding: 16px 18px;
  }

  .page-title-strip { padding: 44px 0 36px; }
  .page-title-strip h1 { font-size: 32px; }
  .page-title-strip p { font-size: 15px; }
}
