/* ============================================================
   GIRL+GRID — 03 · THE CHAMPIONSHIP

   Built by scripts/academy-standings.js. A podium for the top three,
   then the rest as a list that can be re-ranked, opened and expanded.

   Rose thinks: pink only. Bodoni Moda carries names and numbers —
   italic for every figure, because a Didone's figures are the best
   thing in it — and mono carries the labels. Loads after
   girl-type.css.
   ============================================================ */

.stand { padding-block: var(--space-section); }

/* ---- head ---------------------------------------------------- */
.stand__head {
  display: grid;
  gap: 1.2rem;
  margin-bottom: clamp(2rem, 5vw, 4rem);
}
@media (min-width: 900px) {
  .stand__head { grid-template-columns: 1fr auto; align-items: end; }
}
.stand__title { font-size: var(--text-section); }
.stand__lede { color: var(--muted); max-width: 46ch; margin-top: 0.8rem; }
.stand__stamp { color: var(--muted); white-space: nowrap; }

/* Shown only once the calendar has moved past the snapshot. It has to
   stop being a whisper at that point — a stale standings table that
   still looks authoritative is worse than no table. */
.stand__stamp.is-stale { white-space: normal; }
.stand__stale {
  display: block;
  margin-top: 0.35rem;
  padding: 0.3rem 0.55rem;
  max-width: 28ch;
  border-left: 2px solid var(--accent);
  color: var(--accent-text, var(--accent));
  white-space: normal;
}

/* ---- the podium ---------------------------------------------- */
.stand__podium {
  list-style: none;
  margin: 0 auto clamp(3rem, 7vw, 5.5rem);
  padding: 0;
  max-width: 1080px;
  display: grid;
  grid-template-columns: 1fr 1.16fr 1fr;
  align-items: end;
  gap: clamp(0.5rem, 1.4vw, 1.2rem);
}
.stand__step { display: flex; flex-direction: column; min-width: 0; }
.stand__step--p1 { grid-column: 2; grid-row: 1; }
.stand__step--p2 { grid-column: 1; grid-row: 1; }
.stand__step--p3 { grid-column: 3; grid-row: 1; }

/* The cut-outs are busts cropped flat at the bottom edge, so they sit
   on the plinth like a bust on a pedestal. */
.stand__fig { margin: 0 0 -1px; position: relative; z-index: 1; }
.stand__fig img { display: block; width: 100%; height: auto; }

.stand__plinth {
  /* The step heights: content plus a lift, so P1 > P2 > P3 holds
     whatever the names wrap to. */
  --lift: 0rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: clamp(0.9rem, 1.8vw, 1.5rem) clamp(0.6rem, 1.4vw, 1.2rem) calc(1.2rem + var(--lift));
  border-radius: 0.3rem 0.3rem 0 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,.85), rgba(255,255,255,0) 2px),
    linear-gradient(180deg, var(--blue-soft), color-mix(in srgb, var(--blue-soft) 55%, var(--ground)));
  box-shadow: 0 2.2rem 3.5rem -2.4rem color-mix(in srgb, var(--accent) 55%, transparent);
}
.stand__step--p1 .stand__plinth {
  --lift: clamp(3.5rem, 1.5rem + 4.5vw, 7rem);
  background:
    linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,0) 2px),
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 20%, var(--blue-soft)), var(--blue-soft));
}
.stand__step--p2 .stand__plinth { --lift: clamp(1.6rem, 0.6rem + 2.2vw, 3.2rem); }

.stand__plinth > * { margin: 0; }
.stand__ppos {
  font-family: var(--display-face);
  font-style: italic;
  font-weight: 800;
  font-size: clamp(2.6rem, 1.6rem + 3.4vw, 5.5rem);
  line-height: 0.8;
  color: var(--accent-text);
  margin-bottom: 0.35em;
}
.stand__pname {
  font-family: var(--display-face);
  font-weight: 700;
  font-size: clamp(1.05rem, 0.85rem + 0.8vw, 1.6rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--ink);
}
.stand__step--p1 .stand__pname { font-size: clamp(1.25rem, 0.95rem + 1.1vw, 2rem); }
.stand__pmeta { color: var(--muted); margin-top: 0.45rem; }
.stand__ppts { margin-top: auto; padding-top: 0.7rem; color: var(--ink); }
.stand__ppts b {
  font-family: var(--display-face);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(2rem, 1.3rem + 2.6vw, 4rem);
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
}
.stand__step--p1 .stand__ppts b { font-size: clamp(2.6rem, 1.6rem + 3.6vw, 5.4rem); color: var(--accent-text); }
.stand__ppts .mono { color: var(--muted); }
.stand__pgap { color: var(--accent-text); margin-top: 0.3rem; }

