/* File: 07-top-athletes.css */

/* =========================
   TOP ATHLETES (ta-*) - FINAL
   Scoped to #top-athletes
========================= */

#top-athletes.top-athletes-section {
  background: #fff;
  overflow: visible;
}

/* =========================
   HEADER
========================= */
#top-athletes .ta-head {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

#top-athletes .ta-head .section-title {
  margin-bottom: 0.5rem;
}

/* Title logic unified in section-title.css */

#top-athletes .ta-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 2px;
}

#top-athletes .ta-tab {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: #8a8f98;
  padding: 6px 10px;
  border-radius: 10px;
  transition: .2s ease;
}

#top-athletes .ta-tab.active {
  color: #f59e0b;
  background: rgba(245, 158, 11, .10);
  box-shadow: inset 0 0 0 2px rgba(245, 158, 11, .35);
}

#top-athletes .ta-sep {
  color: #b8bcc3;
  font-weight: 700;
}

#top-athletes .hidden {
  display: none !important;
}

#top-athletes .ta-panel {
  width: 100%;
  margin-top: 18px;
}

/* =========================
   DESKTOP PODIUM
========================= */
#top-athletes .ta-grid {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 34px;
  flex-wrap: nowrap;
  overflow: visible;
  padding-top: 42px;
}

#top-athletes .ta-card {
  flex: 0 0 auto;
  width: 190px;
  height: 230px;
  background: var(--primary-blue);
  border-radius: var(--radius-md);
  position: relative;
  box-shadow: var(--shadow-sm);
  overflow: visible;
}

#top-athletes .ta-card.rank-1 {
  width: 210px;
  height: 250px;
}

/* podium offsets */
#top-athletes .ta-card.rank-5 {
  transform: translateY(0px);
}

#top-athletes .ta-card.rank-3 {
  transform: translateY(16px);
}

#top-athletes .ta-card.rank-1 {
  transform: translateY(36px);
}

#top-athletes .ta-card.rank-2 {
  transform: translateY(22px);
}

#top-athletes .ta-card.rank-4 {
  transform: translateY(8px);
}

/* wreath */
#top-athletes .ta-wreath {
  position: absolute;
  top: -62px;
  left: 50%;
  transform: translateX(-50%);
  width: 170px;
  height: 170px;
  z-index: 2;
  pointer-events: none;
}

#top-athletes .ta-wreath img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* avatar */
#top-athletes .ta-avatar {
  position: absolute;
  top: -36px;
  left: 50%;
  transform: translateX(-50%);
  width: 104px;
  height: 104px;
  border-radius: 999px;
  overflow: hidden;
  z-index: 3;
  background: #fff;

  border: 2px solid rgba(255, 255, 255, .95);
  box-shadow: 0 10px 22px rgba(0, 0, 0, .18), 0 0 0 2px rgba(11, 58, 120, .12);

  display: flex;
  align-items: center;
  justify-content: center;
}

#top-athletes .ta-card.rank-1 .ta-avatar {
  width: 112px;
  height: 112px;
  top: -42px;
}

/* ✅ image crop fix */
#top-athletes .ta-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 20%;
  display: block;
}

/* fallback only when no-photo */
#top-athletes .ta-avatar-fallback {
  display: none;
  align-items: center;
  justify-content: center;
}

#top-athletes .ta-avatar.no-photo .ta-avatar-fallback {
  display: flex;
}

/* rank text */
#top-athletes .ta-rank {
  position: absolute;
  top: 62px;
  left: 18px;
  z-index: 4;

  background: transparent !important;
  box-shadow: none !important;

  color: #f59e0b;
  font-family: 'Cairo', sans-serif;
  font-weight: 900;
  font-size: 15px;
}

/* body */
#top-athletes .ta-body {
  padding: 118px 18px 16px;
  color: #fff;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

#top-athletes .ta-info {
  text-align: right;
  direction: rtl;
}

#top-athletes .ta-name {
  font-family: 'Cairo', sans-serif;
  font-weight: 800;
  font-size: 18px;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

#top-athletes .ta-loc {
  margin-top: 6px;
  font-family: 'Cairo', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: rgba(255, 255, 255, .75);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

#top-athletes .ta-weight {
  font-family: 'Cairo', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: rgba(255, 255, 255, .92);
  white-space: nowrap;

  display: inline-flex;
  gap: 4px;
  direction: rtl;
  unicode-bidi: plaintext;
}

