/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --ink:        #1a1612;
  --ink-light:  #5a5047;
  /* --paper:      #faf8f4; */
  --paper:      #ffffff;
  --manila:     #faf8f4;
  --rule:       #e2ddd6;
  --accent:     #962922;
  --accent-dim: #e2ddd6;
  --gold:       #a07840;
  --mono:       'JetBrains Mono', monospace;
  --serif:      'Source Serif 4', serif;
  --display:    'Playfair Display', serif;
  --max-w:      1100px;
}

/* ── Reset / base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 300;
  line-height: 1.7;
  min-height: 100vh;
}

/* ── Layout ────────────────────────────────────────────────── */
.page-wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 2rem; }

/* ── Header ────────────────────────────────────────────────── */
header {
  border-bottom: 3px double var(--ink);
  padding: 2.5rem 0 2rem;
}
.header-title {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
#icon {
  width: 100px;
  margin-bottom: -0.4rem;
  flex-shrink: 0;
}
h1 {
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 3.6rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.02em;
  /* color: var(--ink); */
  color: var(--accent);
}
h1 em {
  font-style: italic;
  /* font-style: normal; */
  color: var(--accent);
}
.subtitle {
  margin-top: 0.6rem;
  font-size: 1.05rem;
  font-weight: 300;
  font-style: italic;
  color: var(--ink-light);
  max-width: 900px;
}

.nav-paper-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}

/* ── Nav ───────────────────────────────────────────────────── */
nav {
  display: flex;
  margin-top: 0.5rem;
  gap: 0.3rem;
}
nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--paper);
  background: var(--ink);
  padding: 0.35em 0.9em;
  border: 1px solid var(--ink);
  border-radius: 2px;
  line-height: 1.8;
}
nav a:hover, nav a.active {
  background: var(--accent);
  border-color: var(--accent);
}
nav a.active { pointer-events: none; }

/* ── Paper links (arXiv / GitHub) ──────────────────────────── */
.paper-links {
  display: flex;
  margin-top: 0.5rem;
  gap: 0.3rem;
}
.paper-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7em;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  padding: 0.35em 0.9em;
  border-radius: 2px;
  line-height: 1.8;
}
.paper-links a:hover { background: var(--accent-dim); }
.paper-links a svg { width: 13px; height: 13px; fill: currentColor; flex-shrink: 0; }

/* ── Main content ──────────────────────────────────────────── */
main { padding: 0 0 4rem; }

/* ── Section heading ───────────────────────────────────────── */
.section-title {
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 700;
  margin: 1em 0 0.5rem;
}
.section-intro {
  color: var(--ink-light);
  font-size: 0.95rem;
  margin-bottom: 0;
  max-width: 700px;
}
.section-intro a { color: var(--accent); }

/* ── Paragraph links ───────────────────────────────────────── */
p {
  margin-bottom: 0.9rem; 
  font-size: 0.97rem;
  text-align: justify;
}
p:last-child {
  margin-bottom: 0;
}

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

/* ── Highlight pill (rank 1) ───────────────────────────────── */
.rank-gold   { color: var(--gold); font-weight: 600; }
.rank-silver { color: #7a7a8a; font-weight: 600; }
.rank-bronze { color: #a0694a; font-weight: 600; }

/* ── DataTables overrides ──────────────────────────────────── */
#leaderboard-wrap {
  /* background: #fff; */
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0;
}

/* Top controls (search + length) */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  font-family: var(--mono);
  font-size: 0.78rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.3em 0.6em;
  background: var(--paper);
  color: var(--ink);
}
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--ink-light);
}

/* Table itself */
table#leaderboard {
  width: 100% !important;
  border-collapse: collapse;
  font-size: 0.88rem;
}
table#leaderboard thead th {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-light);
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
  padding: 0.5em 2.5em 0.8em 1em;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
table#leaderboard thead th:first-child { text-align: center; width: 3.5rem; }

/* Sort arrows */
table.dataTable thead th.dt-orderable-asc::after,
table.dataTable thead th.dt-orderable-desc::after {
  opacity: 0.3;
  font-size: 0.7em;
}
table.dataTable thead th.dt-ordering-asc::after,
table.dataTable thead th.dt-ordering-desc::after {
  opacity: 1;
  color: var(--accent);
}

