/* Tap-for-meaning (static/dna_portal/moonlit/glossary.js): genetics codes and
   words become buttons that look like the text around them, with a dotted
   underline, and open a small moonlit card with the meaning. */
.gloss {
  display: inline;
  margin: 0;
  padding: 0 .06em;
  border: 0;
  border-bottom: 1.5px dotted rgb(var(--c-accent) / .75);
  border-radius: 3px 3px 0 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  text-align: inherit;
  cursor: help;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .2s ease, border-color .2s ease;
}
.gloss:hover, .gloss[aria-expanded='true'] { background: rgb(var(--c-accent) / .12); border-bottom-color: rgb(var(--c-accent)); border-bottom-style: solid; }
.gloss:focus-visible { outline: 2px solid rgb(var(--c-candle)); outline-offset: 2px; }
.gloss-code { white-space: nowrap; }

.gloss-pop {
  position: absolute;
  z-index: 60;
  box-sizing: border-box;
  padding: .75rem 2.2rem .8rem .95rem;
  border-radius: 12px;
  color: rgb(var(--c-surface-soft));
  background: linear-gradient(180deg, rgb(var(--c-night)), rgb(var(--c-bg-2)));
  border: 1px solid rgb(var(--c-neon) / .55);
  box-shadow: 0 0 0 1px rgb(var(--c-night)), 0 12px 28px rgb(var(--c-black) / .45), 0 0 18px rgb(var(--c-neon) / .25);
  font-family: var(--lh-sans);
  text-align: left;
  animation: gloss-in .18s ease both;
}
.gloss-pop[hidden] { display: none; }
.gloss-pop::before {
  content: '';
  position: absolute;
  top: -7px;
  left: calc(var(--gloss-arrow, 50%) - 7px);
  width: 12px;
  height: 12px;
  background: rgb(var(--c-night));
  border-left: 1px solid rgb(var(--c-neon) / .55);
  border-top: 1px solid rgb(var(--c-neon) / .55);
  transform: rotate(45deg);
}
.gloss-pop.is-above::before { top: auto; bottom: -7px; background: rgb(var(--c-bg-2)); border: 0; border-right: 1px solid rgb(var(--c-neon) / .55); border-bottom: 1px solid rgb(var(--c-neon) / .55); }
.gloss-pop p { margin: 0; }
.gloss-pop-gene { font: 700 .64rem/1.3 var(--lh-sans); letter-spacing: .16em; text-transform: uppercase; color: rgb(var(--c-violet-200)); }
.gloss-pop-term { margin-top: .1rem !important; font: 600 1.3rem/1.15 var(--lh-serif); color: rgb(var(--c-white)); }
.gloss-pop-meaning { margin-top: .35rem !important; font-size: .92rem; line-height: 1.5; }
.gloss-pop-close { position: absolute; top: .35rem; right: .4rem; width: 2rem; height: 2rem; border: 0; border-radius: 50%; background: none; color: rgb(var(--c-violet-200)); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.gloss-pop-close:hover { background: rgb(var(--c-white) / .08); color: rgb(var(--c-white)); }
.gloss-pop-close:focus-visible { outline: 2px solid rgb(var(--c-candle)); }
@keyframes gloss-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
html[data-sparkles='off'] .gloss-pop { animation: none; }
@media (prefers-reduced-motion: reduce) { html:not([data-sparkles='on']) .gloss-pop { animation: none; } }
@media print { .gloss { border: 0; } .gloss-pop { display: none !important; } }
