/* stats_hub.css — /all_stats (Leaders, Awards, Database, Players, profiles) */
:root {
  --navy: #222F3E;
  --navy-2: #2D3D50;
  --navy-3: #3A4D63;
  --paper: #EDF0F3;
  --card: #FFFFFF;
  --ink: #17212B;
  --muted: #5A6774;
  --rule: #D2D9E0;
  --rule-soft: #E6EAEE;
  --accent: #2A6FCB;
  --accent-ink: #1D5AAE;
  --gold: #E9A92B;
  --gold-tint: #FFF4DC;
  --row-alt: #F7F9FA;
  --sort: #E3EEFB;
  --cond: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --text: "Barlow", Arial, sans-serif;
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.hub { flex: 1 0 auto; background: var(--paper); color: var(--ink); font-family: var(--text); font-size: 15px; line-height: 1.45; }
.hub, .hub * { -webkit-user-select: text; user-select: text; }
.hub-wrap { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.hub a { color: var(--accent); text-decoration: none; }
.hub a:hover { text-decoration: underline; }
.hub :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hub button, .hub select, .hub input { font-family: var(--text); font-size: 14px; }

/* ---------- masthead ---------- */
.hub-masthead { background: var(--navy-2); border-top: 1px solid var(--navy-3); color: #fff; position: relative; z-index: 50; }
.hub-masthead-inner { display: flex; align-items: center; gap: 28px; min-height: 56px; position: relative; }
.hub-title { font-family: var(--cond); font-weight: 700; font-size: 30px; letter-spacing: .01em; line-height: 1; }
/* The tab row is split at --hub-center: the gap between Awards and Database
   sits directly under the middle of the site's middle nav button (set by
   alignHubTabs() in stats_hub.js; 50% until it runs). */
.hub-tabs { position: absolute; left: 0; right: 0; top: 0; bottom: 0; pointer-events: none; }
.hub-tabs-half { position: absolute; top: 0; bottom: 0; display: flex; pointer-events: auto; }
.hub-tabs-half.l { right: calc(100% - var(--hub-center, 50%)); }
.hub-tabs-half.r { left: var(--hub-center, 50%); }
.hub-title, .hub-find { position: relative; z-index: 1; }
.hub-tabs a { display: flex; align-items: center; padding: 0 14px; color: #C9D4DF; font-family: var(--cond); font-size: 20px; font-weight: 600; border-bottom: 3px solid transparent; text-decoration: none !important; }
.hub-tabs a:hover { color: #fff; }
.hub-tabs a.active { color: #fff; border-bottom-color: var(--gold); }
.hub-find { margin-left: auto; position: relative; width: 260px; }
@media (max-width: 1150px) { .hub-find { width: 190px; } }
.hub-find input { width: 100%; height: 34px; padding: 0 12px; border-radius: 4px; border: 1px solid var(--navy-3); background: #fff; color: var(--ink); font-size: 15px; }
.find-results { position: absolute; top: 38px; left: 0; right: 0; background: #fff; border: 1px solid var(--rule); border-radius: 4px; box-shadow: 0 10px 24px rgba(23,33,43,.18); max-height: 360px; overflow-y: auto; }
.find-results a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; color: var(--ink); border-bottom: 1px solid var(--rule-soft); }
.find-results a span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.find-results a:hover, .find-results a.on { background: var(--sort); text-decoration: none; }

.hub-view { padding-top: 22px; padding-bottom: 48px; min-height: 60vh; }
.hub-loading, .hub-empty { color: var(--muted); padding: 40px 0; }
.hub-error { background: #fff; border-left: 4px solid #C9372C; padding: 14px 16px; }

/* ---------- section head + controls ---------- */
.view-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 24px; margin-bottom: 18px; }
/* Page titles centered over the page; controls stay pinned to the right on wide screens. */
@media (min-width: 861px) {
  .view-head { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; }
  .view-head > div:first-child { grid-column: 2; text-align: center; }
  .view-head > .controls { grid-column: 3; justify-self: end; margin-left: 0; }
}
@media (max-width: 860px) {
  .view-head { flex-direction: column; align-items: center; text-align: center; }
  .view-head > .controls { margin-left: 0; justify-content: center; }
}
.view-head h2 { font-family: var(--cond); font-weight: 700; font-size: 40px; line-height: 1; margin: 0; }
.view-head .sub { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-left: auto; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 7px 14px; cursor: pointer; color: var(--ink); font-weight: 600; }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button.on { background: var(--navy); color: #fff; }
.ctl { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.ctl select, .ctl input[type="text"], .ctl input[type="search"] { height: 34px; border: 1px solid var(--rule); border-radius: 4px; background: #fff; color: var(--ink); padding: 0 8px; }
.ctl input[type="text"], .ctl input[type="search"] { width: 190px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); }

/* ---------- leaders ---------- */
.lead-group { margin-top: 26px; }
.lead-group > h3 { font-family: var(--cond); font-size: 24px; font-weight: 700; margin: 0 0 10px; color: var(--navy); }
.lead-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.board { background: var(--card); border-top: 4px solid var(--navy); display: flex; flex-direction: column; }
.board-head { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 14px 0; }
.board-head h4 { margin: 0; font-size: 15px; font-weight: 600; }
.board-head .abbr { color: var(--muted); font-size: 12px; }
.board-top { display: grid; grid-template-columns: 58px 1fr auto; gap: 12px; align-items: center; padding: 10px 14px 12px; border-bottom: 1px solid var(--rule-soft); }
.board-top .ph { width: 58px; height: 58px; border-radius: 50%; background: var(--paper) center/cover no-repeat; border: 2px solid var(--gold); display: flex; align-items: center; justify-content: center; font-family: var(--cond); font-weight: 700; color: var(--muted); font-size: 20px; overflow: hidden; }
.board-top .ph img { width: 100%; height: 100%; object-fit: cover; }
.board-top .who { min-width: 0; }
.board-top .who .nm { font-weight: 700; font-size: 16px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-top .who .tm { color: var(--muted); font-size: 13px; }
.board-top .val { font-family: var(--cond); font-weight: 700; font-size: 44px; line-height: .9; font-variant-numeric: tabular-nums; color: var(--ink); }
.board ol { list-style: none; margin: 0; padding: 4px 0; }
.board li { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; padding: 4px 14px; font-size: 14px; align-items: baseline; }
.board li .rk { color: var(--muted); font-variant-numeric: tabular-nums; }
.board li .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board li .nm small { color: var(--muted); font-size: 12px; margin-left: 4px; }
.board li .v { font-variant-numeric: tabular-nums; font-weight: 600; }
.board .more { margin-top: auto; padding: 8px 14px 12px; font-size: 14px; font-weight: 600; }
.board .none { padding: 16px 14px; color: var(--muted); font-size: 14px; }
.lead-note { color: var(--muted); font-size: 13px; margin-top: 22px; max-width: 80ch; }

/* ---------- awards ---------- */
.award-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.award { background: var(--card); padding: 14px 16px 16px; border-left: 4px solid var(--gold); }
.award h4 { margin: 0 0 8px; font-family: var(--cond); font-size: 22px; font-weight: 700; }
.award .winner { font-size: 18px; font-weight: 700; }
.award .winner small { display: block; color: var(--muted); font-weight: 500; font-size: 13px; }
.award ol { margin: 10px 0 0; padding-left: 20px; font-size: 14px; color: var(--ink); }
.award ol li { padding: 1px 0; }
.award ol li span { color: var(--muted); font-size: 13px; }
.award .team-name { margin: 10px 0 2px; font-weight: 600; font-size: 13px; color: var(--muted); }
.award ul { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.award-list { background: var(--card); padding: 6px 0; }
.award-list .row { display: grid; grid-template-columns: minmax(180px, 1.2fr) 1fr; gap: 12px; padding: 7px 16px; border-bottom: 1px solid var(--rule-soft); font-size: 14px; }
.award-list .row:last-child { border-bottom: 0; }
.award-list .row b { font-weight: 600; }

/* ---------- tables ---------- */
.tbl-wrap { background: var(--card); overflow: auto; max-height: 78vh; border: 1px solid var(--rule); }
.tbl-wrap.flat { max-height: none; }
table.st { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
table.st th, table.st td { padding: 5px 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--rule-soft); }
table.st thead th { position: sticky; top: 0; z-index: 2; background: var(--navy); color: #fff; font-weight: 600; font-size: 12.5px; cursor: default; border-bottom: 0; }
table.st thead th.sortable { cursor: pointer; }
table.st thead th.sortable:hover { background: var(--navy-3); }
table.st thead th.sorted { background: var(--accent-ink); }
table.st thead th.sorted::after { content: " \25BE"; font-size: 10px; }
table.st thead th.sorted.asc::after { content: " \25B4"; }
table.st td.sorted { background: var(--sort); }
table.st tbody tr:nth-child(even) td { background-color: var(--row-alt); }
table.st tbody tr:nth-child(even) td.sorted { background: #D9E7F8; }
table.st tbody tr:hover td { background: #FFF8E6; }
table.st .l { text-align: left; }
table.st .pin { position: sticky; left: 0; z-index: 1; background: var(--card); border-right: 1px solid var(--rule); text-align: left; }
table.st thead th.pin { z-index: 3; background: var(--navy); }
table.st tbody tr:nth-child(even) td.pin { background: var(--row-alt); }
table.st td.pin a { font-weight: 600; }
table.st tr.career td { font-weight: 700; border-top: 2px solid var(--rule); background: #F2F5F8; }
table.st td.dim { color: #9AA6B1; }
.tbl-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 8px; }
.btn { border: 1px solid var(--rule); background: #fff; color: var(--ink); border-radius: 4px; padding: 7px 14px; cursor: pointer; font-weight: 600; }
.btn:hover { background: var(--paper); }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.qhelp { color: var(--muted); font-size: 12.5px; margin: -6px 0 12px; }
.qerr { color: #B42318; }

/* ---------- players directory ---------- */
.dir-count { color: var(--muted); font-size: 14px; margin-bottom: 8px; }

/* ---------- profile ---------- */
.prof-back { display: inline-block; margin-bottom: 12px; font-weight: 600; }
.prof-head { background: var(--navy); color: #fff; display: grid; grid-template-columns: 105px 1fr auto; gap: 24px; padding: 22px 24px; align-items: center; }
/* Headshots are 75x100 (3:4); a 3:4 box shows the whole photo with the least upscaling. */
.prof-photo { width: 105px; height: 140px; background: var(--navy-2); border-radius: 6px; overflow: hidden; display: flex; align-items: center; justify-content: center; font-family: var(--cond); font-size: 40px; color: #8FA0B2; }
.prof-photo img { width: 100%; height: 100%; object-fit: cover; }
.prof-name { font-family: var(--cond); font-weight: 700; font-size: 52px; line-height: .95; margin: 0; }
.prof-pos { margin: 8px 0 0; font-size: 17px; color: #E3EAF1; }
.prof-nick { margin: 4px 0 0; font-size: 15px; color: #C3CFDB; font-style: italic; }
.prof-logo { align-self: start; margin-top: -8px; }
.prof-logo img { width: 96px; height: 96px; object-fit: contain; display: block; }
.prof-head { position: relative; }
.prof-cmp { position: absolute; right: 24px; bottom: 16px; background: var(--navy-2) !important; color: #fff !important; border-color: var(--navy-3) !important; text-decoration: none !important; }
.prof-cmp:hover { background: var(--navy-3) !important; }
@media (max-width: 860px) { .prof-cmp { position: static; grid-column: 1 / -1; justify-self: start; } }
.prof-facts { background: var(--card); display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0; border-bottom: 1px solid var(--rule); }
.prof-facts div { padding: 10px 24px; border-bottom: 1px solid var(--rule-soft); }
.prof-facts dt { color: var(--muted); font-size: 12.5px; }
.prof-facts dd { margin: 2px 0 0; font-size: 14.5px; font-weight: 500; }
.prof-honors { background: var(--gold-tint); padding: 10px 24px; font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.prof-honors b { font-weight: 700; }
.phase-tabs { display: flex; flex-wrap: wrap; gap: 0; margin-top: 22px; border-bottom: 2px solid var(--navy); }
.phase-tabs button { border: 0; background: transparent; padding: 9px 18px; font-family: var(--cond); font-size: 20px; font-weight: 600; color: var(--muted); cursor: pointer; }
.phase-tabs button.on { background: var(--navy); color: #fff; }
.phase-block h3 { font-family: var(--cond); font-weight: 700; font-size: 24px; margin: 22px 0 8px; }
.src-note { color: var(--muted); font-size: 13px; margin-top: 18px; max-width: 90ch; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .hub-masthead-inner { flex-wrap: wrap; gap: 6px 16px; padding-top: 10px; }
  .hub-title { font-size: 26px; }
  .hub-find { order: 2; margin-left: auto; width: 180px; }
  .hub-tabs { order: 3; position: relative; width: 100%; height: 46px; flex: 0 0 100%; }
  .hub-tabs a { padding: 10px 12px; font-size: 18px; }
  .prof-head { grid-template-columns: 72px 1fr; padding: 16px; gap: 16px; }
  .prof-photo { width: 72px; height: 96px; font-size: 28px; }
  .prof-name { font-size: 36px; }
  .prof-logo { display: none; }
}
@media (max-width: 600px) {
  .hub-wrap { padding: 0 16px; }
  .hub-find { width: 100%; order: 4; margin: 0 0 10px; }
  .view-head h2 { font-size: 32px; }
  .controls { margin-left: 0; }
  .ctl input[type="text"], .ctl input[type="search"] { width: 150px; }
  .lead-grid, .award-cols { grid-template-columns: 1fr; }
  .tbl-wrap { max-height: 70vh; }
  .prof-facts { grid-template-columns: 1fr 1fr; }
  .prof-facts div { padding: 8px 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- filter chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -2px 0 12px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--rule); border-radius: 999px; padding: 3px 4px 3px 12px; font-size: 13px; }
.chip button { border: 0; background: var(--paper); border-radius: 50%; width: 22px; height: 22px; cursor: pointer; font-size: 15px; line-height: 1; color: var(--muted); }
.chip button:hover { background: var(--rule); color: var(--ink); }
.linkbtn { border: 0; background: none; color: var(--accent); cursor: pointer; font-weight: 600; font-size: 13px; padding: 4px 6px; }

/* ---------- popup ---------- */
.hub-modal { position: fixed; inset: 0; background: rgba(23, 33, 43, .55); z-index: 2000; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; font-family: var(--text); color: var(--ink); }
.hub-modal-card { background: #fff; width: 100%; max-width: 620px; border-top: 5px solid var(--navy); box-shadow: 0 18px 50px rgba(0,0,0,.3); }
.hub-modal-card.wide { max-width: 900px; }
.hub-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px 6px; }
.hub-modal-head h3 { margin: 0; font-family: var(--cond); font-size: 28px; font-weight: 700; }
.hub-modal .hub-modal-x { border: 0; background: none; font-size: 30px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }
.hub-modal-x:hover { color: var(--ink); }
.hub-modal-body { padding: 6px 20px 20px; }
.hub-modal .modal-tabs { margin: 4px 0 14px; }
.hub-modal input, .hub-modal select, .hub-modal button { font-family: var(--text); font-size: 14px; }
.ff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px 12px; max-height: 52vh; overflow-y: auto; padding: 2px 2px 6px; }
.ff { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ff span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.ff input, .ff select { height: 34px; border: 1px solid var(--rule); border-radius: 4px; padding: 0 8px; background: #fff; color: var(--ink); width: 100%; }
.ff input:focus, .ff select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px rgba(42,111,203,.18); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.cmp-form .cmp-row { display: grid; grid-template-columns: 1.3fr 1.3fr .6fr; gap: 12px; margin-bottom: 12px; }
.cmp-form .cmp-row .ff:nth-child(2):last-child { grid-column: span 2; }
.cmp-form .ff.small input { width: 100%; }
.cmp-groups { border: 1px solid var(--rule-soft); border-radius: 4px; margin: 12px 0; padding: 8px 12px 10px; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.cmp-groups legend { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 0 4px; }
.cmp-err { margin: 8px 0 0; font-size: 14px; }

/* ---------- compare results ---------- */
.h2h-score { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 16px; }
.h2h-score .big { font-family: var(--cond); font-weight: 700; font-size: 64px; line-height: 1; color: var(--navy); }
.h2h-score span:last-child { color: var(--muted); font-size: 16px; }
.cmp-h3 { font-family: var(--cond); font-size: 24px; margin: 22px 0 8px; }
table.st td.bar-col { width: 40%; }
.bar { display: inline-block; height: 10px; background: var(--accent); border-radius: 2px; vertical-align: middle; }

@media (max-width: 600px) {
  .cmp-form .cmp-row { grid-template-columns: 1fr; }
  .cmp-form .cmp-row .ff:nth-child(2):last-child { grid-column: auto; }
  .ff-grid { grid-template-columns: repeat(3, 1fr); }
  .hub-modal { padding: 0; }
  .hub-modal-card { min-height: 100%; }
  .h2h-score .big { font-size: 48px; }
}

.chk.inline { display: inline-flex; margin-left: 6px; font-size: 13px; color: var(--muted); }