:root {
  color-scheme: light;
  --text: #18202a;
  --muted: #66707d;
  --border: #dce1e7;
  --border-strong: #c9d1da;
  --surface: #fff;
  --surface-subtle: #f4f6f8;
  --surface-hover: #f7f9fb;
  --link: #0759b8;
  --link-hover: #064b98;
  --focus-ring: rgb(9 105 218 / 16%);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background: #fafbfc;
  font-family: SBB, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  transition: color 120ms ease;
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1;
  padding: 7px 11px;
  border-radius: 6px;
  color: #fff;
  background: var(--text);
  transform: translateY(-150%);
}

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

.site-header,
.ranking {
  width: min(860px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  padding: 28px 0 36px;
  border-bottom: 1px solid var(--border);
}

h1,
h2 {
  margin: 0;
  line-height: 1.25;
}

h1 {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.035em;
}

h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.description {
  max-width: 640px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.summary strong {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.project-notes {
  max-width: 700px;
  margin: 22px 0 0;
  padding-left: 14px;
  border-left: 2px solid var(--border-strong);
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.6;
}

.project-notes p {
  margin: 4px 0 0;
}

.project-notes p:first-child {
  margin-top: 0;
}

.project-notes a {
  text-underline-offset: 3px;
}

.ranking {
  padding: 36px 0 64px;
}

.ranking:focus {
  outline: none;
}

.ranking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.search {
  display: flex;
  width: 260px;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(31 35 40 / 3%);
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.search:hover {
  border-color: #aeb7c2;
}

.search:focus-within {
  border-color: var(--link);
  outline: 3px solid var(--focus-ring);
  box-shadow: none;
}

.search svg {
  width: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.search input {
  width: 100%;
  padding: 8px 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font: inherit;
  font-size: 0.875rem;
}

.search input::placeholder {
  color: var(--muted);
}

.search input:disabled {
  cursor: wait;
}

.result-status {
  margin: 22px 2px 10px;
  color: var(--muted);
  font-size: 0.8125rem;
}

.table-shell {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow:
    0 1px 2px rgb(31 35 40 / 3%),
    0 8px 24px rgb(31 35 40 / 3%);
  overscroll-behavior-inline: contain;
}

table {
  width: 100%;
  border-spacing: 0;
  border-collapse: separate;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

th {
  color: var(--muted);
  background: var(--surface-subtle);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

tbody tr {
  background: var(--surface);
  transition: background-color 120ms ease;
}

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

tbody tr:focus-within {
  background: var(--surface-hover);
}

@media (hover: hover) {
  tbody tr:hover {
    background: var(--surface-hover);
  }
}

th:first-child,
td:first-child {
  width: 72px;
}

th:last-child,
td:last-child {
  text-align: right;
}

.rank-cell,
.contributions-cell {
  font-variant-numeric: tabular-nums;
}

.rank-cell {
  color: var(--muted);
}

.developer-cell a {
  font-weight: 700;
  text-decoration: none;
}

.developer-cell a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.loading,
.empty,
.error {
  padding-block: 40px;
  color: var(--muted);
  text-align: center !important;
}

.error {
  color: #cf222e;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 600px) {
  .site-header,
  .ranking {
    width: calc(100% - 24px);
  }

  .ranking-header {
    align-items: stretch;
    flex-direction: column;
  }

  .search {
    width: 100%;
  }

  th:first-child,
  td:first-child {
    width: 48px;
  }

  th,
  td {
    padding-inline: 10px;
  }
}

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