/* ==========================================================================
   DP World ILT20 - Belts Leaderboard Section (Home Page)
   Design: ILT20-belt/home-page-belt.png (desktop frame 1440 x 738)
   Markup: index.html #belts | Logic: js/belts.js | Data: assets/data/belts.json
   Docs: docs/belts-section.md
   ========================================================================== */

/* --------------------------------------------------------------------------
   Section Shell (white canvas, pink stadium + calligraphy artwork)
   -------------------------------------------------------------------------- */
.belts-section {
  position: relative;
  background-color: #ffffff;
  background-image: url('../assets/belts/belts-section-bg.jpg');
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: cover;
  color: #ffffff;
  overflow: hidden;
  padding: 61px 0 70px;
}

.belts-inner {
  position: relative;
  max-width: 1119px;
  margin: 0 auto;
  padding-top: 117px;
}

/* Giant outlined "BELTS" title (Figma node 411:7550, 550 x 187) */
.belts-title {
  position: absolute;
  top: 0;
  left: 20.1%;
  width: 550px;
  max-width: 50%;
  margin: 0;
  line-height: 0;
  pointer-events: none;
}

.belts-title-img {
  display: block;
  width: 100%;
  height: auto;
}

/* --------------------------------------------------------------------------
   Season Selector (pink pill, top right)
   -------------------------------------------------------------------------- */
.belts-season-select {
  position: absolute;
  top: 45px;
  right: 60px;
  z-index: 5;
}

.belts-season-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 41px;
  padding: 0 11px;
  background: var(--color-pink-primary);
  border: none;
  border-radius: 4px;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 17.2px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.belts-season-btn:hover {
  background: var(--color-pink-hover);
}

.belts-season-btn:focus-visible {
  outline: 2px solid var(--color-bg-purple);
  outline-offset: 3px;
}

.belts-season-btn svg {
  transition: transform 0.25s ease;
}

.belts-season-btn[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.belts-season-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 100%;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  background: var(--color-bg-purple);
  border-radius: 4px;
  box-shadow: 0 10px 24px rgba(20, 2, 36, 0.35);
}

.belts-season-menu[hidden] {
  display: none;
}

.belts-season-option {
  padding: 8px 14px;
  font-family: var(--font-display);
  font-size: 16px;
  text-transform: uppercase;
  white-space: nowrap;
  color: #ffffff;
  cursor: pointer;
}

.belts-season-option:hover,
.belts-season-option:focus-visible,
.belts-season-option[aria-selected="true"] {
  background: var(--color-pink-primary);
  outline: none;
}

/* --------------------------------------------------------------------------
   Two-Column Layout: Spotlight Card + Leaderboard
   -------------------------------------------------------------------------- */
.belts-layout {
  position: relative;
  display: flex;
  gap: 20px;
}

/* Spotlight player card (398 x 490). Base colour follows the active belt. */
.belts-spotlight {
  --belt-card-base: #073624;
  position: relative;
  flex: 0 0 398px;
  height: 490px;
  border-radius: 10px;
  overflow: hidden;
  background-color: var(--belt-card-base);
  transition: background-color 0.35s ease;
}

.belts-spotlight.belt-theme-white {
  --belt-card-base: #d6d0dd;
}

.belts-spotlight.belt-theme-red {
  --belt-card-base: #4c0710;
}

.belts-spotlight.belt-theme-blue {
  --belt-card-base: #0b2a5e;
}

.belts-spotlight-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The supplied card art is green. Until per-belt art exists, other belts show it as a neutral texture. */
.belts-spotlight:not(.belt-theme-green) .belts-spotlight-bg {
  filter: grayscale(1);
  mix-blend-mode: luminosity;
  opacity: 0.45;
}

.belts-spotlight-player {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 100%;
  height: 445px;
  object-fit: contain;
  object-position: center bottom;
  transform: translateX(-50%);
  transition: opacity 0.3s ease;
}

