:root {
  --paper: #f3f0e8;
  --paper-raised: #fbfaf6;
  --ink: #17211b;
  --muted: #657069;
  --line: #cfd3cc;
  --line-strong: #aeb6ae;
  --green: #1f5b45;
  --green-dark: #123b2d;
  --green-pale: #dce9e2;
  --amber: #a85d18;
  --red: #8d3b35;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --serif: "Newsreader", Georgia, serif;
  --max: 78rem;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(rgba(23, 33, 27, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 33, 27, 0.025) 1px, transparent 1px),
    var(--paper);
  background-size: 2rem 2rem;
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.6;
}

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid #d8873d;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 20;
  padding: 0.65rem 0.9rem;
  background: var(--ink);
  color: white;
  transform: translateY(-180%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  width: min(calc(100% - 2.5rem), var(--max));
  margin: 0 auto;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand svg {
  width: 2.5rem;
  fill: none;
  stroke: var(--green);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.35rem;
}

.site-header nav a {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  text-underline-offset: 0.28rem;
}

.site-header nav a:hover,
.site-header nav a[aria-current="page"] {
  color: var(--green);
  text-decoration: underline;
}

main,
.site-footer {
  width: min(calc(100% - 2.5rem), var(--max));
  margin-inline: auto;
}

.landing-hero {
  max-width: 68rem;
  padding: clamp(5rem, 11vw, 9rem) 0 clamp(3rem, 7vw, 5rem);
}

.eyebrow,
.route-kicker {
  margin: 0 0 1rem;
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  text-wrap: pretty;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.02;
}

.landing-hero h1,
.board-hero h1 {
  max-width: 64rem;
  margin: 0;
  font-size: clamp(3.6rem, 9vw, 7.8rem);
}

.landing-hero h1 em {
  color: var(--green);
  font-weight: 500;
}

.hero-copy,
.board-copy {
  max-width: 42rem;
  margin: 2rem 0 0;
  color: var(--muted);
  font-size: clamp(1.08rem, 2vw, 1.28rem);
  line-height: 1.65;
}

.route-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  border-block: 1px solid var(--line-strong);
}

.route {
  min-height: 31rem;
  padding: clamp(2rem, 5vw, 4.5rem);
  display: flex;
  flex-direction: column;
}

.route + .route {
  border-left: 1px solid var(--line-strong);
}

.route-board {
  background: rgba(251, 250, 246, 0.74);
}

.route h2 {
  margin: 0 0 1.2rem;
  font-size: clamp(2.5rem, 5vw, 4.5rem);
}

.route > p:not(.route-kicker, .current-leader) {
  max-width: 34rem;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.live-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0.22rem var(--green-pale);
}

.route-facts,
.board-stats {
  margin: 2.4rem 0 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-block: 1px solid var(--line);
}

.route-facts div,
.board-stats div {
  padding: 1rem 0;
}

.route-facts div + div,
.board-stats div + div {
  padding-left: 1rem;
  border-left: 1px solid var(--line);
}

.route-facts dt,
.board-stats dt {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
}

