/*
 * stats.html, written by tools/generate-stats-page.cjs. Built on css/app.css and
 * css/ui.css like the other pages: the groups, notes, chips, cards and data
 * tables come from there, and so do the colours, in light and dark.
 */

.stats-asof { margin: 10px 0 16px; color: var(--muted); font-size: 13px; }
.stats-asof time { font-variant-numeric: tabular-nums; }

/* ---------- stat tiles (the look of the profile's festival year) ---------- */
.stats-tiles {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr));
  gap: 8px; margin: 0 0 12px;
}
.stats-tiles p {
  min-width: 0; margin: 0; padding: 14px 12px 12px; border-radius: 14px;
  background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-strong);
}
.stats-tiles b {
  display: block; color: var(--accent);
  font-family: var(--display); font-weight: 800; font-size: clamp(32px, 7vw, 48px); line-height: 1;
  overflow-wrap: anywhere;
}
.stats-tiles span {
  display: block; margin-top: 6px; color: var(--muted);
  font-size: 11px; font-weight: 700; letter-spacing: .08em; line-height: 1.3; text-transform: uppercase;
}

/* ---------- column charts ---------- */
.stats-chart {
  margin: 0 0 14px; padding: 12px 14px 10px; border-radius: 14px;
  background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-strong);
}
.stats-chart figcaption { margin: 0 0 6px; }
/* The plot: gridlines behind, one grid column per bar, the y labels in the
   left gutter. --h is a bar's height, --at a gridline's, both in % of the plot. */
.stats-plot { position: relative; height: clamp(140px, 24vw, 200px); margin: 22px 0 0 36px; }
.stats-grid { position: absolute; inset: 0; }
.stats-gridline { position: absolute; left: 0; right: 0; bottom: var(--at); border-top: 1px solid var(--line-strong); }
.stats-gridline span {
  position: absolute; right: calc(100% + 6px); bottom: -7px;
  color: var(--muted); font-size: 11px; font-style: normal; line-height: 14px; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.stats-bars {
  position: absolute; inset: 0; margin: 0; padding: 0; list-style: none;
  display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px;
}
.stats-bars li { position: relative; display: flex; align-items: flex-end; justify-content: center; min-width: 0; }
.stats-bar { display: block; width: 100%; max-width: 24px; height: var(--h); border-radius: 4px 4px 0 0; background: var(--accent); }
.stats-bars li:hover .stats-bar { opacity: .78; }
.stats-value {
  position: absolute; left: 50%; bottom: calc(var(--h) + 4px); transform: translateX(-50%);
  color: var(--ink); font-size: 12px; font-weight: 700; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.stats-xaxis {
  display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px;
  margin: 6px 0 0 36px; color: var(--muted); font-size: 11px; line-height: 1.2; font-variant-numeric: tabular-nums;
}
/* A label is wider than its column: centred on it, overflowing both sides. */
.stats-xaxis span { display: flex; justify-content: center; min-width: 0; white-space: nowrap; }
.stats-table { margin-top: 8px; }
.stats-table summary { cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 600; }
.stats-table .table-wrap { margin: 8px 0 0; box-shadow: none; }
.stats-table .data-table td:last-child,
.stats-table .data-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
/* Forced colours drop backgrounds, so the bars keep theirs as plain text colour. */
@media (forced-colors: active) {
  .stats-bar { forced-color-adjust: none; background: CanvasText; }
  .stats-gridline { border-top-color: GrayText; }
}

/* ---------- two lists side by side ---------- */
.stats-cols { display: grid; gap: 0 24px; }
@media (min-width: 900px) {
  .stats-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}

/* ---------- ranked lists ---------- */
.stats-rank { margin: 0 0 14px; padding: 0; list-style: none; }
.stats-rank li {
  display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 2px 10px; align-items: baseline;
  padding: 11px 14px;
}
.stats-rank li + li { border-top: 1px solid var(--line-strong); }
.stats-rank-n { color: var(--muted); font-family: var(--display); font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.stats-rank a { min-width: 0; font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
.stats-rank small { grid-column: 2; color: var(--muted); font-size: 12px; }
.stats-rank small b { color: var(--ink); font-variant-numeric: tabular-nums; }
.stats-pair { min-width: 0; }
.stats-pair > span { color: var(--muted); }
@media (min-width: 560px) {
  .stats-rank li { grid-template-columns: 26px minmax(0, 1fr) auto; }
  .stats-rank small { grid-column: auto; white-space: nowrap; }
}

/* ---------- cards with one figure ---------- */
.stats-card-figure { margin-top: 4px !important; color: var(--muted); }
.stats-card-figure b { color: var(--ink); font-family: var(--display); font-weight: 800; font-size: 22px; font-variant-numeric: tabular-nums; }
.section .cards { margin-bottom: 14px; }

/* ---------- tables and lists ---------- */
.stats-biggest th:not(:first-child),
.stats-biggest td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.stats-recent li { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.stats-recent a { min-width: 0; font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.stats-recent time { flex: none; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ---------- community (js/stats-community.js) ---------- */
.stats-favourites { margin: 4px 0 0; padding: 0; list-style: none; }
.stats-favourites li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; align-items: baseline;
  padding: 8px 0; font-size: 13.5px;
}
.stats-favourites li + li { border-top: 1px solid var(--line-strong); }
.stats-favourites li > span:first-child { min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.stats-favourite-where { grid-column: 1; color: var(--muted); font-size: 12px; }
.stats-favourites small { grid-column: 2; grid-row: 1; color: var(--muted); font-size: 12px; white-space: nowrap; }
.stats-favourites small b, .stats-recent small b { color: var(--ink); font-variant-numeric: tabular-nums; }
.stats-recent small { flex: none; color: var(--muted); font-size: 12.5px; }
/* .notes li b is a block heading in css/ui.css; here it is the number in a line. */
.stats-recent small b { display: inline; margin: 0; font-size: inherit; }

/* ---------- countries and genres ---------- */
.stats-flags img { width: 18px; height: 12px; border-radius: 2px; object-fit: cover; }
.toc .chip b { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
