/* =============================================================================
   Stats Hub — the /stats national performance leaderboards.
   Rides the explore hub's .xh token system (cards, chips, table, tooltips);
   this sheet adds the stats-specific layout and chart styles under .sh-*.
   ============================================================================= */

/* Fluid width, same as /explore (Pico's .container cap lifted). */
.page-stats main.container { max-width: 100%; width: 100%; padding-left: 0; padding-right: 0; }
.sh .sh-section { max-width: none; margin: 0 0 18px; padding: 0 32px; }

/* ---- header — the /leaderboard title lockup (.lb-header/.lb-title/.lb-byline
   treatment: centered, radial glow backdrop, skewed-brand byline) ----------- */
.sh-head { position: relative; text-align: center; padding: 26px 32px 0; margin-bottom: 26px; }
.sh-head::before {
  content: ''; position: absolute; top: -160px; left: 50%; transform: translateX(-50%);
  width: min(900px, 100vw); height: 420px;
  background: radial-gradient(ellipse at center, rgba(0, 168, 255, 0.07) 0%, transparent 65%);
  pointer-events: none;
}
.sh-title {
  position: relative; margin: 0 0 0.6rem;
  font-size: clamp(2rem, 4vw, 2.7rem); font-weight: 650; letter-spacing: -0.03em;
  font-style: normal; color: #f2f5f7; line-height: 1.12;
}
.sh-byline {
  position: relative; display: flex; align-items: center; justify-content: center;
  gap: 7px; margin: 0 auto 0.9rem; font-size: 0.95rem; text-decoration: none; width: fit-content;
}
.sh-byline-by { color: rgba(255, 255, 255, 0.5); }
.sh-byline-logo {
  width: 22px; height: 22px; border-radius: 5px;
  box-shadow: 0 0 10px rgba(0, 168, 255, 0.4); transition: transform 0.2s ease;
}
.sh-byline-brand {
  display: inline-block; font-weight: 600; color: rgba(255, 255, 255, 0.92);
  transform: skewX(-10deg); transform-origin: 0 100%;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.15); transition: color 0.2s ease;
}
.sh-byline:hover .sh-byline-logo { transform: scale(1.08); }
.sh-sub { position: relative; margin: 0 auto; max-width: 640px; font-size: 0.9rem; line-height: 1.6; color: rgba(255, 255, 255, 0.62); }

/* ---- controls ---------------------------------------------------------------- */
/* Conference + category rows both use /explore's .xh-conf-tab chip styling
   (free-standing text+logo tabs; selected gets the card surface). */
.sh-controls { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.sh-cats { display: flex; gap: 8px; flex-wrap: wrap; }
/* Season select — Pico paints bare selects; reset like the form inputs. */
.sh-season,
select.sh-season {
  width: auto !important; margin: 0 !important; padding: 7px 34px 7px 13px !important;
  border: 1px solid var(--xh-line) !important; border-radius: 9px !important;
  background-color: var(--xh-card) !important; color: var(--xh-ink) !important;
  font-size: 0.8rem !important; font-weight: 600; font-family: inherit;
  cursor: pointer; box-shadow: none !important;
}
.sh-statchips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sh-statchips-label {
  font-size: 0.64rem; font-weight: 700; font-style: italic; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--xh-ink-3); margin-right: 4px;
}
.sh-statchip {
  appearance: none; margin: 0; width: auto; cursor: pointer; flex: none;
  padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--xh-line); background: transparent; color: var(--xh-ink-2);
  font-size: 0.72rem; font-weight: 600; font-family: inherit;
  transition: all 0.15s ease;
}
.sh-statchip:hover { color: #fff; border-color: var(--xh-line-strong); }
.sh-statchip.on { background: rgba(0, 168, 255, 0.12); border-color: rgba(0, 168, 255, 0.4); color: var(--xh-accent); }

/* ---- full-width leaderboard, charts row beneath ----------------------------- */
.sh-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; transition: opacity 0.18s ease; }
/* Capped to ~10 rows; the rest scrolls inside the wrap under a sticky header. */
.sh-table-wrap { max-width: none; max-height: 600px; overflow-y: auto; }
.sh-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: #181c21;   /* solid stand-in for the card shade over the page bg */
}
/* Cards stretch to the row height (no align-items: start) so the pair match. */
.sh-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; min-width: 0; }
.sh-card { min-width: 0; }
.sh-cell-active { color: #fff; font-weight: 800; }
.sh-spark polyline { stroke: rgba(255, 255, 255, 0.45); }

/* Percentile cell: thin bar + value, tabular */
.sh-col-pct { width: 110px; }
.sh-pct { display: inline-flex; align-items: center; gap: 8px; }
.sh-pct-track {
  width: 56px; height: 5px; border-radius: 3px; overflow: hidden; flex: none;
  background: rgba(255, 255, 255, 0.07);
}
.sh-pct-fill { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, rgba(0, 168, 255, 0.45), var(--xh-accent)); }
.sh-pct b { font-weight: 700; color: var(--xh-ink); min-width: 24px; text-align: right; }

/* ---- charts ------------------------------------------------------------------ */
.sh-race { width: 100%; height: 200px; display: block; }
.sh-grid-line { stroke: rgba(255, 255, 255, 0.06); stroke-width: 1; }
.sh-axis { fill: rgba(255, 255, 255, 0.35); font-size: 10px; }
.sh-empty { padding: 22px 4px; font-size: 0.78rem; color: var(--xh-ink-3); }

/* Grows to fill the stretched card so the bars run as tall as the race chart. */
.sh-hist { display: flex; align-items: flex-end; gap: 3px; flex: 1 1 auto; min-height: 120px; padding-top: 8px; }
.sh-hist-bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; cursor: default; }
.sh-hist-fill { background: rgba(255, 255, 255, 0.16); border-radius: 2px 2px 0 0; min-height: 2px; transition: background 0.15s ease; }
.sh-hist-bar:hover .sh-hist-fill { background: rgba(255, 255, 255, 0.3); }
.sh-hist-bar.focal .sh-hist-fill { background: var(--xh-accent); }
.sh-hist-axis {
  display: flex; justify-content: space-between; gap: 8px; padding-top: 7px;
  font-size: 0.62rem; color: var(--xh-ink-3);
}

@media (max-width: 1100px) {
  .sh-charts { grid-template-columns: 1fr; }
}
