/**
 * Player profile pages — design contract alignment (styling only).
 * Pitcher, Batter, Reliever, Bullpen Profile + shared profile patterns.
 */
/* Pitcher Profile — inherit Team Profile section shell when body has team-profile-page */
body.pitcher-profile-page.team-profile-page .tp-identity-stack {
  display: flex;
  flex-direction: column;
  gap: var(--tp-section-gap, 12px);
}

body.pitcher-profile-page.team-profile-page .tp-lineup-context-bar:not(:empty) {
  margin-bottom: var(--tp-header-gap, 12px);
}

body.pitcher-profile-page.team-profile-page .pp-intel-section .pp-intel-panel__metrics {
  margin-top: 0;
}

body.pitcher-profile-page.team-profile-page {
  --tp-stat-chip-size: 18px;
  --tp-stat-label-size: 11px;
}

body.pitcher-profile-page.team-profile-page .profile-deep-sections {
  display: flex;
  flex-direction: column;
  gap: var(--tp-section-gap, 12px);
}

body.player-profile-page {
  font-family: var(--sans, var(--font-body, system-ui));
  font-variant-numeric: tabular-nums;
  --tp-helper-size: 12px;
  --tp-band-title-size: 12px;
  --tp-band-hint-size: 11px;
  --tp-note-size: 12px;
  --tp-desc-color: #C4CBD6;
  --tp-note-color: #B8C0CC;
  --tp-header-gap: 12px;
  --tp-band-pad-y: 14px;
  --tp-band-pad-x: 16px;
  --tp-band-pad-bottom: 16px;
}

body.player-profile-page .container {
  max-width: 1400px;
  padding: 20px 24px 72px;
}

/* Page header — editorial, not marketing gradient */
body.player-profile-page .header {
  margin-bottom: 20px;
}

body.player-profile-page .header h1,
body.player-profile-page h1.page-title {
  color: var(--text) !important;
  -webkit-text-fill-color: var(--text) !important;
  background: none !important;
  background-clip: border-box !important;
  font-family: var(--display, var(--font-display));
  font-weight: 800;
  font-size: clamp(20px, 2.2vw, 24px);
  letter-spacing: -0.015em;
  line-height: 1.15;
}

body.player-profile-page .brand-tag {
  color: var(--v-light, var(--purple));
  font-weight: 700;
  letter-spacing: 0.12em;
}

body.player-profile-page .subtitle {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-2);
  max-width: 680px;
}

/* Legacy .section boards — ca-board.tp-section uses team_profile.css when team-profile-page is on body */
body.player-profile-page .section:not(.ca-board) {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), transparent 28%),
    linear-gradient(180deg, var(--ca-panel-solid, #10131F) 0%, var(--ca-panel-solid-2, #070912) 100%);
  border: 1px solid rgba(154, 107, 255, 0.35);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.48);
}

body.player-profile-page .section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--v-grad, linear-gradient(135deg, #9A6BFF 0%, #5B2BE0 100%));
  pointer-events: none;
}

body.player-profile-page .section-eyebrow {
  color: var(--v-light, var(--purple));
  font-weight: 700;
}

body.player-profile-page .section-title {
  font-family: var(--display, var(--font-display));
  font-weight: 800;
  font-size: 14px !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
  padding-top: 0;
  color: var(--text-1, #F3F4F6);
  text-align: left;
}

body.player-profile-page .section-subtitle {
  font-size: 12px !important;
  font-weight: 500 !important;
  line-height: 1.5;
  color: var(--tp-desc-color, #C4CBD6);
  margin-bottom: 10px;
  text-align: left;
  max-width: none;
}

/* Snapshot / header panels */
body.player-profile-page .pitcher-snapshot,
body.player-profile-page .player-header-panel,
body.player-profile-page .player-header {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.082), transparent 28%),
    linear-gradient(135deg, #181A2A 0%, #0B0E18 58%, #05060C 100%);
  border: 2px solid var(--ca-panel-border, rgba(154, 107, 255, 0.58));
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--ca-glow-violet-strong, 0 34px 96px rgba(0,0,0,0.9));
}

body.player-profile-page .pitcher-snapshot::before,
body.player-profile-page .player-header-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--v-grad);
  pointer-events: none;
}

