/* /champs/: the wall of epic gamers. Plaques rendered by src/champs.js, enhanced by assets/champs.js.
   Loaded after styles.css (whose older .champ-* rules still style the shared bits: .champ-who, .champ-you, .champ-count).
   Gold (#ffcf40) is the crown colour everywhere on the site; each plaque's --accent is its game's own colour.
   Motion is transform/opacity only (no layout shift); reduced motion drops all of it. */

.champs-page { max-width: 1120px; }
.champs-head { position: relative; }

/* ---------- Gary, commentating ---------- */
.champ-gary { display: flex; align-items: center; gap: var(--s-3); margin-top: var(--s-5); }
.champ-gary-btn { flex: none; width: 64px; height: 74px; padding: 0; border: 0; background: none; cursor: pointer; border-radius: var(--r-md); }
.champ-gary-btn img { display: block; width: 100%; height: 100%; image-rendering: pixelated; filter: drop-shadow(0 6px 14px rgb(0 0 0 / .6)) drop-shadow(0 0 16px rgb(255 207 64 / .25)); }
.champ-gary-btn:focus-visible { outline: 2px solid #ffcf40; outline-offset: 3px; }
.champ-gary-btn.is-poked img { animation: gary-bonk .45s var(--ease-out); }
.champ-says { position: relative; flex: 1; min-width: 0; min-height: 3.2em; margin: 0; padding: var(--s-3) var(--s-4);
  border: 1px solid rgb(255 207 64 / .35); border-radius: var(--r-md); background: var(--surface);
  font-family: var(--mono); font-size: var(--fs-14, .875rem); line-height: 1.45; color: var(--text); overflow-wrap: anywhere; }
.champ-says::before { content: ""; position: absolute; left: -7px; top: 50%; width: 12px; height: 12px; margin-top: -6px;
  background: var(--surface); border-left: 1px solid rgb(255 207 64 / .35); border-bottom: 1px solid rgb(255 207 64 / .35); transform: rotate(45deg); }
.champ-says-who { color: #ffcf40; font-weight: 700; }
.champ-says.is-new [data-says-text] { animation: says-in .35s var(--ease-out); }
@keyframes gary-bonk { 0% { transform: none; } 25% { transform: rotate(-9deg) translateY(-4px); } 55% { transform: rotate(6deg); } 100% { transform: none; } }
@keyframes says-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- most crowns ---------- */
.champ-most-list { display: grid; gap: var(--s-2); grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.champ-most-list .most-row { display: flex; align-items: center; gap: var(--s-2); min-width: 0; padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md); font-size: var(--fs-14, .875rem); }
.champ-most-list .most-row.is-top { border-color: rgb(255 207 64 / .6); box-shadow: 0 0 22px -8px rgb(255 207 64 / .45); }
.most-rank { flex: none; width: 1.6em; height: 1.6em; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--text-dim); font-size: var(--fs-12); }
.is-top .most-rank { background: #ffcf40; color: #14110a; }
.most-row .champ-who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.most-pips { flex: none; color: #ffcf40; letter-spacing: -.1em; font-size: var(--fs-12); }
.most-n { flex: none; margin-left: auto; color: var(--text-dim); font-size: var(--fs-12); }

/* ---------- sort ---------- */
.wall-tools { margin-top: var(--s-6); min-height: 40px; }
.wall-tools:not(.is-ready) { visibility: hidden; }
/* one line that never wraps (it scrolls sideways if it must), so hiding a button can't change its height (CLS) */
.wall-sort { display: flex; flex-wrap: nowrap; gap: var(--s-2); overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
.wall-sort::-webkit-scrollbar { display: none; }
/* phones: the row scrolls sideways, so its right edge fades to say "more this way"; the end padding lets the last
   button scroll clear of the fade. The plaque titles get a taller tap area without moving anything. */
@media (max-width: 560px) {
  .wall-sort { padding-right: 36px; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
  .plaque-game a { display: inline-block; padding-block: 7px; margin-block: -7px; }
}
.wall-sort button { flex: none; white-space: nowrap; min-height: 40px; padding: 0 var(--s-3); border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface);
  color: var(--text-dim); font-family: var(--mono); font-size: var(--fs-12); cursor: pointer; }
.wall-sort button:hover { color: var(--text); border-color: rgb(255 207 64 / .5); }
.wall-sort button[aria-pressed="true"] { background: #ffcf40; border-color: #ffcf40; color: #14110a; font-weight: 700; }
.wall-sort button:focus-visible { outline: 2px solid #ffcf40; outline-offset: 2px; }
.wall-sort button[hidden] { display: none; }

/* ---------- the wall ---------- */
.champ-list.wall { display: grid; gap: var(--s-4); margin-top: var(--s-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 248px), 1fr)); }
.wall .champ-empty { grid-column: 1 / -1; }
.plaque { position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  border: 1px solid rgb(255 207 64 / .3); border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--surface-2), var(--surface) 55%);
  box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 4px rgb(255 207 64 / .12), 0 10px 24px -16px rgb(0 0 0 / .9);
  transition: transform .18s var(--ease-out), border-color .18s ease, box-shadow .18s ease; transform-origin: 50% 50%; }
.plaque:hover, .plaque:focus-within { transform: translateY(-3px); border-color: rgb(255 207 64 / .7);
  box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 4px rgb(255 207 64 / .2), 0 16px 32px -14px rgb(0 0 0 / .9), 0 0 28px -8px rgb(255 207 64 / .4); }
.plaque.is-fresh { border-color: rgb(255 207 64 / .65); }
.plaque.is-free { border-style: dashed; border-color: rgb(var(--phosphor) / .35); background: var(--surface); }
.plaque.is-free:hover, .plaque.is-free:focus-within { border-color: var(--accent); box-shadow: 0 16px 32px -14px rgb(0 0 0 / .9), 0 0 28px -10px rgb(var(--phosphor) / .5); }

.plaque-art { position: relative; display: block; aspect-ratio: 16 / 9; margin: 4px 4px 0; overflow: hidden; border-radius: calc(var(--r-md) - 4px) calc(var(--r-md) - 4px) 0 0; background: #07080a; }
.plaque-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* scanlines over the poster: it's a screen on a wall */
.plaque-art::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgb(0 0 0 / .22) 0 1px, transparent 1px 3px), linear-gradient(180deg, transparent 55%, rgb(14 15 17 / .7)); }
.plaque.is-free .plaque-art img { filter: grayscale(.7) brightness(.7); }

.plaque-body { flex: 1; min-width: 0; padding: var(--s-3) var(--s-4) 0; }
.plaque-game { margin: 0; font-family: var(--display); font-weight: 600; font-size: var(--fs-20); line-height: 1.15; }
.plaque-game a { color: var(--text); text-decoration: none; }
.plaque-game a::after { content: ""; position: absolute; inset: 0; } /* the whole plaque opens the game */
.plaque-game a:focus-visible { outline: none; }
.plaque:has(.plaque-game a:focus-visible) { outline: 2px solid #ffcf40; outline-offset: 2px; }
.plaque-badge { position: absolute; z-index: 1; top: var(--s-3); right: var(--s-3); pointer-events: none; padding: 2px 7px; border-radius: var(--r-sm);
  font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.plaque-badge.is-new { background: #ffcf40; color: #14110a; }
.plaque-badge.is-long { background: var(--surface-2); color: #ffcf40; border: 1px solid rgb(255 207 64 / .5); }
.plaque-badge.is-free { background: var(--accent); color: var(--on-accent); }

/* the nameplate */
.plaque-holder { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--s-2); margin: var(--s-3) 0 0; padding: var(--s-2) var(--s-3);
  border: 1px solid rgb(255 207 64 / .3); border-radius: var(--r-sm);
  background: linear-gradient(180deg, rgb(255 207 64 / .1), rgb(255 207 64 / .03)); font-size: var(--fs-16); }
.plaque-holder .champ-who { min-width: 0; font-weight: 700; }
.plaque-score { margin-left: auto; color: #ffcf40; font-weight: 800; font-size: var(--fs-16); }
.plaque.is-free .plaque-holder { border-style: dashed; border-color: rgb(var(--phosphor) / .3); background: none; color: var(--text-dim); font-family: var(--mono); font-size: var(--fs-12); }
.plaque-crown { flex: none; font-size: 1.25em; line-height: 1; color: #ffcf40; filter: drop-shadow(0 0 6px rgb(255 207 64 / .55)); }
.plaque-crown.is-empty { color: transparent; -webkit-text-stroke: 1px var(--accent); filter: none; opacity: .8; }
.plaque-meta, .plaque-week { margin: var(--s-2) 0 0; font-size: var(--fs-12); color: var(--text-dim); }
.plaque-held { color: var(--beige); font-family: var(--mono); }
.plaque-week .champ-who { font-weight: 500; color: inherit; }
.plaque .champ-you { margin-top: var(--s-2); }

.plaque-cta { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: 44px;
  margin: var(--s-3) var(--s-4) var(--s-4); padding: var(--s-2) var(--s-3); border-radius: var(--r-sm);
  background: #ffcf40; color: #14110a; font-family: var(--mono); font-size: var(--fs-14, .875rem); font-weight: 800; text-decoration: none;
  box-shadow: 0 3px 0 #a07a10; transition: transform .12s var(--ease-out), box-shadow .12s ease, background .12s ease; }
.plaque-cta:hover { background: #ffdc6e; }
.plaque-cta:active { transform: translateY(3px); box-shadow: 0 0 0 #a07a10; }
.plaque-cta:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.plaque.is-free .plaque-cta { background: var(--accent); color: var(--on-accent); box-shadow: 0 3px 0 rgb(var(--phosphor) / .45); }
.plaque .champ-who { z-index: 1; }

/* the crown shimmers (a gold glint sweeping across the glyph) */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .plaque-crown:not(.is-empty), .is-top .most-pips {
    background: linear-gradient(105deg, #ffcf40 0 38%, #fff7d6 48%, #ffcf40 58% 100%) 0 0 / 300% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: crown-glint 4.2s linear infinite; }
  .plaque:nth-child(3n+2) .plaque-crown { animation-delay: -1.4s; }
  .plaque:nth-child(3n) .plaque-crown { animation-delay: -2.8s; }
}
@keyframes crown-glint { 0%, 55% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* power on: a CRT line that opens into the plaque */
.plaque.is-off { opacity: 0; transform: scaleY(.02); }
.plaque.is-on { animation: plaque-on .55s var(--ease-boot) backwards; }
@keyframes plaque-on {
  0% { opacity: 0; transform: scale(.7, .02); filter: brightness(3); }
  35% { opacity: 1; transform: scale(1, .03); filter: brightness(2.6); }
  100% { opacity: 1; transform: none; filter: none; }
}

/* phones: plaques turn into rows (poster left, nameplate right), the button full width underneath */
@media (max-width: 559px) {
  .champ-list.wall { gap: var(--s-3); }
  .plaque { display: grid; grid-template-columns: 112px minmax(0, 1fr); }
  .plaque-art { grid-row: 1; margin: 4px 0 0 4px; border-radius: calc(var(--r-md) - 4px); align-self: start; }
  .plaque-body { padding: var(--s-2) var(--s-3) 0; }
  .plaque-badge { position: static; display: inline-block; margin-top: var(--s-1); }
  .plaque-game { font-size: var(--fs-16); }
  .plaque-holder { margin-top: var(--s-2); padding: var(--s-1) var(--s-2); font-size: var(--fs-14, .875rem); }
  .plaque-cta { grid-column: 1 / -1; margin: var(--s-2) var(--s-3) var(--s-3); }
  .champ-gary-btn { width: 52px; height: 60px; }
  .champ-says { font-size: var(--fs-12); }
}

@media (prefers-reduced-motion: reduce) {
  .plaque, .plaque-cta { transition: none; }
  .plaque:hover, .plaque:focus-within, .plaque-cta:active { transform: none; }
  .plaque.is-off { opacity: 1; transform: none; }
  .plaque.is-on, .plaque-crown, .is-top .most-pips, .champ-gary-btn.is-poked img, .champ-says.is-new [data-says-text] { animation: none; }
}
