.rendered-content {
  position: relative;
}

.footnote-reference {
  display: inline-grid;
  place-items: center;
  min-width: 1.55em;
  height: 1.55em;
  margin-left: 0.14em;
  padding: 0 0.28em;
  color: var(--ve-blueprint, #1e3aeb) !important;
  background: rgba(30, 58, 235, 0.06);
  border: 1px solid rgba(30, 58, 235, 0.45);
  border-radius: 999px;
  box-shadow: none;
  font-family: var(--ve-mono, ui-monospace, monospace);
  font-size: 0.58em;
  font-weight: 700;
  line-height: 1;
  text-decoration: none !important;
  vertical-align: super;
  cursor: help;
  transform: translateY(-0.08em);
  transition:
    color 120ms ease,
    background 120ms ease,
    border-color 120ms ease,
    transform 120ms ease;
}

.footnote-reference:hover,
.footnote-reference:focus-visible,
.footnote-reference--active {
  color: var(--ve-panel, #fffdf7) !important;
  background: var(--ve-blueprint, #1e3aeb);
  border-color: var(--ve-blueprint, #1e3aeb);
  outline: none;
  transform: translateY(-0.16em);
}

.footnote-popover {
  position: absolute;
  z-index: 30;
  width: min(340px, calc(100vw - 40px));
  padding: 0;
  color: var(--ve-ink, #111);
  background: var(--ve-panel-strong, #fff);
  border: 1px solid var(--ve-line-strong, #111);
  box-shadow: 8px 8px 0 rgba(17, 17, 17, 0.12);
  transform: translateY(calc(-100% - 12px));
  animation: footnote-popover-in 130ms ease-out;
}

.footnote-popover::after {
  position: absolute;
  bottom: -7px;
  left: var(--footnote-pointer-left, 24px);
  width: 12px;
  height: 12px;
  content: "";
  background: var(--ve-panel-strong, #fff);
  border-right: 1px solid var(--ve-line-strong, #111);
  border-bottom: 1px solid var(--ve-line-strong, #111);
  transform: translateX(-50%) rotate(45deg);
}

.footnote-popover header {
  display: block;
  padding: 9px 12px;
  color: var(--ve-panel, #fffdf7);
  background: var(--ve-slate, #20242a);
  font-family: var(--ve-mono, ui-monospace, monospace);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.footnote-popover__body {
  padding: 15px 16px 17px;
  font-family: var(--ve-sans, system-ui, sans-serif);
  font-size: 14px;
  line-height: 1.55;
}

.footnote-popover__body,
.footnote-popover__body p {
  margin: 0 !important;
  color: inherit !important;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

@keyframes footnote-popover-in {
  from {
    opacity: 0;
    transform: translateY(calc(-100% - 6px));
  }

  to {
    opacity: 1;
    transform: translateY(calc(-100% - 12px));
  }
}

@media (max-width: 640px) {
  .footnote-popover {
    position: fixed;
    z-index: 990;
    right: 12px;
    bottom: 24px;
    left: 12px !important;
    top: auto !important;
    width: auto;
    transform: none;
    animation: footnote-sheet-in 150ms ease-out;
  }

  .footnote-popover::after {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .footnote-reference,
  .footnote-popover {
    transition: none;
    animation: none;
  }
}

@keyframes footnote-sheet-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
