/* Collections in the Édito design: the index (pages.CollectionsIndexView) and
   a collection page (pages.CollectionPageView, with list.css for its rows,
   cards and badges). Titles in Newsreader, figures in mono under a short rule,
   collection cards with their top three, the comparison table. */

.c-main { display: block; padding-bottom: 72px; }
.c-main:focus { outline: none; }
.c-main a:focus-visible, .c-main button:focus-visible { outline: 2px solid var(--rise); outline-offset: 2px; }

/* Head */
.c-head { display: flex; flex-direction: column; gap: 10px; max-width: 720px; padding: 12px 0 28px; }
.c-kicker { margin: 0; font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.c-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;
}
.c-lead { margin: 0; font-size: 17px; line-height: 1.5; }
.c-body { margin: 0; font-size: 14px; line-height: 1.6; color: var(--muted); }
.c-updated { margin: 0; font-size: 13px; color: var(--muted); }
.c-head .freshness { margin: 0; font-size: 13px; }
.c-head .freshness:not(.freshness--stale) { display: none; }
.cp-intro { display: flex; flex-direction: column; gap: 10px; }
.c-readmore { align-self: flex-start; padding: 4px 0; border: 0; background: none; font: inherit; font-size: 13px; color: var(--text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
@media (min-width: 768px) { .c-readmore { display: none; } }
@media (max-width: 767.98px) { .cp-intro:not(.is-open) .cp-intro__more { display: none; } }

/* Figures */
.c-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 24px; max-width: 720px; margin: 0; padding-bottom: 40px; }
.c-stat { display: flex; flex-direction: column; gap: 6px; }
.c-stat::before { content: ""; order: -2; width: 20px; height: 1px; background: var(--border-strong); }
.c-stat__value { order: -1; margin: 0; font-size: clamp(24px, 2.5vw, 30px); font-weight: 500; line-height: 1.1; }
.c-stat__value--rise { color: var(--rise-text); }
.c-stat__label { font-size: 13px; color: var(--muted); }

/* Sections */
.c-h2 {
  margin: 0; 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);
}
.c-how { padding-bottom: 40px; }
.c-how .c-h2 { margin-bottom: 12px; }
.c-how__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 12px; }
.c-how__item { display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 8px; background: var(--surface); box-shadow: 0 0 0 1px var(--border); }
.c-how__kicker { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.c-how__weights { margin: 0; font-size: 15px; font-weight: 500; }
.c-how__body { margin: 0; font-size: 13px; color: var(--muted); }
.c-filter { margin-bottom: 28px; }
.c-groups { display: flex; flex-direction: column; gap: 44px; }
.c-group { display: flex; flex-direction: column; gap: 14px; }
.c-group__head { display: flex; flex-direction: column; gap: 2px; }
.c-group__sub { font-size: 13px; color: var(--muted); }
.c-sec { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.c-sec__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.c-sec__count { font-size: 13px; color: var(--muted); }
.c-sec__sub { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.c-sec__link { font-size: 14px; color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.c-foot, .c-empty { margin: 8px 0 0; font-size: 13px; color: var(--muted); }

/* Collection cards: the name links the collection, and the whole card with it */
.c-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 12px; }
.c-card { position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 16px; box-sizing: border-box; border-radius: 8px; background: var(--surface); box-shadow: 0 0 0 1px var(--border); }
@media (hover: hover) { .c-card:hover { background: var(--hover); box-shadow: 0 0 0 1px var(--border-strong); } }
.c-card__kicker { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.c-card__name { margin: 0; font-family: var(--font-sans); font-size: 17px; font-weight: 600; line-height: 1.3; }
.c-card__name a { color: var(--text); text-decoration: none; }
.c-card__name a::after { content: ""; position: absolute; inset: 0; border-radius: 8px; }
.c-main .c-card__name a:focus-visible { outline: none; }
.c-card__name a:focus-visible::after { outline: 2px solid var(--rise); outline-offset: -2px; }
.c-card__desc { margin: 0; font-size: 13px; color: var(--muted); }
.c-card__meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; font-size: 12px; color: var(--muted); }
.c-card__top { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; }
.c-card__top li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 7px 0; box-shadow: inset 0 -1px 0 var(--border); font-size: 13px; }
.c-card__rank { font-size: 12px; color: var(--muted); }
.c-card__repo { display: flex; align-items: center; gap: 8px; min-width: 0; }
.c-card__repo-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-card__owner { color: var(--muted); }
.c-card__gain { font-size: 12px; white-space: nowrap; color: var(--muted); }
.c-card__up { font-weight: 500; color: var(--rise-text); }
.c-card__more { align-self: flex-start; margin-top: 4px; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }

/* A collection page */
.cp-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; align-items: start; }
.cp-main, .cp-content { min-width: 0; display: flex; flex-direction: column; gap: 40px; }
.cp-main > .c-head, .cp-main > .c-stats { padding-bottom: 0; }
.cp-rail { display: grid; gap: 16px; align-content: start; min-width: 0; }
/* Below the header and its rail, the comparison, ranking and newcomers take the whole width. */
.cp-wide { display: flex; flex-direction: column; gap: 40px; margin-top: 40px; min-width: 0; }
.c-name { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 6px; min-width: 0; }
.c-name > .avatar { align-self: center; margin-right: 2px; }
.c-name .coll-row__gh { position: relative; z-index: 1; color: var(--muted); line-height: 0; }
.c-name .coll-row__gh:hover { color: var(--text); }
.c-also { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.c-also a { position: relative; z-index: 1; color: var(--text); text-underline-offset: 3px; }
.cp-method { gap: 8px; }
.cp-method__line { margin: 0; font-size: 14px; color: var(--muted); max-width: 72ch; }
.cp-method__w { color: var(--text); font-weight: 600; white-space: nowrap; }
.cp-method__sep { color: var(--faint); margin: 0 2px; }
.cp-method__updated { display: flex; align-items: center; gap: 8px; }
.cp-method__more { align-self: flex-start; font-size: 13px; color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.cp-glance__hint { margin: 0; font-size: 13px; color: var(--muted); }
.cp-weights__label { margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.cp-weights__bar { display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden; }
.cp-weights__seg { display: block; flex-grow: 0; flex-shrink: 1; min-width: 0; }
.cp-weights__seg--health, .cp-swatch--health { background: var(--border-strong); }
.cp-weights__seg--momentum, .cp-swatch--momentum { background: var(--rise-soft); box-shadow: inset 0 0 0 1px var(--rise-line); }
.cp-weights__legend { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.cp-weights__legend li { display: inline-flex; align-items: center; gap: 6px; }
.cp-weights__legend .f-num { color: var(--text); font-weight: 600; }
.cp-swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.cp-glance__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding-top: 12px; box-shadow: inset 0 1px 0 var(--border); }
.cp-glance__stats dt { font-size: 12px; color: var(--muted); }
.cp-glance__stats dd { margin: 0; font-size: 16px; font-weight: 600; }

/* The comparison table: on a phone each row reads as a card */
.cp-cmp-wrap { overflow-x: auto; border-radius: 8px; box-shadow: 0 0 0 1px var(--border); }
.cp-cmp { width: 100%; border-collapse: collapse; font-size: 14px; }
.cp-cmp th, .cp-cmp td { text-align: left; vertical-align: top; padding: 12px; border-bottom: 1px solid var(--border); }
.cp-cmp thead th { font-size: 11px; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--surface); white-space: nowrap; }
.cp-cmp tbody tr:last-child > * { border-bottom: 0; }
.cp-cmp__name { min-width: 9rem; font-weight: 400; }
.cp-cmp__name a { font-weight: 600; color: var(--text); }
.cp-cmp__repo { display: block; font-family: var(--font-mono); font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.cp-cmp__stars { white-space: nowrap; }
.cp-cmp__stars .num { font-family: var(--font-num); }
.cp-cmp__stars .is-rise { display: block; font-size: 12px; color: var(--rise-text); }
.cp-cmp__limits { margin: 0; padding-left: 1em; display: grid; gap: 4px; }
.cp-cmp__src { font-size: 12px; color: var(--muted); }
.cp-cmp__foot { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.cp-cmp .muted { color: var(--muted); }

@media (max-width: 1023.98px) {
  .cp-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767.98px) {
  .cp-cmp-wrap { box-shadow: none; overflow: visible; }
  .cp-cmp thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .cp-cmp, .cp-cmp tbody, .cp-cmp tr, .cp-cmp th, .cp-cmp td { display: block; }
  .cp-cmp tbody { display: grid; gap: 12px; }
  .cp-cmp tr { padding: 12px; border-radius: 8px; box-shadow: 0 0 0 1px var(--border); }
  .cp-cmp th, .cp-cmp td, .cp-cmp tbody tr:last-child > * { border: 0; padding: 0; }
  .cp-cmp td { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 8px; margin-top: 8px; font-size: 13px; }
  .cp-cmp td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; }
  .cp-cmp__stars .is-rise { display: inline; }
}
@media (max-width: 719.98px) {
  .c-filter .e-seg__opt { min-height: 44px; }
}
