/* RepoRanking, design v2: a quiet ranked list. One column, one typeface,
   a monogram tile per repo tinted by language, and a star count on the right. */

@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/fonts/hanken-grotesk-vf-latin.woff2") format("woff2");
}

:root {
  --bg: #ffffff;
  --surface: #f6f6f7;
  --ink: #18181b;
  --ink-2: #3f3f46;
  --muted: #6b6b73;
  --faint: #8e8e96;
  --line: #e9e9ec;
  --accent: #ff5a2a;
  --accent-ink: #c2410c;
  --on-accent: #ffffff;
  --thumb-l: 94%;
  --thumb-s: 70%;
  --thumb-ink-l: 32%;
  --font: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --w: 880px;
  --pad: clamp(16px, 4vw, 32px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111113;
    --surface: #1b1b1e;
    --ink: #ededef;
    --ink-2: #c9c9cf;
    --muted: #a0a0a9;
    --faint: #7c7c85;
    --line: #26262b;
    --accent: #ff7a4d;
    --accent-ink: #ff9a75;
    --on-accent: #1a0b05;
    --thumb-l: 21%;
    --thumb-s: 35%;
    --thumb-ink-l: 80%;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111113;
  --surface: #1b1b1e;
  --ink: #ededef;
  --ink-2: #c9c9cf;
  --muted: #a0a0a9;
  --faint: #7c7c85;
  --line: #26262b;
  --accent: #ff7a4d;
  --accent-ink: #ff9a75;
  --on-accent: #1a0b05;
  --thumb-l: 21%;
  --thumb-s: 35%;
  --thumb-ink-l: 80%;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, ol, ul, figure { margin: 0; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: var(--pad); top: -60px; z-index: 30;
  padding: 8px 14px; background: var(--ink); color: var(--bg); border-radius: 8px; font-weight: 600;
}
.skip:focus { top: 12px; }

.wrap { max-width: var(--w); margin: 0 auto; padding: 0 var(--pad); }

/* ---------- header ---------- */

.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.top__in {
  max-width: var(--w); margin: 0 auto; padding: 0 var(--pad);
  height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; font-size: 17px; letter-spacing: -0.01em; }
.logo__mark {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 15px; letter-spacing: 0;
}
.top__end { display: flex; align-items: center; gap: 14px; }
.top__edition { color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; }

.theme {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--muted); cursor: pointer;
}
.theme:hover { color: var(--ink); background: var(--surface); }
.theme__moon { display: none; }
:root[data-theme="dark"] .theme__sun { display: none; }
:root[data-theme="dark"] .theme__moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme__sun { display: none; }
  :root:not([data-theme="light"]) .theme__moon { display: block; }
}

.tabs { max-width: var(--w); margin: 0 auto; padding: 0 var(--pad); }
.tabs__in {
  display: flex; gap: 4px; padding: 8px 0 10px;
  overflow-x: auto; scrollbar-width: none; margin: 0 -4px; padding-left: 4px; padding-right: 4px;
}
.tabs__in::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none; padding: 6px 12px; border-radius: 999px;
  color: var(--muted); font-size: 14.5px; font-weight: 550; white-space: nowrap;
}
.tabs a:hover { color: var(--ink); background: var(--surface); }
.tabs a[aria-current="page"] { color: var(--ink); background: var(--surface); font-weight: 650; box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- ranking pages ---------- */

.pagehead { padding: 36px 0 14px; }
.pagehead h1 { font-size: clamp(24px, 3.6vw, 30px); line-height: 1.2; font-weight: 750; letter-spacing: -0.02em; }
.pagehead p { margin-top: 8px; color: var(--muted); font-size: 15px; max-width: 64ch; }

.list { list-style: none; padding: 0; margin: 6px -14px 0; }
.row + .row .row__card::before {
  content: ""; position: absolute; top: 0; left: 14px; right: 14px; height: 1px; background: var(--line);
}
.row__card {
  position: relative;
  display: grid; grid-template-columns: 28px 48px minmax(0, 1fr) auto; align-items: start; column-gap: 16px;
  padding: 18px 14px; border-radius: 16px;
  transition: background-color 120ms ease;
}
.row__card:hover { background: var(--surface); }
.row__card--plain { grid-template-columns: 48px minmax(0, 1fr) auto; }
.row__note { color: var(--accent-ink); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.row__card:hover::before, .row:hover + .row .row__card::before { opacity: 0; }

.row__rank {
  line-height: 48px; text-align: right;
  color: var(--faint); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.thumb {
  position: relative; overflow: hidden;
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px;
  background: hsl(var(--h, 0) var(--thumb-s) var(--thumb-l));
  color: hsl(var(--h, 0) 55% var(--thumb-ink-l));
  font-weight: 750; font-size: 20px; line-height: 1;
}
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--surface); }
.thumb::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 8%, transparent);
}
.thumb[data-plain] { background: var(--surface); color: var(--muted); }