/* Phones: the leader on her own, the other two side by side. */
@media (max-width: 639px) {
  .stand__podium { grid-template-columns: 1fr 1fr; row-gap: 1.6rem; }
  .stand__step--p1 { grid-column: 1 / -1; grid-row: 1; }
  .stand__step--p1 .stand__fig { width: min(78%, 20rem); margin-inline: auto; }
  .stand__step--p2 { grid-column: 1; grid-row: 2; }
  .stand__step--p3 { grid-column: 2; grid-row: 2; }
  .stand__step--p1 .stand__plinth { --lift: 1.2rem; }
  .stand__step--p2 .stand__plinth { --lift: 1.4rem; }
}

/* ---- the toggle ---------------------------------------------- */
.stand__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--ink);
}
.stand__seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.stand__seg button {
  appearance: none;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: max(0.66rem, var(--text-mono));
  letter-spacing: 0.16em;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s, background-color 0.25s;
}
.stand__seg button:hover { color: var(--accent-text); }
.stand__seg button[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.stand__hint { margin: 0; }
@media (max-width: 479px) {
  .stand__seg { width: 100%; }
  .stand__seg button { flex: 1; padding-inline: 0.4rem; letter-spacing: 0.1em; }
  .stand__hint { display: none; }
}

/* ---- rows ---------------------------------------------------- */
.stand__list, .stand__teams { list-style: none; margin: 0; padding: 0; }
.stand__item, .stand__trow { border-bottom: 1px solid var(--line); }
.stand__item { transition: opacity 0.3s; }

.stand__row, .stand__trow {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1.3fr) minmax(0, 0.9fr) minmax(5rem, 1.6fr) 7.5rem 1.2rem;
  grid-template-areas: "pos name meta bar val chev";
  align-items: center;
  gap: 0.35rem 1.2rem;
  width: 100%;
  padding: 0.9rem 0.4rem;
  text-align: left;
}
.stand__row {
  appearance: none;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  border-radius: 0.25rem;
  transition: background-color 0.25s;
}
.stand__pos { grid-area: pos; color: var(--muted); }
.stand__name {
  grid-area: name;
  font-family: var(--display-face);
  font-weight: 700;
  font-size: clamp(1.15rem, 0.95rem + 0.8vw, 1.75rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  transition: color 0.2s;
}
.stand__meta {
  grid-area: meta;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stand__bar {
  grid-area: bar;
  display: block;
  height: 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  overflow: hidden;
}
.stand__bar i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  transform-origin: left center;
  background: color-mix(in srgb, var(--accent) 45%, var(--blue-soft));
  transition: background-color 0.25s;
}
.stand__list[data-mode="gap"] .stand__bar i { transform-origin: right center; }
.stand__val { grid-area: val; text-align: right; white-space: nowrap; }
.stand__val b {
  font-family: var(--display-face);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(1.4rem, 1.1rem + 1vw, 2.1rem);
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
}
.stand__unit { color: var(--muted); }
.stand__chev { grid-area: chev; justify-self: end; }
.stand__chev::before {
  content: "+";
  display: block;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--muted);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s;
}
.stand__row[aria-expanded="true"] .stand__chev::before { transform: rotate(45deg); color: var(--accent-text); }

/* Her row lights up: bar to full pink, name to pink, the rest step back. */
.stand__row:is(:hover, :focus-visible, [aria-expanded="true"]) .stand__bar i { background-color: var(--accent); }
.stand__row:is(:hover, :focus-visible) .stand__name { color: var(--accent-text); }
.stand__row:hover { background: color-mix(in srgb, var(--blue-soft) 55%, transparent); }
@media (hover: hover) {
  .stand__list:has(.stand__row:hover) .stand__item:not(:has(.stand__row:hover)) { opacity: 0.45; }
}

