/* Card tiles (libui.js VL.tile), used in every list of cards: homepage, library, creator pages, favourites, forks.
   Final layout (owner decision 2026-11-24, Notion "Card tile, final layout"): a full-width plum bar on top (name left,
   greeting count right), under it the picture left in 3:4 portrait and the text right; tags and stats pinned to the
   bottom. Nothing in the picture's top-right corner. Colours only from style.css tokens. */
:root {
  /* derived badge colours (follow any theme) */
  --badge-hot: color-mix(in srgb, var(--gold) 55%, var(--danger));
  --badge-new: color-mix(in srgb, var(--danger) 72%, var(--accent));
  --badge-upd: var(--gold);
}
.vt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 350px), 1fr)); gap: 14px; margin-top: 8px; }

/* --card-* / --tag-*: set only by a creator's profile design, for the tiles on their own page (STUDIO.md "Character
   cards"; src/sanitize.js CARD_VARS). Unset everywhere else, so the fallbacks are the normal look. */
.vt { position: relative; display: flex; flex-direction: column; min-width: 0; background: var(--card-bg, var(--card)); border: min(var(--card-border-width, 1px), 4px) solid var(--card-border, var(--line)); border-radius: var(--radius);
  box-shadow: var(--card-glow, var(--shadow-card)); overflow: hidden; }
.vt:hover { border-color: var(--line-strong); }

/* top bar: its own row above the picture and text (covers nothing) */
.vt-bar { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 32px; padding: 5px 11px; cursor: pointer;
  background: var(--card-bar-bg, color-mix(in srgb, var(--accent) 45%, var(--card))); border-bottom: 1px solid var(--line); }
.vt-bar .vt-name { flex: 1 1 auto; min-width: 0; }
.vt-count { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: color-mix(in srgb, var(--text) 85%, var(--bg)); }
.vt-ico { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; }
/* the small gold icon before the name: a person (character), a globe (World), an open book (lorebook); owner 2026-11-26 */
.vt-lead { display: block; flex: none; color: var(--gold); line-height: 0; }
.vt-lead .vt-lead-i { display: block; width: 16px; height: 16px; }
.vt-row { display: flex; min-width: 0; }

/* picture: 40% of the tile, always 3:4 (other shapes are cropped); its height sets the tile's height */
.vt-pic { position: relative; flex: 0 0 40%; display: block; align-self: flex-start; }
.vt-pic .card-cover { aspect-ratio: 3 / 4; border-radius: 0; }
.vt-pic .reveal-hint { font-size: 11px; padding: 5px 8px; white-space: normal; text-align: center; width: max-content; max-width: 90%; }
/* top of the picture: the HOT / NEW / UPDATED badge on the left, 18+ snapped to the right (owner 2026-11-27) */
.vt-marks { position: absolute; top: 8px; left: 8px; right: 8px; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; pointer-events: none; }
.vt-badge { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; padding: 3px 9px; border-radius: 999px;
  color: var(--on-gold); box-shadow: 0 2px 8px color-mix(in srgb, var(--scrim) 45%, transparent); pointer-events: none; }
.vt-badge.vt-b-hot { background: var(--badge-hot); }
.vt-badge.vt-b-new { background: var(--badge-new); }
.vt-badge.vt-b-updated { background: var(--badge-upd); }
/* The "World" label: only on a World's own page now (showcase.js); tiles show the globe icon instead (owner 2026-11-26) */
.vt-world { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px;
  color: var(--on-gold); background: var(--gold); box-shadow: 0 2px 8px color-mix(in srgb, var(--scrim) 45%, transparent); pointer-events: none; }
.vt-nsfw { margin-left: auto; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 6px;
  color: var(--nsfw); background: color-mix(in srgb, var(--scrim) 65%, transparent); border: 1px solid color-mix(in srgb, var(--nsfw) 50%, transparent); pointer-events: none; }
.vt-rating { position: absolute; left: 8px; bottom: 8px; z-index: 2; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  color: var(--gold); background: color-mix(in srgb, var(--scrim) 65%, transparent); white-space: nowrap; }

/* text column */
.vt-body { position: relative; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; padding: 9px 11px 8px; cursor: pointer;
  contain: size; /* the picture alone sets the tile's height; the text fits inside it */ }
