/* STATWIRE spatial maps (Court Map siblings): /mlb/zone-map, /mlb/field-map, /nfl/pass-map, /nfl/run-map.
   Loaded after /assets/site.css. Script: /assets/spatial.js (data-page = zone | field | pass | run).
   Layout = /nba/court and the playoff maps: c8 interactive map card (team / side / metric dropdowns in the dark band,
   SVG, zone inspector, 5-step legend) + c4 league rankings (zone dropdown, Option #1 team-color bars), flush heights.
   /nfl/pass-map and /nfl/run-map are one c12 card (.sz-one): map across the full card width, inspector, legend, then
   the Team rankings section (#rankCard is a div inside the card there) in a 2-column grid from 960px. */
html[data-league="mlb"] { --accent: #C2410C; --accent2: #9A3412; }
html[data-league="nfl"] { --accent: #15803D; --accent2: #166534; }
.card[data-tone="ratings"] { --tone: #84CC16; }

/* 5-step heat palette vs. league average: the Court Map's Analytics (default) / Classic stops, set by SCHEMES in spatial.js */

/* ---------- map card ---------- */
#mapCard { display: flex; flex-direction: column; }
#mapCard > .note { margin: 0 0 8px; }
.sz-wrap { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; min-height: 280px; }
.sz-wrap > .empty { color: var(--muted); font-size: 13px; text-align: center; max-width: 420px; line-height: 1.5; }
.sz-wrap > .empty button { margin-top: 10px; }
.sz-svg { display: block; width: 100%; max-width: 680px; height: auto; font-family: var(--mono); user-select: none; -webkit-user-select: none; }
.sz-svg text { pointer-events: none; }
.sz-svg .z { cursor: pointer; outline: none; }
.sz-svg .z .zf { transition: opacity .15s; }
.sz-svg .z:hover .zf { opacity: .86; }
.sz-svg .z .zs { fill: none; stroke: transparent; stroke-width: 3; pointer-events: none; }
.sz-svg .z:focus-visible .zs { stroke: #0C0C11; stroke-dasharray: 3 3; }
.sz-svg .z.is-sel .zs { stroke: #84CC16; stroke-width: 3.5; }
.sz-svg .z.is-dim { opacity: .38; }
.sz-svg .v { font-weight: 800; text-anchor: middle; letter-spacing: -.02em; }
.sz-svg .s { font-weight: 700; text-anchor: middle; letter-spacing: .02em; }
.sz-svg .lab { font-weight: 800; text-anchor: middle; letter-spacing: .1em; fill: #6B6B76; }
.sz-svg .lab-d { fill: #0C0C11; }
.sz-cap { margin: 6px 0 0; text-align: center; font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.sz-cap:empty { display: none; }

/* ---------- zone inspector ---------- */
.sz-insp { margin-top: 10px; background: #FFFFFF; color: #111810; border-radius: 12px; padding: 10px 12px; border: 1px solid #CEDBC0; flex: 0 0 auto; }
.sz-insp:empty { display: none; }
.zi-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.zi-zone { font-family: var(--mono); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #0C0C11; background: #A3E635; padding: 2px 7px; border-radius: 5px; }
.zi-nm { font-size: 14.5px; font-weight: 800; }
.zi-heat { font-family: var(--mono); font-size: 9.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; }
.zi-rank { margin-left: auto; font-family: var(--mono); font-size: 11px; font-weight: 800; color: #3F6212; white-space: nowrap; }
.zi-rank small { color: #465343; font-weight: 600; }
.zi-kpis { margin: 9px 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.zi-kpis > div { background: #F5F8F1; border: 1px solid #E3ECDA; border-radius: 9px; padding: 6px 9px; min-width: 0; }
.zi-kpis dt { font-family: var(--mono); font-size: 9px; font-weight: 800; letter-spacing: .08em; color: #465343; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zi-kpis dd { margin: 2px 0 0; font-family: var(--mono); font-size: 16px; font-weight: 800; color: #111810; white-space: nowrap; }
.zi-kpis dd small { display: block; font-size: 9.5px; font-weight: 600; color: #465343; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zi-kpis dd.pos { color: #15803D; } .zi-kpis dd.neg { color: #B91C1C; }   /* 5.0:1 / 6.5:1 on #F5F8F1 */
.zi-raw { margin: 8px 0 0; font-family: var(--mono); font-size: 10.5px; color: #465343; line-height: 1.5; }
.zi-raw b { color: #111810; }
@media (max-width: 600px) { .zi-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .zi-rank { margin-left: 0; } }

/* legend */
.sz-legend { justify-content: center; align-items: center; }
.sz-legend i { width: 14px; height: 12px; border-radius: 3px; }
.sz-legend .lg-note { flex-basis: 100%; text-align: center; font-family: var(--mono); font-size: 10px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }

/* Analytics | Classic toggle under the legend: the /nba/court .seg control, scoped (site.css has its own .seg) */
.sz-seg { display: flex; justify-content: center; margin-top: 8px; }
.sz-seg .seg-opts { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.sz-seg button { display: flex; align-items: center; gap: 5px; min-height: 28px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; font: 700 10px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); cursor: pointer; white-space: nowrap; }
.sz-seg button:hover { color: var(--ink); background: #f1f1f5; }
.sz-seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.sz-seg button:focus-visible { outline: 2px solid #6D28D9; outline-offset: 1px; }
.sz-seg .chip { display: flex; width: 14px; height: 8px; border-radius: 2px; overflow: hidden; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.sz-seg .chip b { flex: 1; }

/* ---------- rankings card (Option #1 team-color bars) ---------- */
#rankCard .rows .row { grid-template-columns: 26px minmax(0, 1fr) 62px; gap: 8px; min-height: 44px; padding: 5px 4px; border-left: 3px solid transparent; }
#rankCard .row .n { font-size: 11.5px; font-weight: 800; color: #0C0C11; text-align: left; }
#rankCard .row .rk-mid { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
#rankCard .row .rk-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
#rankCard .row .rk-top .nm { font-size: 13px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#rankCard .row .rk-top small { margin-left: auto; flex: 0 0 auto; font-family: var(--mono); font-size: 9.5px; color: var(--muted); white-space: nowrap; }
#rankCard .row .rk-bar { height: 7px; border-radius: 4px; background: #EEF2EA; overflow: hidden; }
#rankCard .row .rk-bar i { display: block; height: 100%; border-radius: 4px; background: var(--tc); box-shadow: inset 0 0 0 1px rgba(12,12,17,.12); }
#rankCard .row .val { font-family: var(--mono); font-size: 13px; font-weight: 800; color: #0C0C11; }
#rankCard .row .val small { font-size: 9.5px; font-weight: 700; }
#rankCard .row .val small.pos { color: #15803D; } #rankCard .row .val small.neg { color: #DC2626; }
#rankCard .row.is-sel { background: #F7FEE7; border-left-color: #84CC16; }
#rankCard .rk-avg { list-style: none; display: flex; align-items: center; gap: 8px; padding: 4px 6px; margin: 2px 0; border-top: 2px dashed #9AA79A; border-bottom: 0;
  font-family: var(--mono); font-size: 9.5px; font-weight: 800; letter-spacing: .1em; color: #4D7C0F; text-transform: uppercase; cursor: default; min-height: 0; }
#rankCard .rk-avg b { margin-left: auto; color: #0C0C11; font-size: 11px; }
#rankCard > .note { margin: 0 0 8px; }

@media (max-width: 1099px) { #rankCard .rows { max-height: 640px; overflow-y: auto; } }

/* map band: three dropdowns. Below 760px the band grows to two lines (title, then the controls) */
@media (max-width: 759px) {
  #mapCard > .section-h { height: auto; min-height: 48px; flex-wrap: wrap; row-gap: 8px; padding-top: 10px; padding-bottom: 10px; }
  #mapCard > .section-h .sw-hd-ctrls { margin-left: 0; width: 100%; justify-content: flex-start; }
  #mapCard > .section-h .sw-hd-ctrls .sw-hd-sel { flex: 1 1 0; max-width: none; }
}

/* ---------- NFL single-card layout (.sz-one: /nfl/pass-map, /nfl/run-map) ---------- */
.card.sz-one { grid-column: 1 / -1; min-width: 0; }   /* site.css has no .c12 rule: span the whole layout grid */
.sz-one .sz-wrap { width: 100%; max-width: 100%; min-height: 240px; padding: 0; }
.sz-one .sz-svg.sz-wide { width: 100%; max-width: none; margin: 0; }
/* Strike Zone Map: fixed 560 x 548 drawing, centred, never wider than 580px (true proportions on every screen) */
.sz-svg.sz-zone, .sz-one .sz-svg.sz-zone { display: block; width: 100%; max-width: 580px; height: auto; margin: 0 auto; }
.sz-one .sz-rank { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); min-width: 0; }
.sz-rank-h { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin: 0 0 8px; }
.sz-rank-t { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; min-width: 0; }
.sz-rank-t h3 { margin: 0; font-family: var(--mono); font-size: 11px; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; color: #0C0C11; }
.sz-one #rankCard .sz-rank-t > .note { margin: 0; font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #465343; }
.sz-rank-sel { height: 30px; max-width: 220px; padding: 0 30px 0 12px; border: 1px solid #CEDBC0; border-radius: 999px; background: #FFFFFF url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%230C0C11' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 11px center;
  -webkit-appearance: none; appearance: none; font: 800 10.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: #0C0C11; cursor: pointer; }
.sz-rank-sel:hover, .sz-rank-sel:focus-visible { border-color: #84CC16; outline: none; box-shadow: 0 0 0 2px rgba(132, 204, 22, .25); }
.sz-one #rankCard .rows { height: auto; max-height: none; overflow: visible; }
@media (min-width: 960px) {
  /* column-major: ranks 1-16 down the left, the rest down the right; --rk-rows is set by rankings() */
  .sz-one #rankCard .rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(var(--rk-rows, 17), auto); grid-auto-flow: column; gap: 0 24px; align-content: start; }
}
@media (max-width: 1099px) { .sz-one #rankCard .rows { max-height: none; overflow: visible; } }
@media (max-width: 540px) { .sz-rank-sel { max-width: 100%; flex: 1 1 100%; } }
