/* PS.table (js/table.js), the sport tab bar and shared deep-page pieces. Uses the tokens in styles.css.

   ---- Utility hooks for page designers -------------------------------------------------------------
   Heat-mapped cells (any element; built for <td>):
     .t-heat-1 … .t-heat-5   good, light → strong tint (blue)      e.g. top-10 offense = t-heat-5
     .t-cold-1 … .t-cold-5   bad,  light → strong tint (orange)    e.g. bottom-10 defense = t-cold-5
     Suggested mapping from a rank among N: pct = rank / N → ≤.03:5  ≤.10:4  ≤.20:3  ≤.33:2  ≤.45:1,
     and mirror it for the bottom end with .t-cold-*. Leave the middle untinted so the extremes pop.
     Text stays --text in both themes (AA contrast at every level).
   In-cell data bar: <td class="num"><span class="t-bar" style="--v:.62">+18.4</span></td>
     --v is 0…1 (share of the column max); add .neg for a bar in the "bad" color.
   Column helpers: .t-strong (bold display-font value), .t-divider (hairline on the cell's left edge),
     .t-muted (secondary value), .t-up / .t-down (good / bad text color).
   Segmented control (styles.css): <div class="seg" role="group"><button aria-pressed="true">…</button></div>
   --------------------------------------------------------------------------------------------------- */

/* ---------- sport bar: the same tabs in every sport ---------- */
.sportbar { position: sticky; top: var(--header-h); z-index: 20; background: var(--header-bg);
  backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px); border-bottom: 1px solid var(--border); }
.sportbar[hidden] { display: none; }
.sportbar-inner { display: flex; align-items: stretch; gap: 2px; height: var(--sportbar-h); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.sportbar-inner::-webkit-scrollbar { display: none; }
.sportbar .sb-name { display: flex; align-items: center; font-family: var(--font-display); font-weight: 750; font-size: 15px; letter-spacing: -0.01em;
  margin-right: 12px; padding-right: 16px; white-space: nowrap; color: var(--text); position: relative; }
.sportbar .sb-name::after { content: ""; position: absolute; right: 0; top: 50%; height: 18px; margin-top: -9px; width: 1px; background: var(--border-strong); }
.sportbar a.sb-tab { position: relative; display: flex; align-items: center; padding: 0 12px; color: var(--muted); font-size: 14px; font-weight: 560;
  white-space: nowrap; text-decoration: none; transition: color .15s; }
.sportbar a.sb-tab::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: transparent; transition: background .15s; }
.sportbar a.sb-tab:hover { color: var(--text); }
.sportbar a.sb-tab:hover::after { background: var(--border-strong); }
.sportbar a.sb-tab[aria-current] { color: var(--text); font-weight: 650; }
.sportbar a.sb-tab[aria-current]::after { background: var(--accent); }
.sportbar a.sb-tab:focus-visible { outline-offset: -4px; }
@media (max-width: 640px) {
  .sportbar .sb-name { display: none; }
  .sportbar-inner { padding: 0 28px 0 6px;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
  .sportbar a.sb-tab { padding: 0 11px; font-size: 14px; }
  .sportbar a.sb-tab::after { left: 11px; right: 11px; }
}

/* ---------- table controls ---------- */
.ps-table .t-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; margin-bottom: 14px; }
.ps-table .t-search { width: auto; min-width: 200px; flex: 0 1 280px; height: 40px; }
.ps-table .t-filter { display: grid; gap: 4px; font: 650 10.5px/1.2 var(--font-text); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.ps-table .t-filter select { height: 40px; min-width: 120px; text-transform: none; letter-spacing: 0; }
/* Basic / Advanced: a segmented control */
.ps-table .t-views { display: inline-flex; gap: 2px; padding: 3px; height: 40px; border-radius: var(--radius-sm); background: var(--surface-3); border: 1px solid var(--border); }
.ps-table .t-views button { border: 0; background: none; color: var(--text-2); font: 600 13px/1 var(--font-text); padding: 0 14px; border-radius: 7px; cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s; }
.ps-table .t-views button:hover { color: var(--text); }
.ps-table .t-views button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.ps-table .t-count { margin-left: auto; align-self: center; font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ps-table .t-search:focus-visible, .ps-table select:focus-visible, .ps-table button:focus-visible { outline: none; box-shadow: var(--ring); }

/* ---------- the table ---------- */
.ps-table .t-scroll { overflow: auto; max-width: 100%; max-height: min(78vh, 900px); border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.ps-table table.t-table { font-size: 13.5px; font-variant-numeric: tabular-nums; width: 100%; }
.ps-table td, .ps-table th { padding: 7px 10px; }
.ps-table table.t-table tbody td { border-bottom: 1px solid var(--grid); line-height: 1.3; vertical-align: middle; }
.ps-table table.t-table thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); box-shadow: inset 0 -1px 0 var(--border-strong);
  border-bottom: 0; padding-top: 9px; padding-bottom: 8px; vertical-align: bottom; }
.ps-table table.t-table thead th:first-child, .ps-table table.t-table tbody td:first-child { padding-left: 12px; }
.ps-table table.t-table thead th:last-child, .ps-table table.t-table tbody td:last-child { padding-right: 14px; }
/* group band ("Offense", "Defense") above the column labels */
.ps-table table.t-table thead tr.t-band th { top: 0; height: 26px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-2);
  font-weight: 700; text-align: center; padding: 7px 8px 0; box-shadow: none; vertical-align: top; }
