/* MLB Research Hub — Pitcher Matchups grid (/mlb/research-hub/pitchers)
   Scoped under #mlb-pm-hub so nothing leaks. Mirrors mlb-weather-hub.css
   for consistency with the sibling section. */

#mlb-pm-hub {
  width: 100%;
  padding: 20px 20px 32px;
  box-sizing: border-box;
}

#mlb-pm-hub .pm-page {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

#mlb-pm-hub .pm-header { display: flex; flex-direction: column; gap: 4px; }
#mlb-pm-hub .pm-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.01em;
}
#mlb-pm-hub .pm-sub {
  font-size: .85rem;
  color: #94a3b8;
}

/* Hand-filter "tile" — occupies the first grid cell, same size as a
   card. Two chips inside take equal halves and stretch to full height
   so the images can breathe. Grid's default row-stretch keeps this
   tile height-synced to the card next to it. */
#mlb-pm-hub .pm-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  min-width: 0;
}
#mlb-pm-hub .pm-filter {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 6px;
  padding: 10px;
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, opacity 120ms ease, transform 120ms ease;
  opacity: 0.35;
  filter: grayscale(0.85);
  min-width: 0; min-height: 0;
  width: 100%; height: 100%;
}
#mlb-pm-hub .pm-filter:hover { transform: translateY(-1px); }
#mlb-pm-hub .pm-filter.is-active {
  opacity: 1;
  filter: none;
  background: rgba(34, 211, 238, .08);
  border-color: rgba(34, 211, 238, .35);
}
#mlb-pm-hub .pm-filter-img {
  /* Fill most of the tile — caps via max-* so very tall cards don't
     stretch the png past its natural aspect and pixelate it. */
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
  max-height: 260px;
  object-fit: contain;
  pointer-events: none;
}
#mlb-pm-hub .pm-filter-label {
  font-size: .78rem; font-weight: 700;
  letter-spacing: .8px;
  color: #cbd5e1;
}
#mlb-pm-hub .pm-filter.is-active .pm-filter-label { color: #f8fafc; }

/* Masonry layout via JS-distributed columns. The renderer round-robins
   cards into N <div class="pm-col"> wrappers (3/2/1 based on viewport
   width) so reading order stays row-first (cards 1,2,3 in the top row,
   then 4,5,6, etc.). Each column is its own flex stack — no balancing
   algorithm — so an expanded card only pushes the cards below it within
   the same column, leaving adjacent columns packed tight. */
#mlb-pm-hub .pm-grid {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
#mlb-pm-hub .pm-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;             /* allow flex children to shrink under content */
}
#mlb-pm-hub .pm-grid-loading { min-height: 120px; }

/* Card — outer shell. Two click zones inside (see below); the shell
   itself is not clickable, so no cursor here. */
#mlb-pm-hub .pm-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
  overflow: hidden;
  min-width: 0;
}

/* Two click zones: `pm-head` opens the game page, `pm-body` opens the
   pitcher's dashboard. Each gets its own hover treatment so users can
   see the split. */
#mlb-pm-hub .pm-card [data-pm-target] {
  cursor: pointer;
  transition: background 120ms ease;
}
#mlb-pm-hub .pm-card [data-pm-target]:hover {
  background: rgba(34, 211, 238, .05);
}
#mlb-pm-hub .pm-card [data-pm-target]:focus-visible {
  outline: 2px solid rgba(34, 211, 238, .5);
  outline-offset: -2px;
}
#mlb-pm-hub .pm-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 18px 18px;
}

/* Head: matchup + time */
#mlb-pm-hub .pm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
#mlb-pm-hub .pm-matchup {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #f8fafc;
  font-size: .92rem;
}
#mlb-pm-hub .pm-team-logo { width: 22px; height: 22px; object-fit: contain; }
#mlb-pm-hub .pm-code      { letter-spacing: .02em; }
#mlb-pm-hub .pm-code-own  { color: #f8fafc; }
#mlb-pm-hub .pm-vs        { color: #64748b; font-weight: 600; font-size: .8rem; }
#mlb-pm-hub .pm-time {
  font-size: .78rem; color: #94a3b8; font-weight: 600; letter-spacing: .3px;
}

