/* Glossary terms inside articles. The term is underlined with a dotted line
   so readers can spot it; tooltip floats above on hover/focus/tap. */

.glossary-term {
    position: relative;
    cursor: help;
    color: inherit;
    background-image: linear-gradient(120deg, rgba(13, 94, 175, 0.18), rgba(13, 94, 175, 0.18));
    background-repeat: no-repeat;
    background-position: 0 100%;
    background-size: 100% 0.18em;
    border-bottom: 1px dotted rgba(13, 94, 175, 0.7);
    transition: background-size 0.18s ease, color 0.18s ease;
    outline: none;
}

.glossary-term:hover,
.glossary-term:focus-visible {
    background-size: 100% 100%;
    color: #0d5eaf;
}

.glossary-term:focus-visible {
    box-shadow: 0 0 0 2px rgba(13, 94, 175, 0.35);
    border-radius: 3px;
}

.glossary-tooltip {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 9999;
    max-width: 320px;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(20, 24, 36, 0.96);
    color: #fff;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28), 0 2px 8px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.glossary-tooltip.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.glossary-tooltip__term {
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #82b6ff;
    margin-bottom: 4px;
}

.glossary-tooltip__definition {
    color: rgba(255, 255, 255, 0.92);
}

/* Pointer arrow */
.glossary-tooltip::after {
    content: '';
    position: absolute;
    left: var(--glossary-arrow-x, 50%);
    width: 10px;
    height: 10px;
    background: rgba(20, 24, 36, 0.96);
    transform: translateX(-50%) rotate(45deg);
}

.glossary-tooltip[data-placement='top']::after {
    bottom: -5px;
}

.glossary-tooltip[data-placement='bottom']::after {
    top: -5px;
}

@media (max-width: 560px) {
    .glossary-tooltip {
        max-width: calc(100vw - 32px);
        font-size: 13px;
    }
}