.ps-table table.t-table thead tr.t-band ~ tr th { top: 26px; }
.ps-table table.t-table thead tr.t-band th.t-group { box-shadow: inset 0 -2px 0 var(--border-strong); }
.ps-table table.t-table thead tr.t-band th.t-group + th.t-group { border-left: 6px solid var(--surface-2); }
/* sortable labels */
.ps-table .t-sort { display: inline-flex; align-items: center; border: 0; background: none; color: inherit; font: inherit; font-weight: 650; letter-spacing: inherit;
  text-transform: inherit; cursor: pointer; padding: 4px 0; margin: -4px 0; white-space: nowrap; border-radius: 4px; }
.ps-table .t-sort:hover { color: var(--text); }
.ps-table th.t-on { color: var(--accent); }
.ps-table th.t-on .t-sort { color: var(--accent); }
.ps-table table.t-table thead th.t-on { box-shadow: inset 0 -2px 0 var(--accent); }
.ps-table .t-arrow { font-size: 8px; margin-left: 4px; }
/* the sorted column carries a faint accent tint (opaque, so pinned cells never show content scrolling under them) */
.ps-table td.t-on { background: color-mix(in oklab, var(--accent) 5%, var(--surface)); }
.ps-table tbody tr:hover td { background-color: var(--row-hover); }
.ps-table tbody tr:hover td.t-on { background-color: color-mix(in oklab, var(--accent) 7%, var(--row-hover)); }
/* rank under a value */
.ps-table .t-rank { display: block; margin-top: 1px; font-size: 10.5px; line-height: 1.1; color: var(--muted); font-weight: 500; }
.ps-table .t-na { color: var(--muted); }
.ps-table tr.t-link { cursor: pointer; }
.ps-table td a { color: var(--text); text-decoration: none; }
.ps-table td a:hover { color: var(--accent); }
/* pinned rank + name columns */
.ps-table .t-sticky { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.ps-table table.t-table thead th.t-sticky { z-index: 3; background: var(--surface-2); }
.ps-table .t-sticky + .t-sticky { left: var(--t-sticky-2, 44px); }
.ps-table tbody tr:hover .t-sticky { background-color: var(--row-hover); }
.ps-table .t-sticky:not(:has(+ .t-sticky)) { box-shadow: inset -1px 0 0 var(--border); }
.ps-table thead .t-sticky:not(:has(+ .t-sticky)) { box-shadow: inset -1px 0 0 var(--border), inset 0 -1px 0 var(--border-strong); }
.ps-table tbody tr:last-child td { border-bottom: 0; }
.ps-table tbody td.hint[colspan] { padding: 28px; text-align: center; }
.ps-table .t-foot { display: flex; justify-content: center; margin-top: 14px; }
.ps-table .t-foot:empty { display: none; }
.ps-table .t-foot .btn { margin-left: 0; min-width: 160px; }
.ps-table .t-caption { margin-top: 12px; max-width: 90ch; line-height: 1.5; }
@media (max-width: 640px) {
  .ps-table .t-controls { gap: 8px; }
  .ps-table td, .ps-table th { padding: 7px 7px; }
  .ps-table table.t-table tbody td { padding-top: 10px; padding-bottom: 10px; } /* ~42px rows: easy to tap */
  .ps-table table.t-table thead th:first-child, .ps-table table.t-table tbody td:first-child { padding-left: 9px; }
  .ps-table .t-search { flex: 1 1 100%; min-width: 0; }
  .ps-table .t-filter { flex: 1 1 140px; }
  .ps-table .t-filter select { width: 100%; min-width: 0; }
  .ps-table .t-count { margin-left: 0; flex-basis: 100%; }
}

/* ---------- heat-mapped cells + in-cell bars (see the header comment) ---------- */
.t-heat-1, .ps-table td.t-heat-1 { background-image: linear-gradient(color-mix(in oklab, var(--heat-good) 5%, transparent) 0 0); }
.t-heat-2, .ps-table td.t-heat-2 { background-image: linear-gradient(color-mix(in oklab, var(--heat-good) 10%, transparent) 0 0); }
.t-heat-3, .ps-table td.t-heat-3 { background-image: linear-gradient(color-mix(in oklab, var(--heat-good) 16%, transparent) 0 0); }
.t-heat-4, .ps-table td.t-heat-4 { background-image: linear-gradient(color-mix(in oklab, var(--heat-good) 23%, transparent) 0 0); }
.t-heat-5, .ps-table td.t-heat-5 { background-image: linear-gradient(color-mix(in oklab, var(--heat-good) 31%, transparent) 0 0); font-weight: 650; }
.t-cold-1, .ps-table td.t-cold-1 { background-image: linear-gradient(color-mix(in oklab, var(--heat-bad) 5%, transparent) 0 0); }
.t-cold-2, .ps-table td.t-cold-2 { background-image: linear-gradient(color-mix(in oklab, var(--heat-bad) 10%, transparent) 0 0); }
.t-cold-3, .ps-table td.t-cold-3 { background-image: linear-gradient(color-mix(in oklab, var(--heat-bad) 16%, transparent) 0 0); }
.t-cold-4, .ps-table td.t-cold-4 { background-image: linear-gradient(color-mix(in oklab, var(--heat-bad) 23%, transparent) 0 0); }
.t-cold-5, .ps-table td.t-cold-5 { background-image: linear-gradient(color-mix(in oklab, var(--heat-bad) 31%, transparent) 0 0); font-weight: 650; }
[class*="t-heat-"] .t-rank, [class*="t-cold-"] .t-rank { color: var(--text-2); }
.t-bar { display: inline-block; min-width: 56px; padding-bottom: 4px; text-align: right;
  background: linear-gradient(var(--heat-good), var(--heat-good)) right bottom / calc(var(--v, 0) * 100%) 3px no-repeat,
    linear-gradient(var(--grid), var(--grid)) right bottom / 100% 3px no-repeat; }
.t-bar.neg { background: linear-gradient(var(--heat-bad), var(--heat-bad)) right bottom / calc(var(--v, 0) * 100%) 3px no-repeat,
    linear-gradient(var(--grid), var(--grid)) right bottom / 100% 3px no-repeat; }
.t-strong { font-family: var(--font-display); font-weight: 700; font-size: 1.06em; letter-spacing: -0.01em; }
.t-muted { color: var(--muted); }
.t-up { color: var(--good-text); }
.t-down { color: var(--critical); }
td.t-divider, th.t-divider { box-shadow: inset 1px 0 0 var(--border); }

/* ---------- shared page pieces for the deep pages ---------- */
.subtabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--border); margin: 4px 0 20px; scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs a { position: relative; display: flex; align-items: center; min-height: 44px; padding: 0 14px; color: var(--muted); font-weight: 560; font-size: 14.5px;
  white-space: nowrap; text-decoration: none; transition: color .15s; }
