/* The home page's match modules: the recent-matches strip, the live Results
 * ticker, and the match dialog both open (resources/js/home-matches.js).
 * Printed once by RecentResults::assets(). The players inside the dialog are
 * styled by match-videos.css. */

/* ---- Recent matches strip (home-recent-matches.php) ----

   The standings and news panels' construction -- same surface, radius and
   gold eyebrow -- as a full-width row of home-top's grid, under Live Now. */
.rm {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 20px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

.rm__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 14px;
}

.rm__heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
}

.rm__eyebrow {
  margin: 0;
  color: #d99a32;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.rm__summary {
  margin: 0;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rm__actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.rm__nav {
  display: flex;
  gap: 6px;
}

.rm__arrow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.rm__arrow:not(:disabled):hover {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.12);
}

.rm__arrow:disabled {
  opacity: 0.3;
  cursor: default;
}

.rm__all {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.rm__all:hover {
  color: #ffffff;
}

.rm__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 200px;
  gap: 12px;
  margin: 0;
  padding: 0 0 8px;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}

.rm__track > li {
  display: flex;
  scroll-snap-align: start;
}

.rm__track:focus-visible,
.rm__arrow:focus-visible,
.rm-card:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

/* ---- A card ---- */

.rm-card {
  --rm-tone: rgba(255, 255, 255, 0.5);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 14px;
  background: #0d1119;
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #ffffff;
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.rm-card--win { --rm-tone: #4ade80; }
.rm-card--loss { --rm-tone: #f87171; }
.rm-card--neutral { --rm-tone: #60a5fa; }

.rm-card:hover {
  border-color: rgba(255, 255, 255, 0.24);
  transform: translateY(-2px);
}

/* A tint of the result until Kick hands over a thumbnail. */
.rm-card__thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--rm-tone) 22%, transparent), transparent 70%),
    #111722;
  background-size: cover;
  background-position: center;
}

.rm-card__thumb.has-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent 55%);
}

.rm-card__result {
  position: absolute;
  z-index: 1;
  left: 10px;
  top: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(7, 9, 13, 0.78);
  color: var(--rm-tone);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.rm-card__play {
  position: absolute;
  z-index: 1;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #22c55e;
  color: #04130a;
  font-size: 0.7rem;
  font-weight: 900;
}

.rm-card__play[hidden] {
  display: none;
}

.rm-card__body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 12px 12px;
}

.rm-card__vs {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  font-weight: 800;
}

.rm-card__vs-label {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.74rem;
  font-weight: 700;
}

.rm-card__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rm-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.74rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rm-card__vs.is-winner .rm-card__name::before {
  content: '\1F3C6';
  margin-right: 6px;
}

/* Rating up / down, wherever it is printed. */
.hm-tone--up { color: #22c55e; }
.hm-tone--down { color: #f87171; }
.hm-tone--flat { color: rgba(255, 255, 255, 0.5); }

/* ---- The dialog ---- */

.rm-dialog {
  width: min(860px, calc(100% - 32px));
  max-height: calc(100% - 48px);
  padding: 0;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #0d1119;
  color: #ffffff;
}

/* The padding lives in here, so a click that lands on the dialog element
   itself can only be the backdrop. */
.rm-dialog__inner {
  padding: 22px;
}

.rm-dialog::backdrop {
  background: rgba(3, 5, 9, 0.78);
}

.rm-dialog__head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rm-dialog__badge {
  flex: none;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rm-dialog__badge--win { background: rgba(34, 197, 94, 0.16); color: #4ade80; }
.rm-dialog__badge--loss { background: rgba(239, 68, 68, 0.14); color: #f87171; }
.rm-dialog__badge--draw,
.rm-dialog__badge--neutral { background: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.65); }

.rm-dialog__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 1.3rem;
  overflow-wrap: anywhere;
}

.rm-dialog__title a {
  color: inherit;
  text-underline-offset: 3px;
}

.rm-dialog__vs {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.9rem;
}

.rm-dialog__close {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;
  color: #ffffff;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.rm-dialog__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 10px 0 16px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.84rem;
  font-weight: 700;
}

.rm-dialog__vods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.rm-dialog__vods:empty {
  display: none;
}

.rm-dialog__status {
  margin: 0;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.86rem;
}

.rm-dialog__status:empty {
  display: none;
}

.rm-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.rm-dialog__btn {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  background: #22c55e;
  color: #04130a;
  font-size: 0.84rem;
  font-weight: 850;
  text-decoration: none;
}

.rm-dialog__btn--ghost {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

@media (max-width: 600px) {
  .rm {
    padding: 16px;
  }

  .rm__nav {
    display: none;
  }

  .rm__track {
    grid-auto-columns: 62%;
  }

  .rm-dialog__inner {
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rm__track {
    scroll-behavior: auto;
  }

  .rm-card:hover {
    transform: none;
  }
}

/* ---- Results ticker (home-results-ticker.php) ----

   A slimmer band than the strip: the scores ARE the content, so the chips
   are type, not pictures. */

.rt {
  grid-column: 1 / -1;
  min-width: 0;
  color: #ffffff;
}

.rt__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin-bottom: 12px;
}

.rt__eyebrow {
  margin: 0;
  color: #d99a32;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.rt__live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rt__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: rt-pulse 1.6s ease-in-out infinite;
}

.rt__note {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.8rem;
  font-weight: 700;
}

.rt__nav {
  margin-left: auto;
}

.rt__nav[hidden] {
  display: none;
}

.rt__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 220px;
  gap: 10px;
  margin: 0;
  padding: 4px 0 8px;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}

.rt__track:empty {
  display: none;
}

.rt__empty {
  margin: 0;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.86rem;
}

.rt-item {
  display: flex;
}

.rt-chip {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: #0d1119;
  color: #ffffff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.rt-chip:hover {
  border-color: rgba(255, 255, 255, 0.24);
}

.rt-chip:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

.rt-chip__top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.7rem;
  font-weight: 800;
}

.rt-chip__ladder {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.rt-chip__ago {
  flex: none;
}

.rt-chip__row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
  font-weight: 700;
}

.rt-chip__row.is-winner {
  color: #ffffff;
  font-weight: 850;
}

.rt-chip__mark {
  flex: none;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.64rem;
  font-weight: 900;
}

.rt-chip__row.is-winner .rt-chip__mark {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
}

.rt-chip__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rt-chip__elo {
  flex: none;
  font-size: 0.8rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.rt-chip__reason {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.7rem;
  font-weight: 700;
}

/* A result that arrived while the page was open: pops in, then glows green
   for a few seconds so the eye finds it. */
.rt-item.is-new .rt-chip {
  animation: rt-pop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.3) both, rt-glow 6s ease-out both;
}

@keyframes rt-pop {
  from { opacity: 0; transform: translateX(-16px) scale(0.85); }
  to { opacity: 1; transform: none; }
}

@keyframes rt-glow {
  0%, 30% { border-color: rgba(34, 197, 94, 0.85); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); }
  100% { border-color: rgba(255, 255, 255, 0.09); box-shadow: none; }
}

@keyframes rt-pulse {
  50% { opacity: 0.3; }
}

@media (max-width: 600px) {
  .rt__note,
  .rt__nav {
    display: none;
  }

  .rt__track {
    grid-auto-columns: 70%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rt__dot,
  .rt-item.is-new .rt-chip {
    animation: none;
  }

  .rt-item.is-new .rt-chip {
    border-color: rgba(34, 197, 94, 0.6);
  }
}
