/* ===========================================
   Hover card — one floating surface (static/js/hovercard.js) shared by user
   profile previews and status-icon explanations. Positioned by JS with
   position:fixed so table scrollers / overflow ancestors can't clip it.
   =========================================== */
.hovercard {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1300;
    max-width: min(340px, calc(100vw - 16px));
    padding: 12px 14px;
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-popover);
    font-size: 0.8rem;
    line-height: 1.45;
    opacity: 0;
    transform: translateY(4px) scale(0.98);
    transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
    pointer-events: none;
}
.hovercard.open { opacity: 1; transform: none; pointer-events: auto; }
.hovercard[data-placement="top"] { transform-origin: bottom center; }
.hovercard--wide { width: 340px; }

/* Passive hover tip ([data-hovertip]) — same surface, smaller, never interactive,
   stacked above an open hover card (it explains icons inside one). */
.hovertip {
    z-index: 1310;
    max-width: min(260px, calc(100vw - 16px));
    padding: 8px 10px;
    font-size: 0.75rem;
}
.hovertip.open { pointer-events: none; }
.hovertip .hc-status-glyph { width: 22px; height: 22px; }
.hovertip .hc-status-glyph svg { width: 15px; height: 15px; }
[data-hovertip] { cursor: help; }

/* Status explanation */
.hc-status-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.hc-status-head strong { color: var(--tone-bold, var(--text-primary)); font-size: 0.85rem; }
.hc-status-glyph {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: var(--r-sm);
    background: var(--tone-ghost, var(--surface-alt)); color: var(--tone, var(--text-secondary));
}
.hc-status-glyph svg { width: 18px; height: 18px; stroke-width: 2; }
.hc-status p { margin: 0; color: var(--text-secondary); }
.hc-rows {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 12px;
    margin: 8px 0 0;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
}
.hc-rows dt { color: var(--text-muted); }
.hc-rows dd { margin: 0; color: var(--text-primary); font-weight: 500; }

/* Loading: three dots rising in turn (inline SVG, theme colour). */
.hc-loading { display: flex; align-items: center; gap: 10px; color: var(--text-muted); min-width: 160px; }
.hc-loading svg { width: 36px; height: 12px; color: var(--c-special); }
.hc-loading circle { animation: hc-dot 1s var(--ease-out) infinite; }
.hc-loading circle:nth-child(2) { animation-delay: 0.15s; }
.hc-loading circle:nth-child(3) { animation-delay: 0.3s; }
@keyframes hc-dot { 0%, 80%, 100% { transform: translateY(0); opacity: 0.35; } 40% { transform: translateY(-3px); opacity: 1; } }
.hc-loading .hc-loading-text { display: none; }
@media (prefers-reduced-motion: reduce) {
    .hovercard { transition: none; }
    .hc-loading svg { display: none; }
    .hc-loading .hc-loading-text { display: inline; }
}
.hc-error { color: var(--text-muted); }

/* -------------------------------------------
   User profile preview (partials/_user_card.html)
   ------------------------------------------- */
.hovercard .user-card { display: grid; gap: 10px; }
.user-card-head { display: flex; align-items: center; gap: 10px; }
.user-card-avatar {
    width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
    object-fit: cover; display: flex; align-items: center; justify-content: center;
    background: var(--surface-alt); color: var(--text-secondary); font-weight: 600;
}
.user-card-who { min-width: 0; display: grid; gap: 3px; }
.user-card-name {
    font-size: 0.95rem; font-weight: 600; color: var(--text-highlighted); text-decoration: none;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-card-name:hover { color: var(--c-secondary); }
.user-card-avatar-link { display: flex; flex-shrink: 0; border-radius: 50%; }
.user-card-avatar-link:hover { box-shadow: 0 0 0 2px var(--c-secondary); }
.user-card-flags { margin-left: auto; align-self: flex-start; }
.user-card-restriction { display: flex; align-items: center; padding: 6px 8px; border-radius: 8px; background: var(--c-warning-ghost); }
.user-card .user-dates { margin: 0; }
.user-card-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin: 0;
}
.user-card-stats > div {
    padding: 6px 8px;
    border-radius: var(--r-sm);
    background: var(--surface-alt);
}
.user-card-stats dt { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.user-card-stats dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-primary); }
/* Toned stats: grey by default (tone-neutral), warning / danger when the number is a concern. */
.user-card-stats dd.tone-text { color: var(--tone-bold); }
.user-card-stats small { font-weight: 500; opacity: 0.8; }
.user-card-messages {
    list-style: none; margin: 0; padding: 8px 0 0;
    border-top: 1px solid var(--border-light);
    display: grid; gap: 6px;
}
.user-card-msg-meta { display: flex; align-items: center; gap: 6px; font-size: 0.7rem; color: var(--text-muted); }
.user-card-msg-text { display: block; color: var(--text-secondary); overflow-wrap: anywhere; }
/* Equal-width action grid: Open profile + one button per platform line up as
   halves (1 platform), thirds (2) or rows of three (3+), whatever the count. */
.user-card-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    gap: 6px;
}
.user-card-actions .btn {
    justify-content: center;
    gap: 6px;
    min-width: 0;
    white-space: nowrap;
}
/* Identity chips that link to the platform profile. */
.identity-chip-link { text-decoration: none; border-radius: var(--r-sm); }
.identity-chip-link:hover { color: var(--text-primary); text-decoration: underline; text-underline-offset: 2px; }
