/*
 * TAG Legal Desk v2.1, the Canteen's hover previews (js\v21_canteen_peek.js, 15 Oct 2026): a small panel beside a
 * product card with the name, one plain line on what it does and where it shows, and a small live example. Every class
 * starts v21pk-. Tokens only (the shop's own --v21pr- tokens come from the Canteen's sheet). Still (no animation at
 * all) under reduced motion, Calm, the quiet states, a day that matters, High contrast and forced colours; hidden in
 * print and with the rest of the game art.
 */

.v21pk { position: fixed; left: var(--pk-x, 12px); top: var(--pk-y, 12px); z-index: 95; box-sizing: border-box;
  width: min(320px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; overscroll-behavior: contain;
  display: grid; gap: 10px; padding: 10px; border-radius: 14px; color: var(--ink); background: var(--solid);
  border: 1px solid var(--glass-edge); box-shadow: 0 0 0 1px var(--glass-rim), var(--shadow-2); }
.v21pk.is-measuring { visibility: hidden; }
.v21pk-t { display: grid; gap: 4px; padding: 0 2px 2px; min-width: 0; }
.v21pk-name { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: .9375rem; line-height: 1.25rem; overflow-wrap: anywhere; }
.v21pk-kind { display: inline-block; padding: 0 7px; border-radius: 999px; font-size: .6875rem; line-height: 1.125rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); background: var(--solid-2); }
.v21pk-line { margin: 0; font-size: .8125rem; line-height: 1.25rem; color: var(--ink-2); }
.v21pk-sale { margin: 0; font-size: .8125rem; line-height: 1.25rem; font-weight: 700; color: var(--ink); }
.v21pk-still { margin: 0; font-size: .75rem; line-height: 1rem; }
/* t22-canteen4 (canteenSure): whether it is yours, or how many more Leaf Tokens it needs (the example is only an example). */
.v21pk-mine { margin: 0; padding: 4px 8px; border-radius: 8px; font-size: .8125rem; line-height: 1.25rem; font-weight: 700; color: var(--ink); border: 1px dashed var(--edge-strong); }
.v21pk-mine.is-yours { border-style: solid; color: var(--ok); }
.v21pk[data-sure="1"] { min-height: var(--pk-min-h, 0px); align-content: start; }
.v21pk-foot { display: flex; padding-top: 2px; }
.v21pk-play { gap: 6px; }
.v21pk-play:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- the example's window ---------- */
.v21pk-ex { position: relative; height: 152px; border-radius: 10px; overflow: hidden; display: grid; place-items: center;
  background: linear-gradient(180deg, var(--v21pr-wall-hi, #FBFBF8), var(--v21pr-wall, #EEF0EA)); box-shadow: inset 0 0 0 1px var(--glass-rim); }
.v21pk-tag { position: absolute; z-index: 3; padding: 1px 7px; border-radius: 999px; font-size: .6875rem; line-height: 1rem; font-weight: 700; color: var(--ink-2); background: var(--solid); box-shadow: 0 0 0 1px var(--glass-rim); white-space: nowrap; }

/* a paint, metallic or pattern: a card glowing in it, your pointer and your name chip */
.v21pk-scene { position: absolute; inset: 0; background: var(--bg, #EEF1EC); }
.v21pk-card { position: absolute; left: 16px; top: 18px; width: 156px; height: 80px; box-sizing: border-box; padding: 14px 12px; display: grid; align-content: start; gap: 7px;
  border-radius: 12px; background: var(--solid); box-shadow: 0 0 0 1px var(--glass-rim), var(--shadow-1); }
.v21pk-card > i { display: block; height: 6px; border-radius: 3px; background: var(--ink); opacity: .75; }
.v21pk-card > .v21pk-l1 { width: 72%; }
.v21pk-card > .v21pk-l2 { width: 52%; opacity: .4; }
.v21pk-card > .v21pk-l3 { width: 34%; opacity: .25; }
.v21pk-scene.is-plain .v21pk-card { box-shadow: 0 0 0 2px var(--pk-c), 0 0 16px color-mix(in srgb, var(--pk-c) 55%, transparent), var(--shadow-1); }
.v21pk-tag-card { left: 16px; top: 104px; }
.v21pk-chip { position: absolute; right: 12px; bottom: 14px; z-index: 2; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 999px;
  font-size: .8125rem; line-height: 1rem; font-weight: 700; color: var(--ink); background: var(--solid); box-shadow: 0 0 0 2px var(--pk-c), var(--shadow-1); }
.v21pk-av { position: relative; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: .625rem; font-weight: 800; color: #FFFFFF; background: var(--pk-c); }
.v21pk-chip-n { max-width: 88px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v21pk-ptr { position: absolute; left: 150px; top: 60px; z-index: 4; display: block; width: 30px; height: 34px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .3)); }
.v21pk-ptr-svg { display: block; overflow: visible; }
.v21pk-glint { opacity: 0; }

/* a bump power: two pointers meet, the other slides */
.v21pk-bump { position: absolute; inset: 0; background: var(--bg, #EEF1EC); }
.v21pk-bump-track { position: absolute; left: 8%; right: 6%; top: 64%; border-top: 2px dashed color-mix(in srgb, var(--ink-3) 55%, transparent); }
.v21pk-bp { position: absolute; top: 34%; display: block; width: 30px; height: 34px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .3)); }
.v21pk-bp-me { left: 30%; }
.v21pk-bp-them { left: calc(38% + var(--pk-push, 30%)); transform: rotate(18deg); }
.v21pk-spark { position: absolute; left: 39%; top: 38%; width: 18px; height: 18px; border-radius: 50%; opacity: 0;
  background: radial-gradient(circle, #FFFFFF 0 25%, var(--pk-c) 45%, transparent 70%); }
.v21pk-tag-bump { left: 10px; bottom: 10px; }

/* a theme: the Canteen's own mini board, with a pointer over it */
.v21pk-theme { position: absolute; inset: 0; }
.v21pk-ptr-theme { left: 46%; top: 40%; }

/* the Atelier engine's own previews, at the panel's size */
.v21pk-atl { position: absolute; inset: 0; display: grid; }
.v21pk-atl > .v21atl-pv { height: 100%; border-radius: 0; }
.v21pk-atl[data-atl-kind="surface"] .v21atl-material-mini, .v21pk-atl[data-atl-kind="board"] .v21atl-material-mini { width: 66%; min-height: 96px; }

/* your own picture wearing a frame or a piece */
.v21pk-you { position: relative; display: grid; place-items: center; width: 100%; height: 100%; }
.v21pk-you > .av, .v21pk-you > svg { max-height: 128px; }
.v21pk-tag-you { left: 10px; bottom: 10px; }
.v21pk-wear { --pk-av: 104px; }
.v21pk-piece { position: absolute; left: 50%; width: 92px; height: 92px; transform: translateX(-50%); pointer-events: none; z-index: 2; }
.v21pk-piece > img { display: block; width: 100%; height: 100%; object-fit: contain; }
.v21pk-wear[data-spot="head"] .v21pk-piece { top: -10px; }
.v21pk-wear[data-spot="eyes"] .v21pk-piece { top: 20px; }
.v21pk-wear[data-spot="neck"] .v21pk-piece { top: 52px; }

/* a picture: a bigger look, in a mat (gilt for a painted portrait), and you wearing it */
.v21pk-pic { position: absolute; inset: 0; display: grid; place-items: center; }
.v21pk-pic-in { display: grid; place-items: center; width: 132px; height: 132px; padding: 6px; box-sizing: border-box; border-radius: 6px; background: var(--v21pr-mat, #F7F3EA);
  box-shadow: 0 0 0 5px var(--v21pr-wood, #A87945), 0 0 0 7px var(--v21pr-wood-lo, #7A5230), 0 6px 14px rgba(0, 0, 0, .25); }
.v21pk-pic[data-frame="gilt"] .v21pk-pic-in { box-shadow: 0 0 0 5px #C9A13B, 0 0 0 7px #8C6A1C, 0 6px 14px rgba(0, 0, 0, .25); }
.v21pk-pic-in > img { display: block; width: 100%; height: 100%; object-fit: contain; }
.v21pk-pic[data-kind="flora"] .v21pk-pic-in, .v21pk-pic[data-kind="wren"] .v21pk-pic-in { box-shadow: none; background: transparent; }
.v21pk-asyou { position: absolute; right: 10px; bottom: 8px; display: grid; justify-items: center; gap: 2px; font-size: .6875rem; line-height: 1rem; font-weight: 700; color: var(--ink-2); }

/* a tree, a product, a pane, a speaker */
.v21pk-tree { display: grid; place-items: center; height: 100%; }
.v21pk-tree > * { max-height: 140px; }
.v21pk-prod { position: absolute; inset: 0; display: grid; place-items: center; }
.v21pk-win { width: 196px; max-width: 90%; }
.v21pk-pane { position: absolute; inset: 0; overflow: hidden; background: var(--solid-2); }
.v21pk-pane > svg { display: block; width: 100%; height: 100%; }
.v21pk-tag-pane { left: 50%; top: 10px; transform: translateX(-50%); }
.v21pk-sound { position: absolute; inset: 0; display: grid; place-items: center; }
.v21pk-eq { position: absolute; right: 14px; top: 14px; display: flex; align-items: flex-end; gap: 3px; height: 22px; opacity: 0; }
.v21pk-eq > i { display: block; width: 4px; height: 30%; border-radius: 2px; background: var(--brand-text); }
.v21pk-sound.is-playing .v21pk-eq { opacity: 1; }

/* ---------- the moving parts (only while nothing asks for stillness) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .v21pk:not([data-still]) .v21pk-scene .v21pk-ptr { animation: v21pk-drift 4.2s ease-in-out infinite; }
  .v21pk:not([data-still]) .v21pk-scene.is-plain .v21pk-card { animation: v21pk-pulse 2.6s ease-in-out infinite; }
  .v21pk:not([data-still]) .v21pk-scene:is([data-fam="metallic"], [data-fam="pattern"]) .v21pk-glint { animation: v21pk-glint 2.4s ease-in-out infinite; }
  .v21pk:not([data-still]) .v21pk-scene:is([data-fam="metallic"], [data-fam="pattern"]).is-plain .v21pk-card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .55) 46%, transparent 62%) -160px 0 / 200% 100% no-repeat; animation: v21pk-sheen 2.8s ease-in-out infinite; }
  .v21pk:not([data-still]) .v21pk-bp-me { animation: v21pk-me 3.4s ease-in-out infinite; }
  .v21pk:not([data-still]) .v21pk-bp-them { animation: v21pk-them 3.4s ease-in-out infinite; }
  .v21pk:not([data-still]) .v21pk-spark { animation: v21pk-spark 3.4s ease-out infinite; }
  .v21pk:not([data-still]) .v21pk-ptr-theme { animation: v21pk-tour 5s ease-in-out infinite; }
  .v21pk:not([data-still]) .v21pk-theme .v21c-mini-c1 { animation: v21pk-lift 5s ease-in-out infinite; }
  .v21pk:not([data-still]) .v21pk-atl[data-atl-kind="cursor"] .v21atl-pv-canvas { animation: v21pk-wander 4s ease-in-out infinite; }
  .v21pk:not([data-still]) .v21pk-atl[data-atl-kind="brush"] .v21atl-pv-canvas { animation: v21pk-draw 3.2s ease-in-out infinite; }
  .v21pk:not([data-still]) .v21pk-atl:is([data-atl-kind="surface"], [data-atl-kind="board"]) .v21atl-material-mini::before { animation: v21pk-sheen2 3s ease-in-out infinite; }
  .v21pk:not([data-still]) .v21pk-atl[data-atl-kind="interface"] .v21atl-mini-action { animation: v21pk-tilt 3.6s ease-in-out infinite; }
  .v21pk:not([data-still]) .v21pk-wear .v21pk-piece { animation: v21pk-bob 3s ease-in-out infinite; }
  .v21pk:not([data-still]) .v21pk-pic-in { animation: v21pk-breathe 4s ease-in-out infinite; }
  .v21pk:not([data-still]) .v21pk-sound.is-playing .v21pk-eq > i { animation: v21pk-eq .6s ease-in-out infinite alternate; }
  .v21pk:not([data-still]) .v21pk-sound.is-playing .v21pk-eq > i:nth-child(2) { animation-delay: -.2s; }
  .v21pk:not([data-still]) .v21pk-sound.is-playing .v21pk-eq > i:nth-child(3) { animation-delay: -.45s; }
  .v21pk:not([data-still]) .v21pk-sound.is-playing .v21pk-eq > i:nth-child(4) { animation-delay: -.1s; }
  .v21pk:not([data-still]) .v21pk-sound.is-playing .v21pk-eq > i:nth-child(5) { animation-delay: -.3s; }
  .v21pk:not([data-still]) { animation: v21pk-in .14s ease-out 1; }
}
@keyframes v21pk-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes v21pk-drift { 0%, 100% { transform: translate(34px, 34px); } 45%, 60% { transform: translate(0, 0); } }
@keyframes v21pk-pulse { 0%, 100% { box-shadow: 0 0 0 2px var(--pk-c), 0 0 10px color-mix(in srgb, var(--pk-c) 40%, transparent), var(--shadow-1); } 50% { box-shadow: 0 0 0 2px var(--pk-c), 0 0 22px color-mix(in srgb, var(--pk-c) 70%, transparent), var(--shadow-1); } }
@keyframes v21pk-glint { 0% { opacity: 0; transform: translateX(0) skewX(-20deg); } 15% { opacity: .8; } 70% { opacity: .8; transform: translateX(48px) skewX(-20deg); } 71%, 100% { opacity: 0; transform: translateX(48px) skewX(-20deg); } }
@keyframes v21pk-sheen { 0% { background-position: -160px 0; } 70%, 100% { background-position: 200px 0; } }
@keyframes v21pk-me { 0%, 10% { transform: translateX(-40px); } 35% { transform: translateX(0); } 50%, 100% { transform: translateX(-6px); } }
@keyframes v21pk-them { 0%, 33% { left: 38%; transform: rotate(0deg); } 60% { left: calc(38% + var(--pk-push, 30%)); transform: rotate(18deg); } 88%, 100% { left: calc(38% + var(--pk-push, 30%)); transform: rotate(18deg); } }
@keyframes v21pk-spark { 0%, 32% { opacity: 0; transform: scale(.4); } 36% { opacity: 1; transform: scale(1.3); } 48%, 100% { opacity: 0; transform: scale(1.8); } }
@keyframes v21pk-tour { 0%, 100% { transform: translate(-60px, 20px); } 40% { transform: translate(-90px, -24px); } 70% { transform: translate(40px, 10px); } }
@keyframes v21pk-lift { 0%, 25%, 70%, 100% { transform: none; } 40%, 55% { transform: translateY(-3px); box-shadow: 0 0 0 2px var(--brand-text), var(--shadow-2); } }
@keyframes v21pk-wander { 0%, 100% { transform: translate(-10px, 6px); } 50% { transform: translate(12px, -6px); } }
@keyframes v21pk-draw { 0% { clip-path: inset(0 100% 0 0); } 60%, 100% { clip-path: inset(0 0 0 0); } }
@keyframes v21pk-sheen2 { 0%, 100% { transform: translateX(-60%); } 50% { transform: translateX(60%); } }
@keyframes v21pk-tilt { 0%, 100% { transform: perspective(500px) rotateY(-6deg) rotateX(2deg); } 50% { transform: perspective(500px) rotateY(6deg) rotateX(-2deg) translateY(-2px); } }
@keyframes v21pk-bob { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-3px); } }
@keyframes v21pk-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.025); } }
@keyframes v21pk-eq { from { height: 20%; } to { height: 100%; } }

/* ---------- still: the same example, nothing moves ---------- */
:root:is([data-motion="reduced"], [data-calm="on"], [data-quiet="on"], [data-day-matters], [data-theme="high_contrast"]) .v21pk,
:root:is([data-motion="reduced"], [data-calm="on"], [data-quiet="on"], [data-day-matters], [data-theme="high_contrast"]) .v21pk *,
.v21pk[data-still], .v21pk[data-still] * { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { :root:not([data-motion="full"]) .v21pk, :root:not([data-motion="full"]) .v21pk * { animation: none !important; transition: none !important; } }
.v21pk[data-still] .v21pk-scene .v21pk-ptr { transform: translate(8px, 6px); }
.v21pk[data-still] .v21pk-scene .v21pk-card { box-shadow: 0 0 0 2px var(--pk-c), 0 0 12px color-mix(in srgb, var(--pk-c) 45%, transparent), var(--shadow-1); }

/* ---------- Dark, High contrast and forced colours ---------- */
:root[data-theme="dark"] .v21pk { box-shadow: 0 0 0 1px var(--glass-rim), 0 12px 32px rgba(0, 0, 0, .55); }
:root[data-theme="high_contrast"] .v21pk { background: #FFFFFF; color: #000000; border: 2px solid #000000; box-shadow: none; }
:root[data-theme="high_contrast"] .v21pk-ex { background: #FFFFFF; box-shadow: inset 0 0 0 2px #000000; }
:root[data-theme="high_contrast"] :is(.v21pk-line, .v21pk-kind, .v21pk-tag, .v21pk-asyou) { color: #000000; }
:root[data-theme="high_contrast"] :is(.v21pk-kind, .v21pk-tag) { background: #FFFFFF; box-shadow: inset 0 0 0 1px #000000; }
:root[data-theme="high_contrast"] :is(.v21pk-scene, .v21pk-bump) { background: #FFFFFF; }
:root[data-theme="high_contrast"] .v21pk-card { box-shadow: inset 0 0 0 2px #000000 !important; }
@media (forced-colors: active) {
  .v21pk { border: 2px solid CanvasText; background: Canvas; color: CanvasText; forced-color-adjust: auto; }
  .v21pk-ex { border: 1px solid CanvasText; }
  .v21pk-card, .v21pk-chip, .v21pk-tag, .v21pk-kind { border: 1px solid CanvasText; }
  .v21pk * { animation: none !important; }
}

/* ---------- the narrow window: the example a little shorter ---------- */
@media (max-width: 599px) { .v21pk-ex { height: 136px; } .v21pk-card { width: 136px; } .v21pk-ptr { left: 132px; } }

/* ---------- the card the panel is about ---------- */
.v21c-item.v21pk-on { outline: 2px solid color-mix(in srgb, var(--brand-text) 55%, transparent); outline-offset: 2px; }
:root[data-theme="high_contrast"] .v21c-item.v21pk-on { outline: 3px solid #000000; }

/* ---------- never in print, never in the quiet states or a welfare message ---------- */
@media print { .v21pk { display: none !important; } }
:root:is([data-quiet="on"], [data-v21-welfare="on"]) .v21pk { display: none !important; }