.route-facts dd,
.board-stats dd {
  margin: 0.25rem 0 0;
  font-family: var(--serif);
  font-size: 2rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.current-leader {
  min-height: 1.7rem;
  margin: 1.2rem 0 0;
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.route-actions {
  margin-top: auto;
  padding-top: 2.4rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem 1.2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  padding: 0.7rem 1rem;
  border: 1px solid transparent;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button:active {
  transform: translateY(0);
}

.button-primary {
  background: var(--green);
  color: white;
}

.button-primary:hover {
  background: var(--green-dark);
}

.button-light {
  background: var(--paper-raised);
  color: var(--green-dark);
}

.button-light:hover {
  background: white;
}

.text-link {
  color: var(--green);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.28rem;
}

.text-link:hover {
  text-decoration-thickness: 2px;
}

.text-link.light {
  color: #dbece3;
}

.run-strip {
  width: calc(100% + 2.5rem);
  margin-left: -1.25rem;
  padding: clamp(3rem, 7vw, 5.5rem) max(1.25rem, calc((100vw - var(--max)) / 2));
  background: var(--green-dark);
  color: white;
  display: grid;
  grid-template-columns: minmax(14rem, 0.85fr) minmax(18rem, 1.15fr);
  gap: 2rem 5rem;
  align-items: start;
}

.run-strip .eyebrow {
  color: #a9cfba;
}

.run-strip h2,
.ecosystem h2,
.method h2 {
  margin: 0;
  font-size: clamp(2.35rem, 5vw, 4.2rem);
}

.run-strip p:not(.eyebrow) {
  max-width: 29rem;
  color: #b9cec3;
}

.run-strip pre {
  margin: 0;
  padding: 1.4rem;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(4, 18, 13, 0.35);
  color: #edf6f1;
  font: 0.82rem/1.8 var(--mono);
}

.run-links {
  grid-column: 2;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.ecosystem,
.method {
  padding: clamp(4rem, 9vw, 7rem) 0;
}

.repo-list {
  margin-top: 3rem;
  border-top: 1px solid var(--line-strong);
}

.repo-list a {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(10rem, 0.7fr) minmax(15rem, 1.3fr);
  gap: 1.5rem;
  text-decoration: none;
  transition: padding 180ms ease, color 180ms ease;
}

.repo-list a:hover {
  padding-left: 0.65rem;
  color: var(--green);
}

.repo-list span {
  color: var(--muted);
}

.site-footer {
  padding: 1.6rem 0 2.5rem;
  border-top: 1px solid var(--line-strong);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.site-footer a {
  text-underline-offset: 0.2rem;
}

/* Leaderboard */
.board-hero {
  padding: clamp(4.5rem, 10vw, 8rem) 0 3rem;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(17rem, 0.8fr);
  gap: 3rem;
  align-items: end;
}

.board-hero h1 {
  font-size: clamp(4.5rem, 11vw, 9rem);
}

.board-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem 1.2rem;
}

.scope-notice {
  margin: 0 0 2.5rem;
  padding: 1.2rem 1.4rem;
  border-left: 0.28rem solid var(--amber);
  background: #efe4d5;
  color: #5b3517;
}

.scope-notice strong {
  display: block;
  margin-bottom: 0.2rem;
}

.board-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 2.5rem;
}

.filters {
  padding: 1.4rem;
  border: 1px solid var(--line-strong);
  background: rgba(251, 250, 246, 0.76);
  display: grid;
  grid-template-columns: repeat(5, minmax(8rem, 1fr));
  gap: 1rem;
}

.field label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.field select,
.field input {
  width: 100%;
  min-height: 2.65rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--paper-raised);
  color: var(--ink);
  font: 0.88rem var(--sans);
}

.board-status {
  min-height: 1.5rem;
  margin: 1rem 0 2rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.loading-block {
  height: 18rem;
  border: 1px solid var(--line);
  background: linear-gradient(100deg, #e7e5de 30%, #f5f3ed 50%, #e7e5de 70%);
  background-size: 200% 100%;
  animation: loading 1.2s linear infinite;
}

@keyframes loading {
  to { background-position-x: -200%; }
}

.cohort {
  margin: 0 0 3.5rem;
  border-top: 0.22rem solid var(--green);
  background: rgba(251, 250, 246, 0.72);
}

.cohort-head {
  padding: 1.4rem;
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  border-inline: 1px solid var(--line);
}

.cohort-head h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  line-height: 1.12;
}

.cohort-meta,
.cohort-digest {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.cohort-digest {
  flex: 0 0 auto;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
}

.leaderboard-table {
  width: 100%;
  min-width: 76rem;
  border-collapse: collapse;
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 0.82rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: top;
  white-space: nowrap;
}

.leaderboard-table th {
  position: sticky;
  top: 0;
  background: #e8e7e0;
  color: #4e5952;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.leaderboard-table th:first-child,
.leaderboard-table td:first-child,
.leaderboard-table th:nth-child(2),
.leaderboard-table td:nth-child(2) {
  text-align: left;
}

.leaderboard-table tbody tr:hover {
  background: var(--green-pale);
}

.leaderboard-table tbody tr:last-child td {
  border-bottom: 0;
}

.rank-cell {
  width: 4rem;
  color: var(--green);
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 600;
}

.model-cell {
  color: var(--ink);
  font-weight: 600;
}

.setup-cell {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.status-chip {
  display: inline-block;
  padding: 0.18rem 0.42rem;
  border: 1px solid currentColor;
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.65rem;
}

.status-chip.candidate,
.status-chip.smoke-partial {
  color: var(--amber);
}

.status-chip.smoke-unverified {
  color: var(--red);
}

.empty-state,
.error-state {
  padding: 4rem 1.5rem;
  border: 1px solid var(--line-strong);
  text-align: center;
  background: var(--paper-raised);
}

.error-state {
  border-left: 0.3rem solid var(--red);
}

.method-grid {
  margin-top: 2.5rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.method-grid article {
  padding-top: 1rem;
  border-top: 1px solid var(--line-strong);
}

.method-grid h3 {
  margin: 0 0 0.7rem;
  font-size: 1.5rem;
}

.method-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 900px) {
  .route-grid,
  .board-hero,
  .run-strip {
    grid-template-columns: 1fr;
  }

  .route + .route {
    border-left: 0;
    border-top: 1px solid var(--line-strong);
  }

  .run-links {
    grid-column: auto;
  }

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

  .method-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.7rem;
  }

  .site-header nav {
    gap: 0.25rem 1rem;
  }

  .landing-hero h1,
  .board-hero h1 {
    font-size: clamp(3.2rem, 18vw, 5rem);
  }

  .board-hero h1 {
    font-size: clamp(3rem, 15vw, 4.25rem);
  }

  .route {
    min-height: 0;
    padding: 2.2rem 1rem 2.8rem;
  }

  .route-facts,
  .board-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .board-stats div:nth-child(3) {
    border-left: 0;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .cohort-head,
  .site-footer {
    flex-direction: column;
  }

  .repo-list a {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
