/* Champions tab: the grid of every champion as art tiles, and one champion's page with its lane matchups */

/* ---------- the grid panel and its sticky filter bar ---------- */
.champ-grid-panel { padding: 0; gap: 0; }
.champ-grid-panel .tc-filter {
  position: sticky;
  top: calc(-1 * var(--space-9));
  z-index: 4;
  padding: var(--space-6) var(--space-7);
  border-bottom: 1px solid var(--hairline);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  /* solid, not blurred: a blur here re-renders every tile image under the bar on each scroll frame */
  background: color-mix(in oklch, var(--surface-1) 97%, transparent);
}
.tc-filter .filter-groups { gap: var(--space-4) var(--space-5); }
.tc-filter .choices .choice { padding: 0 var(--space-5); }
.tc-filter .field { width: 200px; }

/* ---------- art tiles ---------- */
.champ-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  align-content: start;
  gap: var(--space-6);
  padding: var(--space-7);
}
.champ-tile {
  --tier: var(--hairline-strong);
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--hairline);
  background: var(--surface-2);
  color: var(--text-1);
  text-decoration: none;
  isolation: isolate;
  animation: rise var(--dur-slow) var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 14ms);
  transition: transform var(--dur-base) var(--ease-out), border-color var(--dur-fast), box-shadow var(--dur-base);
}
/* only the first rows rise in; tiles below the fold skip layout and paint until they scroll near */
.champ-tile:nth-child(n+25) { animation: none; content-visibility: auto; contain-intrinsic-size: auto 240px auto 320px; }
.champ-tile[class*="tier-"] { border-color: color-mix(in oklch, var(--tier) 30%, var(--hairline)); }
.champ-tile:hover, .champ-tile:focus-visible {
  transform: translateY(-3px);
  border-color: color-mix(in oklch, var(--tier) 70%, transparent);
  box-shadow: 0 10px 24px -12px rgb(0 0 0 / .8), 0 0 0 1px color-mix(in oklch, var(--tier) 35%, transparent);
}
.champ-tile.tier-splus { box-shadow: 0 0 18px -6px color-mix(in oklch, var(--tier-splus) 70%, transparent); }
/* the square icon only stands in when the art fails; while the art loads the tile stays plain, then the art fades in */
.tc-fallback { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; border-radius: 0; visibility: hidden; }
.champ-tile.art-failed .tc-fallback { visibility: visible; }
.tc-art {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  transform: scale(1.12);
  transform-origin: center 25%;
  opacity: 0;
  transition: transform var(--dur-slow) var(--ease-out), filter var(--dur-slow), opacity var(--dur-base) var(--ease-out);
}
.tc-art.loaded { opacity: 1; }
.champ-tile:hover .tc-art { transform: scale(1.17); filter: saturate(1.08); }
.tc-shade {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(0deg, var(--surface-0) 0%, color-mix(in oklch, var(--surface-0) 75%, transparent) 22%, transparent 55%),
    linear-gradient(180deg, color-mix(in oklch, var(--tier) 16%, transparent), transparent 30%);
  pointer-events: none;
}
.champ-tile-tier { position: absolute; top: var(--space-4); right: var(--space-4); z-index: 1; display: flex; border-radius: var(--radius-sm); box-shadow: 0 2px 8px rgb(0 0 0 / .5); }
.champ-tile-tier .tier { width: 24px; height: 24px; font-size: var(--fs-sm); background: color-mix(in oklch, var(--tier) 26%, var(--surface-0)); border: 1px solid color-mix(in oklch, var(--tier) 60%, transparent); color: var(--tier); opacity: 1; }
.champ-tile-tier .tier.tier-splus { background: var(--tier); color: var(--on-amber); }
.tc-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-5) var(--space-5);
  transform: translateY(18px);
  transition: transform var(--dur-base) var(--ease-out);
}
.champ-tile-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 var(--fs-lg)/1.15 var(--font-display); letter-spacing: .01em; text-shadow: 0 1px 6px rgb(0 0 0 / .8); }
.tc-peek { display: flex; align-items: center; gap: var(--space-5); height: 16px; opacity: 0; transition: opacity var(--dur-base); color: var(--text-2); }
.champ-tile:hover .tc-foot, .champ-tile:focus-visible .tc-foot { transform: translateY(0); }
.champ-tile:hover .tc-peek, .champ-tile:focus-visible .tc-peek { opacity: 1; }
.tc-peek-stat { font: 600 var(--fs-sm)/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-1); }
.tc-peek-stat small { margin-left: 2px; font-size: 10px; font-weight: 500; color: var(--text-3); }
.tc-peek-role { display: inline-flex; align-items: center; gap: var(--space-2); font: 500 var(--fs-sm)/1 var(--font-ui); }
.tc-peek-role .role-svg { width: 13px; height: 13px; }

