/*
  File: css/glossary.css
  Purpose: Page styles for the glossary — the A–Z index
           (Views/public/glossary_public.php: letter sections, term articles,
           sticky browse sidebar with search / letters / category chips that
           becomes a bottom dock + pop-up sheet ≤1000px, js/glossary.js) and
           the per-term page (Views/public/glossary_term.php:
           definition callout with source, "where this comes up" links,
           related-term cards, previous/next pager, soft CTA, and a sidebar
           with the letter jump back into the index). The photo hero above
           both pages is the layout's .banner3[data-hero="tall"] band
           (css/main.css); this file only swaps the band photo via
           [data-page^="glossary"]. Loaded through layouts/public's
           renderSection('head') after bootstrap-4.4.1.css, main.css and
           site-shell.css, so every rule restates font/size/spacing and every
           class is prefixed glossary- (index) or term- (term page); the
           index rules that lived in main.css were retired 2026-09-13. Design tokens (--band, --teal, --line, --display,
           --serif …) come from css/site-shell.css.
  Used by: Views/public/glossary_public.php, Views/public/glossary_term.php
*/

/* ── hero photo (index + every term page) ─────────────── */
.wrapper2[data-page^="glossary"] {
  background-image: url(../images/home/hero-glossary.jpg);   /* wood shavings — nudekarma stock
                                                                 (devindex hero/goumbik-wood-2309314_1920.jpg), 16:9 cut */
  background-attachment: scroll;
  background-position: center 50%;
}

/* ── index (glossary_public.php) ───────────────────────────
   Letter sections + term articles beside the sticky browse sidebar;
   ≤1000px the sidebar becomes the bottom dock (see the media block). */
.glossary-page {
  padding: clamp(2.5rem, 5vw, 4rem) 0 0;
  overflow-x: clip;
}
.glossary-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: start;
}
.glossary-main {
  min-width: 0;
  max-width: 820px;
}
.glossary-status {
  margin: 0 0 1.5rem;
  font-family: var(--display);
  font-size: .78rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.glossary-status b {
  color: var(--ink);
}
.glossary-group {
  scroll-margin-top: 90px;
}
.glossary-group + .glossary-group {
  margin-top: 2.5rem;
}
.glossary-letter {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  margin: 0 0 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--teal);
  font-family: var(--display);
  font-stretch: 112%;
  font-weight: 800;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -.02em;
  color: var(--ink);
}
.glossary-letter-count {
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--teal-deep);
}
.glossary-list {
  display: flex;
  flex-direction: column;
}
.glossary-term {
  padding: 1rem 0 1rem 1.1rem;
  border-left: 3px solid var(--line);
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 90px;
  transition: border-color .2s ease, background .2s ease;
}
.glossary-term:last-child {
  border-bottom: 0;
}
/* a.a2 links from the rest of the site land on #slug — light the row */
.glossary-term:target {
  border-left-color: var(--teal);
  background: var(--teal-tint);
}
.glossary-term-name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem .75rem;
  margin: 0 0 .35rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.3;
  letter-spacing: 0;
}
.glossary-term-name a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: rgba(42, 139, 130, .35);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.glossary-term-name a:hover,
.glossary-term-name a:focus {
  color: var(--teal-deep);
  text-decoration-color: var(--teal-deep);
}
.glossary-term-layer {
  padding: .18rem .5rem;
  border-radius: 999px;
  background: var(--teal-tint);
  color: var(--teal-deep);
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.glossary-term-definition {
  margin: 0;
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-soft);
}
.glossary-term-source {
  margin: .35rem 0 0;
  font-family: var(--display);
  font-size: .74rem;
  letter-spacing: .04em;
  color: var(--muted);
}
.glossary-term-source a {
  color: var(--teal-deep);
  text-decoration: none;
}
.glossary-term-source a::after {
  content: " \2197";
}
.glossary-term-source a:hover,
.glossary-term-source a:focus {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.glossary-empty {
  padding: 2.5rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  text-align: center;
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--muted);
}

