/* explainer.css — styling for the explainer primitive (explainer.js)
 *
 * Design intent: maximally subtle. The info dot is a muted glyph that only
 * gains presence on hover/focus; popovers and hints are quiet, never loud.
 * Reuses the theme tokens from style.css (--fg-muted, --border, --accent, …).
 */

/* ---- info dot -------------------------------------------------------------
 * A small, low-contrast "ⓘ" placed next to a label. Invisible-ish until you
 * look for it; brightens to the accent on hover/focus. */
.xpl-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.05em;
    height: 1.05em;
    margin-left: 0.3em;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--accent-soft, rgba(0, 102, 204, 0.12));
    color: var(--accent, #0066cc);
    font-size: 0.85em;
    line-height: 1;
    opacity: 0.9;
    cursor: help;
    vertical-align: middle;
    transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.xpl-info:hover,
.xpl-info:focus-visible {
    opacity: 1;
    background: var(--accent, #0066cc);
    color: #fff;
}

.xpl-info:focus-visible {
    outline: 2px solid var(--accent, #0066cc);
    outline-offset: 2px;
}

/* ---- popover (the on-demand one-liner) ---------------------------------- */
.xpl-popover {
    position: fixed;
    z-index: 1100; /* above the asset modal (style.css .asset-modal is 1000) so a dot inside a modal still explains */
    max-width: 260px;
    padding: 0.6rem 0.75rem;
    background: #fff;
    color: var(--fg, #1a1a1a);
    border: 1px solid var(--border, #e0e0e0);
    border-radius: 8px;
    box-shadow: var(--shadow-md, 0 4px 16px rgba(0, 0, 0, 0.08));
    font-size: 0.8rem;
    line-height: 1.5;
    animation: xpl-fade 0.12s ease-out;
}

.xpl-popover[hidden] {
    display: none;
}

.xpl-pop-title {
    font-weight: 600;
    font-size: 0.82rem;
    margin-bottom: 0.2rem;
    color: var(--fg, #111);
}

.xpl-pop-body {
    color: var(--fg-muted, #555);
}

@keyframes xpl-fade {
    from {
        opacity: 0;
        transform: translateY(-2px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- one-time hint badge (first-interaction nudge) ---------------------- */
.xpl-hint {
    position: fixed;
    z-index: 650;
    pointer-events: none;
    padding: 2px 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--accent, #0066cc);
    animation: xpl-bob 2.4s ease-in-out infinite;
}

@keyframes xpl-bob {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

/* ---- one-time coachmark (gentle card, used sparingly) ------------------- */
.xpl-coach {
    position: fixed;
    z-index: 660;
    right: 1.25rem;
    bottom: 1.25rem;
    max-width: 320px;
    padding: 1rem 1.1rem;
    background: #fff;
    border: 1px solid var(--border, #e0e0e0);
    border-radius: 10px;
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.1));
    animation: xpl-rise 0.25s ease-out;
}

.xpl-coach-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.35rem;
    color: var(--fg, #111);
}

.xpl-coach-body {
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--fg-muted, #555);
    margin-bottom: 0.8rem;
}

.xpl-coach-close {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid var(--accent, #0066cc);
    background: var(--accent, #0066cc);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    cursor: pointer;
}

.xpl-coach-close:hover {
    filter: brightness(1.05);
}

@keyframes xpl-rise {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Respect reduced-motion: drop the animations, keep everything legible. */
@media (prefers-reduced-motion: reduce) {
    .xpl-hint,
    .xpl-popover,
    .xpl-coach {
        animation: none;
    }
}

/* "View all terms →" link at the foot of each ⓘ popover (to /glossary). */
.xpl-pop-link {
    display: inline-block;
    margin-top: 0.55rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent, #0066cc);
    text-decoration: none;
}
.xpl-pop-link:hover { text-decoration: underline; }