/* Right column (701px) */
.belts-board {
  flex: 1 1 701px;
  max-width: 701px;
  margin-top: 23px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.belts-panel {
  width: 100%;
  background: var(--color-bg-purple);
  border-radius: 5px;
}

/* --------------------------------------------------------------------------
   Belt Tabs (57px bar) + Category Tag ("BEST BATTER")
   -------------------------------------------------------------------------- */
.belts-tabs {
  position: relative;
  display: flex;
  height: 57px;
  background: #2a0842;
  border-radius: 5px 5px 0 0;
}

.belts-tab {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  background: transparent;
  border: none;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: 1.25px;
  text-transform: uppercase;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.belts-tab:first-child {
  border-top-left-radius: 5px;
}

.belts-tab:hover {
  color: var(--color-lime-primary);
}

.belts-tab:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: -4px;
}

/* Active tab colours (same palette as the previous belts widget) */
.belts-tab.active[data-belt="green"] {
  background: #b7dd4a;
  color: #421066;
  border-radius: 5px 6px 6px 0;
}

.belts-tab.active[data-belt="white"] {
  background: #ffffff;
  color: #421066;
  border-radius: 6px;
}

.belts-tab.active[data-belt="red"] {
  background: #de0004;
  color: #ffffff;
  border-radius: 6px;
}

.belts-tab.active[data-belt="blue"] {
  background: #0077ff;
  color: #ffffff;
  border-radius: 6px 5px 0 6px;
}

/* Pink pointer tag above the active tab (Figma "Union", 150 x 40) */
.belts-tab-tag {
  position: absolute;
  bottom: calc(100% + 9px);
  left: 50%;
  min-width: 148px;
  padding: 7px 16px 6px;
  background: var(--color-pink-primary);
  border-radius: 5px;
  text-align: center;
  box-shadow: 0 4px 7.5px rgba(0, 0, 0, 0.27);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
  white-space: nowrap;
  transform: translateX(-50%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.belts-tab-tag::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  border: 6px solid transparent;
  border-top-color: var(--color-pink-primary);
  border-bottom: 0;
  transform: translateX(-50%);
}

.belts-tab.active .belts-tab-tag {
  opacity: 1;
  visibility: visible;
}

/* --------------------------------------------------------------------------
   Leaderboard Rows (5 x 57px)
   -------------------------------------------------------------------------- */
.belts-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 9px 0 8px;
  list-style: none;
  transition: opacity 0.25s ease;
}

.belts-rows.is-updating {
  opacity: 0;
}

.belts-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 50px 178px;
  column-gap: 27px;
  align-items: center;
  height: 57px;
  padding: 0 24px;
  background: linear-gradient(90deg, #3c0759 0%, #421066 50%, #3a0557 100%);
  box-shadow: inset 0 1px 0 #521573, inset 0 -1px 0 rgba(82, 21, 115, 0.87);
  transition: background 0.3s ease;
}

.belts-row:hover {
  background: linear-gradient(90deg, #4a0b6d 0%, #521678 50%, #47086a 100%);
}

/* Rank: white numeral with offset pink outline */
.belts-rank {
  position: relative;
  isolation: isolate;
  /* keeps the outline layer behind the numeral, not behind the row */
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 500;
  line-height: 1;
  color: #ffffff;
}

.belts-rank::before {
  content: attr(data-rank);
  position: absolute;
  top: -1px;
  left: 1px;
  z-index: -1;
  color: transparent;
  -webkit-text-stroke: 1px var(--color-pink-primary);
}

.belts-player {
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 500;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  color: #ffffff;
}

/* Team logos: assets/team/logos/*.png are 100 x 100 (2x) shown at 50 x 50 */
.belts-team-logo {
  display: block;
  width: 50px;
  height: 50px;
  object-fit: contain;
}

.belts-points {
  padding-left: 68px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  color: #b7dd4a;
}

.belts-points small {
  margin-left: 3px;
  font-size: 13px;
}

.belts-empty {
  padding: 40px 24px;
  font-family: var(--font-display);
  font-size: 20px;
  text-align: center;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   Call To Action
   -------------------------------------------------------------------------- */
.belts-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 279px;
  height: 51px;
  padding: 0 21px;
  background: var(--color-pink-primary);
  border-radius: 5px;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 21.5px;
  font-weight: 500;
  text-decoration: none;
  text-transform: uppercase;
  transition: var(--transition-smooth);
}

.belts-cta:hover {
  background: var(--color-pink-hover);
  color: #ffffff;
}

.belts-cta:focus-visible {
  outline: 2px solid var(--color-bg-purple);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1280px) {
  .belts-season-select {
    right: 20px;
  }

  /* Keep the design's 398 x 490 card proportion as the column narrows */
  .belts-spotlight {
    flex-basis: 36%;
    height: auto;
    aspect-ratio: 398 / 490;
    align-self: flex-start;
  }

  .belts-spotlight-player {
    height: 91%;
  }
}

@media (max-width: 1100px) {

  /* Narrower tabs: the tag fits its text instead of the 148px design width */
  .belts-tab-tag {
    min-width: 0;
    padding: 6px 10px 5px;
    font-size: 15px;
  }
}

@media (max-width: 1024px) {
  .belts-tab {
    font-size: 21px;
  }

  .belts-row {
    grid-template-columns: 26px minmax(0, 1fr) 44px 110px;
    column-gap: 16px;
    padding: 0 18px;
  }

  .belts-player {
    font-size: 21px;
  }

  .belts-team-logo {
    width: 44px;
    height: 44px;
  }

  .belts-points {
    padding-left: 12px;
    font-size: 26px;
  }
}

@media (max-width: 860px) {
  .belts-inner {
    padding-top: 15%;
  }

  .belts-title {
    /* max-width: 55%; */
  }

  .belts-spotlight {
    flex-basis: 38%;
  }

  .belts-board {
    margin-top: 12px;
  }

  .belts-tab {
    font-size: 18px;
  }
}

@media (max-width: 760px) {
  .belts-section {
    padding: 36px 0 44px;
    background-size: 1440px auto;
  }

  .belts-inner {
    padding-top: 22%;
  }

  .belts-title {
    left: 0;
    /* max-width: 62%; */
  }

  .belts-season-select {
    top: 10px;
    right: 20px;
  }

  .belts-layout {
    flex-direction: column;
    gap: 56px;
  }

  .belts-spotlight {
    flex: none;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
  }

  .belts-board {
    flex: none;
    width: 100%;
    max-width: none;
    margin-top: 0;
  }

  .belts-cta {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 560px) {
  .belts-season-btn {
    height: 34px;
    font-size: 15px;
  }

  .belts-spotlight {
    max-width: 260px;
  }

  .belts-tabs {
    height: 46px;
  }

  .belts-tab {
    padding: 0 4px;
    font-size: 17px;
    letter-spacing: 0.6px;
  }

  .belts-tab-tag {
    min-width: 0;
    padding: 5px 10px 4px;
    font-size: 13px;
  }

  .belts-row {
    grid-template-columns: 22px minmax(0, 1fr) 34px 74px;
    column-gap: 10px;
    height: 50px;
    padding: 0 12px;
  }

  .belts-rank {
    font-size: 28px;
  }

  .belts-player {
    font-size: 17px;
  }

  .belts-team-logo {
    width: 34px;
    height: 34px;
  }

  .belts-points {
    padding-left: 0;
    font-size: 21px;
    text-align: right;
  }

  .belts-points small {
    font-size: 10px;
  }

  .belts-cta {
    height: 46px;
    font-size: 18px;
  }
}

/* Small phones (320-360px) */
@media (max-width: 360px) {
  .belts-tab {
    padding: 0 2px;
    font-size: 15px;
    letter-spacing: 0.2px;
  }

  .belts-tab-tag {
    padding: 4px 8px 3px;
    font-size: 12px;
  }

  .belts-row {
    grid-template-columns: 20px minmax(0, 1fr) 30px 62px;
    column-gap: 8px;
    padding: 0 10px;
  }

  .belts-rank {
    font-size: 25px;
  }

  .belts-player {
    font-size: 15.5px;
  }

  .belts-team-logo {
    width: 30px;
    height: 30px;
  }

  .belts-points {
    font-size: 19px;
  }
}

@media (prefers-reduced-motion: reduce) {

  .belts-rows,
  .belts-spotlight,
  .belts-spotlight-player,
  .belts-tab-tag {
    transition: none;
  }
}