/* ── index sidebar (sticky card on desktop) ───────────── */
.glossary-side {
  position: sticky;
  top: calc(62px + 1.25rem);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.glossary-side-toggle,
.glossary-side-top {
  display: none;               /* phone-only, see the ≤1000px block */
}
.glossary-side-title {
  margin: 0;
  padding: 1rem 1.25rem;
  background: var(--band);
  color: #fff;
  font-family: var(--display);
  font-weight: 700;
  font-size: .74rem;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.glossary-search {
  position: relative;
  margin: 1rem 1.25rem 0;
}
.glossary-search input {
  width: 100%;
  padding: .65rem 2.4rem .65rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font: inherit;
  font-size: .95rem;
  color: var(--ink);
}
.glossary-search input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-tint);
}
.glossary-search svg {
  position: absolute;
  right: .9rem;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.glossary-letters {
  list-style: none;
  margin: 0;
  padding: 1rem 1.25rem .5rem;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.glossary-letters a {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--teal-deep);
  font-family: var(--display);
  font-weight: 700;
  font-size: .8rem;
  text-decoration: none;
  transition: background .2s ease, border-color .2s ease, color .2s ease, opacity .2s ease;
}
.glossary-letters a:hover,
.glossary-letters a:focus {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--band);
  text-decoration: none;
}
.glossary-letters a[aria-current="true"] {
  background: var(--band);
  border-color: var(--band);
  color: #fff;
}
.glossary-letters a[data-empty="true"] {
  opacity: .3;
  pointer-events: none;
}
.glossary-side-label {
  margin: .75rem 1.25rem .4rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: .66rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}
.glossary-layers {
  list-style: none;
  margin: 0;
  padding: 0 1.25rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.glossary-layer-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font-family: var(--display);
  font-size: .76rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, color .2s ease;
}
.glossary-layer-btn span {
  font-size: .68rem;
  color: var(--muted);
}
.glossary-layer-btn:hover,
.glossary-layer-btn:focus-visible {
  border-color: var(--teal);
  color: var(--teal-deep);
}
.glossary-layer-btn[aria-pressed="true"] {
  background: var(--teal-tint);
  border-color: var(--teal);
  color: var(--teal-deep);
}
.glossary-side-all {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .9rem 1.25rem;
  border-top: 1px solid var(--line);
  font-family: var(--display);
  font-weight: 600;
  font-size: .72rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--teal-deep);
  text-decoration: none;
}
.glossary-side-all svg {
  width: 14px;
  height: 14px;
}
.glossary-side-all:hover,
.glossary-side-all:focus {
  background: var(--teal-tint);
  color: var(--teal-deep);
  text-decoration: none;
}

