/*
 * mw-card: a white card on the ground (docs/design-system.md, spec §5, D14).
 * Cards are never nested. Semantic tokens only; MwComponentPurityTest holds it.
 *
 *   mw-card         the card: border and a soft shadow, since white meets the
 *                   ground at only 1.11:1
 *   mw-card__icon   a navy glyph on the selected blue, tap-target sized
 *   mw-card__title  the card's heading (pick the h level the page needs)
 *   mw-card__text   its body text
 *   mw-card__cta    its one link (mw-link) or button (mw-btn), bottom right;
 *                   it only places what it sits on, never pads it
 *
 * A card with one destination is a stretched link (spec D15): never wrap the
 * card in <a>.
 *   mw-card--link   the card is the target: it lifts and its title underlines
 *                   on hover, and it shows the focus ring when its link has focus
 *   mw-card__link   the one <a>, inside the title; its ::after covers the card
 *   mw-card__more   the visible "See how →", aria-hidden decoration under the
 *                   text, left aligned, at the bottom
 *   mw-card__actions a card with more than one action: its buttons in a row,
 *                   left aligned, at the bottom
 *   mw-card__actions--stack the same buttons one above another; with
 *                   mw-btn--block each fills the card's width
 *
 * Optional parts for cards in a list a reader compares (spec D15):
 *   mw-card__tag    a small label above the title: platform, audience, type
 *   mw-card__meta   a header strip, what it is on the left and one fact on the
 *                   right, divided from the body; for a card with no padding
 *   mw-card__meta-fact the fact on the right of the strip
 *   mw-card__body   the padded body under an image or a meta strip
 */
.mw-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--color-surface);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
}

.mw-card__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: var(--tap-target);
  height: var(--tap-target);
  border-radius: var(--radius-control);
  background: var(--color-selected);
  color: var(--color-primary-text);
}

.mw-card__title {
  margin: 0;
  color: var(--color-heading);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
}

.mw-card__text {
  margin: 0;
  color: var(--color-text-secondary);
}

.mw-card__cta {
  align-self: flex-end;
  margin-top: auto;
}

/* ── One destination: the stretched link ───────────────────────────── */
.mw-card--link {
  position: relative;
}

.mw-card__link {
  color: inherit;
  text-decoration: none;
}

.mw-card__link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-card);
}

.mw-card__link:focus-visible {
  outline: none;
}

.mw-card--link:focus-within {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.mw-card__more {
  margin-top: auto;
  padding-top: var(--space-2);
  color: var(--color-link);
  font-weight: var(--font-weight-semibold);
}

@media (hover: hover) {
  .mw-card--link:hover {
    border-color: var(--color-selected-border);
    box-shadow: var(--shadow);
  }

  .mw-card--link:hover .mw-card__title {
    text-decoration: underline;
  }
}

/* ── More than one action ──────────────────────────────────────────── */
.mw-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: auto;
}

.mw-card__actions--stack {
  flex-direction: column;
}

/* ── Parts for cards in a list ─────────────────────────────────────── */
.mw-card__tag {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mw-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mw-card__meta-fact {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-semibold);
  letter-spacing: normal;
  text-transform: none;
}

.mw-card__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
}
