/*
 * TAG Legal Desk v2.1: the card lock and the slim sending card (register J148, js\v21_cardlock.js). Theme tokens only,
 * no inline styles (the page's policy): the holder's colour comes through the CSSOM as --kcl-c (their chosen colour,
 * or the colour the server gave them). The lock is game art (data-v21="game"): the core's quiet rule hides it while a
 * welfare message is open, in the quiet period and under the nobody band, and the card's own glyph comes back then.
 * The glow breathes softly; reduced motion, Calm, a day that matters, High contrast and forced colours hold it still.
 * Their effect colour (styles\v21_colours_fx.css, the round shape) moves on the frame like every avatar edge.
 * The slim sending card keeps its title (one line), the chip (the countdown and who pressed Send) and, on the
 * sender's own card, the buttons and the line; everything else gives way until it leaves.
 */

/* ---------- the lock: the holder's critter big at the card's left, in a glowing frame, with a padlock ---------- */
:root:not([data-quiet="on"]) .card.kcl-on { grid-template-columns: 56px minmax(0,1fr) auto; }
:root:not([data-quiet="on"]) .card.kcl-on > .glyph { display: none; }
.card > .kcl-lock {
  position: relative; z-index: 2; display: inline-grid; place-items: center; width: 56px; height: 56px;
  pointer-events: none; align-self: center;
}
.card .kcl-frame {
  --kcl-c: var(--brand);
  position: relative; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  background: var(--solid); box-shadow: 0 0 0 3px var(--kcl-c), 0 0 10px 2px var(--kcl-c);
}
/* The soft glow that breathes around the frame (a circle the frame clips to nothing: only its shadow shows). */
.card .kcl-frame::after {
  content: ""; position: absolute; inset: -2px; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 12px 3px var(--kcl-c); opacity: .55;   /* stays inside the card's padding (contain: paint) */
  animation: kcl-breathe 2.6s ease-in-out infinite;
}
@keyframes kcl-breathe { 0%, 100% { opacity: .35; transform: scale(.97); } 50% { opacity: .75; transform: scale(1.03); } }
.card .kcl-frame > .av.kcl-av { width: 44px; height: 44px; font-size: 1rem; box-shadow: none; }
/* The padlock badge, at the frame's foot on the right: shut on a colleague's card, open on your own. */
.card .kcl-pad {
  position: absolute; right: -2px; bottom: -2px; z-index: 1; display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%; background: var(--solid); color: var(--ink);
  box-shadow: 0 0 0 2px var(--kcl-c), var(--shadow-1);
}
.card .kcl-pad .kcl-pad-i { width: 14px; height: 14px; display: block; }
.card .kcl-pad .kcl-pad-hole { fill: var(--solid); }
.card .kcl-pad.is-open { color: var(--ok); }
/* A colleague's card is frosted (desk.css); the lock stays bright above the frost, like the holder chip. */
.card.is-held > .kcl-lock, .card.is-away > .kcl-lock { opacity: 1; }
/* Stepped away: the frame dims a touch, the padlock stays. */
.card.is-away .kcl-frame { filter: saturate(.7); }

/* Still: reduced motion, Calm, a day that matters, High contrast. */
:root[data-motion="reduced"] .card .kcl-frame::after,
:root[data-calm="on"] .card .kcl-frame::after,
:root[data-day-matters] .card .kcl-frame::after,
:root[data-theme="high_contrast"] .card .kcl-frame::after { animation: none; opacity: .5; transform: none; }
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="full"]) .card .kcl-frame::after { animation: none; opacity: .5; transform: none; }
}
/* High contrast: a solid black edge and padlock on white; the colour stays only as a thin inner edge. */
:root[data-theme="high_contrast"] .card .kcl-frame { background: #FFFFFF; box-shadow: 0 0 0 3px #000000, inset 0 0 0 3px var(--kcl-c); }
:root[data-theme="high_contrast"] .card .kcl-frame::after { display: none; }
:root[data-theme="high_contrast"] .card .kcl-pad { background: #FFFFFF; color: #000000; box-shadow: 0 0 0 2px #000000; }
:root[data-theme="high_contrast"] .card .kcl-pad .kcl-pad-hole { fill: #FFFFFF; }
@media (forced-colors: active) {
  .card .kcl-frame { border: 3px solid CanvasText; box-shadow: none; }
  .card .kcl-frame::after { display: none; }
  .card .kcl-pad { border: 2px solid CanvasText; box-shadow: none; }
}
/* Phone width: the column is the desk's 40 px again, the critter 36 px. */
@media (max-width: 599px) {
  :root:not([data-quiet="on"]) .card.kcl-on { grid-template-columns: 44px minmax(0,1fr); }
  .card > .kcl-lock { width: 44px; height: 44px; }
  .card .kcl-frame { width: 40px; height: 40px; box-shadow: 0 0 0 2px var(--kcl-c), 0 0 10px 2px var(--kcl-c); }
  .card .kcl-frame > .av.kcl-av { width: 34px; height: 34px; font-size: .8125rem; }
  .card .kcl-pad { width: 18px; height: 18px; }
  .card .kcl-pad .kcl-pad-i { width: 11px; height: 11px; }
}
@media print { .card > .kcl-lock { display: none; } }

/* ---------- the slim sending card ---------- */
:root[data-v21-core="on"] .card.kcl-slim {
  width: 100%; max-width: 28rem; min-height: 0; grid-template-columns: minmax(0,1fr); gap: 6px;
  padding: 12px 16px 18px;
}
:root[data-v21-core="on"] .card.kcl-slim > .glyph,
:root[data-v21-core="on"] .card.kcl-slim > .side,
:root[data-v21-core="on"] .card.kcl-slim > .kcl-lock,
:root[data-v21-core="on"] .card.kcl-slim .l2,
:root[data-v21-core="on"] .card.kcl-slim .tags,
:root[data-v21-core="on"] .card.kcl-slim .v21-bonus-chip { display: none; }
:root[data-v21-core="on"] .card.kcl-slim .l1 { font-size: .9375rem; line-height: 1.375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* The chip sits under the title, never over it; the buttons and the line under the chip. */
:root[data-v21-core="on"] .card.kcl-slim > .holder {
  position: relative; right: auto; top: auto; transform: none; justify-self: start; max-width: 100%;
  grid-column: 1; flex-wrap: wrap; row-gap: 2px;
}
:root[data-v21-core="on"] .card.kcl-slim > .holder > span:not(.av):not(.amb) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root[data-v21-core="on"] .card.kcl-slim > .v21-ctl { grid-column: 1; margin: 0; }
:root[data-v21-core="on"] .card.kcl-slim > .v21-drain { left: 12px; right: 12px; }
@media (min-width: 600px) {
  :root[data-v21-core="on"] .card.kcl-slim.v21-own .holder { top: auto; transform: none; }
}
@media (max-width: 599px) {
  :root[data-v21-core="on"] .card.kcl-slim { max-width: 85%; }
}
@media (forced-colors: active) { :root[data-v21-core="on"] .card.kcl-slim { border: 1px dashed CanvasText; } }
