/* =============================================================
   NEMTHQ Glossary Tooltips
   Soft orange (#FF9A6C) resting → Brand orange (#FF6B2C) on hover
   ============================================================= */

/* --- Glossary term (inline) --- */
.gl-term {
    position: relative;
    border-bottom: 2px dotted #FF9A6C;
    cursor: help;
    font-weight: 600;
    color: inherit;
    transition: border-color 0.2s ease;
}

.gl-term:hover,
.gl-term.active {
    border-bottom-color: #FF6B2C;
    border-bottom-style: solid;
}

/* --- Tooltip bubble --- */
.gl-tip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    background: #ffffff;
    border: 1px solid #e2e0dc;
    border-radius: 10px;
    padding: 14px 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    transform: translateX(-50%) translateY(4px);
    z-index: 1000;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
    text-align: left;
    font-weight: 400;
}

/* Invisible bridge so mouse can travel from term to tooltip */
.gl-tip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 14px;
    background: transparent;
}

/* Arrow (visible) */
.gl-tip-arrow {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border: 7px solid transparent;
    border-top-color: #ffffff;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.06));
    pointer-events: none;
}
.gl-tip-arrow-border {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-top-color: #e2e0dc;
    pointer-events: none;
}

/* Show on hover (desktop) and active (mobile tap) */
.gl-term:hover .gl-tip,
.gl-term.active .gl-tip,
.gl-tip:hover {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

/* --- Tooltip inner elements --- */
.gl-tip-title {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #1B3A8C;
    margin-bottom: 6px;
    line-height: 1.3;
}

.gl-tip-def {
    display: block;
    font-size: 13px;
    line-height: 1.55;
    color: #4a4a4a;
    margin: 0;
}

.gl-tip-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #FF6B2C;
    text-decoration: none;
    transition: color 0.15s ease;
}
.gl-tip-link:hover {
    color: #e05a1f;
    text-decoration: underline;
}

/* --- Edge detection: keep tooltip on-screen --- */
/* When term is near the left edge */
.gl-term.gl-edge-left .gl-tip {
    left: 0;
    transform: translateX(0) translateY(4px);
}
.gl-term.gl-edge-left:hover .gl-tip,
.gl-term.gl-edge-left.active .gl-tip {
    transform: translateX(0) translateY(0);
}
.gl-term.gl-edge-left .gl-tip::after,
.gl-term.gl-edge-left .gl-tip::before {
    left: 24px;
}

/* When term is near the right edge */
.gl-term.gl-edge-right .gl-tip {
    left: auto;
    right: 0;
    transform: translateX(0) translateY(4px);
}
.gl-term.gl-edge-right:hover .gl-tip,
.gl-term.gl-edge-right.active .gl-tip {
    transform: translateX(0) translateY(0);
}
.gl-term.gl-edge-right .gl-tip::after,
.gl-term.gl-edge-right .gl-tip::before {
    left: auto;
    right: 24px;
}

/* --- Flip below if no room above --- */
.gl-term.gl-flip-below .gl-tip {
    bottom: auto;
    top: calc(100% + 10px);
    transform: translateX(-50%) translateY(-4px);
}
.gl-term.gl-flip-below:hover .gl-tip,
.gl-term.gl-flip-below.active .gl-tip {
    transform: translateX(-50%) translateY(0);
}
.gl-term.gl-flip-below .gl-tip::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: #ffffff;
}
.gl-term.gl-flip-below .gl-tip::before {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: #e2e0dc;
}

/* --- Mobile: slightly smaller tooltip --- */
@media (max-width: 640px) {
    .gl-tip {
        width: 260px;
        padding: 12px 14px;
        font-size: 12px;
    }
    .gl-tip-title {
        font-size: 13px;
    }
    .gl-tip-def {
        font-size: 12px;
    }
}


/* =============================================================
   GLOSSARY PAGE STYLES
   /glossary route — full browsable glossary
   ============================================================= */

