/* Glossary tooltip system — inline term affordance + shared popover.
   Uses the guide.css design tokens (--ink, --line, --green, --paper …).
   Terms are <button class="gloss" data-term="id">…</button>; one shared
   .gloss-pop popover is positioned by glossary.js. */

/* ---- inline term: reads as body text with a tappable affordance ---- */
.gloss {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: help;
  display: inline;
  text-decoration: underline dotted var(--green);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  white-space: normal;
}
.gloss::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 2px;
  vertical-align: -1px;
  background: currentColor;
  opacity: .55;
  /* ⓘ info glyph, masked so it inherits text color */
  -webkit-mask: center / contain no-repeat var(--gloss-i);
  mask: center / contain no-repeat var(--gloss-i);
}
:root { --gloss-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='7' fill='none' stroke='%23000' stroke-width='1.3'/%3E%3Ccircle cx='8' cy='4.6' r='1' fill='%23000'/%3E%3Crect x='7.1' y='6.7' width='1.8' height='5.2' rx='.9' fill='%23000'/%3E%3C/svg%3E"); }
.gloss:hover, .gloss:focus-visible { color: var(--green); opacity: 1; }
.gloss:hover::after, .gloss:focus-visible::after { opacity: .9; }
.gloss:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 3px; }
.gloss[aria-expanded="true"] { color: var(--green); }

/* ---- shared popover ---- */
.gloss-pop {
  position: fixed;
  z-index: 60;
  width: min(300px, calc(100vw - 24px));
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  box-shadow: 0 10px 34px rgba(20, 16, 8, .16), 0 2px 8px rgba(20, 16, 8, .08);
  padding: 13px 15px 12px;
  font-size: 14px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .12s ease, transform .12s ease;
  pointer-events: none;
}
.gloss-pop[data-open="true"] { opacity: 1; transform: translateY(0); pointer-events: auto; }
.gloss-pop__term {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--green);
  margin: 0 0 5px;
}
.gloss-pop__def { margin: 0; color: var(--ink-2); }
.gloss-pop__more {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
  text-decoration: none;
}
.gloss-pop__more:hover { text-decoration: underline; }
.gloss-pop__more svg { width: 12px; height: 12px; }

/* arrow */
.gloss-pop__arrow {
  position: absolute;
  width: 11px;
  height: 11px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  transform: rotate(45deg);
}
.gloss-pop[data-place="below"] .gloss-pop__arrow { top: -6px; border-right: 0; border-bottom: 0; }
.gloss-pop[data-place="above"] .gloss-pop__arrow { bottom: -6px; border-left: 0; border-top: 0; }

@media (prefers-reduced-motion: reduce) {
  .gloss-pop { transition: none; transform: none; }
  .gloss-pop[data-open="true"] { transform: none; }
}

/* ---- glossary PAGE layout ---- */
.gloss-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 30px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}
.gloss-jump a {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
}
.gloss-jump a:hover { color: var(--green); border-color: var(--green); }

.gloss-list { display: grid; gap: 30px; }
.gloss-entry { scroll-margin-top: 90px; }
.gloss-entry h2 { margin: 0 0 8px; font-size: 22px; }
.gloss-entry__short {
  margin: 0 0 10px;
  font-size: 16.5px;
  font-weight: 600;
  color: var(--ink);
  border-left: 3px solid var(--green);
  padding-left: 13px;
}
.gloss-entry p { font-size: 15.5px; line-height: 1.65; color: var(--ink-2); margin: 0 0 8px; }
.gloss-entry__also { font-size: 13px; color: var(--ink-3); font-style: italic; }