.subtabs a::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: transparent; }
.subtabs a:hover { color: var(--text); }
.subtabs a:hover::after { background: var(--border-strong); }
.subtabs a[aria-current] { color: var(--text); font-weight: 650; }
.subtabs a[aria-current]::after { background: var(--accent); }
.subtabs a:focus-visible { outline-offset: -4px; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat-tile { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px 13px; background: var(--surface); box-shadow: var(--shadow-sm); min-width: 0; }
.stat-tile .st-label { font: 650 11px/1.3 var(--font-text); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat-tile .st-value { margin-top: 4px; font: 750 26px/1.1 var(--font-display); letter-spacing: -0.025em; font-variant-numeric: tabular-nums; color: var(--text); }
.stat-tile .st-rank { margin-top: 3px; font-size: 12px; color: var(--muted); }
.model-note { border-left: 3px solid var(--brand-2); padding: 6px 0 6px 14px; color: var(--text-2); font-size: 13px; line-height: 1.55; max-width: 90ch; }

/* pre-rendered search-engine summary (pipeline/seo.py): readable until the app replaces it */
article.seo { padding: 24px 0; line-height: 1.55; }
article.seo table { border-collapse: collapse; font-size: 14px; }
article.seo td, article.seo th { padding: 4px 10px; border-bottom: 1px solid var(--grid); text-align: left; }
article.seo .crumbs { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
