/*
 * The Career card (PlayerCareer.js) — spells in one view, seasons in the other.
 *
 * Both views share a column grid so the two read as one table seen two ways:
 * the crest and the name take whatever is left, and every figure column is a
 * fixed width so the numbers line up down the card — including the ones inside
 * an expanded season, which is what makes the expansion worth opening.
 */

.player-career {
  padding-inline: 0;
  gap: calc(var(--space-2) * var(--player-scale));
}

.player-career .player-card__header {
  padding-inline: calc(var(--space-5) * var(--player-scale));
}

/*
 * `TabBar` is sticky by default — it was written for the top of a page, where
 * the row should stay put while the panel behind it scrolls. Inside a card it is
 * a row of two, and sticking makes it ride over the rows below it as the page
 * scrolls past. Static here, and only here.
 */
/* `TabBar` is shared with three other surfaces, so it carries no scale of its
   own — see the note on `.filter-chip` in player-performance.css for why this is
   applied here rather than at the source. */
.player-career .tab-bar__tab {
  padding: calc(var(--space-2) * var(--player-scale)) calc(var(--space-3) * var(--player-scale))
    calc(var(--space-3) * var(--player-scale));
  font-size: calc(var(--text-sm) * var(--player-scale));
}

.player-career .tab-bar {
  position: static;
  margin-bottom: calc(var(--space-2) * var(--player-scale));
}

.player-career__view[hidden] {
  display: none;
}

.player-career__group {
  display: flex;
  flex-direction: column;
}

.player-career__group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--space-3) * var(--player-scale));
  padding: calc(var(--space-2) * var(--player-scale)) calc(var(--space-5) * var(--player-scale));
  font-size: calc(var(--text-sm) * var(--player-scale));
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
}

.player-career__columns {
  display: flex;
  align-items: center;
  color: var(--text-secondary);
}

/*
 * The figure columns are narrow on purpose. The Season view carries four of
 * them plus a chevron, and every pixel they take comes off the club's name —
 * at 40 apiece the name truncated to "Previ…" on a 390px screen, which is the
 * column that was worth keeping.
 */
.player-career__column {
  display: grid;
  place-items: center;
  width: calc(32px * var(--player-scale));
}

.player-career__list {
  display: flex;
  flex-direction: column;
}

/* --- Rows -------------------------------------------------------------------- */

.player-career__row {
  display: flex;
  align-items: center;
  gap: calc(var(--space-2) * var(--player-scale));
  width: 100%;
  padding: calc(var(--space-3) * var(--player-scale)) calc(var(--space-5) * var(--player-scale));
  text-align: left;
}

.player-career__row + .player-career__row,
.player-career__season + .player-career__season {
  border-top: 1px solid var(--border);
}

.player-career__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: calc(1px * var(--player-scale));
}

.player-career__name {
  font-size: calc(var(--text-md) * var(--player-scale));
  font-weight: var(--weight-semibold);
  color: var(--text);
}

.player-career__years {
  font-size: calc(var(--text-sm) * var(--player-scale));
  color: var(--text-muted);
}

.player-career__figure {
  width: calc(32px * var(--player-scale));
  text-align: center;
  font-size: calc(var(--text-sm) * var(--player-scale));
  font-weight: var(--weight-semibold);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/*
 * The season view's rating, tinted rather than solid — it sits in a row of four
 * columns where the solid chip the match list uses would be the loudest thing
 * on the card and would drag the eye down the rating column past everything
 * else. Same bands, quieter voice; the two treatments are the pair
 * season-stats.css and match-lineup.css already keep apart.
 */
.player-career__rating {
  width: calc(38px * var(--player-scale));
  padding-block: calc(1px * var(--player-scale));
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: calc(var(--text-xs) * var(--player-scale));
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums;
}

.player-career__rating[data-tier="high"] {
  background: var(--rating-high-soft);
  color: var(--rating-high);
}

.player-career__rating[data-tier="mid"] {
  background: var(--rating-mid-soft);
  color: var(--rating-mid);
}

.player-career__rating[data-tier="low"] {
  background: var(--rating-low-soft);
  color: var(--rating-low);
}

.player-career__chevron {
  display: flex;
  color: var(--text-muted);
  transition: transform var(--duration) var(--easing);
}

.player-career__chevron[data-open="true"] {
  transform: rotate(180deg);
}

/* --- A season's competitions -------------------------------------------------- */

.player-career__competitions {
  display: flex;
  flex-direction: column;
  background: var(--surface-sunken);
}

.player-career__competition {
  display: flex;
  align-items: center;
  gap: calc(var(--space-2) * var(--player-scale));
  /* Indented past the crest column above it, so a competition reads as
     belonging to the season rather than as another season. */
  padding: var(--space-2) var(--space-5) var(--space-2) calc(var(--space-5) + 30px);
}

.player-career__competition .player-career__name {
  flex: 1;
  min-width: 0;
  font-size: calc(var(--text-sm) * var(--player-scale));
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
}

/* --- Legend ------------------------------------------------------------------- */

.player-career__legend {
  display: flex;
  justify-content: center;
  gap: calc(var(--space-4) * var(--player-scale));
  padding: calc(var(--space-3) * var(--player-scale)) calc(var(--space-5) * var(--player-scale)) 0;
  font-size: calc(var(--text-xs) * var(--player-scale));
  color: var(--text-muted);
}

.player-career__legend-item {
  display: flex;
  align-items: center;
  gap: calc(var(--space-1) * var(--player-scale));
}

/*
 * The Season view's name line. Smaller than the Club view's, because this row
 * carries two more columns and a chevron in the same width — and because the
 * line under it (the season) is the one the reader is scanning for here, where
 * on the Club view it is the club.
 */
.player-career__row--season .player-career__name {
  font-size: calc(var(--text-sm) * var(--player-scale));
}