/* ---------- sorted by tier: one header row per tier ---------- */
.tc-group {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding-top: var(--space-6);
}
.tc-group:first-child { padding-top: 0; }
.tc-group .tier { width: 28px; height: 28px; font-size: var(--fs-md); }
.tc-group-name { font: 600 var(--fs-xl)/1 var(--font-display); color: var(--text-1); }
.tc-group-count { font: 500 var(--fs-xs)/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.tc-group-line { flex: 1; height: 1px; background: linear-gradient(90deg, color-mix(in oklch, var(--tier, var(--hairline-strong)) 55%, transparent), transparent); }

/* ---------- empty grid ---------- */
.tc-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: var(--space-4); padding: var(--space-10) 0 calc(var(--space-10) * 1.5); text-align: center; }
.tc-empty-icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: var(--space-4); border-radius: 50%; background: var(--surface-2); color: var(--text-3); }
.tc-empty-icon .ui-svg { width: 24px; height: 24px; }
.tc-empty strong { font: 600 var(--fs-lg)/1.3 var(--font-display); color: var(--text-1); }
.tc-empty p { margin: 0 0 var(--space-4); font: 400 var(--fs-md)/1.4 var(--font-ui); color: var(--text-2); }

@media (max-width: 600px) {
  .champ-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--space-4); padding: var(--space-6); }
  .tc-filter .field { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .champ-tile { animation: none; }
  .champ-tile, .tc-art, .tc-foot { transition: none; }
}

/* ---------- champion page: main column + rail, the page scrolls as a whole ---------- */
.champions-page { --cp-gap: var(--space-9); --tc-rail: 320px; overflow: visible; }
.champions-page .cp-back { text-decoration: none; display: inline-flex; align-items: center; }
.champions-page .cp-body { flex: none; overflow: visible; }
.champions-page .cp-body.with-extra {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) var(--tc-rail);
  grid-template-rows: auto;
  grid-template-areas:
    "setup summary rail"
    "setup skills rail"
    "items items rail"
    "cards cards rail";
  align-items: start;
}
.champions-page .cp-body.with-extra > .cp-setup { grid-area: setup; align-self: stretch; }
.champions-page .cp-body.with-extra > .tc-summary { grid-area: summary; --i: 1; }
.champions-page .cp-body.with-extra > .cp-skills { grid-area: skills; align-self: stretch; --i: 2; }
.champions-page .cp-body.with-extra > .cp-items { grid-area: items; --i: 3; }
.champions-page .cp-body.with-extra > .cp-cards { grid-area: cards; --i: 4; }
.champions-page .cp-body.with-extra > .cp-matchups { grid-area: rail; position: sticky; top: var(--space-7); --i: 2; }
.champions-page .cp-body.with-extra .cp-skill-body { flex-direction: column; align-items: stretch; justify-content: center; gap: var(--space-7); }
.champions-page .cp-body.with-extra .cp-skill-side { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4); }
.champions-page .cp-body.with-extra .cp-skill-side > .sublabel + * { margin-right: var(--space-5); }
.champions-page .cp-body.with-extra .cp-skill-stats { flex-direction: row; align-items: baseline; gap: var(--space-4); }
.champions-page .cp-body.with-extra .cp-skill-grid { flex: none; }
.champions-page .cp-body.with-extra .cp-trees { flex: none; align-content: start; padding-top: var(--space-4); }
.champions-page .cp-body.with-extra .cp-spells { margin-top: var(--space-6); }
.champions-page .cp-item-body { overflow: visible; }
.champions-page .cp-slots { overflow: visible; }