body.player-profile-page .ps-name,
body.player-profile-page .player-name-lg,
body.player-profile-page .team-name-lg {
  font-family: var(--display, var(--font-display));
  font-weight: 800;
  letter-spacing: -0.015em;
}

/* Controls */
body.player-profile-page .selector-bar {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), transparent 30%),
    linear-gradient(180deg, #151827, #080A13);
  border: 1.5px solid rgba(196, 176, 255, 0.24);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

body.player-profile-page .window-pill {
  font-weight: 600;
  border-radius: 8px;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

body.player-profile-page .window-pill.active {
  background: var(--v-bg, rgba(124, 77, 255, 0.16));
  border-color: var(--v, var(--purple));
  color: var(--v-light, var(--text));
}

body.player-profile-page .window-pill:hover:not(.active) {
  border-color: color-mix(in srgb, var(--v) 35%, var(--border));
  color: var(--text);
}

/* Metric tiles */
body.player-profile-page .stat-cell,
body.player-profile-page .metric-card,
body.player-profile-page .hand-panel,
body.player-profile-page .loc-panel,
body.player-profile-page .split-panel {
  background: rgba(0, 0, 0, 0.12);
  border: none;
  border-radius: 8px;
  box-shadow: none;
}

body.player-profile-page .metric-card::before {
  background: var(--v-grad);
  height: 3px;
  opacity: 1;
}

body.player-profile-page .metric-card .m-val,
body.player-profile-page .stat-cell .s-val,
body.player-profile-page .mini-stat .ms-val {
  font-family: var(--display, var(--mono));
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

body.player-profile-page .metric-card .m-val {
  font-size: 18px !important;
}

body.player-profile-page .stat-cell .s-val {
  font-size: 16px !important;
}

body.player-profile-page .mini-stat .ms-val {
  font-size: 14px !important;
}

body.player-profile-page .player-name-lg {
  font-size: 20px !important;
}

body.player-profile-page .hand-panel h4,
body.player-profile-page .loc-panel h4 {
  color: var(--text);
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 11px;
}

/* Tables */
body.player-profile-page .table-wrap {
  border-radius: 0;
  border: none;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

body.player-profile-page thead th {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-3);
  background: transparent;
  font-size: 10px !important;
}

/* Compact headers on legacy profile panels — not pp-profile-table data grids */
body.player-profile-page:not(.pitcher-profile-page) thead th,
body.player-profile-page .hand-panel thead th,
body.player-profile-page .loc-panel thead th {
  font-size: 10px;
}

body.player-profile-page tbody tr:hover {
  background: rgba(124, 77, 255, 0.08);
}

body.player-profile-page tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--v, #9A6BFF);
}

body.player-profile-page .num {
  font-variant-numeric: tabular-nums;
}

/* Insight / analyst rails (§7.6) */
body.player-profile-page .insight-line,
body.player-profile-page .betting-panel {
  border-left: 3px solid var(--v, var(--purple));
  background:
    linear-gradient(180deg, rgba(255,255,255,0.052), transparent 28%),
    linear-gradient(180deg, #151827, #080A13);
  border-radius: 0 12px 12px 0;
}

body.player-profile-page .betting-panel {
  border: 1px solid var(--border-violet, rgba(124, 77, 255, 0.35));
  border-left-width: 3px;
  border-left-color: var(--v);
}

body.player-profile-page .betting-panel strong {
  color: var(--text);
}

body.player-profile-page .ca-insight-rail .ca-insight-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05), transparent 30%),
    linear-gradient(180deg, #141726, #080A13);
  border: 1px solid rgba(196, 176, 255, 0.20);
  margin-bottom: 8px;
}

body.player-profile-page .ca-insight-label {
  display: block;
  font-family: var(--display);
  font-weight: 800;
  font-size: var(--tp-band-title-size, 14px);
  color: var(--text-1, #F3F4F6);
  margin-bottom: 4px;
}

body.player-profile-page .ca-insight-text {
  display: block;
  font-size: var(--tp-helper-size, 15px);
  line-height: 1.55;
  color: var(--tp-desc-color, #C4CBD6);
}

/* Tier pills — semantic scale only */
body.player-profile-page .tier-ace { color: var(--d-elite, var(--green)); }
body.player-profile-page .tier-solid { color: var(--d-good, var(--blue-l)); }
body.player-profile-page .tier-avg { color: var(--d-mid, var(--gold)); }
body.player-profile-page .tier-vol { color: var(--d-poor, var(--red-l)); }

body.player-profile-page .tier-high { color: var(--d-poor, var(--red-l)); }
body.player-profile-page .tier-mid { color: var(--d-mid, var(--gold)); }
body.player-profile-page .tier-low { color: var(--d-elite, var(--green-l)); }

/* Chips from shared helpers */
body.player-profile-page .comp-row a {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

body.player-profile-page .comp-row a:hover {
  color: var(--v-light, var(--purple));
  text-decoration: underline;
}

body.player-profile-page .chip {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Flat inline metric rows — pitcher intel panel (band layout in team_profile_lineup_ui.css) */
body.player-profile-page {
  --pp-stat-label-size: 12.5px;
  --pp-stat-label-color: #C8D0DC;
  --pp-stat-chip-size: 15px;
}

body.player-profile-page .pp-intel-panel {
  margin-bottom: 0;
  padding: 14px 16px 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.072), transparent 28%),
    linear-gradient(180deg, var(--ca-panel-solid, #10131F) 0%, var(--ca-panel-solid-2, #070912) 100%);
  border: 1.5px solid var(--ca-panel-border, rgba(154, 107, 255, 0.58));
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--ca-glow-violet, 0 28px 78px rgba(0,0,0,0.78));
}

body.player-profile-page .pp-intel-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--purple, #7C4DFF), transparent 70%);
  pointer-events: none;
}

body.player-profile-page .pp-intel-panel .ca-section-header {
  margin-bottom: 12px;
}

body.player-profile-page .pp-intel-panel__metrics {
  margin-top: 0;
}

body.player-profile-page .pp-stat-hint {
  font-size: var(--tp-note-size, 14px);
  line-height: 1.45;
  color: var(--tp-note-color, #B8C0CC);
  white-space: normal;
}

body.player-profile-page .pp-intel-follow:not(:empty) {
  margin: -8px 0 0;
  padding: 0 16px 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.052), transparent 30%),
    linear-gradient(180deg, #10131F, #06070D);
  border: 1.5px solid var(--ca-panel-border, rgba(154, 107, 255, 0.58));
  border-top: none;
  border-radius: 0 0 16px 16px;
}

body.player-profile-page .pp-intel-follow:not(:empty) + .section,
body.player-profile-page .pp-intel-follow:not(:empty) + .profile-section {
  margin-top: 14px;
}

body.player-profile-page #pitcherIntelPanel:not(:empty) + .pp-intel-follow:not(:empty) {
  margin-top: -14px;
}

body.player-profile-page .pp-intel-section #pitcherIntelPanel:not(:empty) {
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 0;
}

body.player-profile-page .pp-intel-section #pitcherIntelPanel:not(:empty)::before {
  display: none;
}

body.player-profile-page #pitcherIntelPanel:not(:empty) + .pp-intel-follow:empty {
  display: none;
}

@media (max-width: 767px) {
  body.player-profile-page .container {
    padding: 12px 12px 48px;
  }

  body.player-profile-page .tp-offense-metrics__row--inline {
    gap: 8px 12px;
    flex-wrap: wrap;
  }

  body.player-profile-page .metric-grid,
  body.player-profile-page .stat-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body.player-profile-page .pp-hero-banner-shell {
    border-radius: 12px;
  }

  body.player-profile-page .tp-pitcher-banner__inner {
    align-items: center;
  }

  body.player-profile-page h1.page-title,
  body.player-profile-page .header h1 {
    font-size: clamp(1.2rem, 5.5vw, 1.5rem);
  }
}

@media (max-width: 479px) {
  body.player-profile-page .metric-grid,
  body.player-profile-page .stat-bar {
    grid-template-columns: 1fr;
  }

  body.player-profile-page .hand-grid,
  body.player-profile-page .loc-grid {
    grid-template-columns: 1fr;
  }
}
