/* Deep Dive 5 - hover glossary.
 * A math word gets a dotted underline. Hover it, tab to it, or tap it, and the
 * definition appears. This replaces writing the definition inline every time, so a
 * problem can read as a plain question instead of a paragraph of parentheticals.
 * Scoped to .dd5-term* so nothing else is affected.
 */

.dd5-term {
  display: inline;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: help;
  border-bottom: 2px dotted var(--accent-dark, #1B3A5C);
  position: relative;
}
.dd5-term:hover { background: #F4FBF8; }
.dd5-term:focus-visible {
  outline: 3px solid #F4A261;
  outline-offset: 2px;
  border-radius: 2px;
}

.dd5-term-pop {
  position: absolute;
  z-index: 40;
  left: 0;
  top: calc(100% + 9px);
  width: max-content;
  max-width: min(300px, calc(100vw - 40px));
  background: #fff;
  color: var(--text, #2d2348);
  border: 1px solid var(--mist, #D4DBDF);
  border-left: 4px solid var(--accent-dark, #1B3A5C);
  border-radius: 4px;
  padding: 10px 13px;
  font-family: "Work Sans", system-ui, sans-serif;
  font-size: 15.5px;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
  white-space: normal;
  box-shadow: 0 2px 10px rgba(27, 58, 92, .13);
  display: none;
}
.dd5-term-pop b {
  display: block;
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent-dark, #1B3A5C);
  margin-bottom: 3px;
}
/* shown on hover, on keyboard focus, and while pinned open by a tap */
.dd5-term:hover .dd5-term-pop,
.dd5-term:focus-visible .dd5-term-pop,
.dd5-term[aria-expanded="true"] .dd5-term-pop { display: block; }

/* near the right edge the panel flips so it cannot run off screen */
.dd5-term.dd5-term-right .dd5-term-pop { left: auto; right: 0; }

@media (max-width: 560px) {
  .dd5-term-pop { font-size: 15px; max-width: calc(100vw - 32px); }
}

@media print {
  .dd5-term { border-bottom: 0; }
  .dd5-term-pop { display: none !important; }
}
