/*
 * Cards: a raised surface for one record in a list. A card is a Box, and
 * sets the Box's custom properties rather than its own padding and border.
 *
 *   <article class="box card">…</article>
 *   <a class="box card" href="…">…</a>   lifts under the pointer
 *
 * data-variant="media" lets an image run to the card's edges; pad the text
 * beneath it with .card__body.
 */
@layer components {
  .card {
    --box-bg: var(--color-surface);
    --box-fg: var(--color-text);
    --box-radius: var(--radius-card);
    --box-border-width: 0;

    box-shadow: var(--shadow-raised);

    &:any-link {
      display: block;
      text-decoration: none;
      transition: translate var(--duration-base), box-shadow var(--duration-base);

      &:hover { translate: 0 -0.25rem; box-shadow: var(--shadow-lifted); }
    }

    &[data-variant="media"] {
      --box-padding: 0;

      overflow: hidden;

      & > img { inline-size: 100%; object-fit: cover; }
    }
  }

  .card__body { padding: var(--space-3); }

  /* A card's title is a heading at whatever level the page needs, sized
     for a card rather than for its level. */
  .card__title { font-size: var(--text-base); }
}
