/* ---------------------------------------------------------------------------
   NASTAR leaderboard component — skiracing.nastar.com.

   MIRROR of the leaderboard, racer-photo and own-row blocks of
   /home/nastar_com/public_html/theme/css/home.css. Same class names,
   same values, same reasoning — so the leaderboard on this site's Rankings
   page and the one on the nastar.com homepage are the same component, not two
   look-alikes. Kept in step the same way theme_2026/css/nastar.css is kept in
   step with its counterpart.

   Every colour, space and radius is a token from theme_2026/css/nastar.css, so
   this cannot drift from the approved theme.

   Two deliberate differences from home.css, both required to RENDER the same
   rather than to read the same (project instructions, "Identical rendered,
   not identical source"):

     1. `rem` is replaced with the equivalent px. Legacy nastar_2019.css carries
        `* { font-size: 14px }`, which lands on <html> too, so the root font
        here is 14px against nastar.com's 16px and rem cannot express matching
        sizes. Only two values were affected: the leaderboard row's rank column,
        2.5rem/2rem, written here as 40px/32px.

     2. A "legacy resets" section at the end. That same `* { … }` rule in
        nastar_2019.css sets font-family and colour on EVERY element directly,
        which beats inheritance regardless of specificity, and
        theme_2026/css/nastar.css underlines every link inside .main-container.
        Neither applies on nastar.com. The resets restore the intended
        rendering; they add nothing new.
   --------------------------------------------------------------------------- */

/* ----------------------------------------------------------- leaderboard */
.lb {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--white);
}

/* Three distinct states, per David's reference (2026-08-20):
     default  navy / white
     hover    lighter blue-grey / white, hovered item only
     active   gold / dark navy text, persistent
   The gap lets the container colour through as hairline dividers, which also
   separates the two rows the tabs wrap onto at phone widths. */
.lb__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  background: var(--nastar-gold);
}
.lb__tab {
  flex: 1 1 auto;
  min-height: var(--tap-min);
  padding: var(--space-3) var(--space-4);
  border: 0;
  background: var(--nastar-blue-dark);
  color: var(--white);
  font: 700 14px/1 var(--font-heading);
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease;
}
@media (prefers-reduced-motion: reduce) {
  .lb__tab { transition: none; }
}

/* `:not([aria-pressed="true"])` is the whole behavioural rule: hover must
   never visually replace or obscure the selected family. Both the server-
   rendered path and leaderboard.js set aria-pressed, so keying off it (rather
   than a class) means the two paths cannot disagree about which tab is active. */
.lb__tab:hover:not([aria-pressed="true"]) {
  background: var(--nastar-blue-light);
  color: var(--white);
}

.lb__tab[aria-pressed="true"] {
  /* Gold on navy text measures 5.08:1 — above the 4.5:1 needed at this size. */
  background: var(--nastar-gold);
  color: var(--nastar-blue-dark);
}

/* Keyboard users get an equivalent, and it stays visible on the gold fill. */
.lb__tab:focus-visible {
  outline: 3px solid var(--white);
  outline-offset: -5px;
}
.lb__tab[aria-pressed="true"]:focus-visible { outline-color: var(--nastar-blue-dark); }

.lb__controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: end;
  padding: var(--space-4) var(--space-5);
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-200);
}
/* `min-width: 0` overrides the flex default of `auto`, which sizes an item to
   its min-content. A <select> measures that from its LONGEST OPTION, so the
   Adaptive family's classification names ("Adaptive Snowboard: Lower Limb
   Disability") pushed this control ~25px past the row on a 390px phone. */
.lb__ctl { display: flex; flex-direction: column; gap: 4px; flex: 1 1 200px; min-width: 0; }
/* `display: flex` above beats the UA stylesheet's [hidden] { display: none },
   so the hidden group selector stayed visible as an empty box. */
.lb__ctl[hidden] { display: none; }
.lb__ctl-label {
  font: 700 11px/1 var(--font-heading);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gray-500);
}
.lb__select {
  max-width: 100%;
  min-height: var(--tap-min);
  padding: 0 var(--space-3);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--gray-900);
  font: 15px/1 var(--font-body);
}
/* The no-JavaScript submit. leaderboard.js removes it once it takes over. */
.lb__go {
  min-height: var(--tap-min);
  padding: 0 var(--space-4);
  border: 1px solid var(--nastar-blue-dark);
  border-radius: var(--radius-sm);
  background: var(--nastar-blue-dark);
  color: var(--white);
  font: 700 14px/1 var(--font-heading);
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
}

.lb__boardhead {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  align-items: baseline;
  justify-content: space-between;
  padding: var(--space-5) var(--space-5) var(--space-3);
}
.lb__title { margin: 0; font-size: 20px; }
/* Which season is on screen, and whether it is finished. The season selector
   shows only the year, so this is not redundant with it. */
.lb__season {
  margin: 0;
  color: var(--gray-500);
  font: 700 11px/1 var(--font-heading);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.lb__list { list-style: none; margin: 0; padding: 0 var(--space-5) var(--space-3); }
.lb__row {
  display: grid;
  grid-template-columns: 40px 1fr auto;   /* home.css: 2.5rem — see header note */
  gap: var(--space-3);
  align-items: baseline;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--gray-200);
}
.lb__row--head {
  border-bottom: 2px solid var(--gray-300);
  font: 700 11px/1 var(--font-heading);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gray-500);
}
.lb__row:last-child { border-bottom: 0; }
.lb__rank { font: 700 17px/1 var(--font-heading); color: var(--nastar-blue); text-align: right; }
.lb__row--head .lb__rank { font-size: 11px; color: var(--gray-500); }
/* Content links are underlined, including inside data tables — the link is
   the point of the row (project instructions, "Links are how racers explore
   the data"). */
