/* Profile: player and club headers, percentile bars, charts, career.
 *
 * The header keeps the club's two-colour stripe and its faded logo. The
 * rating is a large figure in its step's dark colour with its chip under it.
 */

.pview { position: relative; flex: 1; min-height: 0; }

/* =============================================================== header === */

.prof-head {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: var(--sp-6);
  padding-top: var(--sp-8); border-bottom: 1px solid var(--line);
}
/* the stripe: the club's first colour, then a sliver of its second */
.prof-head .band { flex: none; align-self: stretch; width: 6px; border-radius: 3px 0 0 3px; background: var(--club); }
.prof-head .band2 { flex: none; align-self: stretch; width: 3px; margin-left: calc(-1 * var(--sp-6)); border-radius: 0 3px 3px 0; background: var(--club2); }
.prof-head .wmk { position: absolute; right: 250px; top: 50%; width: 320px; transform: translateY(-58%); opacity: .07; pointer-events: none; }
.bighs {
  width: 120px; height: 120px; flex: none; border-radius: 50%;
  background: color-mix(in srgb, var(--club) 14%, var(--paper)); object-fit: cover; object-position: top;
}
div.bighs, span.bighs { display: inline-flex; align-items: center; justify-content: center; color: var(--sub); font: 600 var(--fs-3xl)/1 var(--sans); }
/* the fallback's inline-flex would beat the built-in [hidden] rule */
.bighs[hidden] { display: none; }
.club-head .club-logo { width: 104px; height: 104px; flex: none; object-fit: contain; }
.club-head span.club-logo-fb {
  display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
  background: var(--club); color: var(--paper); box-shadow: inset 0 0 0 4px var(--club2);
  font: 700 var(--fs-2xl)/1 var(--sans);
}

.pmeta { position: relative; flex: 1; min-width: 0; }
.pmeta .crumbs { flex-wrap: wrap; margin-bottom: var(--sp-1); }
.pmeta h1 { margin: 2px 0 0; font-size: var(--fs-4xl); font-weight: 600; line-height: 1.06; letter-spacing: var(--tight); }
.facts { display: flex; flex-wrap: wrap; row-gap: var(--sp-3); margin-top: var(--sp-4); }
.facts > div { margin: 0; padding: 0 var(--sp-5); border-left: 1px solid var(--line); white-space: nowrap; }
.facts > div:first-child { padding-left: 0; border-left: 0; }
.facts dt { font-size: var(--fs-2xs); color: var(--sub); }
.facts dd { margin: 2px 0 0; }
.facts b { display: block; color: var(--ink); font-size: var(--fs-lg); font-weight: 600; letter-spacing: var(--snug); }
/* the header's own rule carries the section tabs */
.pmeta .sub-tabs { margin-top: var(--sp-6); border-bottom: 0; }

.score { position: relative; flex: none; align-self: flex-start; min-width: 200px; padding-bottom: var(--sp-5); text-align: right; }
.score-lab { margin-bottom: 2px; color: var(--sub); font-size: var(--fs-sm); }
.score .box { display: flex; flex-direction: column; align-items: flex-end; gap: var(--sp-2); }
.score .box b { font-size: 68px; line-height: 1; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--ink); }
.score .box b.score-held { font-size: var(--fs-xl); letter-spacing: 0; }
.score .box .score-sub {
  display: inline-block; padding: 2px var(--sp-2); border-radius: var(--r-sm);
  background: var(--fill); color: var(--sub); font-size: var(--fs-2xs); font-weight: 600;
}
.score .box.elite b { color: var(--t-elite); }
.score .box.high b { color: var(--t-high-ink); }
.score .box.avg b { color: var(--t-avg-ink); }
.score .box.below b { color: var(--t-below-ink); }
.score .box.poor b { color: var(--t-poor-ink); }
.score .box.tier-none b { color: var(--sub); }
.score .box.elite .score-sub { background: var(--t-elite); color: var(--t-elite-ink); }
.score .box.high .score-sub { background: var(--t-high-bg); color: var(--t-high-ink); }
.score .box.avg .score-sub { background: var(--t-avg-bg); color: var(--t-avg-ink); }
.score .box.below .score-sub { background: var(--t-below-bg); color: var(--t-below-ink); }
.score .box.poor .score-sub { background: var(--t-poor-bg); color: var(--t-poor-ink); }
.score-ci { margin-top: 6px; color: var(--sub); font-size: var(--fs-xs); }
/* the main action sits at the right edge, the second one beside it */
.score-act { display: flex; flex-direction: row-reverse; justify-content: flex-start; gap: var(--sp-2); margin-top: var(--sp-4); }
/* the header clips at its edge (for the faded logo), where these buttons sit:
   their ring is drawn inside */
