/*
 * TAG Legal Desk v2.1: the Bush Book (js\v21_bushbook.js) and the Grove's library art (js\v21_artlib_grove.js).
 * A field guide in the desk's glass: a contents list with counts (a scrolling row on a phone), plates on still glass
 * with a soft specimen light behind each picture, and a page for each picture. Only transform and opacity move, and
 * nothing moves under reduced motion, Calm or a day that matters. Everything here is game art: the core hides every
 * [data-v21="game"] at once while a welfare message is open, in the quiet period and under the nobody band.
 * Tokens only (every theme, the Canteen themes too); High contrast gets plain black edges and no gradients.
 */

/* ---------- the sheet ---------- */
.v21bb-sheet .sheet-b { scrollbar-gutter: stable; }
.v21bb { display: grid; gap: 18px; width: 100%; max-width: 1320px; margin: 0 auto; min-width: 0; }
.v21bb-intro { display: grid; gap: 4px; }
.v21bb-intro p { margin: 0; }
.v21bb-total { display: flex; align-items: center; gap: 10px; font-size: 1.125rem; line-height: 1.5rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.v21bb-glyph { flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--brand-text); }
.v21bb-layout { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); align-items: start; min-width: 0; }
.v21bb-main { display: grid; gap: 14px; min-width: 0; align-content: start; }
.v21bb-kicker { margin: 0; font-size: .6875rem; line-height: 1rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--brand-text); }

/* ---------- the contents: a scrolling row of chips, a column beside the plates from 960 px ---------- */
.v21bb-nav { display: grid; gap: 8px; min-width: 0; }
.v21bb-nav > .v21bb-kicker { display: none; }
.v21bb-toc { display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding: 2px 2px 8px; margin: 0 -2px; min-width: 0; scrollbar-width: none; }
/* fixer: the phone's row of chips scrolls by touch, the wheel and the arrow keys; no heavy scrollbar under it */
.v21bb-toc::-webkit-scrollbar { display: none; }
.v21bb-chap { flex: none; scroll-snap-align: start; display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 0 12px 0 14px;
  border-radius: 14px; border: 1px solid var(--glass-edge); background: var(--glass-1); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-rim);
  color: var(--ink); font-size: .8125rem; font-weight: 700; white-space: nowrap; text-align: left; cursor: pointer;
  transition: background-color var(--t-small) var(--ease-out), transform var(--t-small) var(--ease-out); }
.v21bb-chap:hover { background: var(--glass-2); }
.v21bb-chap-n { font-variant-numeric: tabular-nums; font-size: .75rem; font-weight: 800; color: var(--ink-3); padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); }
.v21bb-chap[aria-checked="true"] { background: linear-gradient(180deg, var(--brand-hi), var(--brand)); border-color: transparent; color: var(--brand-ink); box-shadow: var(--btn-shadow); }
.v21bb-chap[aria-checked="true"] .v21bb-chap-n { color: var(--brand-ink); background: rgba(255, 255, 255, .18); }
@media (min-width: 960px) {
  .v21bb-layout { grid-template-columns: 250px minmax(0, 1fr); gap: 24px; }
  .v21bb-nav { position: sticky; top: 0; padding: 14px; border-radius: 22px; background: var(--glass-1); border: 1px solid var(--glass-edge);
    box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-rim), var(--shadow-1); max-height: calc(100vh - 120px); overflow-y: auto; }
  .v21bb-nav > .v21bb-kicker { display: block; padding: 0 4px; }
  .v21bb-toc { flex-direction: column; overflow: visible; padding: 0; margin: 0; gap: 4px; scroll-snap-type: none; }
  .v21bb-chap { width: 100%; min-height: 40px; border-color: transparent; background: transparent; box-shadow: none; white-space: normal; }
  .v21bb-chap:hover { background: var(--glass-hover); }
  .v21bb-chap[aria-checked="true"] { background: linear-gradient(180deg, var(--brand-hi), var(--brand)); box-shadow: var(--btn-shadow); }
}

