/*
 * TAG Legal Desk v2.1, J105: Leaf Token piles under the Grove (js\v21_leafpiles.js).
 * Desk tokens only, so every theme reads (Light, Dark, Eucalypt, Harbour, High contrast). The canvas reads its token
 * colours from the custom properties below (the Canteen's brass token and the desk's gum leaf colours), so a theme
 * changes the piles with no code. Nothing here moves: the piles fall on the canvas only when motion is allowed.
 * No inline styles anywhere: the page sets the column template and each column through the CSSOM.
 * The strip carries data-v21="game", so it hides at once during a welfare message, the quiet period and the
 * "While nobody was here" band (data-quiet on the root), like the Grove it sits in.
 */

:root[data-quiet="on"] .v21-lp { display: none !important; }

.v21-lp {
  --v21-lp-face: var(--metal-brass, #B48A3C);
  --v21-lp-rim: var(--metal-brass-lo, #7D5E24);
  --v21-lp-hi: var(--metal-brass-hi, #E2C37E);
  --v21-lp-leaf: var(--flora-gum, #5A7D5E);
  --v21-lp-leaf-2: var(--flora-gum-juvenile, #8FAEA3);
  --v21-lp-vein: var(--flora-gum-deep, #34553A);
  --v21-lp-ground: var(--art-ground, #CFC8B6);
  --v21-lp-tpl: repeat(3, minmax(0, 1fr));
  --v21-lp-h: 120px;
  display: grid; gap: 6px; min-width: 0; margin: 0;
}
.v21-lp-head { display: grid; gap: 2px; min-width: 0; }
.v21-lp-h { margin: 0; font-size: 1rem; line-height: 1.375rem; color: var(--ink); }
.v21-lp-head .meta { margin: 0; }

/* The names and counts above the piles, and the lines under them, in the piles' own columns. */
.v21-lp-list, .v21-lp-notes { display: grid; grid-template-columns: var(--v21-lp-tpl); min-width: 0; margin: 0; padding: 0; list-style: none; }
.v21-lp-list { align-items: end; }
.v21-lp-notes { align-items: start; }
.v21-lp-who { grid-row: 1; display: grid; justify-items: center; align-content: end; min-width: 0; padding: 4px 2px 2px; border-radius: 10px; text-align: center; color: var(--ink); }
.v21-lp-name { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8125rem; line-height: 1.125rem; color: var(--ink-2); }
.v21-lp-n { display: block; max-width: 100%; font-family: var(--font-num, inherit); font-size: 1.625rem; line-height: 1.875rem; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.01em; color: var(--ink); overflow-wrap: anywhere; }
.v21-lp-who.is-me .v21-lp-name { color: var(--brand-text); font-weight: 700; }
.v21-lp-who.is-seen .v21-lp-n { color: var(--ink-2); }
.v21-lp-note { grid-row: 1; display: grid; justify-items: center; gap: 2px; min-width: 0; padding: 2px 2px 0; text-align: center; font-size: .75rem; line-height: 1rem; color: var(--ink-2); overflow-wrap: anywhere; }

/* The piles. The canvas is decorative: the list above says the same in words. */
.v21-lp-stage { position: relative; min-width: 0; }
.v21-lp-canvas { display: block; width: 100%; height: var(--v21-lp-h); }

/* With the Grove art the scene stops at 78 percent of the window's height, centred (styles/v21_grove.css): the strip
   takes the same width, so each pile stays under its tree on a wide, short window. The page adds is-art. */
@media (min-width: 600px) {
  .v21-grove-sheet .v21-lp.is-art { width: 100%; max-width: calc(78vh * 960 / 360); margin-left: auto; margin-right: auto; }
}

/* Narrow columns (many people, or a phone): smaller words so every count still fits its own column. */
.v21-lp.is-tight .v21-lp-n { font-size: 1.125rem; line-height: 1.375rem; }
.v21-lp.is-tight .v21-lp-name { font-size: .6875rem; line-height: 1rem; }
.v21-lp.is-tight .v21-lp-note { font-size: .6875rem; line-height: .875rem; }

/* High contrast: white tokens with black rims and black leaves on a black ground line; black words. */
:root[data-theme="high_contrast"] .v21-lp { --v21-lp-face: #FFFFFF; --v21-lp-rim: #000000; --v21-lp-hi: #FFFFFF; --v21-lp-leaf: #000000; --v21-lp-leaf-2: #000000; --v21-lp-vein: #FFFFFF; --v21-lp-ground: #000000; }
:root[data-theme="high_contrast"] .v21-lp-name,
:root[data-theme="high_contrast"] .v21-lp-note,
:root[data-theme="high_contrast"] .v21-lp-who.is-seen .v21-lp-n { color: #000; }
:root[data-theme="high_contrast"] .v21-lp-who.is-me { outline: 2px solid #000; outline-offset: 1px; }
@media (forced-colors: active) {
  .v21-lp { --v21-lp-face: Canvas; --v21-lp-rim: CanvasText; --v21-lp-hi: Canvas; --v21-lp-leaf: CanvasText; --v21-lp-leaf-2: CanvasText; --v21-lp-vein: Canvas; --v21-lp-ground: CanvasText; }
}

/* Phones (XS, 360 to 599): a shorter strip, no horizontal scroll. */
@media (max-width: 599px) {
  .v21-lp { --v21-lp-h: 104px; }
  .v21-lp-n { font-size: 1.375rem; line-height: 1.625rem; }
}