.row__body { min-width: 0; padding-top: 1px; }
.row__title { font-size: 16.5px; line-height: 1.35; font-weight: 650; letter-spacing: -0.005em; overflow-wrap: anywhere; }
.row__link::after { content: ""; position: absolute; inset: 0; border-radius: 16px; }
.row__link:focus-visible { outline: none; }
.row__link:focus-visible::after { outline: 2px solid var(--accent); outline-offset: -2px; }
.row__owner { margin-left: 4px; color: var(--faint); font-size: 14px; font-weight: 450; }
.row__desc { margin-top: 3px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.row__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 10px; }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; color: var(--faint); font-size: 13px; }
.meta__lang {
  padding: 1px 8px; border-radius: 6px; border: 1px solid var(--line);
  color: var(--muted); font-weight: 550;
}
.row__gh {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 3px;
  color: var(--faint); font-size: 13px; font-weight: 600;
}
.row__gh:hover { color: var(--ink); }

.stars {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 60px; padding: 8px 8px 7px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
  font-size: 13px; line-height: 1.1; font-variant-numeric: tabular-nums;
}
.stars svg { color: var(--accent); }
.stars strong { font-weight: 700; color: var(--ink); }
.row__card:hover .stars { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }

/* ---------- repo pages ---------- */

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 24px; color: var(--faint); font-size: 13.5px; }
.crumbs a:hover { color: var(--ink); }
.crumbs [aria-current] { color: var(--muted); }

.rhead { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 18px; padding-top: 22px; }
.thumb--lg { width: 64px; height: 64px; border-radius: 16px; font-size: 28px; }
.rhead__title { min-width: 0; flex: 1 1 260px; }
.rhead__name { font-size: clamp(26px, 4vw, 34px); line-height: 1.15; font-weight: 750; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.rhead__owner { margin-top: 2px; color: var(--muted); font-size: 15px; }
.rhead__side { display: flex; align-items: center; gap: 12px; }
.stars--lg { flex-direction: row; gap: 6px; min-width: 0; padding: 10px 14px; font-size: 15px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 11px 16px; border-radius: 12px; background: var(--ink); color: var(--bg);
  font-size: 14.5px; font-weight: 650; white-space: nowrap;
}
.btn:hover { background: var(--ink-2); }
.btn svg, .row__gh svg { flex: none; }
.rhead__summary { margin-top: 20px; max-width: 64ch; font-size: 18px; line-height: 1.55; color: var(--ink-2); }
.rhead__summary + .meta { margin-top: 12px; }

.rbody { display: grid; gap: 40px; margin-top: 36px; padding-top: 32px; border-top: 1px solid var(--line); }
@media (min-width: 820px) { .rbody { grid-template-columns: minmax(0, 1fr) 260px; gap: 56px; } }
.prose h2, .related h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.prose p { margin-top: 14px; font-size: 16.5px; line-height: 1.7; color: var(--ink-2); max-width: 66ch; }
.topics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 22px !important; }
.topics span { padding: 3px 10px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13px !important; }

