/* ==========================================================================
   COMPONENTS · GLOSSARY — the medical-terms dictionary: an A-Z jump index over
   serif letter groups, each a <dl> of run-down entries. Terms in serif with a
   trailing mono abbreviation; definitions in the reading voice, hung under a
   hairline; cross-references are ordinary ink-with-rubric links. A calm,
   printed-dictionary register — apparatus, not chrome.
   ========================================================================== */

.op-glossary {
  display: grid;
  gap: var(--space-lg);
}

/* — The A-Z jump index: a sunken register strip of mono letters — */
.op-glossary__index {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  background: var(--surface-sunken);
  border: 1px solid var(--rule);
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-deboss);
}
.op-glossary__jump {
  font-family: var(--font-data);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--text);
  text-decoration: none;
  text-align: center;
  min-inline-size: 1.7em;
  padding: var(--space-2xs) var(--space-3xs);
  border-inline-end: 1px solid var(--rule-faint);
  transition: var(--transition-ink);
}
.op-glossary__jump:last-child { border-inline-end: 0; }
.op-glossary__jump:hover { color: var(--accent); }
/* A letter with no entries reads dimmed AND inert — colour is not the only cue */
.op-glossary__jump[aria-disabled="true"],
.op-glossary__jump[data-empty] {
  color: var(--text-muted);
  pointer-events: none;
  cursor: default;
}

/* — A letter group header: a big serif initial trailed by a hairline struck
     through its optical centre — */
.op-glossary__letter {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-reading);
  font-weight: var(--weight-bold);
  font-size: var(--text-2xl);
  line-height: var(--leading-solid);
  color: var(--text);
  scroll-margin-top: var(--space-lg);
}
.op-glossary__letter::after {
  content: "";
  flex: 1;
  block-size: 2px;
  background: var(--rule-strong);
  /* align-items:center sits the rule on the line-box centre, which is low on an
     all-caps initial (the line box carries descender + leading below the
     baseline). Lift it to the cap-height midpoint of the letterform. */
  transform: translateY(-0.12em);
}

/* — The entry list: a real <dl>, one bordered group per term — */
/* Reset the base dl's `auto 1fr` ledger grid (04-elements/_lists.css): the
   entries here are <div> wrappers (dt + hung dd), not flat dt|dd pairs, so the
   default two-column grid would deal them left/right instead of stacking. */
.op-glossary__list { margin: 0; display: grid; grid-template-columns: 1fr; gap: 0; }
.op-glossary__entry {
  padding-block: var(--space-sm);
  border-bottom: 1px solid var(--rule-faint);
}
.op-glossary__entry:last-child { border-bottom: 0; }

.op-glossary__term {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5em;
  margin: 0;
  font-family: var(--font-reading);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  color: var(--text);
}
/* The trailing abbreviation / pronunciation, in the mono data register */
.op-glossary__abbr {
  font-family: var(--font-data);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums lining-nums;
  font-weight: var(--weight-regular);
  color: var(--text-muted);
}

/* The definition, hung and indented under its term in the reading voice */
.op-glossary__def {
  margin: var(--space-3xs) 0 0;
  padding-inline-start: var(--space-md);
  font-family: var(--font-reading);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--text-secondary);
}

/* — The per-term entry apparatus (show page): the type tag, the "also known
     as" line, external references, and the see-also list. All token-only, so
     the dark theme's remapped tokens carry over with no extra rules. — */

/* A subtle metadata tag beside the headword — furniture caps, muted */
.op-glossary__type {
  font-family: var(--font-furniture);
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-secondary);
  vertical-align: middle;
  margin-inline-start: var(--space-xs);
  padding: var(--space-3xs) var(--space-2xs);
  border: 1px solid var(--rule);
  border-radius: var(--radius-xs);
}

/* Alternate names/spellings under the standfirst — small, secondary */
.op-glossary__aka {
  margin: var(--space-2xs) 0 0;
  font-family: var(--font-reading);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* The takeaway callout — just its outer spacing; the callout is self-styled */
.op-glossary__takeaway { margin-block: var(--space-lg); }

/* External references — a plain list under a lettered heading */
.op-glossary__refs,
.op-glossary__seealso { margin-block-start: var(--space-lg); }

.op-glossary__reflist,
.op-glossary__seealso-list {
  margin: var(--space-sm) 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-2xs);
}
.op-glossary__reflist li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5em;
}

/* The source-type badge — the callout label's furniture-caps treatment, muted */
.op-glossary__reftag {
  font-family: var(--font-furniture);
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* See also — an inline-wrapped, ·-separated run of cross-links */
.op-glossary__seealso-list {
  display: block;
  font-family: var(--font-reading);
  font-size: var(--text-sm);
}
.op-glossary__seealso-list li { display: inline; }
.op-glossary__seealso-list li + li::before {
  content: "·";
  margin-inline: 0.5em;
  color: var(--text-muted);
}

/* A "see also" run-in: a small-caps furniture lead-in before the cross-links */
.op-glossary__see {
  font-family: var(--font-furniture);
  font-size: var(--text-3xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
  margin-inline-end: 0.5em;
}
