/* Leaderboard page (/front, /rear). Block name: board. */

.board {
  --board-pad: max(var(--gutter), calc((100% - 80rem) / 2));
}

/* --- wordmark band ------------------------------------------------------ */

.board__band {
  overflow: hidden;
  padding: clamp(1rem, 4vw, 3rem) var(--gutter) clamp(0.5rem, 2vw, 1.5rem);
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.board__wordmark {
  display: inline-block;
  max-width: 100%;
  padding: 0 0.05em 0.08em;
  font-size: clamp(2.25rem, 13vw, 11rem);
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

/* --- heading and controls ----------------------------------------------- */

.board__head {
  display: grid;
  gap: 0.75rem;
  padding: clamp(1.5rem, 4vw, 2.5rem) var(--board-pad) 1.25rem;
}
.board__title {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.05;
  text-transform: uppercase;
}
.board__intro {
  color: var(--ink-soft);
  max-width: var(--measure);
}
.board__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin-top: 0.5rem;
}
.board__toggle {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font-family: var(--font-data);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 0.25em;
}
.board__toggle:hover {
  color: var(--accent);
}

.board__nodata {
  padding: 0 var(--board-pad);
}

.board__empty {
  display: grid;
  justify-items: start;
  gap: 0.5rem;
  padding: 2rem var(--board-pad);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

/* --- rows --------------------------------------------------------------- */

.board__list {
  border-top: 1px solid var(--line);
}
.board__row {
  position: relative;
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  grid-template-areas:
    "rank main primary"
    "rank facts primary";
  column-gap: clamp(1rem, 3vw, 2.5rem);
  align-items: center;
  padding: clamp(1.25rem, 2.5vw, 2rem) var(--board-pad);
  border-bottom: 1px solid var(--line);
  transition: background-color 0.2s ease;
}
.board__row:hover,
.board__row:focus-within {
  background-color: var(--row-hover);
}

/* Decorative pale outlined numeral, set vertically. */
.board__rank {
  grid-area: rank;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  font-size: clamp(3rem, 5vw, 4.5rem);
  font-weight: 800;
  line-height: 0.8;
  color: transparent;
  -webkit-text-stroke: 1.5px color-mix(in srgb, var(--ink) 28%, transparent);
  user-select: none;
}

.board__main {
  grid-area: main;
  min-width: 0;
}
.board__name {
  font-size: clamp(1.5rem, 3.2vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.board__link {
  text-decoration: none;
}
/* The whole row is the target of this one link. */
.board__link::after {
  content: "";
  position: absolute;
  inset: 0;
}
.board__link:focus-visible {
  outline: none;
}
.board__link:focus-visible::after {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}
.board__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.board__sub {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.375rem;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.board__rule {
  flex: none;
  width: 2rem;
  height: 1px;
  background: var(--accent);
  transition: width 0.25s ease;
}
.board__row:hover .board__rule,
.board__row:focus-within .board__rule {
  width: 4.5rem;
}
.board__chip {
  margin-top: 0.625rem;
}

/* Primary metric of the current sort. */
.board__primary {
  grid-area: primary;
  display: grid;
  justify-items: end;
  gap: 0.25rem;
  max-width: 16rem;
  text-align: right;
}
.board__metric-label {
  line-height: 1.35;
}
.board__value {
  font-size: clamp(2.5rem, 5vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.board__value-unit {
  margin-left: 0.15em;
  font-family: var(--font-data);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-soft);
}
.board__none {
  font-family: var(--font-data);
  font-size: 0.75rem;
  color: var(--ink-soft);
}

/* Secondary figures. */
.board__facts {
  grid-area: facts;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.625rem 1.5rem;
  margin-top: 1rem;
}
.board__fact {
  min-width: 0;
}
.board__fact dt {
  line-height: 1.35;
}
.board__fact dd {
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

/* --- note under the board ----------------------------------------------- */

.board__note {
  max-width: var(--measure);
  padding: 1.5rem var(--board-pad) 3rem;
  font-family: var(--font-data);
  font-size: 0.75rem;
  line-height: 1.7;
  color: var(--ink-soft);
}
.board__note a {
  margin-left: 0.5rem;
  color: var(--ink);
}

/* --- narrow screens: the row stacks ------------------------------------- */

@media (max-width: 40rem) {
  .board__row {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "rank"
      "main"
      "primary"
      "facts";
    align-items: start;
    row-gap: 0.75rem;
  }
  .board__rank {
    justify-content: flex-start;
    writing-mode: horizontal-tb;
    transform: none;
    font-size: 1.5rem;
    line-height: 1;
    -webkit-text-stroke-width: 1px;
  }
  .board__primary {
    justify-items: start;
    max-width: none;
    text-align: left;
  }
  .board__facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 0.25rem;
  }
  .board__sub {
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
  }
}

/* Narrow screens: Axle, Sort and Unit in one row of three equal columns (PC33); the label
   sits above its options, the options stack and may wrap, never truncate. */
@media (max-width: 40rem) {
  .board__controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: 0.75rem 0.5rem;
  }
  .board__controls > .switch {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.375rem;
    min-width: 0;
  }
  .board__controls > .switch .switch__option {
    justify-content: center;
    padding: 0.25rem 0.375rem;
    text-align: center;
    overflow-wrap: anywhere;
  }
  .board__controls > .board__toggle {
    grid-column: 1 / -1;
  }
}

/* --- filters (05): plain links inside a disclosure ----------------------- */

.board__filtered {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
  font-weight: 600;
}
.board__filters {
  margin-top: 0.75rem;
  max-width: var(--measure);
}
.board__filters-summary {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  cursor: pointer;
  font-family: var(--font-data);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.board__filters-summary:hover {
  color: var(--accent);
}
.board__filters-summary strong {
  margin-left: 0.5rem;
  color: var(--accent);
}
.board__filter {
  display: flex;
  margin: 0.5rem 0;
}
.board__filter .switch__label {
  flex-basis: 100%;
}
.board__filters-note {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  color: var(--ink-soft);
}