.lb__name { font-size: 16px; text-decoration: underline; }
.lb__row--head .lb__name { font-size: 11px; text-decoration: none; }
.lb__where { margin-top: 2px; color: var(--gray-500); font-size: 13px; }
/* Its own link now, so it carries its own underline rather than inheriting the
   name's. Deliberately quieter than the name: the racer is the primary target. */
.lb__where a { color: inherit; text-decoration: underline; }
.lb__where a:hover { color: var(--nastar-blue); }
.lb__val {
  font: 700 16px/1 var(--font-body);
  font-variant-numeric: tabular-nums;
  color: var(--gray-900);
  text-align: right;
}
.lb__row--head .lb__val { font-size: 11px; color: var(--gray-500); }

.lb__more { display: inline-block; padding: 0 var(--space-5) var(--space-5); font-size: 15px; }

/* ------------------------------------------------- own row, when signed in */
.lb__row--me {
  background: rgba(234, 175, 29, .16);
  box-shadow: inset 3px 0 0 var(--nastar-gold);
}

/* --------------------------------------------------- racer photo (camera) */
/* The name+camera share one line; the hometown sits on its own beneath, as its
   own link. Three independent controls in one column, and the row stays the
   same height it was when the hometown lived inside the name link. */
.lb__who { display: flex; flex-direction: column; min-width: 0; }
.lb__wholine { display: flex; align-items: baseline; gap: var(--space-2); min-width: 0; }
.lb__wholine .lb__name { min-width: 0; }

.lb__cam {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* 44px of hit area from a 16px icon, without changing the line box:
     the padding is absorbed by a negative margin. */
  width: var(--tap-min);
  height: var(--tap-min);
  margin: calc(var(--tap-min) / -2 + 8px) calc(var(--tap-min) / -2 + 8px);
  padding: 0;
  border: 0;
  background: none;
  color: var(--gray-500);
  cursor: pointer;
}
.lb__cam svg { width: 16px; height: 16px; fill: currentColor; }
.lb__cam:hover, .lb__cam[aria-expanded="true"] { color: var(--nastar-blue); }
.lb__cam:focus-visible { outline: 2px solid var(--nastar-blue); outline-offset: -12px; border-radius: var(--radius-sm); }

.racerpop {
  position: absolute;
  z-index: 50;
  width: min(320px, calc(100vw - 16px));
  padding: var(--space-2);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-lg);
}
.racerpop[hidden] { display: none; }
.racerpop__img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 60vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--gray-100);
}
.racerpop.is-loading .racerpop__img { min-height: 120px; }
.racerpop__cap {
  margin: var(--space-2) 0 0;
  font: 700 13px/1.2 var(--font-heading);
  color: var(--gray-700);
  text-align: center;
}
.racerpop__close {
  position: absolute;
  top: 0; right: 0;
  width: var(--tap-min); height: var(--tap-min);
  border: 0;
  background: none;
  color: var(--gray-700);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
@media (hover: hover) {
  /* The close control is for touch, where there is nothing to hover away to. */
  .racerpop__close { display: none; }
}

@media (max-width: 640px) {
  /* Tabs wrap onto two rows rather than scrolling sideways: nothing here may
     introduce horizontal overflow. */
  .lb__tab { flex: 1 1 33%; font-size: 12px; padding: var(--space-3) var(--space-2); }

  .lb__controls { padding: var(--space-3) var(--space-4); gap: var(--space-3); }
  .lb__ctl { flex: 1 1 100%; }
  .lb__go { width: 100%; }

  .lb__boardhead { padding: var(--space-4) var(--space-4) var(--space-2); }
  .lb__title { font-size: 18px; }
  .lb__list, .lb__more { padding-inline: var(--space-4); }

  /* Three columns is still the phone limit: rank, name, value. The hometown
     is NOT dropped, though — it is a real link to that town's racers, not
     decoration. It sits on its own line under the name inside the same column,
     so the row keeps three columns and grows by one small line. */
  .lb__row { grid-template-columns: 32px 1fr auto; gap: var(--space-2); }  /* home.css: 2rem */
  .lb__where { font-size: 12px; }
  .lb__name, .lb__val { font-size: 15px; }
}

/* ===========================================================================
   LEGACY RESETS — this site only. Nothing above this line differs from
   nastar.com in intent; everything below exists solely to neutralise legacy
   rules that do not exist there.

   nastar_2019.css line 4 is `* { font-family: "Trebuchet MS", …; color: black }`.
   The universal selector matches every element DIRECTLY, so it beats an
   inherited value no matter how specific the ancestor's rule was. Any
   leaderboard element that does not state its own font-family therefore
   rendered in Trebuchet instead of the theme's Roboto. Elements that already
   carry the `font:` shorthand above (tabs, control labels, selects, the rank,
   the value, the season line, the header row, the popover caption) are
   unaffected and are not repeated here.
   =========================================================================== */
.lb__name,
.lb__where,
.lb__where a,
.lb__more,
.lb__select option { font-family: var(--font-body); }

/* theme_2026/css/nastar.css underlines every link inside .main-container --
   this site's content wrapper, which nastar.com has no equivalent of. The
   racer name and the hometown are meant to be underlined and set their own
   underline above; "See the full ranking" is a section-closing action and is
   not underlined on the homepage, so restore that. */
.main-container a.lb__more { text-decoration: none; }
.main-container a.lb__more:hover { text-decoration: underline; }
