/**
 * @file: period-leaderboards.css
 * @description: Страница рейтингов закрытой недели / месяца
 * @created: 2026-07-22
 */

@layer components {
  .period-lb {
    --period-lb-accent: var(--primary, #c81e1e);
    padding-bottom: 2.5rem;
  }

  .period-lb__header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem 1.25rem;
    margin-bottom: 1.25rem;
  }

  .period-lb__title {
    margin: 0;
    font-size: clamp(1.35rem, 2.2vw, 1.85rem);
    font-weight: 800;
    letter-spacing: -0.02em;
  }

  .period-lb__dates {
    margin: 0.25rem 0 0;
    font-size: 0.95rem;
    opacity: 0.78;
  }

  .period-lb__actions {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
  }

  .period-lb__segmented {
    display: inline-flex;
    gap: 0.2rem;
    padding: 0.2rem;
    border-radius: 12px;
    border: 1px solid rgba(127, 127, 127, 0.35);
    background: rgba(127, 127, 127, 0.08);
  }

  .period-lb__segment {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.85rem;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    color: inherit;
    opacity: 0.75;
  }

  .period-lb__segment:hover {
    opacity: 1;
    text-decoration: none;
    color: inherit;
  }

  .period-lb__segment.is-active {
    opacity: 1;
    background: var(--period-lb-accent);
    color: #fff !important;
  }

  .period-lb__segment.is-active:hover,
  .period-lb__segment.is-active:focus,
  .period-lb__segment.is-active:visited {
    color: #fff !important;
  }

  .period-lb__section-title {
    margin: 1.75rem 0 0.85rem;
    font-size: 1.1rem;
    font-weight: 800;
  }

  .period-lb__section-note {
    margin: -0.35rem 0 0.85rem;
    font-size: 0.85rem;
    opacity: 0.72;
  }

  .period-lb__formula {
    border: 1px solid rgba(127, 127, 127, 0.28);
    border-radius: 14px;
    background: rgba(127, 127, 127, 0.06);
    margin-bottom: 1.25rem;
  }

  .period-lb__formula-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 0;
    background: transparent;
    color: inherit;
    font-weight: 700;
    text-align: left;
  }

  .period-lb__formula-body {
    padding: 0 1rem 1rem;
  }

  .period-lb__weights {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
  }

  .period-lb__weights th,
  .period-lb__weights td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid rgba(127, 127, 127, 0.2);
    text-align: left;
  }

  .period-lb__hero {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
  }

  @media (max-width: 991.98px) {
    .period-lb__hero {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }

  @media (max-width: 575.98px) {
    .period-lb__hero {
      grid-template-columns: 1fr;
    }
  }

  .period-lb__hero-card {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.85rem;
    border-radius: 14px;
    border: 1px solid rgba(127, 127, 127, 0.28);
    background: rgba(127, 127, 127, 0.05);
    min-width: 0;
  }

  .period-lb__hero-card--first {
    border-color: color-mix(in srgb, var(--period-lb-accent) 55%, transparent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--period-lb-accent) 25%, transparent);
  }

  .period-lb__hero-top {
    display: flex;
    align-items: center;
    gap: 0.65rem;
  }

  .period-lb__hero-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
  }

  .period-lb__hero-avatar-ph {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(127, 127, 127, 0.2);
    flex-shrink: 0;
  }

  .period-lb__hero-place {
    font-size: 0.75rem;
    font-weight: 800;
    opacity: 0.7;
  }

  .period-lb__hero-name {
    font-weight: 800;
    line-height: 1.2;
    text-decoration: none;
    color: inherit;
  }

  .period-lb__hero-name:hover {
    color: var(--period-lb-accent);
  }

  .period-lb__hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
    font-size: 0.78rem;
    opacity: 0.8;
  }

  .period-lb__hero-score {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1;
  }

  .period-lb__breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
  }

  .period-lb__breakdown-title {
    font-size: 0.8rem;
    font-weight: 700;
    opacity: 0.85;
    margin-bottom: 0.15rem;
  }

  .period-lb__breakdown-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.25rem 0.5rem;
    font-size: 0.75rem;
  }

  .period-lb__bar {
    grid-column: 1 / -1;
    height: 4px;
    border-radius: 999px;
    background: rgba(127, 127, 127, 0.2);
    overflow: hidden;
  }

  .period-lb__bar > span {
    display: block;
    height: 100%;
    background: var(--period-lb-accent);
    border-radius: inherit;
  }

  .period-lb__noms {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
  }

  @media (max-width: 991.98px) {
    .period-lb__noms {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }

  @media (max-width: 575.98px) {
    .period-lb__noms {
      grid-template-columns: 1fr;
    }
  }

  .period-lb__nom-card {
    border: 1px solid rgba(127, 127, 127, 0.28);
    border-radius: 14px;
    padding: 0.9rem;
    background: rgba(127, 127, 127, 0.04);
    height: 100%;
  }

  .period-lb__nom-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0 0.25rem;
    font-size: 0.98rem;
    font-weight: 800;
  }

  .period-lb__weight-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    background: color-mix(in srgb, var(--period-lb-accent) 18%, transparent);
    color: var(--period-lb-accent);
  }

  .period-lb__nom-hint {
    margin: 0 0 0.7rem;
    font-size: 0.78rem;
    opacity: 0.72;
  }

  .period-lb__nom-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
  }

  .period-lb__nom-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
  }

  .period-lb__nom-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
  }

  .period-lb__nom-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
    color: inherit;
    font-size: 0.86rem;
  }

  .period-lb__nom-name:hover {
    color: var(--period-lb-accent);
  }

  .period-lb__nom-value {
    font-weight: 800;
    font-size: 0.86rem;
    flex-shrink: 0;
  }

  .period-lb__empty {
    opacity: 0.65;
    font-size: 0.88rem;
    margin: 0;
  }
}
