/* NBA MVP Race — self-contained, no external fonts or libraries */
:root {
  --bg: #0a0c10;
  --bg-elev: #12161e;
  --bg-elev-2: #181d27;
  --bg-row: #141822;
  --bg-row-alt: #10141c;
  --bg-sticky: #1a2030;
  --line: #2a3140;
  --line-soft: #222834;
  --text: #e9edf3;
  --muted: #8b95a8;
  --faint: #6a7384;
  --gold: #e4b54a;
  --gold-dim: #b8892a;
  --gold-soft: rgba(228, 181, 74, 0.14);
  --blue: #7eb6ff;
  --green: #3ecf8e;
  --red: #ff6b6b;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --max: 1280px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(228, 181, 74, 0.08), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(126, 182, 255, 0.06), transparent 50%),
    var(--bg);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
}

/* Header */
.site-header {
  padding: 2.25rem 0 1.5rem;
  border-bottom: 1px solid var(--line-soft);
}

.kicker {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
  margin: 0 0 0.55rem;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 0.4rem;
  font-weight: 700;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.15rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.chip strong {
  color: var(--text);
  font-weight: 650;
}

/* Leader card */
.leader {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 1.5rem 0 0;
}

@media (min-width: 720px) {
  .leader { grid-template-columns: 1.1fr 0.9fr; }
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem 1.25rem;
  box-shadow: var(--shadow);
}

.leader-card {
  background:
    linear-gradient(135deg, var(--gold-soft), transparent 42%),
    var(--bg-elev);
}

.leader-label {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
  margin: 0 0 0.35rem;
}

.leader-name {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0;
}

.leader-team {
  color: var(--muted);
  margin: 0.15rem 0 0.85rem;
}

.leader-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
}

.stat-block .n {
  font-variant-numeric: tabular-nums;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stat-block .l {
  display: block;
  font-size: 0.72rem;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.formula h2,
.category h2 {
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.45rem;
}

.formula p,
.note, .category .lede {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.formula {
  margin-top: 0;
}

.weights {
  margin: 0.85rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.35rem 0.75rem;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.weights li span {
  color: var(--gold);
  font-weight: 700;
  margin-right: 0.3rem;
}

/* Sticky nav */
.toc-wrap {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 12, 16, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
  margin: 1.5rem 0 0;
}

.toc {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.7rem 0;
  scrollbar-width: thin;
}

.toc a {
  flex: 0 0 auto;
  color: var(--text);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 650;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
}

.toc a:hover {
  border-color: var(--gold-dim);
  color: var(--gold);
  text-decoration: none;
}

/* Sections */
.category {
  margin: 2rem 0;
}

.category header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  margin-bottom: 0.7rem;
}

/* Tables */
.table-wrap {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

#table-mvp {
  min-width: 1340px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-sticky);
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  text-align: right;
  padding: 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

thead th:first-child,
thead th.col-player,
thead th.col-team {
  text-align: left;
}

thead th button {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  font-weight: inherit;
  width: 100%;
  padding: 0.62rem 0.48rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.3rem;
  text-align: inherit;
}

thead th:first-child button,
thead th.col-player button,
thead th.col-team button {
  justify-content: flex-start;
}

thead th button:hover,
thead th button:focus-visible {
  color: var(--gold);
  outline: none;
}

th[aria-sort="ascending"] button,
th[aria-sort="descending"] button {
  color: var(--gold);
}

.sort-ind {
  font-size: 0.7rem;
  opacity: 0.35;
  line-height: 1;
}

th[aria-sort] .sort-ind { opacity: 1; color: var(--gold); }

tbody td {
  padding: 0.55rem 0.48rem;
  text-align: right;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}

tbody tr:last-child td { border-bottom: 0; }

tbody tr:nth-child(odd) td { background: var(--bg-row); }
tbody tr:nth-child(even) td { background: var(--bg-row-alt); }

tbody tr:hover td { background: #1c2433; }

td.col-player, th.col-player { text-align: left; font-weight: 650; }
td.col-team, th.col-team { text-align: left; color: var(--muted); }

td.col-rank, th.col-rank { text-align: left; width: 3.2rem; }

td.col-rank {
  font-weight: 700;
  color: var(--muted);
}

tr[data-orig-rank="1"] td.col-rank { color: var(--gold); }
tr[data-orig-rank="2"] td.col-rank,
tr[data-orig-rank="3"] td.col-rank { color: #d8d8d8; }

td.col-player {
  position: sticky;
  left: 0;
  z-index: 1;
  box-shadow: 6px 0 8px -6px rgba(0,0,0,0.45);
}

thead th.col-player {
  position: sticky;
  left: 0;
  z-index: 3;
}

.pos { color: var(--green); }
.neg { color: var(--red); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

footer {
  border-top: 1px solid var(--line-soft);
  padding: 2rem 0 3rem;
  color: var(--faint);
  font-size: 0.82rem;
}

footer p { margin: 0 0 0.6rem; }

.caveats {
  margin: 2rem 0;
}

.caveats ul {
  margin: 0.5rem 0 0;
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.caveats li { margin: 0.3rem 0; }


.table-toggle-wrap {
  display: flex;
  justify-content: center;
  margin-top: 0.85rem;
}

.table-toggle {
  appearance: none;
  background: var(--gold-soft);
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  border-radius: 999px;
  padding: 0.5rem 1.2rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.table-toggle:hover,
.table-toggle:focus-visible {
  border-color: var(--gold);
  background: rgba(228, 181, 74, 0.22);
  color: var(--text);
  outline: none;
}

#table-mvp[data-row-limit="10"]:not([data-expanded]) tbody tr:nth-child(n+11) {
  display: none;
}


#table-history {
  min-width: 820px;
}

#table-history tr.is-match td {
  background: rgba(228, 181, 74, 0.10);
}

#table-history tr.is-match:nth-child(even) td {
  background: rgba(228, 181, 74, 0.07);
}

#table-history tr.is-match:hover td {
  background: rgba(228, 181, 74, 0.18);
}

#table-history td.is-match-cell::after {
  content: " \2713";
  color: var(--gold);
  font-weight: 700;
}

.history-legend {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.history-legend .swatch {
  color: var(--gold);
  font-weight: 700;
  margin-right: 0.2rem;
}

@media (max-width: 600px) {
  .wrap { width: min(var(--max), calc(100% - 20px)); }
  table { font-size: 0.8rem; }
  #table-mvp { min-width: 1200px; }
  #table-history { min-width: 720px; }
  thead th button, tbody td { padding-left: 0.45rem; padding-right: 0.45rem; }
}
