/* Hover previews of person, event and term links
   (public/js/commulingo-link-preview.js): the reader's footnote popover look
   (.doc-pop in commulingo-doc.css), placed by the script under the link. */
.link-pop {
  position: absolute;
  z-index: 60;
  box-sizing: border-box;
  max-width: min(320px, calc(100vw - 24px));
  width: max-content;
  padding: 8px 12px;
  background: var(--bg-surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  font-size: var(--text-sm);
  font-weight: 400;
  line-height: var(--leading-snug);
  text-align: start;
  pointer-events: auto;
}

.link-pop-meta {
  margin-left: 0.5em;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.link-pop-body {
  margin-top: 0.2rem;
  color: var(--text-secondary);
}

/* Touch: the tapped box is the button that opens the page. */
.link-pop.is-passive {
    pointer-events: none;
}
.link-pop.is-tap {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.link-pop-open {
  margin-top: 0.4rem;
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-align: end;
}

/* A tapped box waiting on its text: as wide as a filled box, two thin
   pulsing lines where the text will be. */
.link-pop.is-loading {
  width: min(320px, calc(100vw - 24px));
}
.link-pop-lines {
  display: flex;
  flex-direction: column;
  gap: 0.45em;
  margin-top: 0.45rem;
}
.link-pop-lines > span {
  display: block;
  height: 0.8em;
  background: color-mix(in srgb, var(--text-muted) 22%, transparent);
  animation: link-pop-pulse 1.2s ease-in-out infinite;
}
.link-pop-lines > span + span {
  width: 65%;
  animation-delay: 0.2s;
}
@keyframes link-pop-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .link-pop-lines > span { animation: none; }
}
