/* ═══════════════════════════════════════════════════════════════
   glossary.css — Glossary index additions + the per-term page

   PATH: public/css/glossary.css
   ROLE: Styles the per-term page (/glossary/<slug>, Views/public/
         glossary_term.php) — definition callout, source line, usage list,
         related-term cards, previous/next pager, soft CTA, browse sidebar —
         plus the two things the A–Z index gained when term names became
         links: the link itself and the :target highlight an old-style
         glossary#slug link still lands on. The index's own letter sections
         stay in public.css (.glossary-letter*, .glossary-term-block, …);
         nothing here overrides them.
   LOADED BY: Views/public/glossary.php and Views/public/glossary_term.php,
         through the layout's 'styles' section.
   TOKENS: public.css :root — --teal, --teal-dark, --accent, --light-bg,
         --text-dark, --text-mid, --text-light, --border — plus --steel-pale
         and --radius-sm/md/lg from ckc-brand-variables.css (the brand kit,
         loaded after public.css with the same core values). No new colours.
   NAME CLASH NOTE: .glossary-term in public.css is the store-time tooltip
         span GlossaryLinker writes into post bodies — not an index row. The
         index row is .glossary-term-block. Nothing here touches either.
   Author: coder
   Created: 2026-09-26
   Last Modified: 2026-09-26 — new file (per-term glossary pages)
   ═══════════════════════════════════════════════════════════════ */


/* ─── 1. Index: term name is now a link to the term's own page ─── */

.glossary-term-name a {
    color: var(--text-dark);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.glossary-term-name a:hover,
.glossary-term-name a:focus-visible {
    color: var(--teal);
    border-bottom-color: var(--teal);
}

/* Tooltip links elsewhere on the site point at glossary#slug — light the row
   they land on so the reader sees which definition they were sent to. */
.glossary-term-block:target {
    background: var(--steel-pale);
    border-left: 3px solid var(--teal);
    padding: 10px 14px;
    margin-left: -17px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}


/* ─── 2. Term page: two-column frame ─── */

.term-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 210px;
    gap: 40px;
    align-items: start;
    max-width: 1000px;
    margin: 0 auto;
}

.term-article {
    min-width: 0;
}

.term-section {
    margin-top: 36px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
}

.term-section-heading {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 16px;
}


/* ─── 3. Definition callout (the snippet target) ─── */

.term-definition {
    background: var(--steel-pale);
    border-left: 4px solid var(--teal);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    padding: 20px 24px;
}

.term-definition-label {
    font-family: 'Oswald', 'Oswald Fallback', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
    font-weight: 600;
    color: var(--teal-dark);
    margin: 0 0 8px;
}

.term-definition-text {
    font-size: 17px;
    line-height: 1.65;
    color: var(--text-dark);
    margin: 0;
}

.term-source {
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.6;
    margin: 10px 0 0;
}

.term-source a {
    color: var(--teal-dark);
    text-decoration: none;
}

.term-source a:hover,
.term-source a:focus-visible {
    color: var(--teal);
    text-decoration: underline;
}

.term-source .fa-external-link-alt {
    font-size: 10px;
    opacity: 0.7;
}


/* ─── 4. Where this comes up ─── */

.term-usage {
    list-style: none;
    margin: 0;
    padding: 0;
}

.term-usage li + li {
    border-top: 1px solid var(--border);
}

.term-usage a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    padding: 10px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--teal);
    text-decoration: none;
}

.term-usage a:hover,
.term-usage a:focus-visible {
    color: var(--accent);
}

.term-usage .fa-arrow-right {
    font-size: 12px;
    opacity: 0.6;
}


/* ─── 5. Related terms ─── */

.term-related {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.term-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.term-card:hover {
    border-color: var(--teal);
    box-shadow: 0 2px 10px rgba(19, 23, 34, 0.07);
}

.term-card-name {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 6px;
}

.term-card-name a {
    color: var(--text-dark);
    text-decoration: none;
}

.term-card-name a:hover,
.term-card-name a:focus-visible {
    color: var(--teal);
}

.term-card-definition {
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-mid);
    margin: 0;
}


/* ─── 6. Previous / next term ─── */

.term-pager {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.term-pager-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 0 1 auto;
    max-width: 48%;
    min-height: 44px;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
}

/* The first term has no previous link and the last no next one, so the single
   remaining link is pushed to its own side instead of an empty placeholder. */
.term-pager-link[data-direction="next"] {
    margin-inline-start: auto;
    text-align: right;
}

.term-pager-link:hover,
.term-pager-link:focus-visible {
    border-color: var(--teal);
    background: var(--light-bg);
}

.term-pager-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-light);
}

.term-pager-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--teal);
}

.term-pager-name i {
    font-size: 11px;
    opacity: 0.7;
}


/* ─── 7. Soft CTA (wording matches the site's .cta-band) ─── */

.term-cta {
    margin-top: 36px;
    padding: 28px 24px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
}

.term-cta-heading {
    font-size: 22px;
    color: var(--text-dark);
    margin: 0 0 8px;
}

.term-cta-sub {
    font-size: 15px;
    color: var(--text-light);
    margin: 0 0 20px;
}

.term-cta-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.term-cta-primary,
.term-cta-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 28px;
    border-radius: var(--radius-sm);
    font-family: 'Oswald', 'Oswald Fallback', sans-serif;
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.term-cta-primary {
    background: var(--teal);
    border: 2px solid var(--teal);
    color: #fff;
}

.term-cta-primary:hover,
.term-cta-primary:focus-visible {
    background: var(--teal-dark);
    border-color: var(--teal-dark);
    color: #fff;
}

.term-cta-secondary {
    background: #fff;
    border: 2px solid var(--teal);
    color: var(--text-dark);
}

.term-cta-secondary:hover,
.term-cta-secondary:focus-visible {
    background: var(--light-bg);
    color: var(--teal-dark);
}


/* ─── 8. Browse sidebar ─── */

.term-side {
    position: sticky;
    top: 96px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 16px;
}

.term-side-title {
    font-family: 'Oswald', 'Oswald Fallback', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    margin: 0 0 12px;
}

.term-letters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
}

.term-letters a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--light-bg);
    border: 1px solid var(--border);
    color: var(--text-mid);
    font-family: 'Oswald', 'Oswald Fallback', sans-serif;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.term-letters a:hover,
.term-letters a:focus-visible {
    background: var(--teal);
    border-color: var(--teal);
    color: #fff;
}

.term-side-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--teal);
    text-decoration: none;
}

.term-side-all:hover,
.term-side-all:focus-visible {
    color: var(--accent);
}

.term-side-all i {
    font-size: 11px;
}


/* ─── 9. Responsive ─── */

@media (max-width: 991px) {
    .term-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
    }

    .term-side {
        position: static;
    }
}

@media (max-width: 560px) {
    .term-definition {
        padding: 16px 18px;
    }

    .term-definition-text {
        font-size: 16px;
    }

    .term-pager-link {
        max-width: 100%;
        flex: 1 1 100%;
    }

    .term-pager-link[data-direction="next"] {
        margin-inline-start: 0;
        text-align: left;
    }

    .term-cta-primary,
    .term-cta-secondary {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .term-card,
    .term-pager-link,
    .term-letters a,
    .term-cta-primary,
    .term-cta-secondary {
        transition: none;
    }
}
