/* Ranking de Calendario: tabla compacta, ordenable y coherente con la sección oscura. */
.ranking {
  padding: clamp(4.5rem, 8vw, 7.5rem) var(--side);
  background: var(--ink);
  color: var(--paper);
}
.ranking-head,
.ranking-scroll,
.ranking-help {
  width: min(100%, 74.375rem);
  margin-inline: auto;
}
.ranking-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1rem 2rem;
  margin-bottom: clamp(2.5rem, 5vw, 4.5rem);
}
.ranking-head .eyebrow {
  grid-column: 1 / -1;
  color: var(--gold);
}
.ranking-head h2 {
  max-width: 8ch;
  margin: 0;
  font-size: clamp(4rem, 8.5vw, 8.5rem);
}
.ranking-week-control { display: flex; flex-wrap: wrap; gap: 0.5rem; align-self: end; }
.ranking-week-control button {
  min-height: 2.75rem;
  padding: 0.625rem 0.875rem;
  border: 1px solid rgba(255, 254, 245, 0.55);
  background: transparent;
  color: var(--paper);
  font-size: 0.75rem;
  font-weight: 700;
}
.ranking-week-control button:hover:not(:disabled),
.ranking-week-control button:focus-visible,
.ranking-week-control button[aria-pressed="true"] {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--ink);
}
.ranking-week-control button:disabled { opacity: 0.4; cursor: default; }
.ranking-scroll {
  overflow-x: auto;
  border-block: 1px solid rgba(255, 254, 245, 0.55);
  scrollbar-width: thin;
  scrollbar-color: var(--gold) rgba(255, 255, 255, 0.08);
}
.ranking-table {
  width: 100%;
  min-width: 58rem;
  border-collapse: collapse;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}
.ranking-table th,
.ranking-table td {
  padding: 1rem 0.875rem;
  border-bottom: 1px solid rgba(255, 254, 245, 0.18);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
.ranking-table tbody tr:last-child td { border-bottom: 0; }
.ranking-table th {
  padding: 0;
  color: var(--gold);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
}
.ranking-table th[aria-sort="ascending"],
.ranking-table th[aria-sort="descending"] {
  background: rgba(255, 254, 245, 0.07);
}
.ranking-table th button {
  width: 100%;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.75rem 0.875rem;
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 700;
  text-align: left;
}
.ranking-table th:first-child button { justify-content: center; text-align: center; }
.ranking-table th button:hover,
.ranking-table th button:focus-visible {
  color: var(--paper);
}
.ranking-table th button span {
  width: 0.5rem;
  height: 0.5rem;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  opacity: 0.32;
  transform: rotate(45deg) translateY(-0.125rem);
  transition: opacity 160ms ease, transform 220ms var(--ease-soft);
}
.ranking-table th[aria-sort="ascending"] button span,
.ranking-table th[aria-sort="descending"] button span { opacity: 1; }
.ranking-table th[aria-sort="ascending"] button span { transform: rotate(225deg) translate(-0.125rem, -0.125rem); }
.ranking-row {
  animation: ranking-row-in 320ms var(--ease-soft) both;
  animation-delay: calc(var(--row-index) * 24ms);
  transition: background 180ms ease;
}
.ranking-row:hover { background: rgba(225, 178, 35, 0.08); }
.ranking-row td { transition: background 180ms ease, color 180ms ease; }
.ranking-row td:hover { background: rgba(225, 178, 35, 0.17); color: var(--paper); }
.ranking-table tbody td:first-child {
  color: var(--gold);
  font-size: 1.125rem;
  font-weight: 900;
  text-align: center;
}
.ranking-place {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  vertical-align: middle;
}
.ranking-place--podium {
  position: relative;
  width: 2rem;
  height: 2rem;
  color: var(--gold);
  vertical-align: middle;
}
.ranking-place--podium svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
  opacity: 0.9;
}
.ranking-place-number {
  position: absolute;
  top: 0.41rem;
  left: 50%;
  color: var(--ink);
  font-family: Arial, sans-serif;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  transform: translateX(-50%);
}
.ranking-cyclist {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
}
a.ranking-cyclist:hover { color: var(--gold); }
.ranking-avatar {
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 2.25rem;
  border-radius: 50%;
  object-fit: cover;
}
.ranking-initials {
  display: grid;
  place-items: center;
  background: var(--favicon-bg);
  color: var(--ink);
  font-size: 0.6875rem;
}
.ranking-table small { color: rgba(255, 254, 245, 0.65); }
.ranking-empty { color: rgba(255, 254, 245, 0.48); }
.ranking-loading td {
  height: 8rem;
  color: rgba(255, 254, 245, 0.7);
  text-align: center;
}
.ranking-pagination {
  width: min(100%, 74.375rem);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 1.5rem auto 0;
}
.ranking-pagination[hidden] { display: none; }
.ranking-page-list { display: flex; align-items: center; gap: 0.35rem; }
.ranking-pagination button {
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid rgba(255, 254, 245, 0.34);
  background: transparent;
  color: var(--paper);
  font-size: 0.6875rem;
  font-weight: 700;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms var(--ease-soft);
}
.ranking-pagination button:hover:not(:disabled),
.ranking-pagination button:focus-visible,
.ranking-pagination button[aria-current="page"] {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--ink);
  transform: translateY(-0.1rem);
}
.ranking-pagination button:disabled { opacity: 0.32; cursor: default; }
.ranking-help {
  display: none;
  margin-top: 0.75rem;
  color: rgba(255, 254, 245, 0.65);
  font-size: 0.6875rem;
}
.ranking-note {
  width: min(100%, 74.375rem);
  margin: 0.875rem auto 0;
  color: var(--gold);
  font-size: 0.6875rem;
  font-style: italic;
}
@keyframes ranking-row-in {
  from { opacity: 0.72; transform: translateY(0.18rem); }
}
@media (max-width: 640px) {
  .ranking { padding-block: 4rem; }
  .ranking-head { grid-template-columns: 1fr; gap: 0.75rem; }
  .ranking-head h2 { font-size: clamp(3.75rem, 19vw, 6rem); }
  .ranking-week-control { margin-top: 0.5rem; }
  .ranking-table { min-width: 54rem; }
  .ranking-table th,
  .ranking-table td { padding-inline: 0.75rem; }
  .ranking-table th { padding: 0; }
  .ranking-help { display: block; }
  .ranking-pagination { gap: 0.35rem; }
  .ranking-pagination > button { width: 2.75rem; padding-inline: 0; font-size: 0; }
  .ranking-pagination > button::before { font-size: 0.875rem; }
  .ranking-pagination > [data-ranking-page="previous"]::before { content: "←"; }
  .ranking-pagination > [data-ranking-page="next"]::before { content: "→"; }
}
