/* The ranked lists of the Édito design (pages/list.templ): a topic's ranking,
   /trending and /emerging. A head in Newsreader, the ranking's periods and
   filters, one row per repo (rank, project, trend, gains, score, total) and,
   beside them, how Upstar ranks, the Monday digest and related topics. Under
   720px the rows narrow to rank, project and gains over the trend, and the
   card on ranking folds above them. Upstar's tokens only. */

main:focus { outline: none; }
.l-main a:focus-visible, .l-main button:focus-visible, .l-main select:focus-visible, .l-main input:focus-visible,
.l-main summary:focus-visible { outline: 2px solid var(--rise); outline-offset: 2px; }

/* Head */
.l-head { display: flex; flex-direction: column; gap: 8px; max-width: 720px; padding: 12px 0 28px; }
.l-kicker { margin: 0; font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.l-title {
  margin: 0; font-family: var(--font-display); font-weight: var(--display-weight); line-height: 1.08;
  font-size: calc(clamp(32px, 4.6vw, 52px) * var(--display-scale)); letter-spacing: var(--display-tracking);
  text-wrap: balance; overflow-wrap: anywhere;
}
.l-lead { margin: 4px 0 0; font-size: 17px; line-height: 1.5; }
.l-summary { margin: 4px 0 0; font-size: 14px; line-height: 1.6; color: var(--muted); }
.l-summary a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.l-summary a:hover { text-decoration-color: currentColor; }
.l-updated { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.l-head .freshness { margin: 0; font-size: 13px; }
.l-head .freshness:not(.freshness--stale) { display: none; }
.l-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.l-act { height: auto; min-height: 36px; padding: 0 14px; }
.l-act--ghost { padding: 0 12px; color: var(--text); }
.l-act--ghost:hover { color: var(--text); background: var(--hover); }
.l-act.is-subscribed .btn-icon-slot { color: var(--rise); }
.l-act .btn-icon-slot:empty { display: none; }

/* Columns */
.l-cols { display: flex; flex-wrap: wrap; gap: 32px 40px; align-items: flex-start; padding-bottom: 72px; }
.l-rank { flex: 1 1 640px; min-width: 0; }
.l-side { flex: 1 1 280px; max-width: 400px; display: flex; flex-direction: column; gap: 16px; }

/* The ranking's title and its periods */
.l-rankhead { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.l-ranktitle {
  margin: 0; color: var(--text); font-family: var(--font-display); font-weight: var(--display-weight); line-height: 1.2;
  font-size: calc(20px * var(--display-scale-sm)); letter-spacing: var(--display-tracking-sm);
}
.l-tabs { max-width: 100%; overflow-x: auto; padding: 3px; margin: -3px; }

/* Emerging: what orders the list and what the score is */
.l-scorenote { margin: 0 0 8px; font-size: 12px; color: var(--muted); }

/* An owner's later repos, folded under their first one */
.l-fold { padding: 2px 8px 8px 60px; background: linear-gradient(to right, transparent, var(--border) 48px, var(--border) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px; }
.l-fold__sum { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; font-size: 13px; color: var(--muted); cursor: pointer; list-style: none; }
.l-fold__sum::-webkit-details-marker { display: none; }
.l-fold__sum::before { content: ""; width: 6px; height: 6px; margin: 0 3px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); }
.l-fold__box[open] > .l-fold__sum::before { transform: rotate(45deg); }
.l-fold__sum:hover { color: var(--text); }
.l-fold__list { margin-left: -60px; }

/* Filters */
.l-filterbar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 12px; }
.l-filters { display: flex; flex-wrap: wrap; gap: 8px 12px; flex: 1 1 auto; margin: 0; }
.l-filter { display: flex; flex-direction: column; gap: 4px; flex: 1 1 150px; max-width: 220px; }
.l-filter__label { font-size: 12px; color: var(--muted); }
.l-filter__select { min-height: 36px; font-size: 14px; color: var(--text); }
.l-filter__go { align-self: flex-end; }
.l-count { margin: 0 0 0 auto; font-size: 12px; color: var(--muted); }
.l-filtered { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.l-table + .l-filtered { margin: 12px 0 0; }
.l-filtered a, .l-links a { color: var(--text); text-underline-offset: 3px; }

/* Rows: the name links the repo page and the whole row with it */
.l-thead, .l-row {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) 92px 96px 64px 64px; gap: 16px; align-items: center;
  background: linear-gradient(to right, transparent, var(--border) 48px, var(--border) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
}
.l-thead {
  padding: 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  background-image: linear-gradient(to right, transparent, var(--border-strong) 48px, var(--border-strong) calc(100% - 48px), transparent);
}
.l-thead > span { white-space: nowrap; }
.l-r { text-align: right; }
.l-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.l-row { position: relative; padding: 14px 8px; grid-template-areas: "rank proj spark gained score total"; }
@media (hover: hover) { .l-row:hover { background-color: var(--hover); } }
.l-rank { grid-area: rank; font-size: 15px; color: var(--muted); }
.l-row--top .l-rank { color: var(--text); }
.l-proj { grid-area: proj; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.l-name { font-size: 15px; font-weight: 500; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.l-name:hover { color: var(--text); }
.l-name::after { content: ""; position: absolute; inset: 0; border-radius: 6px; }
.l-main .l-name:focus-visible { outline: none; }
.l-name:focus-visible::after { outline: 2px solid var(--rise); outline-offset: -2px; }
.l-owner { color: var(--muted); font-weight: 400; }
.l-desc { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l-reason { font-size: 12px; color: var(--text); }
.l-note { font-size: 12px; color: var(--muted); }
.l-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12px; color: var(--muted); }
.l-lang:empty { display: none; }
.l-lang-total { display: none; }
.l-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 7px; border-radius: 999px;
  font-size: 11px; line-height: 1.5; color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); white-space: nowrap;
}
.l-badge__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warning); }
.l-badge--spot { color: var(--spot); }
.l-spark { grid-area: spark; display: flex; color: var(--rise); line-height: 0; }
.l-spark .sparkline__area { display: none; }
.l-gained { grid-area: gained; text-align: right; font-size: 15px; font-weight: 500; color: var(--rise-text); }
.l-score { grid-area: score; text-align: right; font-size: 13px; }
.l-total { grid-area: total; text-align: right; font-size: 13px; color: var(--muted); }
.l-more { display: flex; margin-top: 20px; }
.l-more .btn { height: auto; min-height: 44px; padding: 0 16px; }
.l-links { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 24px 0 0; font-size: 13px; color: var(--muted); }
.l-links__weeks { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; }

/* Cards beside the rows */
.l-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; box-sizing: border-box; border-radius: 8px; background: var(--surface); box-shadow: 0 0 0 1px var(--border); }
.l-card__kicker { margin: 0; font-family: var(--font-sans); font-size: 10px; font-weight: 400; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.l-how__body { margin: 0; font-size: 14px; }
.l-how__ex { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px 14px; align-items: baseline; font-size: 13px; }
.l-how__col { font-size: 11px; color: var(--muted); text-align: right; }
.l-how__repo { display: flex; flex-direction: column; }
.l-how__stars { font-size: 12px; color: var(--muted); }
.l-how__gained { color: var(--rise-text); text-align: right; }
.l-how__score { text-align: right; }
.l-how__score--lead { font-weight: 600; }
.l-how__formula {
  margin: 0; padding: 8px 10px; font-family: var(--font-mono); font-size: 12px; line-height: 1.5;
  border-radius: 6px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--border);
}
.l-how__min { margin: 0; font-size: 12px; color: var(--muted); }
.l-how__more { align-self: flex-start; font-size: 13px; color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.l-crit { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.l-crit li { display: flex; gap: 10px; align-items: baseline; font-size: 14px; }
.l-crit__n { font-size: 12px; color: var(--muted); }

/* On a phone, a link above the rows to "How Upstar ranks", which follows them */
.l-howlink { display: none; margin: 4px 0 12px; font-size: 14px; }
.l-howlink a { display: inline-flex; align-items: center; min-height: 44px; color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* The Monday digest */
.l-digest { gap: 10px; }
.l-digest__head { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.l-digest__head svg { flex: none; }
.l-digest__title { margin: 0; font-family: var(--font-sans); font-size: 16px; font-weight: 600; line-height: 1.35; color: var(--text); }
.l-digest__sub { margin: 0; font-size: 13px; color: var(--muted); }
.l-digest__form { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.l-digest__email { min-height: 44px; }
.l-digest__go { height: auto; min-height: 44px; }
.l-digest__go:not(.l-digest__go--quiet):hover { color: var(--on-rise); background: var(--rise-fill-strong); }
.l-digest__go--quiet:hover { color: var(--text); background: var(--hover); }
.l-digest__done { display: flex; gap: 8px; align-items: flex-start; margin: 0; font-size: 14px; }
.l-digest__done svg { flex: none; margin-top: 2px; color: var(--rise); }
.l-digest__sample { align-self: flex-start; padding: 4px 0; font-size: 13px; color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.l-digest__add { height: auto; min-height: 44px; width: 100%; }
.l-digest__add.is-subscribed .btn-icon-slot { color: var(--rise); }

/* Related topics */
.l-related { gap: 2px; }
.l-related__title { margin: 0 0 4px; font-family: var(--font-sans); font-size: 16px; font-weight: 600; }
.l-related__list { list-style: none; margin: 0; padding: 0; }
.l-related__link {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; font-size: 14px; color: var(--text); text-decoration: none;
  background: linear-gradient(to right, var(--border), var(--border) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
}
.l-related__link:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.l-related__slug { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

@media (max-width: 719.98px) {
  .l-act, .l-filter__select { min-height: 44px; }
  .l-tabs .e-seg__opt { min-height: 44px; }
  .l-scorenote { display: none; }
  .l-fold { padding-left: 36px; }
  .l-fold__list { margin-left: -36px; }
  .l-howlink { display: block; }
  .l-filter { max-width: none; }
  .l-count { margin-left: 0; flex-basis: 100%; }
  .l-thead { display: none; }
  .l-row {
    grid-template-columns: 26px minmax(0, 1fr) auto; grid-template-areas: "rank proj gained" "rank proj spark";
    gap: 4px 10px; align-items: start; padding: 14px 0;
  }
  .l-rank { padding-top: 1px; }
  .l-proj { grid-row: 1 / span 2; gap: 4px; }
  .l-desc { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .l-meta { gap: 6px 8px; }
  .l-lang { display: none; }
  .l-lang-total { display: inline; }
  .l-score, .l-total { display: none; }
  .l-gained { font-size: 16px; }
  .l-spark { justify-content: flex-end; }
  .l-spark svg { width: 56px; height: auto; }
  .l-side { max-width: none; }
}

/* Not found (pages.TopicNotFound) */
.page { padding-top: var(--sp-6); }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: var(--fs-13); color: var(--muted); }
.crumbs li { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.crumbs li + li::before { content: "/"; color: var(--faint); margin-right: 2px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs [aria-current="page"] { color: var(--text); font-family: var(--font-mono); }
.notfound { padding: var(--sp-16) 0; }
.notfound h1.empty-state__title { font-size: var(--fs-24); }
#l-how-title { scroll-margin-top: 80px; }
