/* Card frame: design G "Corner + Tuck Foot" (Silas approved, board #172 msg 382).
   Needs web/theme.css (tokens), web/assets/ui/kit.css (.ui-icon, [data-el] → --m --k --l --on)
   and web/assets/ui/icons.css (the ui-i-* icon classes).
   Markup, slots and layer order: art/frames/README.md. Layers: bun art/frames/gen-frames.mjs.
   Card box = 10 x 14 em; 1 em = card width / 10 (set --w on the card). */

.uc {
  --w: 200px;
  position: relative; flex: none; box-sizing: border-box;
  width: var(--w); height: calc(var(--w) * var(--card-ratio));
  font-size: calc(var(--w) / 10);
  border-radius: calc(var(--w) * var(--card-corner));
  overflow: hidden; isolation: isolate;
  background: var(--l);
  color: var(--ink);
  box-shadow: 0 0 0 var(--card-keyline) var(--edge), var(--card-drop);
  transform: translateY(var(--lift, 0)) rotate(var(--r, 0deg)) scale(var(--zoom, 1));
  transition: transform var(--dur-med) var(--ease-pop), box-shadow var(--dur-med) var(--ease-out);
}
.uc * { box-sizing: border-box; }
.uc b { font-weight: 700; font-family: var(--font-number); }

/* ---- Layer 1: art, full bleed ---- */
.uc-art { position: absolute; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 46%; }
/* Per-art crop. Art is square, so on the 1 : 1.4 card only x moves. Keyed on the image path: no markup needed. */
.uc-art[src$="/ice_glacieryak.webp"]     { object-position: 40% 46%; } /* left horn clear of the coin */
.uc-art[src$="/leaf-evolved.webp"]       { object-position: 40% 46%; } /* left antler clear of the coins */
/* Art quality pass (backlog #8): evolved heroes stand with the head high on the right; centre the face.
   Only x matters: the square art fills the card's height, so y has no effect. */
.uc-art[src$="/fire-evolved.webp"]       { object-position: 60% 46%; }
.uc-art[src$="/ice-evolved.webp"]        { object-position: 70% 46%; }
.uc-art[src$="/water-evolved.webp"]      { object-position: 68% 46%; }
.uc-art[src$="/rock-evolved.webp"]       { object-position: 62% 46%; }
.uc-art[src$="/fire_magmamole.webp"]     { object-position: 58% 46%; } /* right claws back on the card */

/* ---- Layers 2 + 3: name scrim, then the tuck foot (one SVG per element; gold on the evolved hero) ---- */
.uc::before {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  --uc-scrim: linear-gradient(rgba(21, 14, 34, 0), rgba(21, 14, 34, 0.5));
  background-image: none, var(--uc-scrim); /* first image = the element's foot, set per element below */
  background-size: 100% 100%, 100% 22%;
  background-position: 0 0, 0 calc(100% - 1.8em);
  background-repeat: no-repeat;
}
/* ---- Layer 4: inner element rim (gold, a touch thicker, on the evolved hero) ---- */
.uc::after {
  content: ""; position: absolute; inset: 0; z-index: 3; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 calc(var(--w) * var(--card-rim)) var(--m);
}
.uc.is-evolved::after { box-shadow: inset 0 0 0 calc(var(--w) * 0.024) var(--gold); }