table#leaderboard tbody tr {
  border-bottom: 1px solid var(--rule);
  transition: background 0.1s;
}
table#leaderboard tbody tr:last-child { border-bottom: none; }
table#leaderboard tbody tr:hover { background: #f5f0ea; }
table#leaderboard tbody tr.top-row { background: #fffbf0; }

table#leaderboard td {
  padding: 0.75em 1em;
  vertical-align: middle;
}
table#leaderboard td:first-child {
  text-align: center;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-light);
}

/* Model name column */
.model-name {
  font-weight: 600;
  color: var(--ink);
}
.model-org {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-light);
  font-weight: 300;
}
.model-link {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.05em;
}
.model-link:hover { text-decoration: underline; }

/* Score cells */
.score {
  font-family: var(--mono);
  font-size: 0.88rem;
  text-align: right;
}
.score-main {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: right;
}

/* Tags */
.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15em 0.55em;
  border-radius: 2px;
  border: 1px solid var(--rule);
  color: var(--ink-light);
}
.tag.open   { border-color: #b8d4b8; color: #2d7a2d; background: #f0f9f0; }
.tag.closed { border-color: #d4c4b8; color: #7a5a2d; background: #fdf5ec; }
.tag.api    { border-color: #b8c4d4; color: #2d4a7a; background: #f0f3f9; }

/* Bottom info */
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--ink-light);
  margin-top: 0.8rem;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  font-family: var(--mono);
  font-size: 0.7rem;
  border-radius: 2px !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--ink) !important;
  border-color: var(--ink) !important;
  color: var(--paper) !important;
}
div.dataTables_wrapper { padding: 1.2rem 1.2rem 1rem; }

/* ── Notes / legend ────────────────────────────────────────── */
.legend {
  margin: 1.4rem 0 0;
  display: flex;
  justify-content: space-between;  
  font-size: 0.8rem;
  color: var(--ink-light);
  font-family: var(--mono);
}
.legend-justify {
  gap: 0.5rem 1.6rem;
  display: flex;
  flex-wrap: wrap;
}
.legend-item { 
  display: flex; 
  align-items: center; 
  gap: 0.4em;
}

/* ── Citation box ──────────────────────────────────────────── */
.citation-box {
  /* margin-top: 3.5rem; */
  border-left: 3px solid var(--accent);
  background: var(--manila);
  padding: 1.1rem 1.4rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--ink-light);
  white-space: pre-wrap;
  overflow-x: auto;
}
.citation-box .cite-label {
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.5rem;
  display: block;
}

.code-block {
  margin: 1rem 0 1.5rem;
  padding: 1rem 1.2rem;
  /* border: 1px solid var(--rule); */
  border-left: 3px solid var(--accent);
  background: var(--manila);
  overflow-x: auto;
}
.code-block code {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
}

/* ── Content spacing ─────────────────────────────────────── */
.citation-box {
  margin-top: 1.4rem;
}

/* ── Divider ─────────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
  grid-column: 1 / -1;
}

/* ── Author cards ────────────────────────────────── */
.author-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.4rem;
}
.author-card {
  border: 1px solid var(--rule);
  background: #fff;
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
}
.author-card strong {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
}
.author-card span {
  color: var(--ink-light);
  font-size: 0.8rem;
}
.author-card a {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
}

/* ── Update log ──────────────────────────────────── */
.update-log {
  list-style: none;
  font-size: 0.88rem;
}
.update-log li {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 0.8rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rule);
}
.update-log li:last-child { border-bottom: none; }
.update-log .log-date {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--gold);
  white-space: nowrap;
  padding-top: 0.1rem;
}

/* ── Footer ────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--rule);
  padding: 1.5rem 0;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--ink-light);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem;
}

video {
  display: block;
  margin: 1em auto;
  width: min(60%, 100%);
  border: 1px solid var(--accent-dim);
  border-radius: 0.5em;
}

@media (max-width: 720px) {
  video {
    width: 100%;
  }
}

.diagram {
  display: block;
  text-align: center;
  padding: 1em 0;
}
#diagram {
  width: 60%;
  border-color: black;
  border-width: 1px;
  border-style: solid;
}
.diagram-description {
  width: 80%;
  margin: 0.75rem auto 0;
  text-align: justify;
}