#top-athletes .ta-weight-val {
  direction: ltr;
  unicode-bidi: isolate;
}

#top-athletes .ta-weight-unit {
  font-weight: 600;
  opacity: .95;
}

#top-athletes .ta-card.is-placeholder {
  background: #7a92b3;
}

/* =========================
   FOOTER
========================= */
#top-athletes .ta-footer {
  margin-top: 42px;
  text-align: center;
}

#top-athletes .ta-footer-org {
  font-family: 'Cairo', sans-serif;
  font-weight: 800;
  color: #0b2c55;
  font-size: 16px;
}

#top-athletes .ta-footer-date {
  margin-top: 6px;
  font-family: 'Cairo', sans-serif;
  font-weight: 800;
  color: #f59e0b;
  font-size: 13px;
}

/* =========================
   RESPONSIVE
========================= */

/* ✅ medium screens: horizontal scroll instead of wrap chaos */
@media (max-width: 1200px) and (min-width: 769px) {
  #top-athletes .ta-grid {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 12px;
    scroll-snap-type: x mandatory;
  }

  #top-athletes .ta-card {
    scroll-snap-align: center;
  }
}

/* =========================
   MOBILE: Rectangular list + ordered + avatar badge icons
========================= */
@media (max-width: 768px) {
  #top-athletes .ta-title {
    font-size: 24px;
  }

  /* list layout */
  #top-athletes .ta-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-top: 18px;
    align-items: stretch;
  }

  /* rectangular cards */
  #top-athletes .ta-card {
    order: var(--r, 999);
    /* ✅ 1..5 */
    width: 100%;
    max-width: 520px;
    margin-inline: auto;

    border-radius: 16px;
    overflow: hidden;
    transform: none !important;

    display: flex;
    align-items: center;
    gap: 14px;

    padding: 14px 14px;
    min-height: 92px;

    box-shadow: 0 10px 22px rgba(0, 0, 0, .08);
  }

  /* ✅ Top1 same size as others */
  #top-athletes .ta-card.rank-1 {
    width: 100% !important;
    max-width: 520px;
  }

  /* no wreath on mobile */
  #top-athletes .ta-wreath {
    display: none !important;
  }

  /* avatar in-flow */
  #top-athletes .ta-avatar {
    position: relative;
    /* ✅ for badge */
    overflow: hidden;

    position: static;
    transform: none;

    width: 66px;
    height: 66px;
    flex: 0 0 auto;

    box-shadow: 0 8px 16px rgba(0, 0, 0, .12);
  }

  /* rank becomes inline */
  #top-athletes .ta-rank {
    position: static;
    margin-inline-start: 2px;
    font-size: 13px;
  }

  /* body row layout */
  #top-athletes .ta-body {
    padding: 0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  #top-athletes .ta-name {
    font-size: 16px;
    line-height: 1.25;
  }

  #top-athletes .ta-loc {
    margin-top: 4px;
    font-size: 12.5px;
    opacity: .85;
  }

  #top-athletes .ta-weight {
    font-size: 13px;
    opacity: .95;
  }

  /* ✅ Badge over avatar (for all cards) */
  #top-athletes .ta-avatar::after {
    content: "";
    position: absolute;
    top: 6px;
    inset-inline-end: 6px;

    width: 22px;
    height: 22px;
    border-radius: 999px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 12px;
    line-height: 1;

    background: rgba(255, 255, 255, .92);
    box-shadow: 0 6px 14px rgba(0, 0, 0, .18);
    border: 2px solid rgba(245, 158, 11, .55);

    z-index: 3;
  }

  /* icons per rank */
  #top-athletes .ta-card.rank-1 .ta-avatar::after {
    content: "👑";
  }

  #top-athletes .ta-card.rank-2 .ta-avatar::after {
    content: "🥈";
  }

  #top-athletes .ta-card.rank-3 .ta-avatar::after {
    content: "🥉";
  }

  #top-athletes .ta-card.rank-4 .ta-avatar::after {
    content: "⭐";
  }

  #top-athletes .ta-card.rank-5 .ta-avatar::after {
    content: "⭐";
  }
}

@media (max-width: 420px) {
  #top-athletes .ta-card {
    padding: 12px 12px;
    gap: 12px;
  }

  #top-athletes .ta-avatar {
    width: 60px;
    height: 60px;
  }
}