/* chimpvibe.dev front page: the High score board view and the Wall / High score board switch (hiscore.js).
   The rules below the first block are copied from the design system (ChimpVibe/design-system/components.css, the
   Hi-Score view section and .cv-chip), scoped to .cv-ds like /shared/cv-components.css. Only the layout wrappers at the
   end (.cv-board, .cv-board__tree, the narrow row) are this page's own. */

/* ---- Hi-Score theme tokens (design-system tokens.css [data-view="hi-score"]) ---- */
.cv-ds [data-view="hi-score"] {
  --text-heading: clamp(30px, 3.2vw, 46px);
  --text-stat: clamp(56px, 5.8vw, 112px);
  --text-card-title: 23px;
  --text-rank: 32px;
  --text-row-count: 34px;
  --text-row-count-minor: 24px;
  --text-chip: 20px;
  --text-eyebrow-accent: 18px;
  --tracking-eyebrow-accent: .17em;
  --size-row: 96px;
  --size-chip: 44px;
  --size-tab: 44px;
  --duration-glow: 1200ms; /* design-system motion token, not yet in /shared/cv-tokens.css */
}
/* the view switch uses the metric pills too, outside the board: it takes their tab height */
.cv-ds .cv-views { --size-tab: 44px; }

/* ---- design system: metric switcher ---- */
.cv-ds .cv-eyebrow--accent{font:var(--weight-regular) var(--text-eyebrow-accent)/1 var(--font-display);letter-spacing:var(--tracking-eyebrow-accent);color:var(--color-accent)}
.cv-ds .cv-metrics{display:flex;flex-wrap:wrap;gap:var(--space-2);margin:0;padding:var(--space-1);border-radius:var(--radius-pill);background:var(--color-surface-sunken);width:max-content;max-width:100%}
.cv-ds .cv-metric{appearance:none;border:0;margin:0;cursor:pointer;display:inline-flex;align-items:center;gap:var(--space-2);
  height:var(--size-tab);padding:0 var(--space-5);border-radius:var(--radius-pill);background:transparent;
  font:var(--weight-medium) var(--text-control-quiet)/1 var(--font-body);color:var(--color-text-muted);
  transition:background var(--duration-fade) var(--ease-standard),color var(--duration-fade) var(--ease-standard)}
.cv-ds .cv-metric svg{width:18px;height:18px;fill:currentColor;flex:none}
.cv-ds .cv-metric:hover,.cv-ds .cv-metric.is-hover{background:var(--color-surface);color:var(--color-text)}
.cv-ds .cv-metric[aria-selected="true"],.cv-ds .cv-metric.is-selected{background:var(--color-primary-tint);color:var(--color-primary-strong)}
.cv-ds .cv-metric:active,.cv-ds .cv-metric.is-active{background:var(--color-surface-raised)}
.cv-ds .cv-metric:focus-visible,.cv-ds .cv-metric.is-focus{outline:var(--focus-ring);outline-offset:var(--focus-offset)}
.cv-ds .cv-metric:disabled,.cv-ds .cv-metric.is-disabled{cursor:not-allowed;background:transparent;color:var(--color-disabled-text);opacity:.6}

/* ---- design system: ranking table and game row ---- */
.cv-ds .cv-rank{display:grid;gap:var(--space-2)}
.cv-ds .cv-rank[hidden]{display:none}
.cv-ds .cv-row,.cv-ds .cv-row__head{display:grid;grid-template-columns:48px 144px minmax(0,1fr) 120px 96px 104px 128px;gap:var(--space-4);align-items:center;padding-right:var(--space-6)}
.cv-ds .cv-row{min-height:var(--size-row);border-radius:var(--radius-lg);background:var(--material-low);
  transition:background var(--duration-fade) var(--ease-standard)}
