/* The match's big moments (js/showcase.js): the line-up, a round's winners, the podium. Captions over the
   canvas (names under the fighters, a team's name, VS, the big title, the skip hint), and the HUD stepping
   aside while a scene has the camera. Class prefix: sx-. */

/* ---------------------------------------------------------------- the HUD steps aside */

/* A whole scene: no HUD, no thumb controls (the pause button and anything else in #touch stay). Opacity as
   well as visibility: a HUD part that sets its own visibility can't show through. */
body.sx-on #hud,
body.sx-on #overlays,
body.sx-on #touch #lookpad,
body.sx-on #touch #stick,
body.sx-on #touch .touch-cluster { visibility: hidden; opacity: 0; }

/* A round's winners: only the banner and the score. */
body.sx-beat #hud > :not(.banner):not(.hud-top),
body.sx-beat #hud .hud-top > :not(.hud-score),
body.sx-beat #overlays,
body.sx-beat #touch #stick,
body.sx-beat #touch .touch-cluster { visibility: hidden; opacity: 0; }

/* ---------------------------------------------------------------- the layer */

#showcase {
  position: fixed;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  overflow: hidden;
  font-family: var(--display);
  color: #fff;
  --edge: 0 2px 0 var(--ink), 0 -2px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink);
}

/* Bars top and bottom, like a film. */
.sx-bar {
  position: absolute;
  left: 0;
  right: 0;
  height: clamp(18px, 6.5vh, 54px);
  background: #0b1426;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sx-top { top: 0; transform: translateY(-100%); }
.sx-bottom { bottom: 0; transform: translateY(100%); }
#showcase.sx-lineup .sx-bar,
#showcase.sx-sweep .sx-bar { transform: none; }

/* ---------------------------------------------------------------- names under the fighters */

.sx-tags { position: absolute; inset: 0; }
.sx-tag {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  justify-items: center;
  gap: 2px;
  white-space: nowrap;
  opacity: 0;
  will-change: transform;
}
.sx-tag b {
  display: block;
  padding: 3px 12px 4px;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: clamp(14px, 1.7vw, 20px);
  line-height: 1.1;
  box-shadow: 0 0 0 2.5px var(--ink), 0 4px 0 2.5px var(--ink), inset 0 -4px 0 var(--c, var(--blue));
  max-width: 34vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sx-tag.me b { background: var(--yellow); }
.sx-tag i {
  display: block;
  margin-top: 4px;
  padding: 1px 9px 2px;
  border-radius: 999px;
  background: var(--c, var(--blue));
  color: #fff;
  font-style: normal;
  font-size: clamp(11px, 1.2vw, 14px);
  text-shadow: 0 1px 0 rgba(18, 32, 58, 0.5);
  box-shadow: 0 0 0 2px var(--ink);
}
.sx-tag s {
  display: block;
  margin-bottom: 1px;
  padding: 1px 8px;
  border-radius: 6px;
  background: var(--yellow);
  color: var(--ink);
  text-decoration: none;
  font-size: clamp(11px, 1.1vw, 13px);
  box-shadow: 0 0 0 2px var(--ink);
}
/* The pop is on what a plate holds, not on the plate itself: the plate is put in place by its transform,
   and a scale on it scales that move too (plates flew in from the corner and overshot the screen's edge). */
.sx-tag.on { opacity: 1; }
.sx-tag.on > * { animation: sx-plate 0.32s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
@keyframes sx-plate {
  from { opacity: 0; scale: 0.4; }
  to { opacity: 1; scale: 1; }
}

/* ---------------------------------------------------------------- a team's name */

.sx-cap {
  position: absolute;
  left: max(22px, env(safe-area-inset-left));
  top: calc(clamp(18px, 6.5vh, 54px) + 14px);
  display: grid;
  justify-items: start;
  gap: 2px;
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.18s ease, transform 0.3s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.sx-cap.on { opacity: 1; transform: none; }
.sx-cap small {
  padding: 2px 10px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: clamp(12px, 1.4vw, 16px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sx-cap small:empty { display: none; }
.sx-cap b {
  font-size: clamp(30px, 5.2vw, 64px);
  line-height: 1;
  color: var(--c, #fff);
  text-shadow: var(--edge), 0 6px 0 var(--ink);
  text-transform: uppercase;
}

/* ---------------------------------------------------------------- VS */

.sx-vs {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  opacity: 0;
}
.sx-vs b {
  display: grid;
  place-items: center;
  width: clamp(84px, 12vw, 140px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--ink);
  font-size: clamp(38px, 5.5vw, 66px);
  box-shadow: 0 0 0 5px var(--ink), 0 9px 0 5px var(--ink);
  rotate: -8deg;
}
.sx-vs.on { opacity: 1; animation: sx-vs 0.36s cubic-bezier(0.2, 1.8, 0.4, 1) both; }
@keyframes sx-vs {
  from { scale: 2.4; opacity: 0; }
  to { scale: 1; opacity: 1; }
}

/* ---------------------------------------------------------------- the big title */

.sx-title {
  position: absolute;
  left: 50%;
  top: max(4vh, env(safe-area-inset-top));
  display: grid;
  justify-items: center;
  translate: -50% 0;
  opacity: 0;
  white-space: nowrap;
}
.sx-title b {
  position: relative;
  font-size: min(clamp(54px, 11vw, 132px), calc(150vw / var(--len, 7)));
  line-height: 1;
  color: var(--c, var(--yellow));
  text-shadow: 0 3px 0 var(--ink), 0 -3px 0 var(--ink), 3px 0 0 var(--ink), -3px 0 0 var(--ink), 3px 3px 0 var(--ink), -3px 3px 0 var(--ink), 3px -3px 0 var(--ink), -3px -3px 0 var(--ink), 0 9px 0 var(--ink);
  letter-spacing: 0.02em;
}
.sx-title span {
  position: relative;
  margin-top: 6px;
  padding: 3px 16px 5px;
  border-radius: 8px;
  background: var(--ink);
  font-size: clamp(16px, 2.2vw, 26px);
}
.sx-title span:empty { display: none; }
/* Sunbeams behind a win, turning slowly. */
.sx-rays {
  position: absolute;
  left: 50%;
  top: 42%;
  width: min(64vw, 560px);
  aspect-ratio: 1;
  translate: -50% -50%;
  background: repeating-conic-gradient(rgba(255, 220, 90, 0.3) 0deg 9deg, transparent 9deg 22deg);
  -webkit-mask-image: radial-gradient(circle, #000 18%, transparent 62%);
  mask-image: radial-gradient(circle, #000 18%, transparent 62%);
  opacity: 0;
}
.sx-title.on { animation: sx-slam 0.42s cubic-bezier(0.2, 1.5, 0.35, 1) both; }
.sx-title.on[data-kind="lose"] { animation: sx-sink 0.5s ease-out both; }
.sx-title.on[data-kind="win"] .sx-rays { opacity: 1; animation: sx-turn 14s linear infinite; }
@keyframes sx-slam {
  0% { opacity: 0; scale: 3; }
  60% { opacity: 1; scale: 0.92; }
  100% { opacity: 1; scale: 1; }
}
@keyframes sx-sink {
  from { opacity: 0; transform: translateY(-40px); }
  to { opacity: 1; transform: none; }
}
@keyframes sx-turn { to { rotate: 360deg; } }

/* ---------------------------------------------------------------- skip */

/* In the top bar, out of the picture's way. */
.sx-skip {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  top: max(3px, calc((clamp(18px, 6.5vh, 54px) - 25px) / 2));
  padding: 4px 12px 5px;
  border-radius: 999px;
  background: rgba(11, 20, 38, 0.62);
  font-family: var(--ui);
  font-weight: 800;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.sx-skip.on { opacity: 0.9; }
#showcase.sx-podium .sx-skip { top: max(12px, env(safe-area-inset-top)); }

/* ---------------------------------------------------------------- phones */

/* Upright: names smaller, the team's name above the row. */
@media (max-aspect-ratio: 1/1) {
  .sx-tag b { font-size: 14px; max-width: 46vw; }
  .sx-cap { left: 50%; translate: -50% 0; justify-items: center; }
  .sx-cap.on { transform: none; }
  .sx-title b { font-size: min(clamp(44px, 18vw, 92px), calc(160vw / var(--len, 7))); }
}
/* On their side, short: thinner bars. */
@media (max-height: 520px) {
  .sx-bar { height: 16px; }
  .sx-cap { top: 26px; }
  .sx-cap b { font-size: 30px; }
  .sx-title b { font-size: min(56px, calc(150vw / var(--len, 7))); }
  .sx-title span { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .sx-tag.on, .sx-tag.on > *, .sx-vs.on, .sx-title.on, .sx-title.on[data-kind="lose"] { animation: none; opacity: 1; }
  .sx-title.on[data-kind="win"] .sx-rays { animation: none; }
}
