/* /t/{slug}/week/{monday}: a past week's ranking, frozen (pages.ArchiveView),
   on the ranked lists' layout (list.css): its text or first sentence, four
   facts, the top 10 with each move since the week before, ranks 11 to 30 in
   compact lines and the rest folded; beside them, the topic's newcomers, the
   repos that left the top 10 and the same week in neighbouring topics.
   /t/{slug}/week: one line per past week (pages.ArchiveIndexView). */

.w-text { max-width: 68ch; }
.w-main .l-updated { max-width: 68ch; }

/* The week's facts */
.w-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; max-width: 880px; margin: -8px 0 32px; padding: 0; }
.w-fact { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 2px; padding: 12px 16px 12px 0; border-top: 1px solid var(--border-strong); }
.w-fact + .w-fact { padding-left: 16px; border-left: 1px solid var(--border); }
.w-fact dt { font-size: 13px; color: var(--muted); }
.w-fact dd { margin: 0; font-size: 22px; font-weight: 500; color: var(--text); }
.w-fact__vs { display: block; font-size: 12px; }

/* The top 10 */
.w-list .l-row { grid-template-columns: 36px minmax(0, 1fr) 96px; grid-template-areas: "rank proj gained"; }
.w-list .l-desc { white-space: normal; }
.w-name--gone { color: var(--muted); }
.w-subtitle { margin: 32px 0 6px; }
.w-move { font-size: 12px; color: var(--muted); white-space: nowrap; }
.w-move--up { color: var(--rise-text); }
.w-move--in { color: var(--text); font-weight: 500; }
.w-removed { margin: 12px 0 0; }

/* Ranks 11 to 30 and the rest: one line each */
.archive-rows { list-style: none; margin: 0; padding: 0; }
.archive-row {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto 72px; align-items: center; gap: 12px; min-height: 44px; padding: 0 8px;
  background: linear-gradient(to right, transparent, var(--border) 48px, var(--border) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
}
.archive-row__rank { font-size: 14px; color: var(--muted); }
.archive-row__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--text); text-decoration: none; }
span.archive-row__name { color: var(--muted); }
a.archive-row__name:hover { text-decoration: underline; text-underline-offset: 3px; }
.archive-row__gain { text-align: right; font-size: 14px; color: var(--rise-text); }
.archive-more { margin-top: 20px; }
.archive-more > summary { list-style: none; width: fit-content; cursor: pointer; height: auto; min-height: 44px; }
.archive-more > summary::-webkit-details-marker { display: none; }
.archive-more[open] > summary { margin-bottom: 12px; }
.archive-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 20px; margin: 28px 0 0; font-size: 14px; }
.archive-nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--text); text-underline-offset: 3px; }

/* Beside the ranking */
.w-side { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.w-side__row {
  display: flex; flex-direction: column; gap: 2px; padding: 8px 0; font-size: 14px;
  background: linear-gradient(to right, var(--border), var(--border) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
}
.w-side__name { color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
a.w-side__name:hover { text-decoration: underline; text-underline-offset: 3px; }
.w-side__note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12px; color: var(--muted); }

/* The list of weeks */
.w-weeks { max-width: 880px; padding-bottom: 72px; }
.w-weeks__head, .w-weeks__row {
  display: grid; grid-template-columns: minmax(150px, 200px) minmax(0, 1fr) 110px 80px; gap: 16px; align-items: center; padding: 0 8px;
  background: linear-gradient(to right, transparent, var(--border) 48px, var(--border) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
}
.w-weeks__head { padding-top: 8px; padding-bottom: 8px; font-size: 13px; color: var(--muted); }
.w-weeks__list { list-style: none; margin: 0; padding: 0; }
.w-weeks__row { min-height: 52px; font-size: 14px; }
.w-weeks__week { display: inline-flex; align-items: center; min-height: 44px; color: var(--text); font-weight: 500; text-underline-offset: 3px; }
.w-weeks__lead { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.w-weeks__row--now .w-weeks__lead { grid-column: 2 / -1; white-space: normal; color: var(--muted); }
.w-weeks__n { text-align: right; color: var(--rise-text); }
.w-weeks__ranked { color: var(--muted); }

@media (max-width: 719.98px) {
  .w-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: -12px; }
  .w-fact:nth-child(odd) { padding-left: 0; border-left: 0; }
  .w-list .l-row { grid-template-columns: 26px minmax(0, 1fr) auto; grid-template-areas: "rank proj gained"; }
  .archive-row { grid-template-columns: 26px minmax(0, 1fr) auto; grid-template-areas: "rank name gain" "rank move gain"; gap: 0 10px; padding: 8px 0; }
  .archive-row__rank { grid-area: rank; }
  .archive-row__name { grid-area: name; }
  .archive-row__move { grid-area: move; }
  .archive-row__gain { grid-area: gain; }
  .w-weeks__head { display: none; }
  .w-weeks__row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "week top10" "lead lead"; gap: 0 12px; padding: 8px 0; }
  .w-weeks__week { grid-area: week; }
  .w-weeks__lead { grid-area: lead; font-size: 13px; color: var(--muted); }
  .w-weeks__row--now .w-weeks__lead { grid-column: auto; }
  .w-weeks__n { grid-area: top10; }
  .w-weeks__ranked { display: none; }
}
