/* ============================================================
   BUREAU OF LOST TIMELINES — ROLL OF OPERATIVES SHEET
   Version: 2.0 (Dossier system)

   The leaderboard is the Bureau's roll call: a column of file rows, each
   with its position number in the margin, the operative, and the three
   counters the Bureau keeps score on. Rank is metal, not neon — the top
   three get a rail and a numeral in gold, silver or bronze, and nothing
   else. Your own row is the only one stamped red, because it is the only
   row this file is about.
   ============================================================ */

.lb-main {
  max-width: var(--maxw-narrow);
  margin: 0 auto;
  padding: var(--s-5) var(--gutter) var(--s-7);
}

/* ---------- the basis rail ---------- */
.lb-tabs {
  display: flex;
  gap: var(--s-1);
  flex-wrap: wrap;
  margin-bottom: var(--s-4);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--line);
}

.lb-tab {
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-1);
  color: var(--muted-strong);
  padding: 8px var(--s-4);
  min-height: 36px;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--dur-1) var(--ease),
              border-color var(--dur-1) var(--ease),
              background var(--dur-1) var(--ease);
}

.lb-tab:hover {
  color: var(--paper-bright);
  border-color: var(--alert);
}

.lb-tab.active {
  background: var(--alert);
  border-color: var(--alert);
  color: var(--ink-0);
}

.lb-tab:focus-visible {
  outline: 2px solid var(--alert-bright);
  outline-offset: 2px;
}

/* ---------- the roll ---------- */
.lb-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--line-hair);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  overflow: hidden;
}

.lb-row {
  display: grid;
  grid-template-columns: 56px 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-3);
  background: var(--ink-1);
  padding: var(--s-2) var(--s-3);
  position: relative;
  transition: background var(--dur-1) var(--ease);
}

.lb-row:hover {
  background: var(--ink-2);
}

/* Position in the margin: the file number of the roll, set in the
   condensed display face so it reads as a ledger column. */
.lb-rank {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-h4);
  line-height: 1;
  letter-spacing: 0.02em;
  text-align: center;
  color: var(--muted);
}

.lb-row.top-1 .lb-rank { color: var(--gold); }
.lb-row.top-2 .lb-rank { color: var(--silver); }
.lb-row.top-3 .lb-rank { color: var(--bronze); }

/* The medal rail: a thin strip of the rank metal down the leading edge. */
.lb-row.top-1::before,
.lb-row.top-2::before,
.lb-row.top-3::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--spine);
}

.lb-row.top-1::before { background: var(--gold); }
.lb-row.top-2::before { background: var(--silver); }
.lb-row.top-3::before { background: var(--bronze); }

/* ---------- the operative ---------- */
.lb-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--ink-2);
  color: var(--phosphor);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-h4);
  overflow: hidden;
  flex-shrink: 0;
}

.lb-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lb-info {
  min-width: 0;
}

.lb-name {
  font-size: var(--fs-label);
  font-weight: 600;
  line-height: var(--lh-snug);
  color: var(--paper-bright);
  margin-bottom: 2px;
  overflow-wrap: anywhere;
}

/* "YOU" is the one claim a row gets to make about the reader, so it is
   the authority colour — and it is the reason the row itself is ruled. */
.me-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: var(--tr-label);
  background: var(--alert);
  color: var(--ink-0);
  padding: 1px 6px;
  border-radius: var(--r-1);
  margin-left: 5px;
  vertical-align: 1px;
}

.lb-role {
  font-family: var(--font-my);
  font-size: var(--fs-micro);
  line-height: 1.6;
  color: var(--muted-strong);
}

/* ---------- the counters ---------- */
.lb-stats {
  display: flex;
  gap: var(--s-3);
  align-items: center;
}

.lb-stat {
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--muted);
  min-width: 38px;
}

.lb-stat span {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-h4);
  letter-spacing: 0;
  color: var(--paper-bright);
  margin-bottom: 1px;
}

/* ---------- your own row ---------- */
.lb-row.me {
  background: var(--ink-2);
}

.lb-row.me::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--spine);
  background: var(--alert);
}

.lb-row.me .lb-stat span {
  color: var(--alert-bright);
}

/* A medal row that is also yours keeps its metal rail; the red moves to
   the trailing edge so the two claims stay readable. */
.lb-row.me.top-1::before,
.lb-row.me.top-2::before,
.lb-row.me.top-3::before {
  left: auto;
  right: 0;
  background: var(--alert);
}

/* ---------- an empty roll ---------- */
/* The list box already draws the frame, so the note inside it drops its own. */
.lb-list > .empty-note {
  background: var(--ink-1);
  border: 0;
  border-radius: 0;
  padding: var(--s-8) var(--s-4);
}

/* ---------- narrow screens: drop the counters to their own line ---------- */
@media (max-width: 640px) {
  .lb-row {
    grid-template-columns: 36px 36px minmax(0, 1fr);
    gap: var(--s-2);
    padding: var(--s-2);
    row-gap: var(--s-1);
  }

  .lb-avatar {
    width: 36px;
    height: 36px;
    font-size: var(--fs-label);
  }

  .lb-rank {
    font-size: var(--fs-label);
  }

  .lb-stats {
    grid-column: 1 / -1;
    justify-content: flex-start;
    gap: var(--s-4);
    padding-left: var(--s-2);
  }

  .lb-name {
    font-size: var(--fs-label);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lb-row,
  .lb-tab {
    transition: none;
  }
}