/* ---------- summary: one sentence that reads the numbers, then the build at a glance ---------- */
.tc-summary {
  position: relative;
  gap: var(--space-7);
  background:
    radial-gradient(420px 160px at 0% 0%, color-mix(in oklch, var(--amber) 9%, transparent), transparent 70%),
    linear-gradient(180deg, rgb(255 255 255 / .03), transparent 40%),
    var(--surface-1);
  border-color: color-mix(in oklch, var(--amber) 18%, var(--hairline));
}
.tc-summary-text { margin: 0; font: 400 var(--fs-lg)/1.55 var(--font-ui); color: var(--text-2); text-wrap: pretty; }
.tc-summary-text b { font-weight: 600; color: var(--text-1); }
.tc-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6) var(--space-7); padding-top: var(--space-7); border-top: 1px solid var(--hairline); }
.tc-fact { min-width: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.tc-fact-body { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.tc-fact-icon { flex: none; width: 30px; height: 30px; border-radius: var(--radius-md); border: 1px solid var(--line-slot); }
.tc-fact-icon.round { border-radius: 50%; border-color: color-mix(in oklch, var(--amber) 55%, transparent); }
.tc-fact-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 var(--fs-md)/1.2 var(--font-ui); color: var(--text-1); }
.tc-fact-keys b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: var(--radius-sm); background: color-mix(in oklch, var(--amber) 16%, var(--surface-2)); border: 1px solid color-mix(in oklch, var(--amber) 40%, transparent); font: 700 var(--fs-md)/1 var(--font-mono); color: var(--amber); }
.tc-fact-keys b:first-child { background: var(--amber); color: var(--on-amber); }

/* ---------- rail: matchups as rows with a win-rate change bar ---------- */
.cp-matchups { --i: 4; }
.mu-body { display: flex; flex-direction: column; gap: var(--space-8); }
.mu-list { display: flex; flex-direction: column; gap: var(--space-1); }
.mu-head { display: flex; align-items: center; gap: var(--space-4); margin-bottom: var(--space-3); font: 600 var(--fs-xs)/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.mu-dot { width: 8px; height: 8px; border-radius: 50%; }
.mu-dot.pos { background: var(--pos); box-shadow: 0 0 8px color-mix(in oklch, var(--pos) 60%, transparent); }
.mu-dot.neg { background: var(--neg); box-shadow: 0 0 8px color-mix(in oklch, var(--neg) 60%, transparent); }
/* a row opens the opponent's page; the button at its end opens the matchup in the planner */
.mu-row { display: flex; align-items: center; gap: var(--space-2); margin: 0 calc(-1 * var(--space-4)); padding-right: var(--space-2); border-radius: var(--radius-md); transition: background var(--dur-fast); }
.mu-row:hover { background: var(--surface-2); }
.mu-link { flex: 1; min-width: 0; display: grid; grid-template-columns: 32px minmax(0, 1fr) 48px 50px; align-items: center; gap: var(--space-5); padding: var(--space-3) var(--space-4); color: inherit; text-decoration: none; }
.mu-icon { width: 32px; height: 32px; border-radius: var(--radius-md); border: 1px solid var(--line-slot); }
.mu-text { min-width: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.mu-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 var(--fs-md)/1.1 var(--font-ui); color: var(--text-1); transition: color var(--dur-fast); }
.mu-link:hover .mu-name { color: var(--amber); }
.mu-games { font: 500 var(--fs-xs)/1 var(--font-mono); color: var(--text-3); }
.mu-bar { position: relative; height: 4px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; }
.mu-bar::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: var(--pct); border-radius: inherit; }
.mu-bar.pos::after { background: var(--pos); }
.mu-bar.neg::after { background: var(--neg); }
.mu-rate { font: 600 var(--fs-md)/1 var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
.mu-plan { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: var(--radius-sm); color: var(--text-4); }
.mu-row:hover .mu-plan { color: var(--text-2); }
.mu-plan:hover { color: var(--amber) !important; background: var(--surface-3); }
.mu-plan .ui-svg { width: 15px; height: 15px; }

@media (max-width: 1279px) {
  .champions-page { --tc-rail: 280px; }
}
@media (max-width: 1023px) {
  .champions-page .cp-body.with-extra {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "summary" "setup" "items" "skills" "rail" "cards";
  }
  .champions-page .cp-body.with-extra > .cp-matchups { position: static; }
}
