/* ==================================================
   Stats hub (/stats/)
   Header + season select, four headline leaders,
   stats by season (chips + tables), a pinned section
   nav, then board groups of three (one column below
   768px, two to 1024px), records tiles and notes.
================================================== */

.stats_hub {
  min-width: 0;
}

/* ── Header ─────────────────────────────────────────────────── */
.hub_head {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hub_title {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding-left: 0;
}

.hub_title::before {
  display: none;
}

.hub_title .entity_name {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.hub_title .entity_season {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.hub_status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.hub_status_dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
}

.hub_status_link {
  display: none;
  align-items: center;
  gap: 5px;
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.hub_status_link .icon {
  font-size: 9px;
}

.hub_status_link:hover {
  color: var(--brand-hover);
}

.hub_summary {
  display: none;
  max-width: 640px;
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.hub_head_side {
  display: flex;
  gap: 10px;
}

.hub_season {
  position: relative;
  flex: 1;
  min-width: 0;
}

.hub_season_label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.hub_season select {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 46px;
  padding: 0 36px 0 14px;
  background: var(--dark);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.hub_season select:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.hub_season select:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.hub_season_icon {
  position: absolute;
  right: 14px;
  bottom: 17px;
  font-size: 11px;
  color: var(--text-secondary);
  pointer-events: none;
}

.hub_table_btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 18px;
  background: var(--dark);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}

.hub_table_btn .icon {
  font-size: 14px;
  color: var(--brand);
}

.hub_table_btn:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

/* ── Headline leaders ───────────────────────────────────────── */
.hub_kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: var(--space-4);
}

.hub_kpi {
  display: grid;
  grid-template-areas:
    "label"
    "value"
    "who";
  align-content: start;
  min-width: 0;
  padding: 14px;
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.hub_kpi > .hub_face {
  display: none;
}

.hub_kpi_label {
  grid-area: label;
  margin: 0;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.hub_kpi_value {
  grid-area: value;
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 8px 0 0;
}

.hub_kpi_num {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--brand);
}

.hub_kpi_unit {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.hub_kpi_who {
  grid-area: who;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 10px 0 0;
}

.hub_kpi .hub_name {
  font-size: 15px;
}

/* ── Shared row pieces: face, name, meta ────────────────────── */
.hub_face {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.hub_face--image {
  overflow: hidden;
  background: var(--dark-secondary);
}

.hub_face--image img {
  display: block;
  width: 100%;
  height: 100%;
  transform: scale(1.18) translateY(-4%);
}

.hub_face--team {
  background: var(--dark-secondary);
  border: 1px solid var(--border);
}

.hub_face--team .team_badge {
  width: 62%;
  height: 62%;
  justify-content: center;
}

.hub_face--team .team_badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hub_face--team .team_badge--initials {
  font-size: 9px;
  font-weight: 800;
  border: none;
  background: none;
}

.hub_who {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hub_name {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

a.hub_name:hover {
  color: var(--brand);
}

.hub_meta {
  overflow: hidden;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Stats by season ────────────────────────────────────────── */
.hub_seasons {
  margin-top: var(--space-5);
  padding: 18px 16px 16px;
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  scroll-margin-top: calc(var(--topbar-h) + 64px);
}

.hub_seasons_title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.hub_seasons_text {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.hub_season_chips {
  display: flex;
  gap: 8px;
  margin: 16px -16px 0;
  padding: 0 16px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.hub_season_chips::-webkit-scrollbar {
  display: none;
}

.hub_season_chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: var(--dark-secondary);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.hub_season_chip:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

/* Only a chosen tab looks chosen; without JS the chips are plain links */
.js_hub .hub_season_chip.is_active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--dark);
}

.hub_season_chip:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.hub_season_panel {
  margin-top: 12px;
  padding: 14px;
  background: var(--dark-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.hub_season_panel[hidden] {
  display: none;
}

.hub_season_panel_head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.hub_season_name {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.hub_season_count {
  font-size: 13px;
  color: var(--text-secondary);
}

.hub_season_tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.hub_season_tile {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  min-height: 56px;
  padding: 10px 12px;
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  text-decoration: none;
  transition: border-color 0.15s;
}

.hub_season_tile:hover {
  border-color: rgba(57, 169, 151, 0.5);
}

.hub_season_tile_text {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hub_season_tile_name {
  font-size: 14px;
  font-weight: 700;
}

.hub_season_tile_sub {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-secondary);
}

.hub_season_tile .icon {
  flex-shrink: 0;
  font-size: 10px;
  color: var(--text-secondary);
}

.hub_season_tile:hover .icon {
  color: var(--brand);
}

/* ── Section nav (pinned under the top bar) ─────────────────── */
.hub_nav {
  position: sticky;
  top: var(--topbar-h);
  z-index: 30;
  margin: var(--space-5) -16px 0;
  padding: 10px 0;
  background: var(--dark-secondary);
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.hub_nav.is_stuck {
  border-bottom-color: var(--border-strong);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

.hub_nav_inner {
  position: relative;
  display: flex;
  gap: 8px;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.hub_nav_inner::-webkit-scrollbar {
  display: none;
}

.hub_nav_link {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--dark);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.hub_nav_link:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.hub_nav_link.is_active {
  background: var(--brand-soft);
  border-color: rgba(57, 169, 151, 0.7);
  color: var(--brand);
}

/* ── Board groups ───────────────────────────────────────────── */
.hub_group {
  margin-top: var(--space-5);
  scroll-margin-top: calc(var(--topbar-h) + 68px);
}

.hub_group_head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  margin-bottom: 12px;
}

.hub_group_title {
  margin: 0;
  padding: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.hub_group_title::before {
  display: none;
}

.hub_group_sub {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.hub_boards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.hub_board {
  overflow: hidden;
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.hub_board_head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 0;
}

.hub_board_title {
  margin: 0;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.hub_board_link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.hub_board_link .icon {
  font-size: 8px;
}

.hub_board_link:hover {
  color: var(--brand-hover);
}

.hub_rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Leader */
.hub_lead {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 14px;
  border-bottom: 1px solid var(--border);
}

.hub_lead_face {
  position: relative;
  flex-shrink: 0;
}

.hub_lead_face .hub_face {
  width: 48px;
  height: 48px;
  font-size: 13px;
  box-shadow: 0 0 0 2px var(--dark), 0 0 0 3px rgba(57, 169, 151, 0.45);
}

.hub_lead_rank {
  position: absolute;
  top: -4px;
  left: -4px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--brand);
  border: 2px solid var(--dark);
  color: var(--dark);
  font-size: 10px;
  font-weight: 800;
  box-sizing: content-box;
}

.hub_lead .hub_who {
  flex: 1;
}

.hub_lead .hub_name {
  font-size: 16px;
}

.hub_lead_value {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
  text-align: right;
}

.hub_lead_num {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.05;
  color: var(--brand);
}

.hub_lead_unit {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Ranks 2-5, with a bar sized against the leader */
.hub_row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 16px 8px 12px;
  background: var(--surface-sunken);
  isolation: isolate;
}

.hub_row + .hub_row {
  border-top: 1px solid var(--border);
}

.hub_row::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  width: calc(var(--bar, 0%) * 0.38);
  background: linear-gradient(to right, rgba(57, 169, 151, 0.04), rgba(57, 169, 151, 0.14));
  border-left: 2px solid rgba(57, 169, 151, 0.35);
}

.hub_rank {
  flex-shrink: 0;
  width: 22px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  color: var(--text-secondary);
}

.hub_row .hub_face {
  width: 30px;
  height: 30px;
}

.hub_row .hub_who {
  flex: 1;
}

.hub_row .hub_name {
  font-size: 13px;
}

.hub_row .hub_meta {
  font-size: 11px;
}

.hub_value {
  flex-shrink: 0;
  min-width: 36px;
  font-size: 15px;
  font-weight: 800;
  text-align: right;
  color: var(--text-primary);
}

/* ── Records and guides ─────────────────────────────────────── */
.hub_more_tiles {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.hub_more_tile {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 12px 16px;
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  text-decoration: none;
  transition: border-color 0.15s;
}

.hub_more_tile:hover {
  border-color: rgba(57, 169, 151, 0.5);
}

.hub_more_icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 15px;
}

.hub_more_text {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hub_more_name {
  font-size: 14px;
  font-weight: 700;
}

.hub_more_sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.hub_more_chev {
  flex-shrink: 0;
  font-size: 10px;
  color: var(--text-secondary);
}

.hub_more_tile:hover .hub_more_chev {
  color: var(--brand);
}

/* ── About ──────────────────────────────────────────────────── */
.hub_about {
  margin-top: var(--space-6);
}

.hub_about_title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 800;
}

.hub_about p {
  max-width: 760px;
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.hub_about a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}

.hub_about a:hover {
  text-decoration: underline;
}

/* ── Tablet (≥ 768px): two boards a row, four headline tiles ── */
@media screen and (min-width: 768px) {
  .hub_boards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hub_more_tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hub_season_tiles {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

/* ── Desktop (≥ 1024px) ─────────────────────────────────────── */
@media screen and (min-width: 1024px) {
  .hub_head {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-6);
  }

  .hub_head_main {
    min-width: 0;
  }

  .hub_title {
    display: block;
  }

  .hub_title .entity_name {
    font-size: var(--fs-h1-d);
  }

  .hub_title .entity_season {
    margin-left: 6px;
    font-size: 26px;
    font-weight: 500;
  }

  .hub_status_link {
    display: inline-flex;
  }

  .hub_summary {
    display: block;
  }

  .hub_head_side {
    flex-shrink: 0;
    padding-bottom: 2px;
  }

  .hub_table_btn {
    display: none;
  }

  .hub_season {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .hub_season_label {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
  }

  .hub_season select {
    width: auto;
    min-width: 190px;
    height: 42px;
    font-size: 14px;
  }

  .hub_season_icon {
    bottom: 15px;
  }

  /* Headline tiles: label, then face · who · figure */
  .hub_kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: var(--space-6);
  }

  .hub_kpi {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    grid-template-areas:
      "label label label"
      "face  who   value";
    align-items: center;
    column-gap: 12px;
    padding: 16px 18px;
  }

  .hub_kpi > .hub_face {
    grid-area: face;
    display: flex;
    width: 40px;
    height: 40px;
    margin-top: 14px;
    font-size: 11px;
  }

  .hub_kpi_who {
    margin: 14px 0 0;
  }

  .hub_kpi .hub_name {
    font-size: 14px;
  }

  .hub_kpi_value {
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    margin: 14px 0 0;
  }

  .hub_kpi_num {
    font-size: 30px;
  }

  .hub_kpi_unit {
    font-size: 11px;
  }

  /* Stats by season */
  .hub_seasons {
    margin-top: var(--space-6);
    padding: 22px 22px 20px;
    scroll-margin-top: calc(var(--topbar-h-desktop) + 68px);
  }

  .hub_seasons_text {
    font-size: 13px;
  }

  .hub_season_chips {
    flex-wrap: wrap;
    margin: 16px 0 0;
    padding: 0;
    overflow: visible;
  }

  .hub_season_chip {
    height: 34px;
    padding: 0 14px;
    font-size: 13px;
  }

  .hub_season_panel {
    padding: 16px;
  }

  .hub_season_name {
    font-size: 15px;
  }

  .hub_season_tiles {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  /* Section nav */
  .hub_nav {
    top: var(--topbar-h-desktop);
    margin: var(--space-6) 0 0;
    padding: 12px 0;
  }

  .hub_nav.is_stuck {
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }

  .hub_nav_inner {
    padding: 0;
  }

  /* Groups: three boards a row */
  .hub_group {
    margin-top: var(--space-6);
    scroll-margin-top: calc(var(--topbar-h-desktop) + 72px);
  }

  .hub_group_title {
    font-size: 22px;
  }

  .hub_boards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }

  .hub_more {
    margin-top: var(--space-7);
  }

  .hub_about {
    margin-top: var(--space-7);
  }
}