/* Element layers. url() stays out of custom properties: browsers disagree on what it is relative to. */
.uc[data-el="fire"]::before    { background-image: url("foot-fire.svg"), var(--uc-scrim); }
.uc[data-el="ice"]::before     { background-image: url("foot-ice.svg"), var(--uc-scrim); }
.uc[data-el="leaf"]::before    { background-image: url("foot-leaf.svg"), var(--uc-scrim); }
.uc[data-el="electric"]::before{ background-image: url("foot-electric.svg"), var(--uc-scrim); }
.uc[data-el="water"]::before   { background-image: url("foot-water.svg"), var(--uc-scrim); }
.uc[data-el="rock"]::before    { background-image: url("foot-rock.svg"), var(--uc-scrim); }
.uc.is-evolved[data-el="fire"]::before    { background-image: url("foot-fire-evolved.svg"), var(--uc-scrim); }
.uc.is-evolved[data-el="ice"]::before     { background-image: url("foot-ice-evolved.svg"), var(--uc-scrim); }
.uc.is-evolved[data-el="leaf"]::before    { background-image: url("foot-leaf-evolved.svg"), var(--uc-scrim); }
.uc.is-evolved[data-el="electric"]::before{ background-image: url("foot-electric-evolved.svg"), var(--uc-scrim); }
.uc.is-evolved[data-el="water"]::before   { background-image: url("foot-water-evolved.svg"), var(--uc-scrim); }
.uc.is-evolved[data-el="rock"]::before    { background-image: url("foot-rock-evolved.svg"), var(--uc-scrim); }
.uc[data-el="fire"] .uc-ix    { background-image: url("index-fire.svg"); }
.uc[data-el="ice"] .uc-ix     { background-image: url("index-ice.svg"); }
.uc[data-el="leaf"] .uc-ix    { background-image: url("index-leaf.svg"); }
.uc[data-el="electric"] .uc-ix{ background-image: url("index-electric.svg"); }
.uc[data-el="water"] .uc-ix   { background-image: url("index-water.svg"); }
.uc[data-el="rock"] .uc-ix    { background-image: url("index-rock.svg"); }
.uc.is-evolved .uc-ix { background-image: url("index-star.svg"); }

/* ---- Layer 5: marks ---- */
/* Index: Blast number inside the element's shape (top-left). Hero: evolve icon. Evolved hero: Super push on a gold star. */
.uc-ix {
  position: absolute; z-index: 4; left: 0.35em; top: 0.35em; width: 3em; height: 3em;
  display: grid; place-items: center;
  background: center / 108% 108% no-repeat; /* image per element below; layer viewBox has 4% bleed for the outline */
}
.uc-ix b { font-size: 1.95em; line-height: 1; margin-top: 0.1em; color: var(--surface); -webkit-text-stroke: 0.06em var(--edge); paint-order: stroke fill; }
.uc-ix .ui-icon { font-size: 1.4em; margin-top: 0.1em; color: var(--surface); }
.uc.is-evolved .uc-ix b { color: var(--ink); -webkit-text-stroke: 0; margin-top: 0; }
.uc.is-evolved .uc-ix .ui-icon { color: var(--ink); }

/* Blast effects: small cream coins tucked under the index. Evolved hero: gold Super Move coin first. */
.uc-fx { position: absolute; z-index: 5; left: 2.45em; top: 2.35em; display: flex; gap: 0.18em; }
.uc-fx-i { position: relative; display: grid; place-items: center; width: 1.35em; height: 1.35em; border-radius: 50%;
  background: var(--surface); color: var(--ink); box-shadow: 0 0 0 0.1em var(--edge); }
.uc-fx-i .ui-icon { font-size: 0.85em; }
.uc-fx-i.is-gold { background: var(--gold); }
.uc-fx-i sub { position: absolute; right: -0.1em; bottom: -0.15em; font: 700 0.5em/1 var(--font-number);
  background: var(--surface); color: var(--ink); border-radius: 1em; padding: 0.12em 0.32em; box-shadow: 0 0 0 0.12em var(--edge); }