.score-act .btn:focus-visible { outline-offset: -4px; }

/* ================================================================= body === */

.grid3 { display: grid; grid-template-columns: 1.1fr 1fr .9fr; gap: 0 var(--sp-12); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--sp-12); }
.club-grid { padding-top: 0; }
/* the header's rule already stands above the first row of sections */
.prof-head + .grid3 > .panel, .prof-head + .grid2 > .panel, .prof-head + .panel { border-top: 0; }
/* a titled table between panels: the same rule and heading room as a panel */
.prof-sec { padding: 0 0 var(--sp-6); border-top: 1px solid var(--line); }
.prof-head + .prof-sec { border-top: 0; }
.prof-sec .section-title { margin: 0; padding: var(--sp-5) 0 var(--sp-3); }

.pb { display: grid; grid-template-columns: 150px 1fr 36px; align-items: center; gap: var(--sp-3); padding: var(--sp-2) 0; }
.pb .bar { height: 6px; background: var(--line-2); border-radius: var(--r-pill); overflow: hidden; }
.pb .bar i { display: block; height: 100%; border-radius: var(--r-pill); background: var(--t-none); }
.pb .bar i.elite { background: var(--t-elite); }
.pb .bar i.high { background: var(--t-high); }
.pb .bar i.avg { background: var(--t-avg); }
.pb .bar i.below { background: var(--t-below); }
.pb .bar i.poor { background: var(--t-poor); }
/* Receiving tab: neutral measures (more is not better) draw an untiered bar */
.pb .bar i.neutral { background: var(--t-none); }
.pb b { font-weight: 600; }
.pb small { margin-left: var(--sp-1); font-variant-numeric: tabular-nums; }
.pb-grp { margin: var(--sp-3) 0 0; font-size: var(--fs-2xs); color: var(--sub); }

.sparks { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp-4); padding: var(--sp-2) 0 var(--sp-4); }
.spark { margin: 0; }
.spark svg { display: block; width: 100%; height: 56px; color: var(--ink); }
.spark figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-2); margin-top: var(--sp-1); font-size: var(--fs-2xs); color: var(--sub); }
.spark figcaption b { color: var(--ink); font-size: var(--fs-md); }
.splits { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: var(--sp-4) var(--sp-12); }
.splits .split .note { margin-top: var(--sp-1); }

/* season chart: one bar per season in its step's colour, the figure above */
.wk { display: flex; align-items: flex-end; gap: var(--sp-3); height: 170px; padding: 26px 0 28px; }
.wk > div { flex: 1; position: relative; border-radius: 6px 6px 0 0; background: var(--t-none); }
.wk > div span { position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: var(--fs-2xs); color: var(--sub); }
.wk > .wk-bar { max-width: 56px; }
.wk > .wk-bar em { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font: 600 var(--fs-2xs)/1 var(--sans); font-style: normal; color: var(--ink); font-variant-numeric: tabular-nums; }
.wk > .wk-bar.elite { background: var(--t-elite); }
.wk > .wk-bar.high { background: var(--t-high); }
.wk > .wk-bar.avg { background: var(--t-avg); }
.wk > .wk-bar.below { background: var(--t-below); }
.wk > .wk-bar.poor { background: var(--t-poor); }

