/* ============================================================================
   Tharsol Connect: tinted brand marks (user, 21 Oct 2026: "icons in the accent colour, tinted"). The house rule for
   anything small and coloured: a tint fill, the saturated colour for the ink and a 1px border of it, never a solid fill.

   Loaded on every Connect page (Components/App.razor) and on the ticket screens' own host page
   (Components/Tickets/TicketsHost.razor), after css/accents.css. Only --tms-accent is read, so the marks follow the
   person's accent (or the admins' default, or the built-in Blue) in both looks, light and dark.
   ========================================================================== */

/* ---- the Tharsol Connect app logo (title bar, sign-in page, client home, boot splashes) -----------------------------
   A tile of the accent's tint, a 1px border of the accent and the mark (img/tharsol-connect-mark.svg, used as a mask)
   in the saturated accent. --tc-logo-under is what the tint is mixed into: transparent where the tile sits on the
   page, the surface where it sits on something coloured (the sign-in page's accent panel), so it stays a light tile in
   light mode and a dark one in dark mode. Size it with width/height; the mark scales with it. */
.tc-logo {
    --tc-logo-ink: var(--tms-accent, #1560D4);
    --tc-logo-under: transparent;
    position: relative;
    display: block;
    flex: none;
    box-sizing: border-box;
    width: 32px;
    height: 32px;
    border-radius: 25%;
    background: color-mix(in srgb, var(--tc-logo-ink) 14%, var(--tc-logo-under));
    border: 1px solid color-mix(in srgb, var(--tc-logo-ink) 45%, transparent);
}

    .tc-logo::after {
        content: "";
        position: absolute;
        inset: 1px;
        background: var(--tc-logo-ink);
        -webkit-mask: url("../img/tharsol-connect-mark.svg") center / contain no-repeat;
        mask: url("../img/tharsol-connect-mark.svg") center / contain no-repeat;
    }

:root[data-theme="dark"] .tc-logo {
    background: color-mix(in srgb, var(--tc-logo-ink) 18%, var(--tc-logo-under));
    border-color: color-mix(in srgb, var(--tc-logo-ink) 50%, transparent);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .tc-logo {
        background: color-mix(in srgb, var(--tc-logo-ink) 18%, var(--tc-logo-under));
        border-color: color-mix(in srgb, var(--tc-logo-ink) 50%, transparent);
    }
}

/* ---- initials avatars (mail, chat, people, pickers, the account menu, ticket screens) ------------------------------
   Every generated initials avatar: the person's own colour (stable per name / address) as a wash, a 1px border of it
   and the initials in a shade of it that reads on the wash. The shades come from the server (Core AvatarTint.Style:
   --c, --av-l, --av-d, contrast-checked); components set only size and shape. A real photo (an <img> inside) shows
   as it is, with no wash or border; Connect Robot keeps its own picture on its solid blue. The ticket screens' avatars
   (.tms-av, t/css/tms-base.css: six colours, their shades set there) are drawn the same way; a chat photo there is a
   background image (tms-chat.js), so only background-color is set here. */
.tint-av,
.tms-av {
    --av-ink: var(--av-l, var(--c, #64748B));
    --av-wash: var(--c, #64748B);
    box-sizing: border-box;
    background-color: color-mix(in srgb, var(--av-wash) 16%, transparent);
    color: var(--av-ink);
    border: 1px solid color-mix(in srgb, var(--av-wash) 45%, transparent);
}

:root[data-theme="dark"] :is(.tint-av, .tms-av) {
    --av-ink: var(--av-d, var(--c, #94A3B8));
    --av-wash: var(--av-d, var(--c, #94A3B8));
    background-color: color-mix(in srgb, var(--av-wash) 18%, transparent);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) :is(.tint-av, .tms-av) {
        --av-ink: var(--av-d, var(--c, #94A3B8));
        --av-wash: var(--av-d, var(--c, #94A3B8));
        background-color: color-mix(in srgb, var(--av-wash) 18%, transparent);
    }
}

/* (":root:is(...)" lifts these over the dark-mode rules above.) */
:root:is([data-theme], :not([data-theme])) .tint-av:has(> img) {
    background-color: transparent;
    border-color: transparent;
}

:root:is([data-theme], :not([data-theme])) .tint-av:has(> svg.robot) {
    background-color: var(--c);
    border-color: transparent;
}

:root:is([data-theme], :not([data-theme])) .tms-av[style*="background-image"] {
    border-color: transparent;
}