/* Name + chips + avatar */
#mlb-pm-hub .pm-name-row {
  display: flex; align-items: center;
  gap: 10px;
}
#mlb-pm-hub .pm-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover; object-position: top center;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
  display: block;
}
#mlb-pm-hub .pm-avatar.is-fallback {
  object-fit: contain; padding: 4px; background: rgba(255,255,255,.04);
}
/* Avatar wrapper — positions the team-logo badge over the headshot.
   Only used when a real headshot is rendered (see pitcherMatchupsHub.js). */
#mlb-pm-hub .pm-avatar-wrap {
  position: relative;
  width: 44px; height: 44px;
  flex-shrink: 0;
  display: inline-block;
}
#mlb-pm-hub .pm-avatar-team-badge {
  position: absolute;
  right: -2px; bottom: -2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #0b1220;
  padding: 2px;
  box-sizing: border-box;
  object-fit: contain;
  border: 1px solid rgba(255,255,255,.12);
  pointer-events: none;
}
/* Hide the badge if the headshot itself fell back to the team logo
   (the onerror handler on pm-avatar adds `is-fallback` to the wrapper).
   Avoids showing the same team crest twice side-by-side. */
#mlb-pm-hub .pm-avatar-wrap.is-fallback .pm-avatar-team-badge { display: none; }
#mlb-pm-hub .pm-avatar-wrap.is-fallback .pm-avatar {
  object-fit: contain; padding: 4px; background: rgba(255,255,255,.04);
}
#mlb-pm-hub .pm-name-col {
  display: flex; flex-direction: column; gap: 4px;
  min-width: 0; flex: 1;
}
#mlb-pm-hub .pm-name {
  font-size: 1.05rem; font-weight: 700; color: #f1f5f9;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#mlb-pm-hub .pm-chips { display: flex; gap: 6px; flex-wrap: wrap; }
#mlb-pm-hub .pm-hand,
#mlb-pm-hub .pm-sample {
  font-size: .65rem; font-weight: 700; letter-spacing: .5px;
  padding: 2px 7px; border-radius: 999px;
  background: rgba(148,163,184,.10); color: #cbd5e1;
  border: 1px solid rgba(255,255,255,.06);
}
/* Hand-color variants — same hex values as the in-drawer batter
   chips so handedness reads the same across both pills. */
#mlb-pm-hub .pm-hand-l { background: rgba(79,143,247,.18);  color: #7dd3fc; }
#mlb-pm-hub .pm-hand-r { background: rgba(239,68,68,.18);   color: #fca5a5; }
#mlb-pm-hub .pm-hand-s { background: rgba(168,85,247,.18);  color: #d8b4fe; }

/* Score + tier row */
#mlb-pm-hub .pm-score-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
#mlb-pm-hub .pm-tier {
  font-size: .72rem; font-weight: 700; letter-spacing: .6px;
  padding: 4px 10px; border-radius: 999px;
  text-transform: uppercase;
}
#mlb-pm-hub .pm-tier-elite   { background: rgba(34,197,94,.22);  color: #bbf7d0; border: 1px solid rgba(34,197,94,.45); }
#mlb-pm-hub .pm-tier-target  { background: rgba(34,197,94,.12);  color: #d9f99d; border: 1px solid rgba(34,197,94,.28); }
#mlb-pm-hub .pm-tier-neutral { background: rgba(148,163,184,.10); color: #cbd5e1; border: 1px solid rgba(255,255,255,.08); }
#mlb-pm-hub .pm-tier-tough   { background: rgba(239,68,68,.18);  color: #fca5a5; border: 1px solid rgba(239,68,68,.35); }
#mlb-pm-hub .pm-tier-unknown { background: rgba(148,163,184,.06); color: #64748b; border: 1px solid rgba(255,255,255,.04); }

#mlb-pm-hub .pm-score { display: flex; align-items: baseline; gap: 5px; }
#mlb-pm-hub .pm-score-label {
  font-size: .62rem; letter-spacing: .8px; font-weight: 700; color: #64748b;
}
#mlb-pm-hub .pm-score-val {
  font-size: 1.1rem; font-weight: 700; color: #f8fafc;
}

