@layer components {
  /* The hover popup, one per page and moved by JS. It is never a pointer
     target: covering the link it describes would make the hover flicker, so
     pointer-events stays off in both states. Opacity rather than [hidden]
     keeps it measurable, which is what lets JS place it before it appears. */
  .card-preview {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 10;
    width: 15rem;
    overflow: hidden;
    background: var(--color-well);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease-out;
  }

  .card-preview--visible {
    opacity: 1;
  }

  /* A Magic card's proportions, so the popup reaches full height before the
     image loads and JS measures it once. The margin leaves the well's dark
     ground showing around a card whose own border may be white. */
  .card-preview__image {
    display: block;
    width: calc(100% - 2 * var(--space-3));
    margin: var(--space-3);
    aspect-ratio: 745 / 1040;
    border-radius: var(--card-corner-radius);
  }

  /* The badge draws on page ink, which is unreadable on the well, so it gets
     the page's own surface to sit on. */
  .card-preview__points {
    padding: var(--space-2) var(--space-3);
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    text-align: center;
  }

  @media (prefers-reduced-motion: reduce) {
    .card-preview {
      transition: none;
    }
  }
}
