/* batch5-integration — fixes found by the integrated full-app check (qa/nav/batch5-integrated-live.mjs) on the merged
   batch-5 branch. Loaded last. Contrast values are measured (WCAG 4.5:1 text, 3:1 large text). */

/* ── Chats notes strip: white initials on the person's colour / the accent gradient (2.8–4.3:1) → one step deeper. */
body #messagesPage .chats-avatar { background: color-mix(in srgb, var(--avatar-color, #7c5ce6) 78%, #000); }
body #messagesPage .chats-self .chats-avatar { background: linear-gradient(135deg, color-mix(in srgb, var(--accent-primary, #8b5cf6) 78%, #000), color-mix(in srgb, var(--accent-light, #a78bfa) 62%, #000)); }

/* ── Chats (a light page in both site themes) ───────────────────────────────────────────────────────────────── */
body #messagesPage { --chat-muted: #5f5c78; }   /* previews, times, the People tab (2.7–3.2:1) */
body #messagesPage :is(.chat-pinned-count, .chats-gif-btn, #chatsInboxTab span, .chats-call-soon small) { color: #6d3fd6; }
body .link-preview .link-preview-platform { color: #6d3fd6; }
body #messagesPage .mine .dm-bubble { background: color-mix(in srgb, var(--accent-primary, #8b5cf6) 84%, #000); }   /* white text 4.2:1 */
body:not(.light) .chat-attachment.is-unavailable .chat-attachment-status { color: #c4b5fd; }

/* ── Spaces: accent initials on the purple person cards (3.2–3.7:1) and the light "Leave Space" red. ──────── */
body:not(.light) .ms-avatar { color: #d8ccff; }
body.light .ms-avatar { color: #5b2fc9; }
body.light .ms-danger-row span { color: #b91c1c; }
body.light .ms-danger-row small { color: #5f5878; }

/* ── Publishing Center: "Step N of 3" on the wizard gradient, and white "Save" on the light accent. ─────────── */
.pc-step { background: rgba(0, 0, 0, 0.22) !important; }
body .genre-picker-count { background: color-mix(in srgb, var(--accent-strong, #7c3aed) 80%, #000); }
.pc-primary { background: color-mix(in srgb, var(--accent-primary, #8b5cf6) 82%, #000) !important; }
body.light .book-editor-form .vu-required { color: #c81e1e; }
body.light .book-editor-form .vu-label small { color: #5f6472 !important; }

/* ── Connections: the teal "Mutual" tag (3.2:1 light, 4.1:1 dark). ───────────────────────────────────────── */
body.light .conn-mutual { color: #0b7a6b; }
body:not(.light) .conn-mutual { color: #2dd4bf; }

/* ── Supporter Leaderboard: white place numbers on the gold / silver / bronze medals (2.1–3.0:1). ─────────── */
.sl-place, .sl-step { color: #1d1406 !important; }

/* ── Reader / feed (light): the reader's notice text and post times. ─────────────────────────────────────── */
body.light #readerContent > .loading { color: #5b5670; }
body.light .post-card .post-time, body.light .post-card .post-time span { color: #4f4a66; }
/* the composer's audience how-to: white "Next" on the light accent (4.2:1) */
.post-audience-actions :is([data-audience-save], [data-tour-next]) { background: color-mix(in srgb, var(--accent-primary, #8b5cf6) 82%, #000); }

/* ── Initials avatars, everywhere (owner: every visual defect is fixed): white letters on the accent / per-person
      fills measured 3.2–4.2:1 (post cards, Moments, chat thread + list, group tiles, Connections and follow lists).
      A 28 % shade drawn UNDER the letters (and under any photo child) keeps everyone's colour, clears 4.5:1, and
      needs no change to the fills themselves. :where() keeps the positioning rule weightless, so avatars that are
      absolutely positioned (Moments, group tiles) stay as they are. ───────────────────────────────────────────── */
:where(.avatar, .moment-card-avatar, .dm-group-tile, .dm-thread-avatar, .dm-conv-avatar:not(.dm-group-avatar), .follow-list-avatar) { position: relative; }
.avatar, .moment-card-avatar, .dm-group-tile, .dm-thread-avatar, .dm-conv-avatar:not(.dm-group-avatar), .follow-list-avatar { isolation: isolate; }
.avatar::before, .moment-card-avatar::before, .dm-group-tile::before, .dm-thread-avatar::before, .dm-conv-avatar:not(.dm-group-avatar)::before, .follow-list-avatar::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; background: rgba(0, 0, 0, 0.28); z-index: -1; pointer-events: none;
}

/* ── Composer mode row: the selected mode's label in the accent on its soft tile (3.6:1 dark, 3.7:1 light). ── */
body:not(.light) #postComposerDialog .compose-modes > button[aria-current], body:not(.light) #postComposerDialog .compose-modes > button[aria-current] span,
body:not(.light) #postComposerDialog #composeModePoll.is-ready, body:not(.light) #postComposerDialog #composeModePoll.is-ready span,
body:not(.light) #postComposerDialog .compose-poll-add { color: color-mix(in srgb, var(--accent-primary, #8b5cf6) 50%, #fff); }
body.light #postComposerDialog .compose-modes > button[aria-current], body.light #postComposerDialog .compose-modes > button[aria-current] span,
body.light #postComposerDialog #composeModePoll.is-ready, body.light #postComposerDialog #composeModePoll.is-ready span,
body.light #postComposerDialog .compose-poll-add { color: color-mix(in srgb, var(--accent-primary, #8b5cf6) 80%, #000); }

/* ── Small marks: the "sent" tick disc (4.4:1) and the Rankings rating star (1.6–1.8:1 on light). ─────────── */
.chat-send-state.is-sent { background: #55515f; }
body.light .brv-star { color: #a15c07; }
body.light #postComposerDialog .compose-count-limit { color: #3f3a52; }