/* ── index ≤1000px: single column; the aside becomes the bottom dock ── */
@media (max-width: 1000px) {
  .glossary-layout {
    grid-template-columns: 1fr;
  }
  .glossary-main {
    max-width: none;
  }
  .glossary-page,
  .glossary-page ~ .footer {
    padding-bottom: 4.6rem;    /* the dock is ~64px tall; keep the band and © row clear */
  }
  .glossary-side {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 40;               /* under the fixed header (50) and the popup dialog */
    top: auto;
    border: 0;
    border-top: 1px solid rgba(87, 193, 182, .3);
    border-radius: 0;
    overflow: visible;
    background: rgba(15, 26, 25, .94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: .6rem 4vw max(.6rem, env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: .9rem;
    color: #fff;
  }
  .glossary-side-toggle {
    flex: 1;
    display: flex;
    align-items: center;
    gap: .6rem;
    min-width: 0;
    padding: .7rem 1rem;
    border: 1.5px solid rgba(255, 255, 255, .3);
    border-radius: 999px;
    background: transparent;
    color: #fff;
    font-family: var(--display);
    font-weight: 600;
    font-size: .7rem;
    letter-spacing: .13em;
    text-transform: uppercase;
    line-height: 1;
    cursor: pointer;
  }
  .glossary-side-toggle-label {
    color: rgba(255, 255, 255, .6);
  }
  .glossary-side-toggle-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--teal);
  }
  .glossary-side-toggle svg {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    transition: transform .25s var(--ease);
  }
  .glossary-side[data-open="true"] .glossary-side-toggle {
    border-color: var(--teal);
  }
  .glossary-side[data-open="true"] .glossary-side-toggle svg {
    transform: rotate(180deg);
  }
  .glossary-side-top {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--teal);
    color: var(--band);
  }
  .glossary-side-top svg {
    width: 18px;
    height: 18px;
  }
  .glossary-side-top:hover,
  .glossary-side-top:focus {
    background: var(--teal-bright);
    color: var(--band);
  }
  .glossary-side-panel {
    position: absolute;
    left: 4vw;
    right: 4vw;
    bottom: calc(100% + .6rem);
    max-height: min(60vh, 520px);
    overflow: auto;
    background: var(--paper);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 -18px 50px -20px rgba(15, 26, 25, .6);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s;
  }
  .glossary-side[data-open="true"] .glossary-side-panel {
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  .glossary-side-all {
    display: none;             /* the round button takes over on phones */
  }
  /* sandbox only: CI4's debug toolbar icon sits over the round button */
  #debug-icon {
    bottom: 4.6rem;
  }
}

/* ── term page frame ──────────────────────────────────── */
.term-page {
  overflow-x: clip;
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--ink-soft);
  padding-bottom: clamp(4rem, 8vw, 6.5rem);
}

.term-page p {
  text-indent: 0;
  margin: 0 0 1.1rem;
}

.term-page h2 {
  font-family: var(--display);
  font-stretch: 112%;
  font-weight: 800;
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  line-height: 1.15;
  letter-spacing: -.01em;
  color: var(--ink);
  margin: 0 0 1rem;
}

.term-page h3 {
  font-family: var(--display);
  font-stretch: 112%;
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.25;
  letter-spacing: -.01em;
  color: var(--ink);
  margin: 0 0 .5rem;
}

.term-layout {
  width: min(1180px, 92vw);
  margin: clamp(2.5rem, 5vw, 4rem) auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: start;
}

.term-article {
  max-width: 780px;
  min-width: 0;
}

.term-crumb {
  font-family: var(--display);
  font-weight: 600;
  font-size: .72rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.4rem;
}

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

/* the definition callout (snippet target) */
.term-definition {
  margin: 0 0 1rem;
  padding: 1.4rem 1.6rem;
  border-left: 4px solid var(--teal);
  background: var(--teal-tint);
  border-radius: 0 8px 8px 0;
}

.term-definition-label {
  display: block;
  font-family: var(--display);
  font-weight: 700;
  font-size: .7rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--teal-deep);
  margin-bottom: .5rem;
}

.term-definition p {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.65;
  color: var(--ink);
}

.term-source {
  font-size: .9rem;
  color: var(--muted);
}

.term-source a {
  color: var(--teal-deep);
  text-decoration: underline;
  text-decoration-color: rgba(42, 139, 130, .35);
  text-underline-offset: 3px;
  word-break: break-word;
}

.term-section {
  margin-top: 2.5rem;
}

/* where the term is used */
.term-usage {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}

.term-usage a {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1rem;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  color: var(--teal-deep);
  font-family: var(--display);
  font-weight: 600;
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  transition: border-color .25s var(--ease), background .25s var(--ease);
}

.term-usage a svg {
  width: 13px;
  height: 13px;
}

.term-usage a:hover,
.term-usage a:focus {
  border-color: var(--teal-deep);
  background: var(--teal-tint);
  color: var(--teal-deep);
  text-decoration: none;
}

/* related-term cards */
.term-related {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.term-card {
  padding: 1.2rem 1.3rem 1.1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 3px solid var(--teal);
  border-radius: 8px;
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}

.term-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 40px -24px rgba(15, 26, 25, .45);
}

