.footnote-popover {
  position: absolute;
  z-index: 1000;
  box-sizing: border-box;
  width: min(26rem, calc(100vw - 1rem));
  margin: 0;
  padding: 1rem 2.5rem 1rem 1rem;
  border: 1px solid currentColor;
  border-radius: 0.25rem;
  background: Canvas;
  color: CanvasText;
  box-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 18%);
  line-height: 1.45;
}

.footnote-popover__content {
  margin: 0;
}

.footnote-popover__content p:last-child,
.footnote-popover__content li:last-child {
  margin-bottom: 0;
}

.footnote-popover__close {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}

.footnote-popover__close:hover,
.footnote-popover__close:focus-visible {
  background: rgb(127 127 127 / 18%);
}

.footnotes-enhanced [data-footnote-source="true"] {
  display: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .footnote-popover {
    animation: footnote-popover-in 120ms ease-out;
  }
}

@keyframes footnote-popover-in {
  from { opacity: 0; transform: translateY(-0.25rem); }
  to { opacity: 1; transform: translateY(0); }
}