/* ---------- search, the chapter's head, the status line ---------- */
.v21bb-find { position: relative; max-width: 560px; }
.v21bb-find[hidden] { display: none; }
.v21bb-search-ico { position: absolute; left: 12px; top: 13px; fill: none; stroke: var(--ink-3); stroke-width: 1.8; stroke-linecap: round; pointer-events: none; }
.v21bb-search { width: 100%; min-height: 44px; box-sizing: border-box; padding: 0 12px 0 38px; border-radius: 14px; border: 1px solid var(--edge-strong); background: var(--solid); color: var(--ink); font: inherit; font-size: .9375rem; }
.v21bb-search::placeholder { color: var(--ink-3); opacity: 1; }
.v21bb-search:focus-visible { outline-offset: 0; border-color: var(--focus); }
.v21bb-headhost[hidden] { display: none; }
.v21bb-head { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: center; padding: 18px 20px; border-radius: 22px; background: var(--glass-1); border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-rim), var(--shadow-1); overflow: hidden; }
.v21bb-head-words { display: grid; gap: 4px; min-width: 0; }
.v21bb-head p, .v21bb-head h3 { margin: 0; }
/* the head's cover: four pictures from across the collection, each on its own specimen light */
.v21bb-cover { display: flex; gap: 10px; justify-content: flex-end; }
.v21bb-cover-pic { display: grid; place-items: center; width: 88px; height: 88px; border-radius: 18px; background: radial-gradient(120% 95% at 50% 32%, var(--solid) 0%, var(--solid-2) 100%);
  box-shadow: inset 0 0 0 1px var(--glass-rim); }
.v21bb-cover-pic:nth-child(even) { transform: translateY(8px); }
.v21bb-cover-pic img { width: 82%; height: 82%; object-fit: contain; }
@media (min-width: 1100px) { .v21bb-head { grid-template-columns: minmax(0, 1fr) auto; } }
@media (max-width: 1099px) { .v21bb-cover { display: none; } }
:root[data-theme="high_contrast"] .v21bb-cover-pic { background: #fff; box-shadow: inset 0 0 0 1px #000; }
.v21bb-title { font-size: 1.5rem; line-height: 1.9rem; font-weight: 800; color: var(--ink); overflow-wrap: anywhere; }
.v21bb-count { font-size: .8125rem; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.v21bb-blurb { color: var(--ink-2); max-width: 72ch; }
.v21bb-have { display: inline-flex; align-items: center; gap: 8px; justify-self: start; margin-top: 6px !important; padding: 6px 12px 6px 10px; border-radius: 12px;
  background: var(--brand-soft); color: var(--ink); font-size: .8125rem; font-weight: 600; }
.v21bb-status { margin: 0; }

/* ---------- the plates ---------- */
.v21bb-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
.v21bb-cell { min-width: 0; display: flex; }
.v21bb-tile { position: relative; width: 100%; display: grid; grid-template-rows: auto auto auto; align-content: start; justify-items: center; gap: 4px; padding: 10px 10px 12px;
  border-radius: 20px; border: 1px solid var(--glass-edge); background: var(--glass-1); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-rim);
  color: var(--ink); text-align: center; cursor: pointer; min-width: 0;
  transition: transform var(--t-small) var(--ease-out), background-color var(--t-small) var(--ease-out), box-shadow var(--t-small) var(--ease-out); }
.v21bb-tile:hover { background: var(--glass-2); transform: translateY(-2px); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-rim), var(--shadow-1); }
.v21bb-tile.is-mine { box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 2px var(--accent); }
.v21bb-plate { width: 100%; aspect-ratio: 1; display: grid; place-items: center; border-radius: 14px; margin-bottom: 4px; overflow: hidden;
  background: radial-gradient(120% 95% at 50% 32%, var(--solid) 0%, var(--solid-2) 100%); box-shadow: inset 0 0 0 1px var(--glass-rim); }