/* 4 stat cells */
#mlb-pm-hub .pm-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
#mlb-pm-hub .pm-stat {
  background: rgba(148,163,184,.04);
  border: 1px solid rgba(255,255,255,.04);
  border-radius: 8px;
  padding: 8px 6px;
  text-align: center;
}
#mlb-pm-hub .pm-stat-label {
  font-size: .62rem; letter-spacing: .8px; font-weight: 700;
  color: #64748b; text-transform: uppercase;
  margin-bottom: 4px;
}
#mlb-pm-hub .pm-stat-val {
  font-size: 1rem; font-weight: 700; color: #e2e8f0;
}

/* vsLHB / vsRHB sub-grid under each stat value. Horizontal divider
   above it separates the season number from the splits; vertical
   divider between the two columns. */
#mlb-pm-hub .pm-stat-splits {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: grid;
  grid-template-columns: 1fr 1fr;
}
#mlb-pm-hub .pm-stat-split {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 0 4px;
}
#mlb-pm-hub .pm-stat-split + .pm-stat-split {
  border-left: 1px solid rgba(255,255,255,.08);
}
#mlb-pm-hub .pm-stat-split-val {
  font-size: .8rem; font-weight: 700; color: #e2e8f0;
  letter-spacing: .2px;
}
#mlb-pm-hub .pm-stat-split-label {
  font-size: .58rem; font-weight: 700; color: #64748b;
  letter-spacing: .3px;
}

/* Stat tier colors — green = more hittable, red = tougher */
#mlb-pm-hub .pm-green-3 { color: #bbf7d0; }
#mlb-pm-hub .pm-green-2 { color: #d9f99d; }
#mlb-pm-hub .pm-green-1 { color: #ecfccb; }
#mlb-pm-hub .pm-red-2   { color: #fca5a5; }
#mlb-pm-hub .pm-red-3   { color: #fecaca; }

/* Expandable opposing-lineup drawer (replaces the old ERA/IP/TBF foot). */
#mlb-pm-hub .pm-batters-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  padding: 11px 18px;
  background: rgba(255,255,255,.02);
  border: none;
  border-top: 1px solid rgba(255,255,255,.06);
  color: #cbd5e1;
  font-size: .78rem; font-weight: 600;
  letter-spacing: .3px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
#mlb-pm-hub .pm-batters-toggle:hover {
  background: rgba(34, 211, 238, .08);
  color: #f1f5f9;
}
#mlb-pm-hub .pm-batters-caret {
  font-size: .7rem; color: #64748b;
  transition: transform 150ms ease, color 120ms ease;
}
#mlb-pm-hub .pm-batters-toggle[aria-expanded="true"] .pm-batters-caret {
  transform: rotate(180deg);
  color: #cbd5e1;
}
#mlb-pm-hub .pm-batters-toggle[aria-expanded="true"] {
  background: rgba(34, 211, 238, .06);
  color: #f1f5f9;
}

#mlb-pm-hub .pm-batters {
  padding: 4px 12px 12px;
  background: rgba(0,0,0,.14);
  border-top: 1px solid rgba(255,255,255,.04);
}

/* Season / vs-SP-hand toggle above the lineup table */
#mlb-pm-hub .pm-batters-toolbar {
  display: flex; gap: 6px;
  padding: 8px 4px 4px;
}
#mlb-pm-hub .pm-batters-pill {
  padding: 4px 12px;
  background: rgba(148,163,184,.06);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 999px;
  color: #94a3b8;
  font-size: .68rem; font-weight: 700;
  letter-spacing: .3px;
  cursor: pointer;
  transition: color 120ms ease, background 120ms ease, border-color 120ms ease;
}
#mlb-pm-hub .pm-batters-pill:hover {
  color: #cbd5e1;
  border-color: rgba(255,255,255,.14);
}
#mlb-pm-hub .pm-batters-pill.is-active {
  color: #f8fafc;
  background: rgba(34, 211, 238, .12);
  border-color: rgba(34, 211, 238, .40);
}
#mlb-pm-hub .pm-batters-loading,
#mlb-pm-hub .pm-batters-empty {
  padding: 18px 8px; text-align: center;
  color: #64748b; font-size: .78rem; font-style: italic;
}

#mlb-pm-hub .pm-batters-table {
  width: 100%; border-collapse: collapse;
  font-size: .74rem;
}
#mlb-pm-hub .pm-batters-table th {
  text-align: right;
  padding: 6px 6px 8px;
  font-size: .6rem; font-weight: 700; letter-spacing: .5px;
  color: #64748b; text-transform: uppercase;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