.vt-name { display: block; font-weight: 700; font-size: 15px; color: var(--card-text, var(--text)); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vt-name:hover, .vt-bar:hover .vt-name, .vt:has(.vt-body:hover) .vt-name { color: var(--gold); }
.vt-by { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.vt-by a { color: var(--muted); text-decoration: none; }
.vt-by a:hover { color: var(--gold); }
/* A locked tile (logged out, NSFW): "Log in to see" where the tagline would be. */
.vt-locked { display: inline-block; margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--gold); text-decoration: none; }
.vt-locked:hover, .vt-locked:focus-visible { text-decoration: underline; }
/* A fork's credit (libui.js tile): "⑂ creator of the original", one quiet line under the creator. */
.vt-fork { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; margin-top: 2px; min-width: 0; }
.vt-fork > a { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.vt-fork .vt-fork-i { width: 12px; height: 12px; color: var(--gold); stroke-width: 1.5; }
.vt-fork a { color: var(--muted); text-decoration: none; }
.vt-fork a:hover { color: var(--gold); text-decoration: underline; }

/* the middle part gives way first, so the tags and stats always stay at the bottom */
.vt-mid { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 6px; margin: 6px 0 4px; }
.vt-tl { flex: 0 1 auto; font-size: 13px; line-height: 1.4; color: var(--card-text, color-mix(in srgb, var(--text) 85%, var(--bg))); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; border-radius: 4px; -webkit-touch-callout: none; }
.vt-tl:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.vt-whatsnew { flex: none; font-size: 12px; line-height: 1.35; padding: 3px 8px; border-left: 3px solid var(--gold); border-radius: 0 6px 6px 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 28%, var(--card)), color-mix(in srgb, var(--gold) 10%, var(--card)));
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.vt-whatsnew b { color: var(--gold); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; margin-right: 6px; }
/* with a What's new box the tagline keeps 2 whole lines (the full text is still one hover away) */
.vt-mid:has(.vt-whatsnew) .vt-tl { -webkit-line-clamp: 2; flex: none; }

.vt-bottom { flex: none; }
.vt-tags { display: flex; gap: 4px; overflow: hidden; white-space: nowrap; margin: 0 0 6px;
  mask-image: linear-gradient(90deg, #000 85%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); }
.vt-tags:empty { display: none; }
.vt-tag { flex: none; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; color: var(--tag-text, var(--text)); text-decoration: none;
  background: var(--tag-bg, color-mix(in srgb, var(--accent) 35%, var(--panel))); border: 1px solid var(--tag-border, var(--line)); }
.vt-tag:hover, .vt-tag:focus-visible { border-color: var(--gold); color: var(--gold); outline: none; }
.vt-tag.on { border-color: var(--gold-soft); color: var(--gold); }
.vt-tag.on::before { content: "✓ "; font-size: 10px; }
.vt-stats { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 6px; }
.vt-stats .vt-msgs { margin-left: auto; color: var(--gold); }

/* full tagline: covers the tile's own text column only, darker, scrolls; never leaves the tile. It starts under the
   "@creator · 1h" line (libui.js wireTagline sets its top when it opens), so the creator link stays clickable (owner 2026-12-03).
   It belongs to the tagline wrapper (.vt-tlw, no box of its own), so hovering the panel keeps it open and leaving it closes it.
   No delay either way, only a very short fade (owner decision 2026-11-24); hidden = not hoverable. */
.vt-tlw { display: contents; }
.vt-full { display: block; opacity: 0; visibility: hidden; transition: opacity .09s linear, visibility 0s linear .09s; position: absolute; inset: 0; z-index: 3; overflow-y: auto; overscroll-behavior: contain; padding: 10px 12px;
  background: color-mix(in srgb, var(--card) 55%, var(--scrim)); border-left: 1px solid var(--line); font-size: 13.5px; line-height: 1.45;
  white-space: pre-line; overflow-wrap: anywhere; -webkit-touch-callout: none; }
.vt-full-h { color: var(--gold); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 6px; white-space: normal; }
.vt-body.vt-open .vt-full { opacity: 1; visibility: visible; transition: opacity .09s linear, visibility 0s linear 0s; }

/* the small menu on a tag: browse, or follow */
.vt-menu { position: fixed; z-index: 300; min-width: 200px; max-width: calc(100vw - 16px); padding: 5px; background: var(--panel);
  border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow-pop); }
body .vt-menu .vt-menu-item { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; color: var(--text); text-decoration: none;
  background: none; border: none; font: inherit; font-size: 13px; font-weight: 400; letter-spacing: normal; cursor: pointer; }
body .vt-menu .vt-menu-item b { color: var(--gold); }
body .vt-menu .vt-menu-item:hover, body .vt-menu .vt-menu-item:focus-visible { background: color-mix(in srgb, var(--accent) 45%, transparent); outline: none; }

@media (max-width: 420px) {
  .vt-body { padding: 8px 9px 7px; }
  .vt-name { font-size: 14px; }
  .vt-stats { gap: 2px 8px; font-size: 11.5px; }
}