.term-card h3 a {
  color: inherit;
  text-decoration: none;
}

.term-card h3 a:hover,
.term-card h3 a:focus {
  color: var(--teal-deep);
  text-decoration: none;
}

.term-card p {
  margin: 0;
  font-size: .92rem;
  line-height: 1.55;
  color: var(--muted);
}

/* previous / next */
.term-pager {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.term-pager a {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  max-width: 48%;
  text-decoration: none;
  color: var(--ink);
}

.term-pager-next {
  text-align: right;
  align-items: flex-end;
  margin-left: auto;
}

.term-pager span {
  font-family: var(--display);
  font-weight: 600;
  font-size: .68rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
}

.term-pager b {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.3;
  color: var(--teal-deep);
}

.term-pager b svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.term-pager a:hover b,
.term-pager a:focus b {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* soft CTA */
.term-cta {
  margin-top: 3rem;
  padding: 2.5rem 1.75rem;
  border-radius: 8px;
  background: var(--band);
  color: rgba(255, 255, 255, .82);
  text-align: center;
}

.term-cta h2 {
  color: #fff;
  margin-bottom: .6rem;
}

.term-cta p {
  max-width: 640px;
  margin: 0 auto 1.4rem;
  color: rgba(255, 255, 255, .82);
}

.term-cta-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .75rem;
}

.term-cta-primary,
.term-cta-secondary {
  display: inline-block;
  padding: .75rem 1.5rem;
  border-radius: 999px;
  font-family: var(--display);
  font-weight: 600;
  font-size: .76rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  text-decoration: none;
}

.term-cta .term-cta-primary {
  background: var(--teal);
  border: 1px solid var(--teal);
  color: var(--band);
}

.term-cta .term-cta-primary:hover,
.term-cta .term-cta-primary:focus {
  background: var(--teal-bright);
  border-color: var(--teal-bright);
  color: var(--band);
  text-decoration: none;
}

.term-cta .term-cta-secondary {
  background: none;
  border: 1px solid rgba(255, 255, 255, .35);
  color: rgba(255, 255, 255, .85);
}

.term-cta .term-cta-secondary:hover,
.term-cta .term-cta-secondary:focus {
  border-color: var(--teal);
  color: #fff;
  text-decoration: none;
}

/* sidebar: letter jump */
.term-side {
  position: sticky;
  top: calc(62px + 1.25rem);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.term-side-title {
  margin: 0;
  padding: 1rem 1.25rem;
  background: var(--band);
  color: #fff;
  font-family: var(--display);
  font-weight: 700;
  font-size: .74rem;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.term-letters {
  list-style: none;
  margin: 0;
  padding: 1rem 1.25rem .5rem;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.term-letters a {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--teal-deep);
  font-family: var(--display);
  font-weight: 700;
  font-size: .8rem;
  text-decoration: none;
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}

.term-letters a:hover,
.term-letters a:focus {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--band);
  text-decoration: none;
}

.term-side-all {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .9rem 1.25rem;
  border-top: 1px solid var(--line);
  font-family: var(--display);
  font-weight: 600;
  font-size: .72rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--teal-deep);
  text-decoration: none;
}

.term-side-all svg {
  width: 14px;
  height: 14px;
}

.term-side-all:hover,
.term-side-all:focus {
  background: var(--teal-tint);
  color: var(--teal-deep);
  text-decoration: none;
}

/* ── responsive ───────────────────────────────────────── */
@media (max-width: 1000px) {
  .term-layout {
    grid-template-columns: 1fr;
  }

  .term-side {
    position: static;
  }
}

@media (max-width: 620px) {
  .term-related {
    grid-template-columns: 1fr;
  }

  .term-pager {
    flex-direction: column;
  }

  .term-pager a,
  .term-pager-next {
    max-width: none;
    align-items: flex-start;
    text-align: left;
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .term-card,
  .term-usage a,
  .term-letters a {
    transition: none;
  }
}
