/* ── Glossary Page ── */

.glossary-page {
    background: #fff;
}

.glossary-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 24px 80px;
}

/* ── Header ── */
.glossary-header {
    margin-bottom: 48px;
}

.glossary-title {
    font-size: clamp(28px, 5vw, 44px);
    font-weight: 700;
    margin: 0 0 16px;
    color: #1a1a2e;
}

.glossary-intro {
    font-size: 17px;
    line-height: 1.65;
    color: #555;
    margin-bottom: 32px;
    max-width: 680px;
}

/* ── Search ── */
.glossary-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 28px;
}

.glossary-search-icon {
    position: absolute;
    left: 14px;
    width: 20px;
    height: 20px;
    color: #888;
    pointer-events: none;
    flex-shrink: 0;
}

.glossary-search-wrap input.glossary-search-input {
    width: 100%;
    padding: 14px 48px 14px 46px !important;
    font-size: 16px;
    font-family: "Open Sans", sans-serif;
    border: 2px solid #e0e0e8;
    border-radius: 8px;
    outline: none;
    transition: border-color 200ms ease, box-shadow 200ms ease;
    background: #fafafa;
    color: #1a1a2e;
    appearance: none;
    -webkit-appearance: none;
}

.glossary-search-input:focus {
    border-color: #66599a;
    box-shadow: 0 0 0 3px rgba(102, 89, 154, 0.12);
    background: #fff;
}

.glossary-search-input::-webkit-search-cancel-button {
    display: none;
}

.glossary-search-clear {
    position: absolute;
    right: 12px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    border-radius: 4px;
    transition: color 150ms ease;
    padding: 4px;
}

.glossary-search-clear svg {
    width: 16px;
    height: 16px;
}

.glossary-search-clear:hover {
    color: #66599a;
}

/* ── Alphabet nav ── */
.glossary-alphabet {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.glossary-alpha-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 14px;
    font-weight: 600;
    color: #66599a;
    border: 1px solid #e0e0e8;
    border-radius: 6px;
    text-decoration: none;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.glossary-alpha-link:hover {
    background: #66599a;
    color: #fff;
    border-color: #66599a;
}

.glossary-alpha-link--empty {
    opacity: 0.3;
    pointer-events: none;
}

/* ── Sections ── */
.glossary-section {
    margin-bottom: 40px;
    scroll-margin-top: 80px;
}

.glossary-section-letter {
    font-size: 28px;
    font-weight: 700;
    color: #66599a;
    border-bottom: 2px solid #e0e0e8;
    padding-bottom: 8px;
    margin: 0 0 20px;
}

/* ── Terms ── */
.glossary-term {
    padding: 20px 0;
    border-bottom: 1px solid #f0f0f5;
    transition: opacity 200ms ease;
}

.glossary-term:last-child {
    border-bottom: none;
}

.glossary-term-name {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 8px;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.glossary-term-anchor {
    font-size: 14px;
    font-weight: 400;
    color: #ccc;
    text-decoration: none;
    opacity: 0;
    transition: opacity 150ms ease, color 150ms ease;
    flex-shrink: 0;
    line-height: 1;
}

.glossary-term:hover .glossary-term-anchor,
.glossary-term-anchor:focus {
    opacity: 1;
    color: #66599a;
}

/* ── Internal link ── */
.glossary-term-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #66599a;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 150ms ease, color 150ms ease;
}

.glossary-term-link:hover {
    color: #4e3f7e;
    border-bottom-color: currentColor;
}

.glossary-term-link-arrow {
    font-style: normal;
    transition: transform 150ms ease;
}

.glossary-term-link:hover .glossary-term-link-arrow {
    transform: translateX(3px);
}

.glossary-term-name mark {
    background: #fff3b0;
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

.glossary-term-body {
    font-size: 15px;
    line-height: 1.65;
    color: #444;
}

.glossary-term-body p:last-child {
    margin-bottom: 0;
}

.glossary-term-related {
    margin-top: 10px;
    font-size: 14px;
    color: #888;
}

.glossary-term-related-label {
    font-weight: 600;
    color: #66599a;
}

/* ── No results ── */
.glossary-no-results {
    text-align: center;
    padding: 48px 0;
    color: #888;
    font-size: 16px;
    line-height: 1.6;
}

.glossary-reset-link {
    background: none;
    border: none;
    color: #66599a;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    text-decoration: underline;
    padding: 0;
}

/* ── Stats ── */
.glossary-count {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid #f0f0f5;
    font-size: 13px;
    color: #aaa;
    text-align: right;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .glossary-wrapper {
        padding: 40px 16px 60px;
    }

    .glossary-alpha-link {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
}