#mlb-pm-hub .pm-batters-table th.pm-b-col-name,
#mlb-pm-hub .pm-batters-table td.pm-b-name { text-align: left; }
/* Ghost column for the hand chip — fixed width, no header label, so
   the chips line up vertically across rows regardless of name length. */
#mlb-pm-hub .pm-batters-table th.pm-b-hand-col,
#mlb-pm-hub .pm-batters-table td.pm-b-hand-col {
  width: 44px;
  text-align: left;
  padding-left: 0;
  padding-right: 6px;
}
#mlb-pm-hub .pm-batters-table td {
  padding: 6px 6px;
  border-bottom: 1px solid rgba(255,255,255,.03);
  color: #e2e8f0;
}
#mlb-pm-hub .pm-batters-table tbody tr:last-child td { border-bottom: none; }

#mlb-pm-hub .pm-b-name {
  color: #f1f5f9; font-weight: 600;
  /* Stacked first/last name now lives inside .pm-b-name-cell, so the
     cell itself doesn't ellipsis. The stack handles overflow per line. */
}
#mlb-pm-hub .pm-b-name-cell {
  display: flex; align-items: center; gap: 8px;
  min-width: 0;
}
#mlb-pm-hub .pm-b-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  background: rgba(148,163,184,.12);
  border: 1px solid rgba(255,255,255,.06);
}
#mlb-pm-hub .pm-b-avatar.is-fallback {
  /* Quiet circular placeholder when no headshot resolves. */
  background: rgba(148,163,184,.10);
}
#mlb-pm-hub .pm-b-name-stack {
  display: inline-flex; flex-direction: column;
  line-height: 1.1;
  min-width: 0;
}
#mlb-pm-hub .pm-b-name-first {
  font-size: .72rem; font-weight: 500;
  color: #94a3b8;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#mlb-pm-hub .pm-b-name-last {
  font-size: .85rem; font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#mlb-pm-hub .pm-b-link {
  color: inherit; text-decoration: none;
  transition: color 120ms ease;
  cursor: pointer;
}
#mlb-pm-hub .pm-b-link:hover {
  color: #22d3ee;
  text-decoration: underline;
  text-underline-offset: 2px;
}
#mlb-pm-hub .pm-b-stat {
  text-align: right; font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Tier colors inside the batters table. The base `#mlb-pm-hub
   .pm-batters-table td { color: #e2e8f0 }` rule has higher specificity
   than the generic `.pm-green-*` classes, so we re-declare them with
   the `.pm-b-stat.<tier>` compound selector to win the cascade. */
#mlb-pm-hub .pm-batters-table .pm-b-stat.pm-green-3 { color: #86efac; font-weight: 700; }
#mlb-pm-hub .pm-batters-table .pm-b-stat.pm-green-2 { color: #a7f3d0; }
#mlb-pm-hub .pm-batters-table .pm-b-stat.pm-green-1 { color: #d9f99d; }
#mlb-pm-hub .pm-batters-table .pm-b-stat.pm-red-2   { color: #fca5a5; }
#mlb-pm-hub .pm-batters-table .pm-b-stat.pm-red-3   { color: #f87171; font-weight: 700; }
#mlb-pm-hub .pm-b-hand {
  display: inline-block;
  margin-left: 6px;
  font-size: .55rem; font-weight: 700;
  letter-spacing: .4px;
  padding: 1px 5px; border-radius: 3px;
  vertical-align: middle;
}
#mlb-pm-hub .pm-b-hand-l { background: rgba(79,143,247,.18);  color: #7dd3fc; }
#mlb-pm-hub .pm-b-hand-r { background: rgba(239,68,68,.18);   color: #fca5a5; }
#mlb-pm-hub .pm-b-hand-s { background: rgba(168,85,247,.18);  color: #d8b4fe; }

#mlb-pm-hub .pm-empty {
  flex: 1;                  /* span the full row inside .pm-grid (a flex container) */
  padding: 48px 24px; text-align: center;
  color: #64748b; font-style: italic;
  border: 1px dashed rgba(255,255,255,.08);
  border-radius: 12px;
}

/* Responsive — column count handled in JS (pickColumnCount) so the
   round-robin distribution stays consistent with what's on screen. */