.facts h2 { font-size: 12.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--faint); }
.facts h2 + * { margin-top: 12px; }
.facts h2:not(:first-child) { margin-top: 30px; }
.facts__ranks { list-style: none; padding: 0; }
.facts__ranks li + li { margin-top: 4px; }
.facts__ranks a { display: flex; gap: 10px; align-items: baseline; padding: 4px 0; font-size: 15px; color: var(--ink-2); }
.facts__ranks a:hover { color: var(--ink); }
.facts__ranks strong { min-width: 3em; font-weight: 750; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.facts__note { margin-top: 10px; color: var(--muted); font-size: 14.5px; line-height: 1.55; }
.facts__note strong { color: var(--ink); }

.chart { margin: 12px 0 0; }
.chart svg { display: block; width: 100%; height: auto; }
.chart__area { fill: var(--accent); opacity: 0.1; }
.chart__line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart figcaption { display: flex; justify-content: space-between; margin-top: 6px; color: var(--faint); font-size: 12.5px; font-variant-numeric: tabular-nums; }

.related { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--line); }
.related h2 { margin-bottom: 6px; }

/* ---------- content pages ---------- */

.doc { max-width: 680px; padding: 40px 0 8px; }
.doc h1 { font-size: clamp(28px, 4vw, 36px); line-height: 1.15; font-weight: 750; letter-spacing: -0.02em; }
.doc h2 { margin-top: 36px; font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.doc p, .doc li { font-size: 16.5px; line-height: 1.7; color: var(--ink-2); }
.doc p { margin-top: 12px; }
.doc ul { margin-top: 12px; padding-left: 20px; }
.doc li + li { margin-top: 6px; }
.doc a { color: var(--ink); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent); text-underline-offset: 3px; }
.doc a:hover { text-decoration-color: var(--accent); }
.doc .doc__lede { margin-top: 16px; font-size: 19px; line-height: 1.55; color: var(--ink); }
.doc__updated { color: var(--faint); font-size: 13.5px !important; }
.doc__kicker { color: var(--accent-ink) !important; font-weight: 700; font-size: 14px !important; letter-spacing: 0.06em; }
.doc code { padding: 1px 6px; border-radius: 6px; background: var(--surface); font-size: 0.9em; }

/* ---------- footer ---------- */

.foot { margin-top: 72px; border-top: 1px solid var(--line); }
.foot__in {
  max-width: var(--w); margin: 0 auto; padding: 40px var(--pad) 48px;
  display: grid; gap: 32px 24px; grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 760px) { .foot__in { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.foot__intro { grid-column: 1 / -1; }
@media (min-width: 760px) { .foot__intro { grid-column: auto; } }
.foot__brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; font-size: 16px; }
.foot__brand .logo__mark { width: 24px; height: 24px; font-size: 13px; border-radius: 7px; }
.foot__intro p:not(.foot__brand) { margin-top: 10px; color: var(--muted); font-size: 14px; line-height: 1.6; max-width: 40ch; }
.foot__head { font-size: 13px; font-weight: 700; }
.foot__col ul { list-style: none; padding: 0; margin-top: 10px; }
.foot__col li + li { margin-top: 6px; }
.foot__col a { color: var(--muted); font-size: 14px; }
.foot__col a:hover { color: var(--ink); }
.foot__legal { grid-column: 1 / -1; padding-top: 20px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12.5px; }

/* ---------- small screens ---------- */

@media (max-width: 600px) {
  .top__edition { display: none; }
  .list { margin-left: -10px; margin-right: -10px; }
  .row + .row .row__card::before { left: 10px; right: 10px; }
  .row__card { grid-template-columns: 40px minmax(0, 1fr) auto; column-gap: 12px; padding: 16px 10px; }
  .row__rank {
    grid-column: 1; grid-row: 1; z-index: 1; pointer-events: none;
    line-height: 1; margin: -6px 0 0 -6px; align-self: start; justify-self: start;
    min-width: 20px; padding: 3px 5px; border-radius: 999px; background: var(--bg);
    box-shadow: 0 0 0 1px var(--line); font-size: 11px; text-align: center;
  }
  .row__card--plain { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .thumb { grid-column: 1; grid-row: 1; width: 40px; height: 40px; border-radius: 10px; font-size: 17px; }
  .row__title { font-size: 16px; }
  .row__owner { display: block; margin: 1px 0 0; }
  .row__desc { font-size: 14.5px; }
  .stars { min-width: 52px; padding: 7px 6px 6px; font-size: 12px; }
  .rhead__side { width: 100%; }
  .btn { flex: 1; min-width: 0; justify-content: center; white-space: normal; text-align: center; }
}
