/* Glossary CSS Tooltips (Zero JS) */

.glossary-term {
    position: relative;
    display: inline-block;
    cursor: help;
    border-bottom: 2px dashed var(--accent-color, #00ffcc);
    transition: color 0.2s, border-bottom 0.2s;
}

.glossary-term.has-page {
    border-bottom: 2px solid var(--accent-color, #00ffcc);
    font-weight: 500;
}

.glossary-term:hover {
    color: var(--accent-color, #00ffcc);
    border-bottom: 2px solid var(--accent-color, #00ffcc);
}

/* Tooltip container */
.glossary-tooltip {
    position: absolute;
    bottom: 120%; /* display above the word */
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 280px;
    background: #222;
    color: #eee;
    padding: 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.4;
    font-family: inherit;
    font-weight: normal;
    text-align: left;
    white-space: normal;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    border: 1px solid #444;
    
    /* Animation & visibility */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    z-index: 1000;
    /* allow pointer events to interact with links inside */
    pointer-events: none; 
}

/* Tooltip triangle pointer */
.glossary-tooltip::before {
    content: '';
    position: absolute;
    top: 100%; /* adjust to connect tooltip with word */
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #222 transparent transparent transparent;
}

/* Invisible gap filler so hover doesn't break when moving mouse to tooltip */
.glossary-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 15px; /* bridges the gap */
}

/* Hover effect */
.glossary-term:hover .glossary-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
    pointer-events: auto; /* Enable clicking links inside */
}

.glossary-more {
    display: inline-block;
    margin-top: 6px;
    color: var(--accent-color, #00ffcc);
    text-decoration: underline;
    font-weight: bold;
}

.glossary-more:hover {
    color: #fff;
}
