/* atlas-glossary.css — Tooltip-System für Atlas-Fachbegriffe.
 * Gewrappt von enrich.js als <span class="dfn" data-def="…">…</span>.
 * Tooltip via reines CSS (:hover / :focus), kein JS-Toggle.
 */
.dfn {
  border-bottom: 1px dotted var(--atl-border-bright);
  cursor: help;
  position: relative;
  /* Keine Layout-Verschiebung — display:inline reicht */
}

.dfn:hover,
.dfn:focus-visible {
  outline: none;
  color: var(--atl-text-strong);
}

/* Tooltip-Box */
.dfn:hover::after,
.dfn:focus-visible::after {
  content: attr(data-def);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--atl-surface-3);
  color: var(--atl-text);
  padding: 10px 13px;
  border-radius: var(--atl-radius);
  border: 1px solid var(--atl-border-bright);
  font-size: 12.5px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.55;
  letter-spacing: 0;
  white-space: normal;
  width: max-content;
  max-width: 320px;
  z-index: 1000;
  box-shadow: var(--atl-shadow);
  pointer-events: none;
  text-align: left;
}

/* Pfeil zur Box */
.dfn:hover::before,
.dfn:focus-visible::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--atl-border-bright);
  z-index: 1000;
  pointer-events: none;
}

/* Viewport-Schutz: Wenn Begriff nah am rechten Rand ist, kann Tooltip clippen.
 * Browser-Fallback: max-width + word-wrap. Wir verlassen uns auf max-width:320px.
 */
@media (max-width: 640px) {
  .dfn:hover::after,
  .dfn:focus-visible::after {
    max-width: 260px;
    font-size: 12px;
    padding: 8px 11px;
  }
}

/* Print: Tooltips weg, Underline zu solid für Klar-Druck */
@media print {
  .dfn { border-bottom-style: solid; }
  .dfn::after, .dfn::before { display: none !important; }
}