.v21bb-plate img { width: 84%; height: 84%; max-width: 84%; object-fit: contain; }
.v21bb-plate.is-tree { display: flex; align-items: flex-end; justify-content: center; }
.v21bb-name { width: 100%; font-size: .8125rem; line-height: 1.1rem; font-weight: 700; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.v21bb-sub { width: 100%; font-size: .6875rem; line-height: 1rem; color: var(--ink-3); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.v21bb-tag { position: absolute; top: 8px; right: 8px; max-width: calc(100% - 16px); padding: 2px 8px; border-radius: 999px; font-size: .6875rem; line-height: 1rem; font-weight: 800;
  background: var(--solid); color: var(--brand-text); box-shadow: 0 0 0 1px var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v21bb-empty { display: grid; gap: 10px; justify-items: start; padding: 18px 20px; border-radius: 20px; }
.v21bb-empty p { margin: 0; }
.v21bb-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 4px; }
.v21bb .btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* ---------- a picture's page ---------- */
.v21bb-detail { display: grid; gap: 14px; min-width: 0; }
.v21bb-d-top { display: flex; }
.v21bb-back { margin-left: -10px; }
.v21bb-d-body { display: grid; gap: 20px; min-width: 0; }
@media (min-width: 760px) { .v21bb-d-body { grid-template-columns: minmax(260px, 400px) minmax(0, 1fr); align-items: start; } .v21bb-d-pic { position: sticky; top: 0; } }
.v21bb-big { aspect-ratio: 1; display: grid; place-items: center; padding: 18px; box-sizing: border-box; border-radius: 26px;
  background: radial-gradient(115% 90% at 50% 30%, var(--solid) 0%, var(--solid-2) 100%);
  border: 1px solid var(--glass-edge); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-rim), var(--shadow-1); }
.v21bb-big img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.v21bb-words { display: grid; gap: 12px; align-content: start; min-width: 0; }
.v21bb-words > p, .v21bb-words h3 { margin: 0; }
.v21bb-d-title { font-size: 1.625rem; line-height: 2rem; font-weight: 800; color: var(--ink); overflow-wrap: anywhere; }
.v21bb-kind { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.v21bb-pill { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-text); font-size: .75rem; font-weight: 800; }
.v21bb-vers { display: flex; flex-wrap: wrap; gap: 8px; }
.v21bb-ver { width: 56px; height: 56px; padding: 4px; display: grid; place-items: center; border-radius: 14px; border: 1px solid var(--glass-edge); background: var(--glass-1);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-rim); cursor: pointer; }
.v21bb-ver:hover { background: var(--glass-2); }
.v21bb-ver[aria-checked="true"] { background: var(--brand-soft); box-shadow: 0 0 0 2px var(--brand-text); }
.v21bb-ver-pic { display: grid; place-items: center; width: 100%; height: 100%; }
.v21bb-ver-pic img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.v21bb-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; padding: 14px 16px; border-radius: 18px; background: var(--glass-1);
  border: 1px solid var(--glass-edge); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-rim); }
.v21bb-facts dt { font-size: .6875rem; line-height: 1.25rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.v21bb-facts dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.v21bb-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.v21bb-d-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 4px; }

/* ---------- a phone ---------- */
@media (max-width: 600px) {
  .v21bb { gap: 14px; }
  .v21bb-total { font-size: 1rem; }
  .v21bb-grid { gap: 8px; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
  .v21bb-tile { padding: 8px 8px 10px; border-radius: 16px; }
  .v21bb-head { padding: 14px 16px; border-radius: 18px; }
  .v21bb-title { font-size: 1.25rem; line-height: 1.625rem; }
  .v21bb-d-title { font-size: 1.375rem; line-height: 1.75rem; }
  .v21bb-facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .v21bb-facts dd { margin-bottom: 8px; }
}

/* ---------- still: reduced motion, Calm, a day that matters ---------- */
:root[data-motion="reduced"] .v21bb-tile, :root[data-calm="on"] .v21bb-tile, :root[data-day-matters] .v21bb-tile,
:root[data-motion="reduced"] .v21bb-chap, :root[data-calm="on"] .v21bb-chap, :root[data-day-matters] .v21bb-chap { transition: none; }
:root[data-motion="reduced"] .v21bb-tile:hover, :root[data-calm="on"] .v21bb-tile:hover, :root[data-day-matters] .v21bb-tile:hover { transform: none; }
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="full"]) .v21bb-tile, :root:not([data-motion="full"]) .v21bb-chap { transition: none; }
  :root:not([data-motion="full"]) .v21bb-tile:hover { transform: none; }
}

