/* ============================================================================
 * COMPONENT — Card
 * ----------------------------------------------------------------------------
 * Renderer: shared/components/card.php
 *
 * The default container for everything: a form, a list, a profile, a statistic.
 * Header and footer are optional; the body is where content goes.
 * ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  overflow: hidden;
}

/* Raise on hover only when the whole card is a link — a static card that lifts
   under the cursor promises an interaction that is not there. */
.card--link {
  display: block;
  color: inherit;
  transition: box-shadow var(--dur-base) var(--ease),
              border-color var(--dur-base) var(--ease),
              transform var(--dur-base) var(--ease);
}

.card--link:hover {
  box-shadow: var(--sh-3);
  border-color: var(--border-strong);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}

.card--flat { box-shadow: none; }

.card--brand {
  border-color: var(--brand-border);
  background: var(--brand-soft);
}

/* -- sections ------------------------------------------------------------- */

.card__head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-block-end: 1px solid var(--border);
}

.card__title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  min-inline-size: 0;
}

.card__sub {
  margin-block-start: 2px;
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  font-weight: var(--fw-normal);
}

/* Header actions sit at the trailing edge — inline-start/end, so they move to
   the left in Urdu and Arabic without a second rule. */
.card__actions {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.card__body {
  padding: var(--sp-5);
}

.card__body--tight { padding: var(--sp-4); }
.card__body--flush { padding: 0; }

.card__foot {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  border-block-start: 1px solid var(--border);
  background: var(--surface-sunken);
}

/* -- grid ----------------------------------------------------------------- */

/* auto-fill rather than auto-fit: a single card in a wide grid keeps its normal
   width instead of stretching across the whole row. */
.card-grid {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}

.card-grid--wide {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
}