.glossary-page {
    max-width: 780px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* --- Hero --- */
.glossary-hero {
    text-align: center;
    margin-bottom: 2.5rem;
}
.glossary-hero h1 {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-size: 2rem;
    font-weight: 700;
    color: #1B3A8C;
    margin: 0 0 0.5rem;
}
.glossary-hero p {
    font-size: 1.05rem;
    color: #666;
    margin: 0;
    line-height: 1.6;
}

/* --- Search bar --- */
.glossary-search {
    position: relative;
    margin-bottom: 2rem;
}
.glossary-search input {
    width: 100%;
    padding: 14px 20px 14px 48px;
    font-size: 15px;
    border: 2px solid #e2e0dc;
    border-radius: 10px;
    background: #ffffff;
    color: #1a1a1a;
    outline: none;
    transition: border-color 0.2s ease;
    font-family: 'Bricolage Grotesque', sans-serif;
    box-sizing: border-box;
}
.glossary-search input:focus {
    border-color: #1B3A8C;
}
.glossary-search input::placeholder {
    color: #aaa;
}
.glossary-search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #999;
}

/* --- Category filter pills --- */
.glossary-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 2rem;
}
.glossary-filter-pill {
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    border: 1.5px solid #e2e0dc;
    border-radius: 100px;
    background: transparent;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Bricolage Grotesque', sans-serif;
}
.glossary-filter-pill:hover {
    border-color: #1B3A8C;
    color: #1B3A8C;
}
.glossary-filter-pill.active {
    background: #1B3A8C;
    border-color: #1B3A8C;
    color: #ffffff;
}

/* --- Category sections --- */
.glossary-category {
    margin-bottom: 2.5rem;
}
.glossary-category-title {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #FF6B2C;
    margin: 0 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #FFF0E8;
}

/* --- Term cards --- */
.glossary-term-card {
    padding: 1.25rem 0;
    border-bottom: 1px solid #f0eeeb;
    scroll-margin-top: 100px; /* for #anchor links from tooltips */
}
.glossary-term-card:last-child {
    border-bottom: none;
}
.glossary-term-card.highlight {
    background: #FFF8F4;
    margin: 0 -1rem;
    padding: 1.25rem 1rem;
    border-radius: 8px;
    border-bottom: none;
}

.glossary-term-name {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1B3A8C;
    margin: 0 0 2px;
    line-height: 1.3;
}
.glossary-term-abbr {
    display: inline-block;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #FF6B2C;
    background: #FFF0E8;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.glossary-term-def {
    font-size: 15px;
    line-height: 1.7;
    color: #444;
    margin: 0.5rem 0 0;
}

.glossary-term-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 0.75rem;
}

.glossary-term-related {
    font-size: 12px;
    color: #888;
}
.glossary-term-related a {
    color: #1B3A8C;
    font-weight: 600;
    text-decoration: none;
}
.glossary-term-related a:hover {
    text-decoration: underline;
}

.glossary-term-action {
    font-size: 12px;
    font-weight: 600;
    color: #FF6B2C;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.glossary-term-action:hover {
    text-decoration: underline;
}

/* --- Empty state (search no results) --- */
.glossary-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #999;
}
.glossary-empty p {
    font-size: 15px;
    margin: 0;
}

/* --- Count badge --- */
.glossary-count {
    font-size: 13px;
    color: #999;
    text-align: center;
    margin-bottom: 1.5rem;
}
.glossary-count strong {
    color: #1B3A8C;
    font-weight: 700;
}

/* --- Mobile tweaks --- */
@media (max-width: 640px) {
    .glossary-page {
        padding: 1.5rem 1rem 3rem;
    }
    .glossary-hero h1 {
        font-size: 1.6rem;
    }
    .glossary-term-name {
        font-size: 1rem;
    }
    .glossary-term-def {
        font-size: 14px;
    }
}
