/* ==================================================================
   Glossary tooltips for Solo
   Define a word in an article; its definition appears on hover/focus.
   Loaded directly from default.hbs — not part of the Gulp build.
   ================================================================== */

/* The defined word — a soft highlight + a small "?" badge, so it reads
   clearly as "there is a definition here". */
.kdef {
    position: relative;
    cursor: help;
    /* No forced weight or style: the word keeps exactly the formatting it
       has in the editor — bold, italic, both or neither. */
    color: inherit;
    padding: 3px 7px;
    margin: 0 -2px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.06);
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
    text-decoration: none;
    transition: background-color 0.18s ease;
}
.kdef:hover,
.kdef.tip-open {
    background: rgba(0, 0, 0, 0.10);
}

/* Added by glossary.js only when the word sits in light (non-bold) text,
   so it stands out a little. Adjust the value to taste. */
.kdef-boost {
    font-weight: 450;
}

.kdef:focus-visible {
    outline: 3px solid var(--ghost-accent-color, #232323);
    outline-offset: 3px;
    border-radius: 6px;
}

/* The little "?" badge after the word */
.kdef-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5em;
    height: 1.5em;
    margin-left: 0.36em;
    border-radius: 50%;
    background: #474747;
    color: #fff;
    font-size: 0.49em;
    font-weight: 700;
    font-style: normal;
    line-height: 1;
    vertical-align: middle;
}

/* The tooltip — positioned with position:fixed; glossary.js sets top/left
   in viewport coordinates and clamps it fully on-screen, so it can never
   overflow the edge (the bug that needed a swipe to read it on mobile). */
.kdef-pop {
    position: fixed;
    top: 0;
    left: 0;
    transform: translateY(7px);
    scale: 0.96;
    transform-origin: bottom center;
    z-index: 1000;
    width: max-content;
    max-width: min(320px, calc(100vw - 24px));
    padding: 15px 18px;
    background: #232323;
    color: #fdfdfd;
    font-size: 17px;
    font-weight: 400;
    font-style: normal;
    line-height: 1.5;
    text-align: left;
    text-decoration: none;
    letter-spacing: normal;
    border-radius: 16px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16),
                0 14px 34px rgba(0, 0, 0, 0.30);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.17s ease,
                visibility 0.17s ease,
                transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1),
                scale 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}

/* Below-the-word variant (used when there isn't room above) */
.kdef-pop--below {
    transform: translateY(-7px);
    transform-origin: top center;
}

.kdef.tip-open .kdef-pop {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    scale: 1;
}

/* Light formatting allowed inside a definition */
.kdef-pop strong { font-weight: 700; }
.kdef-pop em { font-style: italic; }
.kdef-pop code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.92em;
    background: rgba(255, 255, 255, 0.14);
    padding: 0.1em 0.35em;
    border-radius: 5px;
}

@media (prefers-reduced-motion: reduce) {
    .kdef-pop {
        transition: opacity 0.12s ease, visibility 0.12s ease;
        transform: none;
        scale: 1;
    }
}