.cv-ds .cv-row:hover,.cv-ds .cv-row.is-hover,.cv-ds .cv-row.is-selected{background:var(--material-low-hover)}
.cv-ds .cv-row:focus-visible,.cv-ds .cv-row.is-focus{outline:var(--focus-ring);outline-offset:var(--focus-offset)}
.cv-ds .cv-row__rank{font:var(--weight-regular) var(--text-rank)/1 var(--font-display);color:var(--color-text-muted);text-align:right}
.cv-ds .cv-row--first .cv-row__rank{color:var(--color-text)}
.cv-ds .cv-row__capture{width:144px;height:90px;object-fit:cover;border-radius:var(--radius-card)}
.cv-ds .cv-row__tree{display:grid;place-items:center;width:var(--size-row);height:var(--size-row);padding:var(--space-1);border-radius:var(--radius-lg);background:var(--material-raised)}
.cv-ds .cv-row .cv-count{font-size:var(--text-row-count)}
.cv-ds .cv-row .cv-count--minor{font-size:var(--text-row-count-minor)}
.cv-ds .cv-row__when{font:var(--weight-regular) var(--text-lead)/1 var(--font-display);color:var(--color-text)}
.cv-ds .cv-row__head{padding-block:var(--space-2);font:var(--weight-regular) var(--text-small)/1 var(--font-body);color:var(--color-text-muted)}
.cv-ds .cv-row__head > :first-child{text-align:right}
.cv-ds .cv-row__head .is-sorted{color:var(--color-text);font-weight:var(--weight-medium);box-shadow:inset 0 -2px 0 var(--color-primary);padding-bottom:var(--space-1);justify-self:start}
.cv-ds .cv-row--loading .cv-skel{display:block;height:18px;border-radius:var(--radius-xs);background:var(--color-surface)}
.cv-ds .cv-row--loading .cv-row__capture,.cv-ds .cv-row--loading .cv-row__tree{background:var(--color-surface)}
@media (prefers-reduced-motion:no-preference){.cv-ds .cv-row--loading .cv-skel{animation:cv-pulse var(--duration-glow) var(--ease-standard) infinite alternate}}
@keyframes cv-pulse{to{background:var(--color-surface-raised)}}
.cv-ds .cv-rank-empty{display:grid;justify-items:start;gap:var(--space-3);padding:var(--space-6);border-radius:var(--radius-lg);background:var(--color-surface-sunken)}
.cv-ds .cv-rank-empty__title{margin:0;font:var(--weight-regular) var(--text-lead)/1.2 var(--font-display);color:var(--color-text)}
.cv-ds .cv-rank-empty p{margin:0;color:var(--color-text-muted);max-width:52ch}

@media (prefers-reduced-motion:reduce){
  .cv-ds .cv-row,.cv-ds .cv-metric{transition:none}
}

/* ---- this page's wrappers ---- */
.cv-board { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-5); min-width: 0; container-type: inline-size; }
.cv-board .cv-row__capture { display: block; }
.cv-board .cv-row__game { display: grid; gap: var(--space-1); min-width: 0; }
/* a long name wraps rather than being cut off (as on the wall) */
.cv-board .cv-card__name span { white-space: normal; overflow-wrap: break-word; }
.cv-board .cv-card__name { text-decoration: none; }
/* the author: the profile link (shared/profile-card.css) keeps its own hover shape, so the line does not clip it; a plain
   name still ends in an ellipsis */
.cv-board .cv-card__author { display: flex; align-items: center; overflow: visible; }
.cv-board .cv-card__author-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-board .cv-row .cv-count { white-space: nowrap; }
.cv-board .cv-row .cv-count:empty { visibility: hidden; }
/* the game's real tree, drawn by the site's tree code (growTree) into the row's 96px tile; this wrapper only sizes it */
.cv-board__tree { position: relative; isolation: isolate; display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 100%; overflow: hidden; }
.cv-board__tree > svg { display: block; width: 100%; height: 100%; }
.cv-board .cv-row__tree-link { display: grid; place-items: center; width: 100%; height: 100%; min-height: 0; overflow: hidden; color: inherit; }

/* the board column is narrower than the full row (the right-hand column at 1600-1800, tablets, phones): the row folds
   into two columns of facts beside the capture, the tree tile on the right */
@container (max-width: 959px) {
  .cv-board .cv-row__head { display: none; }
  .cv-board .cv-row {
    grid-template-columns: 28px minmax(80px, 112px) minmax(0, 1fr) 72px;
    grid-template-areas: "rank cap name name" "rank cap count tree" ". minor link tree";
    gap: var(--space-2) var(--space-3);
    padding: var(--space-3) var(--space-3) var(--space-3) 0;
  }
  .cv-board .cv-row__rank { grid-area: rank; font-size: var(--text-lead); align-self: start; padding-top: var(--space-1); }
  .cv-board .cv-row__cap { grid-area: cap; align-self: start; }
  .cv-board .cv-row__capture { width: 100%; height: auto; aspect-ratio: var(--ratio-capture); }
  .cv-board .cv-row__game { grid-area: name; }
  .cv-board .cv-row__score { grid-area: count; }
  .cv-board .cv-row__tree { grid-area: tree; width: 72px; height: 72px; align-self: end; }
  .cv-board .cv-row__minor { grid-area: minor; }
  .cv-board .cv-row__open { grid-area: link; justify-self: start; }
  .cv-board .cv-row .cv-count { font-size: var(--text-lead); }
  .cv-board .cv-row .cv-count--minor { font-size: var(--text-body); }
  .cv-board .cv-row__when { font-size: var(--text-body); }
  .cv-board .cv-card__name { font-size: var(--text-lead); }
  .cv-board .cv-row__open { font-size: var(--text-small); white-space: nowrap; }
}