.stand__row:focus-visible,
.stand__seg button:focus-visible,
.stand__more:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}
.stand__row:focus-visible { outline-offset: -2px; }

/* Team rows carry no chevron and open nothing; their drivers get room. */
@media (min-width: 900px) {
  .stand__trow { grid-template-columns: 2.4rem minmax(0, 1.3fr) minmax(0, 1.4fr) minmax(5rem, 1.1fr) 7.5rem 1.2rem; }
}
.stand__trow .stand__name { font-size: clamp(1.1rem, 0.95rem + 0.6vw, 1.5rem); }

/* ---- a row, opened ------------------------------------------- */
.stand__detail {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr) minmax(0, 17rem);
  align-items: end;
  gap: 1rem 1.6rem;
  padding: 0.2rem 0.4rem 1.3rem calc(2.4rem + 1.2rem + 0.4rem);
  overflow: hidden;
}
.stand__dcut {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 50% 50% 0.2rem 0.2rem / 40% 40% 0.2rem 0.2rem;
  background: var(--blue-soft);
}
.stand__dl {
  display: grid;
  grid-template-columns: repeat(4, auto);
  justify-content: start;
  gap: 0.8rem 1.8rem;
  margin: 0 0 0.3rem;
}
.stand__dl dt { color: var(--muted); }
.stand__dl dd {
  margin: 0.25rem 0 0;
  font-family: var(--display-face);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
.stand__dcar { display: block; width: 100%; height: auto; }

/* ---- show all ------------------------------------------------ */
.stand__more {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 1.6rem;
  padding: 0.9rem 1.4rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: none;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.25s, color 0.25s;
}
.stand__more::after {
  content: "↓";
  font-family: var(--font-mono);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.stand__more[aria-expanded="true"]::after { transform: rotate(180deg); }
.stand__more:hover { background: var(--ink); color: var(--ground); }

.stand__note { margin-top: 1.6rem; color: var(--muted); max-width: 64ch; }

/* ---- her portrait, following the pointer ----------------------
   Positioned by GSAP: x/y is the pointer, xPercent/yPercent put her
   up and to the right of it so she never sits under the cursor. (Not
   the CSS `translate` property: GSAP folds that into its transform.) */
.stand__ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 40;
  width: clamp(170px, 15vw, 260px);
  pointer-events: none;
}
.stand__ghost::before {
  content: "";
  position: absolute;
  inset: 22% 14% 0;
  border-radius: 50% 50% 0.3rem 0.3rem / 42% 42% 0.3rem 0.3rem;
  background: var(--blue-soft);
  box-shadow: 0 1.6rem 3rem -1.4rem color-mix(in srgb, var(--accent) 60%, transparent);
}
.stand__ghost::before, .stand__ghost img {
  opacity: 0;
  scale: 0.86;
  transform-origin: 50% 100%;
  transition: opacity 0.22s, scale 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.stand__ghost img { position: relative; display: block; width: 100%; height: auto; }
.stand__ghost.is-on::before, .stand__ghost.is-on img { opacity: 1; scale: 1; }

/* ---- narrow -------------------------------------------------- */
@media (max-width: 899px) {
  .stand__row, .stand__trow {
    grid-template-columns: 1.9rem minmax(0, 1fr) auto 1rem;
    grid-template-areas:
      "pos name val chev"
      "pos bar  bar .";
    gap: 0.55rem 0.8rem;
    padding: 0.85rem 0.2rem;
  }
  .stand__row .stand__meta { display: none; }
  .stand__trow .stand__meta { grid-area: bar; display: none; }
  .stand__detail {
    grid-template-columns: 5.5rem minmax(0, 1fr);
    padding: 0 0.2rem 1.2rem calc(1.9rem + 0.8rem + 0.2rem);
  }
  .stand__dl { grid-template-columns: repeat(2, auto); gap: 0.7rem 1.4rem; }
  .stand__dl dd { font-size: 1rem; }
  .stand__dcar { grid-column: 1 / -1; max-width: 20rem; }
}

@media (prefers-reduced-motion: reduce) {
  .stand__ghost::before, .stand__ghost img, .stand__item, .stand__chev::before,
  .stand__more::after { transition: none; }
}
