/* The chat's inbox part (round 3, package C7: docs/CHAT_ROUND3_SPEC.md 5.7). The list of chats
   as an inbox: a 64 px row a chat, one state mark at the right, Mute and Delete behind a swipe
   (or the More button with a mouse). Loaded after chats.css, so it wins without editing it. */

/* the old "Studio assistant" row: the studio's own row in the list is that chat now */
.ch-side:has(#chList[data-inbox="on"]) .ch-assist { display: none; }

#chList[data-inbox="on"] { gap: 2px; }
#chList .ib-row { position: relative; overflow: hidden; border-radius: 12px; isolation: isolate; gap: 0; }
#chList .ib-row[hidden] { display: none; }

#chList .ib-item {
  position: relative; z-index: 1; min-height: 64px; height: 64px; gap: 12px; padding: 0 10px;
  background: var(--bg-2); touch-action: pan-y; -webkit-tap-highlight-color: transparent;
  transition: transform .2s ease, background-color .12s ease;
}
#chList .ib-item:hover { background: var(--panel); }
#chList .ib-item.on { background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-strong); }
#chList .ib-item:focus-visible { outline: none; box-shadow: var(--focus-ring, 0 0 0 2px var(--primary)); }

/* the picture: a film's poster, a reel's still in its own shape, the studio's spark */
#chList .ib-pic { width: 40px; height: 40px; border-radius: 10px; flex: none; }
#chList .ib-pic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#chList .ib-studio { background: var(--accent-soft); color: var(--primary); }
#chList .ib-studio svg { fill: currentColor; stroke: none; }
#chList .ib-reelpic { background: var(--raised); }
#chList .ib-shape { display: block; overflow: hidden; border-radius: 4px; }
#chList .ib-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }

#chList .ib-it { flex: 1 1 auto; min-width: 0; gap: 3px; }
#chList .ib-name { font-size: 16px; font-weight: 600; line-height: 1.25; color: var(--ink); }
#chList .ib-line { font-size: 14px; line-height: 1.3; color: var(--muted); }
#chList .ib-it :is(b, small) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* the one state mark */
#chList .ib-mark { flex: none; margin-left: 8px; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
#chList .ib-needs { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--primary-2, var(--primary)); color: #fff; font-size: 13px; font-weight: 700; }
#chList .ib-lapsing { height: 22px; padding: 0 7px; border-radius: 11px; background: var(--warn); color: var(--bg); font-size: 13px; font-weight: 700; }
#chList .ib-making { width: 24px; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--primary) 22%, transparent); overflow: hidden; position: relative; }
#chList .ib-making i { position: absolute; inset: 0 auto 0 0; width: 45%; border-radius: 2px; background: var(--primary); animation: ib-run 1.1s ease-in-out infinite; }
#chList .ib-ready { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
#chList .ib-paused { font-size: 13px; font-weight: 600; color: var(--muted); }
@keyframes ib-run { 0% { transform: translateX(-100%); } 100% { transform: translateX(230%); } }

/* a muted chat: grey, last, and never on the badge */
#chList .ib-muted .ib-mark { filter: grayscale(1); opacity: .7; }
#chList .ib-muted .ib-needs, #chList .ib-muted .ib-lapsing { background: var(--raised); color: var(--muted); }
#chList .ib-muted .ib-ready, #chList .ib-muted .ib-making i { background: var(--faint); }
#chList .ib-muted .ib-making { background: var(--line-strong); }

/* what a screen reader hears after the name and the line */
#chList .ib-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* Mute and Delete, behind the row: a swipe left reveals them (5.7) */
#chList .ib-acts { position: absolute; inset: 0 0 0 auto; height: 100%; min-height: 0; max-height: none; z-index: 0; display: flex; flex-wrap: nowrap; gap: 0; visibility: hidden; }
#chList .ib-open .ib-acts { visibility: visible; }
#chList .ib-act { flex: 0 0 72px; width: 72px; min-width: 72px; height: 100%; min-height: 44px; margin: 0; padding: 0 6px; border-radius: 0;
  border: 0; font-size: 14px; font-weight: 600; white-space: nowrap; }
#chList .ib-mute { background: var(--raised); color: var(--ink); }
#chList .ib-del { background: var(--bg-2); color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
#chList .ib-act:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--primary); }
#chList .ib-del:focus-visible { box-shadow: inset 0 0 0 1px var(--bad), inset 0 0 0 3px var(--primary); }

/* with a mouse: a 44 px More button on the row's hover and focus */
#chList .ib-more { position: absolute; z-index: 2; right: 6px; top: 10px; width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; margin: 0; border: 0;
  border-radius: 10px; display: grid; place-items: center; background: var(--panel); color: var(--muted); opacity: 0;
  transition: transform .2s ease, opacity .12s ease; }
#chList .ib-more svg { width: 18px; height: 18px; fill: currentColor; }
#chList .ib-row:hover .ib-more, #chList .ib-row:focus-within .ib-more, #chList .ib-open .ib-more { opacity: 1; }
#chList .ib-more:hover { color: var(--ink); background: var(--panel); }
#chList .ib-more:focus-visible { outline: none; opacity: 1; box-shadow: inset 0 0 0 2px var(--primary); }
/* a finger swipes instead: the More button is kept for a keyboard and a screen reader only */
@media (hover: none) {
  #chList .ib-more:not(:focus-visible) { position: absolute; right: 0; top: 0; width: 1px; min-width: 1px; height: 1px; min-height: 0; overflow: hidden; clip-path: inset(50%); opacity: 0; }
  #chList .ib-open .ib-more:not(:focus-visible) { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  #chList .ib-item, #chList .ib-more { transition: none; }
  #chList .ib-making i { animation: none; width: 100%; }
}