/* What it beats: push arrow + the two element marks, tiny and pale, top-right. Creatures only. */
.uc-bt { position: absolute; z-index: 4; right: 0.55em; top: 0.45em; display: inline-flex; align-items: center; gap: 0.08em;
  font-size: 0.62em; opacity: 0.8; color: #fff; filter: drop-shadow(0 0 0.12em rgba(21, 14, 34, 0.9)); }
.uc-bt .ui-icon:first-child { font-size: 0.8em; opacity: 0.8; }

/* Name: over the art, just above the foot. */
.uc-nm { position: absolute; z-index: 4; left: 0.6em; bottom: 2.75em; max-width: 8.6em;
  font: 700 0.82em/1 var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: #fff; text-shadow: 0 0.06em 0.2em rgba(21, 14, 34, 0.8); }

/* Tuck strip: the Boost, alone, centered on the foot. The only thing a card tucked under the hero shows. */
.uc-st { position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; height: 2em; padding-top: 0.15em;
  display: flex; align-items: center; justify-content: center; gap: 0.16em; color: var(--on); }
.uc-st .uc-ring { font-size: 1.15em; margin-right: 0.12em; }
.uc-st .uc-pow { font-size: 1.35em; }
.uc-st b { font-size: 1.3em; line-height: 1; }
.uc.is-evolved .uc-st { color: var(--ink); }

/* Evolve pips (hero, normal side): lit = Boosts of the hero's element so far. */
.uc-pip { display: grid; place-items: center; width: 1.25em; height: 1.25em; border-radius: 50%;
  background: rgba(21, 14, 34, 0.18); box-shadow: inset 0 0 0 0.1em rgba(21, 14, 34, 0.45); }
.uc-pip .ui-icon { font-size: 0.85em; opacity: 0.35; }
.uc-pip.is-on { background: var(--l); box-shadow: 0 0 0 0.1em var(--edge); }
.uc-pip.is-on .ui-icon { opacity: 1; color: var(--k); }

/* ---- Layer 6 (screen only, never printed): live push preview, filled by the game when the card is picked ---- */
.uc-preview {
  position: absolute; z-index: 6; left: 3.3em; top: 0.55em; display: none; align-items: center; gap: 0.12em;
  height: 2.2em; padding: 0 0.5em 0 0.35em; border-radius: 1.1em;
  background: var(--spark); color: var(--ink);
  box-shadow: 0 0 0 0.14em var(--edge), 0 0 1.2em 0.3em rgba(255, 226, 122, 0.75);
}
.uc-preview .ui-icon { font-size: 1.15em; }
.uc-preview b { font-size: 1.9em; line-height: 1; }
.uc.has-preview .uc-preview { display: inline-flex; }

/* ---- States ---- */
.uc.is-selected { --lift: -0.9em; --zoom: 1.06; --r: 0deg; z-index: 3;
  box-shadow: 0 0 0 var(--card-keyline) var(--edge), 0 0 0 0.36em #fff, 0 0 2.2em 0.7em var(--m), var(--card-drop); }
/* Small (board row, tray): index, effects and Boost only. */
.uc.is-sm .uc-nm, .uc.is-sm .uc-bt { display: none; }
.uc.is-sm .uc-st { font-size: 0.8em; }

/* ---- Printed: Boosts tucked under the hero. Wrapper height = card + n x tuck. ---- */
.uc-tuck { position: relative; width: var(--w); padding-bottom: calc(var(--w) * var(--card-tuck) * var(--n, 0)); }
.uc-tuck > .uc { --w: inherit; position: absolute; left: 0; top: calc(var(--w) * var(--card-tuck) * var(--k, 1)); z-index: calc(10 - var(--k, 1)); }
.uc-tuck > .uc.is-hero { position: relative; top: 0; z-index: 10; }

/* ==== Card back: J "Title Crest" (Silas, board #606 msg 771). Same box as .uc; the webp carries its own rounded corners.
   .is-sm uses the 140 px file (rival hand, piles under 70 px wide). kit.css .ui-card-back uses the same files. ==== */
.uc-back {
  --w: 96px;
  position: relative; flex: none; display: block;
  width: var(--w); height: calc(var(--w) * var(--card-ratio));
  border-radius: calc(var(--w) * var(--card-corner));
  background: var(--arena-2) url("card-back.webp") center / 100% 100% no-repeat;
  box-shadow: 0 0 0 var(--card-keyline) var(--edge), var(--card-drop);
  transform: translateY(var(--lift, 0)) rotate(var(--r, 0deg)) scale(var(--zoom, 1));
}
.uc-back.is-sm { background-image: url("card-back-sm.webp"); }