/* ---------- High contrast ---------- */
:root[data-theme="high_contrast"] .v21bb-chap, :root[data-theme="high_contrast"] .v21bb-tile, :root[data-theme="high_contrast"] .v21bb-head,
:root[data-theme="high_contrast"] .v21bb-big, :root[data-theme="high_contrast"] .v21bb-ver, :root[data-theme="high_contrast"] .v21bb-facts { background: #fff; border: 2px solid #000; box-shadow: none; color: #000; }
:root[data-theme="high_contrast"] .v21bb-plate { background: #fff; box-shadow: inset 0 0 0 1px #000; }
:root[data-theme="high_contrast"] .v21bb-chap[aria-checked="true"], :root[data-theme="high_contrast"] .v21bb-ver[aria-checked="true"] { background: #000; color: #fff; box-shadow: none; }
:root[data-theme="high_contrast"] .v21bb-chap[aria-checked="true"] .v21bb-chap-n { background: #fff; color: #000; }
:root[data-theme="high_contrast"] .v21bb-chap-n, :root[data-theme="high_contrast"] .v21bb-pill, :root[data-theme="high_contrast"] .v21bb-have { background: #fff; color: #000; box-shadow: inset 0 0 0 1px #000; }
:root[data-theme="high_contrast"] .v21bb-tile.is-mine { box-shadow: 0 0 0 2px #000; border-width: 3px; }
:root[data-theme="high_contrast"] .v21bb-tag { background: #000; color: #fff; box-shadow: none; }
:root[data-theme="high_contrast"] .v21bb-search { border: 2px solid #000; }
@media (min-width: 960px) {
  :root[data-theme="high_contrast"] .v21bb-nav { background: #fff; border: 2px solid #000; box-shadow: none; }
  :root[data-theme="high_contrast"] .v21bb-nav .v21bb-chap { border-color: transparent; }
  :root[data-theme="high_contrast"] .v21bb-nav .v21bb-chap[aria-checked="true"] { border-color: #000; }
}

/* ---------- the Grove: the undergrowth at the foot of each person's tree (js\v21_artlib_grove.js) ---------- */
/* An overlay laid exactly over the scene (grove.js lays out its tags, hit areas and cards the same way), placed in the
   DOM before the name tags, so a tag is always drawn over the undergrowth; every plant stands on the ground band
   above the line where the tags begin. Hidden in High contrast and forced colours, like all the Grove's understorey. */
.v21bb-ug { position: absolute; inset: 0; pointer-events: none; }
.v21bb-ug img { position: absolute; left: var(--x); top: var(--y); width: var(--w); height: auto; max-width: none; transform: translate(-50%, -100%); }
.v21bb-ug-t.is-away { opacity: .5; filter: blur(1.2px); }
.v21bb-ug.is-still .v21bb-ug-t.is-away { filter: none; }
.v21bb-ug.is-new { animation: v21bb-ug-in var(--t-card) var(--ease-out) both; }
@keyframes v21bb-ug-in { from { opacity: 0; } to { opacity: 1; } }
:root[data-motion="reduced"] .v21bb-ug.is-new, :root[data-calm="on"] .v21bb-ug.is-new, :root[data-day-matters] .v21bb-ug.is-new { animation: none; }
@media (prefers-reduced-motion: reduce) { :root:not([data-motion="full"]) .v21bb-ug.is-new { animation: none; } :root:not([data-motion="full"]) .v21bb-ug-t.is-away { filter: none; } }
:root[data-theme="high_contrast"] .v21bb-ug { display: none; }
@media (forced-colors: active) { .v21bb-ug { display: none; } }

/* {ai}'s robot tree resting: its node lights dim and stop blinking while {ai} has cleared nothing for 10 minutes (the
   library's lit and unlit pictures, drawn by the kit's own vector tree) */
.v21-grove-scene.v21bb-fred-resting [data-part="robot"] { --fauna-lori-green: var(--metal-silver-lo, #737B80); }
.v21-grove-scene.v21bb-fred-resting .gb-robot-node { animation: none !important; opacity: .8; }

/* Pick your tree: each species as its picture at your own stage */
.v21-grove-species.v21bb-picks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 6px; max-width: 520px; }
.v21-grove-species.v21bb-picks[hidden] { display: none; }
.v21-grove-species.v21bb-picks button { display: grid; justify-items: center; align-content: start; gap: 4px; min-height: 44px; height: auto; padding: 8px 4px 10px; line-height: 1.2; text-align: center; white-space: normal; }
/* the tree pictures stand at the foot of a tall canvas: shown from the ground up, zoomed for their stage (below) */
.v21bb-pick-pic { display: flex; align-items: flex-end; justify-content: center; width: 72px; height: 72px; overflow: hidden; }
.v21bb-pick-pic img { flex: none; width: 100%; height: auto; max-width: none; }
@media (max-width: 420px) { .v21bb-pick-pic { width: 56px; height: 56px; } .v21-grove-species.v21bb-picks button { font-size: .75rem; } }
:root[data-theme="high_contrast"] .v21-grove-species.v21bb-picks button[aria-checked="true"] { background: #000; color: #fff; }

/* Wren on the Clear panel when its moving picture is not there (the words line had only words before) */
.v21bb-wren-still { display: block; line-height: 0; margin: 0 auto 4px; width: 140px; max-width: 60%; }
.v21bb-wren-still img { width: 100%; height: auto; }
@media (max-width: 600px) { .v21bb-wren-still { width: 110px; } }

/* ---------- fixer (28 Sep 2026): trees stand in their box, zoomed for their stage ---------- */
/* A Grove tree or the robot tree (NS.artlib.standFit, measured from the pictures): the picture is as wide as the box
   times --v21a-z, stands on the bottom edge (dropped by --v21a-dy box widths so its foot is on the ground line) and is
   cut by the box only where the canvas is empty, so a seedling fills its tile and an old growth canopy is never
   cropped. Both come through the CSSOM (element.style.setProperty), never a style attribute. */
.v21bb-ver-pic.is-tree, .v21bb-big.is-tree { display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.v21bb-big.is-tree { padding-bottom: 0; }
.v21bb-pick-pic img.v21a-stand, .v21bb-plate.is-tree img.v21a-stand, .v21bb-ver-pic.is-tree img.v21a-stand, .v21bb-big.is-tree img.v21a-stand {
  flex: none; width: calc(100% * var(--v21a-z, 1)); height: auto; max-width: none; max-height: none; object-fit: contain;
  margin-bottom: calc(-100% * var(--v21a-dy, 0)); }
/* a tree drawn by the desk's own generator (js\v21_bushbook.js vectorTree): it fills its square, sharp at any size */
.v21bb-plate .v21bb-vtree, .v21bb-big .v21bb-vtree { display: block; flex: none; width: 100%; height: 100%; }
.v21bb-big.is-vtree { padding: 12px 12px 0; }
/* the robot tree with its lights off, as the library's unlit pictures are: no halo, the nodes a quiet green */
.v21bb-vtree.is-off { --fauna-lori-green: transparent; }
:root:not([data-theme="high_contrast"]) .v21bb-vtree.is-off .gb-robot-node { fill: #34553A !important; }