.kv { display: flex; justify-content: space-between; gap: var(--sp-3); padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.kv span { color: var(--sub); }
.kv b { font-weight: 600; font-variant-numeric: tabular-nums; }
.kv:last-child { border-bottom: 0; }

/* ================================================== bio and career tab === */

.pview > #bio, .pview > #career { margin: 0; min-width: 0; }
.prof-head + #bio { border-top: 0; }
/* the About pages' measure, so a wide screen still reads well */
#bio > p { max-width: 68ch; }
#bio.sec p + p { margin-top: var(--sp-2); }
.career-body { padding: var(--sp-3) 0; }
#most-productive h3 { margin: 0 0 var(--sp-2); font-size: var(--fs-md); font-weight: 600; }
#most-productive ul { margin: 0 0 var(--sp-3); padding-left: 1.2em; list-style: disc; }
#most-productive li { margin-bottom: var(--sp-1); }
#most-productive li .dim { display: block; font-size: var(--fs-sm); }
/* bars take the team colour from their fill attribute, so no fill rule here */
.career-chart { margin: 0 0 var(--sp-3); max-width: 720px; }
.career-chart svg { width: 100%; height: auto; display: block; }
.career-chart .below-floor { fill: none; stroke: var(--line); }
/* a season whose headline metric was never recorded (an era gap), not low volume */
.career-chart .not-recorded { fill: none; stroke: var(--sub); stroke-dasharray: 2 2; }
.career-chart .career-yr { font-size: var(--fs-sm); fill: var(--sub); }
.career-chart figcaption { font-size: var(--fs-xs); color: var(--sub); }
.coach-change { stroke: var(--sub); stroke-dasharray: 3 3; }
.career-scroll { overflow-x: auto; max-width: 100%; }
.career-table td, .career-table th { white-space: nowrap; }
tr.peak td { background: var(--fill); }
.peak-chip { display: inline-block; margin-left: var(--sp-1); padding: 0 6px; border-radius: var(--r-sm); background: var(--ink); color: var(--paper); font-size: var(--fs-2xs); font-weight: 600; vertical-align: 1px; }
td.era { color: var(--sub); }
tr.stint td:first-child { padding-left: 1.5em; }
.career-all { margin-top: var(--sp-3); }
.career-all summary { cursor: pointer; font-weight: 600; }
/* "How WAR is calculated" collapsible note */
.war-explainer > summary { cursor: pointer; }
.war-explainer p { max-width: 72ch; }

/* =========================================================== responsive === */

@media (max-width: 1100px) {
  .grid3 { grid-template-columns: 1fr 1fr; }
  .prof-head .wmk { right: 120px; }
}
@media (max-width: 860px) {
  .grid3, .grid2 { grid-template-columns: minmax(0, 1fr); }
  .pb { grid-template-columns: 120px 1fr 36px; }
}
/* Phones and upright tablets (from where the shell becomes a scrolling page):
 * the stripe lies across the top, the photo sits beside the name, and the
 * facts, the rating and the section tabs each take the full width. */
@media (max-width: 860px) {
  .prof-head { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 0 var(--sp-4); align-items: center; padding-top: var(--sp-4); }
  .prof-head .band { grid-area: 1 / 1 / 2 / -1; width: 72%; height: 6px; }
  .prof-head .band2 { grid-area: 1 / 1 / 2 / -1; justify-self: end; width: 28%; height: 6px; margin-left: 0; }
  .prof-head .wmk { right: -36px; top: 64px; width: 190px; transform: none; }
  .bighs, .club-head .club-logo { grid-area: 2 / 1 / 4 / 2; width: 72px; height: 72px; margin-top: var(--sp-4); }
  .pmeta { display: contents; }
  .pmeta .crumbs { grid-area: 2 / 2; align-self: end; margin: var(--sp-4) 0 0; font-size: var(--fs-xs); }
  .pmeta h1 { grid-area: 3 / 2; align-self: start; font-size: var(--fs-2xl); }
  /* Every fact keeps its rule and the row is pulled left by that much: the
     first fact of each wrapped row sits flush with the page, and its rule
     falls outside the header, which clips it. */
  .facts { grid-area: 4 / 1 / 5 / -1; margin-left: calc(-1 * var(--sp-3) - 1px); }
  .facts > div, .facts > div:first-child { padding: 0 var(--sp-3); border-left: 1px solid var(--line); }
  .facts b { font-size: var(--fs-md); }
  .score { grid-area: 5 / 1 / 6 / -1; margin-top: var(--sp-5); padding-bottom: 0; text-align: left; }
  .score .box { align-items: flex-start; }
  .score .box b { font-size: var(--fs-4xl); }
  .score-act { flex-direction: row; }
  /* two even buttons across a phone; on a tablet they stop at a button's width */
  .score-act .btn { flex: 1; max-width: 15rem; }
  .pmeta .sub-tabs { grid-area: 6 / 1 / 7 / -1; margin-top: var(--sp-4); }
}
@media (max-width: 760px) {
  .career-all summary, .war-explainer > summary { padding: 9px 0; }
}
/* The season chart gives each bar room for its labels, centred on the bar,
 * and scrolls inside its block when the seasons outrun a narrow phone
 * (base.html opens it on the latest season). The career chart's labels grow
 * in viewBox units and every label the server marks minor is hidden. */
@media (max-width: 640px) {
  .wk { gap: var(--sp-1); overflow-x: auto; }
  .wk > .wk-bar { min-width: calc(var(--sp-6) + var(--sp-2)); }
  .wk > .wk-bar span, .wk > .wk-bar em { left: 50%; right: auto; transform: translateX(-50%); white-space: nowrap; }
  .career-chart .career-yr { font-size: 21px; }
  .career-chart .career-yr.minor { display: none; }
}
