/* ==========================================================================
   DrBenchmark - site stylesheet (no framework, no external dependency)
   ========================================================================== */

:root {
  color-scheme: light;

  --primary: #1565c0;
  --primary-hover: #0d47a1;
  --primary-soft: #e8f1fc;
  --on-primary: #ffffff;

  --text: #1d2430;
  --text-muted: #556070;
  --bg: #ffffff;
  --bg-alt: #f5f8fc;
  --surface: #ffffff;
  --border: #d9e1eb;
  --border-soft: #e9eef5;
  --row-hover: #eaf2fd;
  --group-hover: #f5f9fe;
  --header-bg: rgba(255, 255, 255, 0.86);

  --sorted-bg: #f2f7fe;
  --best-bg: #dceafb;
  --best-text: #0b3f84;

  --code-bg: #1d1f21;
  --code-text: #f9fafb;
  --code-muted: #9aa4b2;

  --dataset-gradient: linear-gradient(135deg, #00838f 0%, #1e5fc2 100%);
  --model-gradient: linear-gradient(120deg, #fbf268 0%, #e5b339 100%);
  --model-text: #6a0306;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 8px 20px rgba(16, 24, 40, 0.06);
  --shadow-lift: 0 14px 30px rgba(16, 24, 40, 0.16);

  --radius: 14px;
  --radius-sm: 9px;
  --header-h: 64px;
  --container: 1280px;
  --gutter: clamp(1rem, 4vw, 2rem);
  --ds-col: 10rem;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* Dark theme: opt-in with the toggle in the menu (light is the default). */
:root[data-theme="dark"] {
  color-scheme: dark;

  --primary: #6ab0f5;
  --primary-hover: #9ccaf8;
  --primary-soft: #15273b;
  --on-primary: #0b1724;

  --text: #e6eaf0;
  --text-muted: #a3adbb;
  --bg: #0e1319;
  --bg-alt: #131a22;
  --surface: #161e27;
  --border: #2b3643;
  --border-soft: #222c37;
  --row-hover: #233041;
  --group-hover: #1b2531;
  --header-bg: rgba(14, 19, 25, 0.84);

  --sorted-bg: #17222e;
  --best-bg: #1d3a5c;
  --best-text: #d6e9ff;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.45), 0 8px 20px rgba(0, 0, 0, 0.3);
  --shadow-lift: 0 14px 30px rgba(0, 0, 0, 0.5);
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 0.5rem);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg {
  vertical-align: middle;
}

img {
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.015em;
}

a {
  color: var(--primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--primary-hover);
}

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

.sprite {
  display: none;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Bilingual content: only the active language is shown (English by default). */
html:not([lang="fr"]) [lang="fr"],
html[lang="fr"] [lang="en"],
html[lang="fr"] .when-en,
html:not([lang="fr"]) .when-fr {
  display: none !important;
}

/* Hints that only make sense when JavaScript runs */
.js-only {
  display: none;
}

.js .js-only {
  display: inline;
}

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
  color: var(--on-primary);
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Header / navigation ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand:hover {
  color: var(--text);
}

.brand img {
  width: 34px;
  height: auto;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 550;
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-links a:hover {
  color: var(--text);
  background: var(--bg-alt);
}

.nav-links a.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.nav-github .icon {
  width: 1.3em;
  height: 1.3em;
}

.nav-github-label {
  display: none;
}

/* Language and light / dark toggles (need JavaScript, hidden otherwise) */
.nav-theme,
.nav-lang {
  display: none;
}

.js .nav-theme,
.js .nav-lang {
  display: block;
}

.lang-toggle,
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.45rem 0.75rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.lang-toggle:hover,
.theme-toggle:hover {
  color: var(--text);
  background: var(--bg-alt);
}

.lang-toggle .icon,
.theme-toggle .icon {
  width: 1.25em;
  height: 1.25em;
}

.lang-code {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.theme-toggle .icon-sun,
:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

.lang-label,
.theme-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-right: -0.5rem;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.nav-toggle:hover {
  background: var(--bg-alt);
}

.nav-toggle .icon {
  width: 26px;
  height: 26px;
}

.nav-toggle .icon-close,
.nav-toggle[aria-expanded="true"] .icon-open {
  display: none;
}

.nav-toggle[aria-expanded="true"] .icon-close {
  display: block;
}

@media (max-width: 1080px) {
  .js .nav-toggle {
    display: inline-flex;
  }

  .js .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    padding: 0.5rem var(--gutter) 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }

  .js .nav-links.open {
    display: flex;
  }

  .js .nav-links a {
    padding: 0.75rem 0.85rem;
    font-size: 1.02rem;
  }

  .js .nav-github-label {
    display: inline;
  }

  .js .lang-toggle,
  .js .theme-toggle {
    padding: 0.75rem 0.85rem;
    font-size: 1.02rem;
  }

  .js .lang-code {
    display: none;
  }

  .js .lang-label,
  .js .theme-label {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
  }

  /* Without JavaScript the links simply wrap under the brand. */
  .nav {
    flex-wrap: wrap;
  }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.62rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

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

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

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

.btn-sm {
  padding: 0.42rem 0.8rem;
  font-size: 0.875rem;
}

.emoji {
  font-size: 1.15em;
  line-height: 1;
}

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

.hero {
  padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(2rem, 4vw, 3rem);
  background:
    radial-gradient(1200px 500px at 10% -10%, var(--primary-soft), transparent 70%),
    var(--bg);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 270px) minmax(0, 1fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: center;
}

.hero-logo {
  width: 100%;
  max-width: 270px;
  filter: drop-shadow(0 12px 22px rgba(16, 24, 40, 0.14));
}

.eyebrow {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 0.6rem;
  font-size: clamp(2.5rem, 6vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.tagline {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  font-size: clamp(1.1rem, 2.2vw, 1.35rem);
  font-weight: 500;
  line-height: 1.4;
}

.lead {
  margin: 0 0 1.75rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 2rem;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stats li {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.stats strong {
  color: var(--text);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.stats span {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.partners {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem 1.5rem;
  margin: clamp(2rem, 5vw, 3rem) 0 0;
  padding: 1.75rem 0 0;
  border-top: 1px solid var(--border);
  list-style: none;
}

.partner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 10rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 550;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
}

.partner:hover {
  color: var(--primary);
}

/* White card behind each logo: logos stay legible in light and dark themes. */
.partner-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 7rem;
  height: 2.75rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.partner:hover .partner-logo {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.partner-logo img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 1.75rem;
}

@media (max-width: 420px) {
  .partners {
    gap: 1rem 0.75rem;
  }

  .partner {
    width: 9.25rem;
  }
}

@media (max-width: 760px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
    text-align: center;
  }

  .hero-logo {
    max-width: 150px;
    margin-inline: auto;
  }

  .actions,
  .stats {
    justify-content: center;
  }

  .stats li {
    align-items: center;
  }
}

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

.section {
  padding: clamp(3rem, 7vw, 5rem) 0;
}

.section-alt {
  background: var(--bg-alt);
  border-block: 1px solid var(--border-soft);
}

.section-title {
  margin: 0 0 0.6rem;
  font-size: clamp(1.65rem, 3.2vw, 2.15rem);
  font-weight: 800;
}

.section-intro {
  margin: 0 0 2rem;
  color: var(--text-muted);
}

.subsection-title {
  margin: 2.75rem 0 0.6rem;
  font-size: clamp(1.2rem, 2.2vw, 1.4rem);
  font-weight: 750;
}

.section-title + .subsection-title {
  margin-top: 1.5rem;
}

.prose {
  margin: 0 0 1.5rem;
}

/* ---------- Cards (datasets & models) ---------- */

.card-grid {
  display: grid;
  gap: clamp(0.75rem, 1.6vw, 1.1rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.dataset-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.model-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 560px) {
  .dataset-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 700px) {
  .dataset-grid,
  .model-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1080px) {
  .dataset-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.dataset-card,
.model-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  border-radius: var(--radius);
  text-align: center;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.dataset-card:hover,
.model-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
}

.dataset-card {
  aspect-ratio: 1 / 1;
  padding: 1rem 0.75rem;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.16), transparent 55%),
    var(--dataset-gradient);
  color: #ffffff;
}

.dataset-card:hover {
  color: #ffffff;
}

.dataset-card .card-name {
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.dataset-card .card-meta {
  margin-top: 0.45rem;
  font-size: 0.78rem;
  font-weight: 550;
  line-height: 1.35;
  opacity: 0.95;
}

.card-arrow {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  width: 1rem;
  height: 1rem;
  opacity: 0.55;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.dataset-card:hover .card-arrow {
  opacity: 1;
  transform: translate(2px, -2px);
}

.model-card {
  gap: 0.55rem;
  padding: 1.4rem 0.9rem 1.2rem;
  background: var(--model-gradient);
  color: var(--model-text);
}

.model-card:hover {
  color: var(--model-text);
}

.model-card img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  transition: transform 0.18s ease;
}

.model-card:hover img {
  transform: scale(1.05);
}

.model-card .card-name {
  font-size: 1.08rem;
  font-weight: 900;
  line-height: 1.2;
}

.model-card .card-meta {
  font-size: 0.78rem;
  font-weight: 650;
  opacity: 0.85;
}

/* ---------- Code blocks ---------- */

.code-block {
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--code-bg);
  box-shadow: var(--shadow);
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.6rem 0.5rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--code-muted);
  font: 600 0.75rem/1 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  background: transparent;
  color: #e5e7eb;
  font: 550 0.8rem/1 var(--font-sans);
  letter-spacing: normal;
  text-transform: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.copy-btn .icon {
  width: 0.95rem;
  height: 0.95rem;
}

.copy-btn .icon-check,
.copy-btn.copied .icon-copy {
  display: none;
}

.copy-btn.copied .icon-check {
  display: block;
}

.copy-btn.copied {
  color: #6ee7b7;
  border-color: rgba(110, 231, 183, 0.5);
}

.code-block pre {
  margin: 0;
  padding: 1.1rem 1.25rem 1.25rem;
  overflow-x: auto;
  color: var(--code-text);
  font: 0.875rem/1.7 var(--font-mono);
  tab-size: 2;
}

.code-block code {
  font: inherit;
}

.tok-str {
  color: #e7ce46;
}

.tok-com {
  color: #5da052;
}

.tok-mod,
.tok-kw {
  color: #da39ec;
}

.tok-id {
  color: #f0a35e;
}

.tok-field {
  color: #6cb6ff;
}

.tok-num {
  color: #9ece6a;
}

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

.table-frame {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Fade on the right edge while the table can still scroll horizontally. */
.table-frame::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 2.5rem;
  background: linear-gradient(to right, transparent, rgba(16, 24, 40, 0.12));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.table-frame.can-scroll::after {
  opacity: 1;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrap:focus-visible {
  outline-offset: -3px;
}

.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.data th,
.data td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.data thead th {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: bottom;
}

.data tbody tr:last-child > *,
.data tbody th.col-ds {
  border-bottom-color: var(--border);
}

.data tbody:last-child tr:last-child > *,
.data tbody:last-child th.col-ds {
  border-bottom: 0;
}

.data tbody tr:hover > * {
  background: var(--row-hover);
}

/* Overview table: each dataset is a <tbody> whose Dataset and License cells span
   all its task rows. Hovering any part of it tints the whole dataset, and the
   task row under the pointer a bit more. The shared cells keep the dataset tint,
   so they never look attached to the first task only. */
.tasks tbody:hover > tr > * {
  background: var(--group-hover);
}

.tasks tbody > tr:hover > :not([rowspan]) {
  background: var(--row-hover);
}

/* Pointer on a shared cell: the whole dataset is targeted, not its first task. */
.tasks tbody > tr:has(> [rowspan]:hover) > * {
  background: var(--group-hover);
}

.data .num {
  text-align: right;
}

.data .col-ds {
  position: sticky;
  left: 0;
  z-index: 1;
  width: var(--ds-col);
  min-width: var(--ds-col);
  max-width: var(--ds-col);
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
}

.data tbody .col-ds a {
  color: var(--text);
  text-decoration: none;
}

.data tbody .col-ds a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.data .col-task {
  position: sticky;
  left: var(--ds-col);
  z-index: 1;
  border-right: 1px solid var(--border);
}

.ds-inline {
  display: none;
}

/* Results table: compact model columns that may wrap at hyphens / slashes. */
.results thead th.model {
  min-width: 5.2rem;
  white-space: normal;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.82rem;
  color: var(--text);
}

.results {
  --ds-col: 9rem;
  font-size: 0.86rem;
}

.results th,
.results td {
  padding: 0.55rem 0.6rem;
}

/* Long task labels (e.g. in French) may wrap rather than widen the table. */
.results td.col-task {
  min-width: 6.5rem;
  white-space: normal;
}

.results .baseline {
  color: var(--text-muted);
}

.results thead th.baseline {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.82rem;
}

.results td strong,
.best-sample {
  display: inline-block;
  margin: -0.1rem -0.35rem;
  padding: 0.1rem 0.35rem;
  border-radius: 5px;
  background: var(--best-bg);
  color: var(--best-text);
  font-weight: 750;
}

.results td.pair strong {
  margin-left: 0;
}

.best-sample {
  margin: 0;
}

.table-note {
  margin: 0.9rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .data .col-ds {
    display: none;
  }

  .data .col-task {
    left: 0;
    min-width: 8.5rem;
  }

  .data tbody .ds-inline {
    display: block;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
  }

  .data thead .ds-inline {
    display: inline;
  }

  .data th,
  .data td {
    padding: 0.55rem 0.6rem;
  }
}

/* ---------- Legend (abbreviations and metrics) ---------- */

.legend {
  margin: 1.25rem 0 0;
  padding: clamp(1.1rem, 2.5vw, 1.5rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.legend-title {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 750;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1.25rem 2.25rem;
}

.legend h4 {
  margin: 0 0 0.6rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.legend dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.4rem 0.85rem;
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.legend dt {
  font-weight: 700;
  white-space: nowrap;
}

.legend dd {
  margin: 0;
  color: var(--text-muted);
}

/* ---------- Results table: filters, sorting, grouping ---------- */

.table-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin: 0 0 0.9rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font: 650 0.85rem/1.2 var(--font-sans);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.chip:hover {
  border-color: var(--primary);
  color: var(--text);
}

.chip[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.chip-count {
  font-weight: 500;
  opacity: 0.75;
}

.filter-status {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* The arrow sits in the cell's right padding, so sorting adds no width to the table. */
.results thead th:not(.col-ds):not(.col-task) {
  position: relative;
}

.sort-btn {
  display: inline-flex;
  align-items: flex-end;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.num .sort-btn {
  justify-content: flex-end;
}

.sort-btn::after {
  content: "\2195";
  position: absolute;
  right: 0.1rem;
  bottom: 0.6rem;
  font-size: 0.7rem;
  line-height: 1;
  opacity: 0.35;
}

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

.sort-btn:hover::after {
  opacity: 0.8;
}

.results thead th[aria-sort] .sort-btn {
  color: var(--primary);
}

.results thead th[aria-sort="ascending"] .sort-btn::after {
  content: "\25B2";
  opacity: 1;
}

.results thead th[aria-sort="descending"] .sort-btn::after {
  content: "\25BC";
  opacity: 1;
}

.results td.col-sorted {
  background: var(--sorted-bg);
}

/* Rows are independent (sortable); rows of the same dataset are grouped visually. */
.results tbody tr > * {
  border-top: 1px solid var(--border);
  border-bottom: 0;
}

.results tbody tr.grp-cont > * {
  border-top-color: var(--border-soft);
}

.results tbody tr.is-first > * {
  border-top: 0;
}

.results tr.grp-cont .ds-name {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Publication ---------- */

.pub-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1.25rem;
  padding: clamp(1.25rem, 3vw, 1.75rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pub-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
}

.pub-icon .icon {
  width: 24px;
  height: 24px;
}

.pub-title {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 750;
  line-height: 1.35;
}

.pub-title a {
  color: var(--text);
  text-decoration: none;
}

.pub-title a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.pub-authors {
  margin: 0 0 0.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.pub-venue {
  margin: 0 0 1.1rem;
  font-size: 0.9rem;
  font-weight: 650;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (max-width: 560px) {
  .pub-card {
    grid-template-columns: minmax(0, 1fr);
  }
}

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

.site-footer {
  padding: 1.75rem 0;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}

.footer-inner p {
  margin: 0;
}

.back-to-top {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  font-weight: 600;
  text-decoration: none;
}

.back-to-top:hover {
  color: var(--primary);
}

/* ---------- Motion & print ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

@media print {
  .site-header,
  .skip-link,
  .actions,
  .copy-btn,
  .back-to-top,
  .card-arrow {
    display: none !important;
  }

  .section,
  .hero {
    padding: 1.25rem 0;
  }

  .table-wrap {
    overflow: visible;
  }

  .data .col-ds,
  .data .col-task {
    position: static;
  }
}
