/*
 * TAG Legal Desk v2.1: tree types and drawn frames for sale (J145, js/v21_shop_trees.js). Theme tokens and plain rules
 * only; every value the script sets goes through the CSSOM (no style attribute). The prefix v21st- is this file's own.
 */

/* ---------- the hidden block of finish filters (made once by the script) ---------- */
.v21st-defs { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }

/* ---------- a tree type's finish: the light theme's filter, then the dark theme's lifted one ---------- */
.v21st-fin[data-finish="autumn"], .v21st-fin-h[data-finish="autumn"] { filter: url(#v21st-f-autumn-l); }
.v21st-fin[data-finish="blossom"], .v21st-fin-h[data-finish="blossom"] { filter: url(#v21st-f-blossom-l); }
.v21st-fin[data-finish="frost"], .v21st-fin-h[data-finish="frost"] { filter: url(#v21st-f-frost-l); }
.v21st-fin[data-finish="jade"], .v21st-fin-h[data-finish="jade"] { filter: url(#v21st-f-jade-l); }
.v21st-fin[data-finish="coral"], .v21st-fin-h[data-finish="coral"] { filter: url(#v21st-f-coral-l); }
.v21st-fin[data-finish="dusk"], .v21st-fin-h[data-finish="dusk"] { filter: url(#v21st-f-dusk-l); }
.v21st-fin[data-finish="sunset"], .v21st-fin-h[data-finish="sunset"] { filter: url(#v21st-f-sunset-l); }
.v21st-fin[data-finish="silver"], .v21st-fin-h[data-finish="silver"] { filter: url(#v21st-f-silver-l); }
.v21st-fin[data-finish="rose_gold"], .v21st-fin-h[data-finish="rose_gold"] { filter: url(#v21st-f-rose_gold-l); }
.v21st-fin[data-finish="midnight"], .v21st-fin-h[data-finish="midnight"] { filter: url(#v21st-f-midnight-l); }
.v21st-fin[data-finish="golden"], .v21st-fin-h[data-finish="golden"] { filter: url(#v21st-f-golden-l); }
.v21st-fin[data-finish="aurora"], .v21st-fin-h[data-finish="aurora"] { filter: url(#v21st-f-aurora-l); }
:root[data-theme="dark"] .v21st-fin[data-finish="autumn"], :root[data-theme="dark"] .v21st-fin-h[data-finish="autumn"],
:root[data-v21-theme="night_shift"] .v21st-fin[data-finish="autumn"], :root[data-v21-theme="night_shift"] .v21st-fin-h[data-finish="autumn"] { filter: url(#v21st-f-autumn-d); }
:root[data-theme="dark"] .v21st-fin[data-finish="blossom"], :root[data-theme="dark"] .v21st-fin-h[data-finish="blossom"],
:root[data-v21-theme="night_shift"] .v21st-fin[data-finish="blossom"], :root[data-v21-theme="night_shift"] .v21st-fin-h[data-finish="blossom"] { filter: url(#v21st-f-blossom-d); }
:root[data-theme="dark"] .v21st-fin[data-finish="frost"], :root[data-theme="dark"] .v21st-fin-h[data-finish="frost"],
:root[data-v21-theme="night_shift"] .v21st-fin[data-finish="frost"], :root[data-v21-theme="night_shift"] .v21st-fin-h[data-finish="frost"] { filter: url(#v21st-f-frost-d); }
:root[data-theme="dark"] .v21st-fin[data-finish="jade"], :root[data-theme="dark"] .v21st-fin-h[data-finish="jade"],
:root[data-v21-theme="night_shift"] .v21st-fin[data-finish="jade"], :root[data-v21-theme="night_shift"] .v21st-fin-h[data-finish="jade"] { filter: url(#v21st-f-jade-d); }
:root[data-theme="dark"] .v21st-fin[data-finish="coral"], :root[data-theme="dark"] .v21st-fin-h[data-finish="coral"],
:root[data-v21-theme="night_shift"] .v21st-fin[data-finish="coral"], :root[data-v21-theme="night_shift"] .v21st-fin-h[data-finish="coral"] { filter: url(#v21st-f-coral-d); }
:root[data-theme="dark"] .v21st-fin[data-finish="dusk"], :root[data-theme="dark"] .v21st-fin-h[data-finish="dusk"],
:root[data-v21-theme="night_shift"] .v21st-fin[data-finish="dusk"], :root[data-v21-theme="night_shift"] .v21st-fin-h[data-finish="dusk"] { filter: url(#v21st-f-dusk-d); }
:root[data-theme="dark"] .v21st-fin[data-finish="sunset"], :root[data-theme="dark"] .v21st-fin-h[data-finish="sunset"],
:root[data-v21-theme="night_shift"] .v21st-fin[data-finish="sunset"], :root[data-v21-theme="night_shift"] .v21st-fin-h[data-finish="sunset"] { filter: url(#v21st-f-sunset-d); }
:root[data-theme="dark"] .v21st-fin[data-finish="silver"], :root[data-theme="dark"] .v21st-fin-h[data-finish="silver"],
:root[data-v21-theme="night_shift"] .v21st-fin[data-finish="silver"], :root[data-v21-theme="night_shift"] .v21st-fin-h[data-finish="silver"] { filter: url(#v21st-f-silver-d); }
:root[data-theme="dark"] .v21st-fin[data-finish="rose_gold"], :root[data-theme="dark"] .v21st-fin-h[data-finish="rose_gold"],
:root[data-v21-theme="night_shift"] .v21st-fin[data-finish="rose_gold"], :root[data-v21-theme="night_shift"] .v21st-fin-h[data-finish="rose_gold"] { filter: url(#v21st-f-rose_gold-d); }
:root[data-theme="dark"] .v21st-fin[data-finish="midnight"], :root[data-theme="dark"] .v21st-fin-h[data-finish="midnight"],
:root[data-v21-theme="night_shift"] .v21st-fin[data-finish="midnight"], :root[data-v21-theme="night_shift"] .v21st-fin-h[data-finish="midnight"] { filter: url(#v21st-f-midnight-d); }
:root[data-theme="dark"] .v21st-fin[data-finish="golden"], :root[data-theme="dark"] .v21st-fin-h[data-finish="golden"],
:root[data-v21-theme="night_shift"] .v21st-fin[data-finish="golden"], :root[data-v21-theme="night_shift"] .v21st-fin-h[data-finish="golden"] { filter: url(#v21st-f-golden-d); }
:root[data-theme="dark"] .v21st-fin[data-finish="aurora"], :root[data-theme="dark"] .v21st-fin-h[data-finish="aurora"],
:root[data-v21-theme="night_shift"] .v21st-fin[data-finish="aurora"], :root[data-v21-theme="night_shift"] .v21st-fin-h[data-finish="aurora"] { filter: url(#v21st-f-aurora-d); }

/* High contrast and forced colours: the tree keeps the theme's own crisp drawing (no colour filter), and the overlay is
   drawn in solid black so the finish still reads as a deliberate mark, never a muddy tint. */
:root[data-theme="high_contrast"] .v21st-fin, :root[data-theme="high_contrast"] .v21st-fin-h { filter: none !important; }
:root[data-theme="high_contrast"] .v21st-ov .v21st-ovf { fill: #000000; opacity: 1; }
:root[data-theme="high_contrast"] .v21st-ov .v21st-ovs { stroke: #000000; opacity: 1; }
:root[data-theme="high_contrast"] .v21st-ov .v21st-glowbed { display: none; }
@media (forced-colors: active) {
  .v21st-fin, .v21st-fin-h { filter: none !important; }
  .v21st-ov { display: none; }
}

/* ---------- the overlay's small life: glints twinkle, the aurora shimmers (never with reduced motion or Calm) ---------- */
@keyframes v21st-tw { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes v21st-sh { 0%, 100% { opacity: .38; } 50% { opacity: .78; } }
.v21st-ov .v21st-tw { animation: v21st-tw 3.2s ease-in-out infinite; }
.v21st-ov .v21st-sh { animation: v21st-sh 5.5s ease-in-out infinite; }
.v21st-ov .v21st-d1 { animation-delay: -.8s; }
.v21st-ov .v21st-d2 { animation-delay: -1.6s; }
.v21st-ov .v21st-d3 { animation-delay: -2.4s; }
:root[data-motion="reduced"] .v21st-ov *, :root[data-calm="on"] .v21st-ov *, :root[data-theme="high_contrast"] .v21st-ov *,
:root[data-day-matters]:not([data-day-matters=""]) .v21st-ov * { animation: none !important; }
@media (prefers-reduced-motion: reduce) { :root:not([data-motion="full"]) .v21st-ov * { animation: none !important; } }

/* The tree type's name on its hover card, and the Grove's column words */
.gb-grove .gb-card .v21st-card-type { display: block; font-size: .8em; opacity: .85; }

/* ---------- Your finishes (under Pick your tree) ---------- */
.v21st-types-box { display: grid; gap: 6px; margin-top: 8px; }
.v21st-types { display: flex; flex-wrap: wrap; gap: 6px; max-width: 100%; }
.v21st-types button { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; height: auto; white-space: normal; text-align: left; }
.v21st-type-sw { display: inline-flex; align-items: flex-end; justify-content: center; width: 28px; height: 28px; overflow: hidden; flex: none; }
.v21st-type-sw img, .v21st-type-sw svg { display: block; width: 100%; height: auto; max-width: none; }
.v21st-types button:focus-visible { outline: 2px solid var(--focus, var(--brand)); outline-offset: 2px; }
:root[data-theme="high_contrast"] .v21st-types button[aria-checked="true"] { background: #000; color: #fff; }
.v21-grove-species button[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
:root[data-theme="high_contrast"] .v21-grove-species button[aria-disabled="true"] { opacity: 1; text-decoration: line-through; }

/* ---------- the shop's preview of a tree type ---------- */
.v21st-prev { display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 100%; min-height: 72px; }
.v21st-prev-leaf { display: flex; align-items: flex-end; justify-content: center; max-width: 100%; }
.v21st-prev-leaf img { display: block; width: 88px; height: auto; max-width: 100%; }

/* ---------- a drawn frame round an avatar ---------- */
/* J160 (29 Sep 2026): the frame covers the avatar's own box and its drawing is sized as a share of the avatar's real
   width (--v21st-k, the drawing's box over the px it was drawn for, set through the CSSOM), so the band always hugs the
   circle, whatever size the page's CSS gives the avatar (the trophy room at 72 px on a narrow screen, the Grove's name tags). */
.v21st-frm { position: absolute; left: 0; top: 0; right: 0; bottom: 0; z-index: 2; pointer-events: none; }
.v21st-frm > svg { position: absolute; display: block; width: calc(var(--v21st-k, 1.4) * 100%); height: calc(var(--v21st-k, 1.4) * 100%); left: calc(50% - var(--v21st-k, 1.4) * 50%); top: calc(50% - var(--v21st-k, 1.4) * 50%); overflow: visible; }
.av-sm > .v21st-frm { display: none; }
:root[data-theme="dark"] .v21st-frm > svg, :root[data-v21-theme="night_shift"] .v21st-frm > svg { filter: brightness(1.15); }
/* High contrast: solid parts black, light parts white with a black edge, light strokes white, the shading left out. */
:root[data-theme="high_contrast"] .v21st-frm .v21st-s { stroke: #000000; }
:root[data-theme="high_contrast"] .v21st-frm .v21st-f { fill: #000000; stroke: #000000; }
:root[data-theme="high_contrast"] .v21st-frm .v21st-k { fill: #FFFFFF; stroke: #000000; }
:root[data-theme="high_contrast"] .v21st-frm .v21st-w { stroke: #FFFFFF; }
:root[data-theme="high_contrast"] .v21st-frm .v21st-glow, :root[data-theme="high_contrast"] .v21st-frm .v21st-o { display: none; }
/* J160 review: a thin thread High contrast shows (lace, a bubble's edge) is drawn 0.9 px and solid, never a grey hairline. */
:root[data-theme="high_contrast"] .v21st-frm .v21st-t { stroke-width: .9px; opacity: 1; }
/* A big framed avatar beside words (the trophy room's look) gives its frame room, so the frame never runs past the
   card's edge or over the words (J160). */
.v21tr-look > .av.v21st-framed { margin: 12px 8px 12px 10px; }
@media (max-width: 720px) { .v21tr-look > .av.v21st-framed { margin: 10px 6px 10px 8px; } }
/* The shop's preview of a frame: your own avatar at the size its frame is drawn for. */
.av.v21st-prev-av { width: var(--v21st-size, 72px); height: var(--v21st-size, 72px); font-size: calc(var(--v21st-size, 72px) * .34); }
/* A small framed avatar in a row (your chip, the honours and trophy lists) takes side room for its frame. */
.av.v21st-framed { margin-inline: var(--v21st-oh, 0px); }
.crew .av.v21st-framed { margin-right: 0; }
/* J160 review: on the crew strip (40 px avatars 12 px apart, each in its own button) a framed avatar takes 3 px more
   each side, so two framed neighbours sit 18 px apart. Under 44 px every part of a frame stays inside its drawing box
   (8 px a side at 40 px), so frames never meet. */
#crew-slot .crew .av.v21st-framed { margin-left: 3px; margin-right: 3px; }
/* J160 review: the header's empty #dots-slot (js\shell.js) made a second grid row, which lifted the crew strip to 4 px
   from the window's top, so every crest was cut. It holds only the narrow screen's crew dots, which are placed
   absolutely against the header, so it needs no box of its own: the crew sits in the middle of the header again
   (10 px from the top). For the orchestrator: this belongs with the header's own rules in styles\desk.css. */
.hdr > #dots-slot { display: contents; }

/* ---------- welfare first: the quiet states, a job, the email paper, welfare, the Leaving card, print ---------- */
:root[data-quiet="on"] .v21st-frm, :root[data-quiet="on"] .v21st-ov, :root[data-quiet="on"] .v21st-types-box, :root[data-quiet="on"] .v21st-prev { display: none !important; }
:root[data-quiet="on"] .v21st-fin, :root[data-quiet="on"] .v21st-fin-h { filter: none !important; }
#job-layer .v21st-frm, .paper .v21st-frm, #wf-layer .v21st-frm, #wf-slot .v21st-frm, #wf-over-job .v21st-frm, #wf-over-cover .v21st-frm,
.wf-band .v21st-frm, .band-welfare .v21st-frm, #leave-root .v21st-frm { display: none !important; }
@media print { .v21st-frm, .v21st-ov, .v21st-types-box, .v21st-prev { display: none !important; } .v21st-fin, .v21st-fin-h { filter: none !important; } }
@media (forced-colors: active) {
  .v21st-frm { display: none; }
  .v21-grove-species button[aria-disabled="true"] { color: GrayText; }
}
