/* ── Card art: base primitives ────────────────────────────────────────────
   Split out of gameArt.css so a consumer that only needs one game's icon
   (the offline hub — see docs/offline-mode-plan.md) can import this plus that
   one game's own /shared/games/<id>/cardArt.css, instead of pulling in every
   game's art through gameArt.css's full @import chain. gameArt.css itself
   still imports this file, so nothing else changes. See gameArt.js for the
   coordinate contract and design rules. */

.game-art {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  container: ga-art / size;
  pointer-events: none;
}
.game-art * { box-sizing: border-box; }

.ga-stage {
  position: relative;
  display: block;
  width: 100cqmin;
  height: 100cqmin;
  container: ga-stage / size;
}
/* ── Shared primitives ────────────────────────────────────────────────────
   Two vocabularies that several games share: a 3x3 board of tiles, and a
   "trace" link — one rounded bar drawn from a point at an angle, which is
   how every dragged path in this app is illustrated. Geometry per link is
   four custom properties, set per game below. */

/* 3x3 grid anchor points: columns a/b/c, rows 1/2/3, centers at 25/50/75. */
.ga-a1 { --x: 25%; --y: 25%; } .ga-b1 { --x: 50%; --y: 25%; } .ga-c1 { --x: 75%; --y: 25%; }
.ga-a2 { --x: 25%; --y: 50%; } .ga-b2 { --x: 50%; --y: 50%; } .ga-c2 { --x: 75%; --y: 50%; }
.ga-a3 { --x: 25%; --y: 75%; } .ga-b3 { --x: 50%; --y: 75%; } .ga-c3 { --x: 75%; --y: 75%; }

.ga-cell {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 20%;
  height: 20%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border-radius: 26%;
  background: var(--surface);
  /* Stronger than the app's own tile border: these sit on a tinted card
     header, and a hairline neutral disappears into it at thumbnail size. */
  border: max(1px, 2cqmin) solid color-mix(in srgb, var(--muted) 45%, var(--border));
  color: var(--text);
  font-family: inherit;
  font-style: normal;
  font-weight: 800;
  font-size: 10cqmin;
  line-height: 1;
  z-index: 2;
}

.ga-link {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--len);
  height: 9%;
  transform-origin: 0 50%;
  transform: translateY(-50%) rotate(var(--rot, 0deg));
  border-radius: 999px;
  background: var(--ga-trace, var(--muted));
  z-index: 1;
}

/* A free-floating pill: the word/clue-chip vocabulary for games that deal
   loose words instead of a letter board (Crosswire, Common Word). Unlike
   .ga-cell, position AND size are per-instance (--x/--y/--w/--h) so a design
   can lay out chips that aren't on the shared 3x3 grid. */
.ga-chip {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  height: var(--h);
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: var(--surface);
  border: max(1px, 2cqmin) solid color-mix(in srgb, var(--muted) 45%, var(--border));
  z-index: 2;
}

/* Detail tier. Below ~100px the icon has to survive on silhouette alone:
   letters become 3-4px of mud, and untouched board tiles turn a clear
   traced path into a cluster of same-sized blobs. Both step back, so what
   is left at thumbnail size is exactly the shape of the play. The 100px
   line is deliberate — the party-pool tile's stage lands at ~104px and
   still has the room to print letters. */
@container ga-stage (max-width: 100px) {
  .ga-cell { font-size: 0; }
  .ga-cell.ga-off { opacity: .3; }
}

/* ── Thumbnail frame ──────────────────────────────────────────────────────
   The Daily and Levels hub cards show the art as a small framed chip rather
   than a bleed illustration — a tinted ground in the game's own accent, so
   a list of cards reads as a row of distinct game marks. Surfaces set
   --tile-accent themselves (both hubs do, from accentFor()). */
.game-art--thumb {
  flex: 0 0 auto;
  width: 76px;
  height: 76px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--tile-accent, var(--muted)) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--tile-accent, var(--border)) 32%, var(--border));
  padding: 6px;
  overflow: hidden;
}
/* Not-yet-drawn art: a dashed empty chip holding the slot open, so every
   card in the list still starts its title at the same x. */
.game-art--pending {
  background: transparent;
  border-style: dashed;
  border-color: color-mix(in srgb, var(--tile-accent, var(--border)) 40%, var(--border));
}
