/* ============================================
   Component: Summary cards
   View: dashboards/summary/show.html.erb
   Partial: parts/_card.html.erb
   Stimulus: none
   ============================================ */
/* The Summary: a card per other tab, which opens its tab. The cards fill the page's width, one to
   a row on a phone. */
.widgets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(16rem, 100%), 1fr));
  gap: var(--spacing-sm);
}

/* A card's title and its "Drill down ↓" share the first row, and its question and figures span the
   card beneath them. Its rows keep to its top: a card shorter than its row's tallest leaves the
   height its row gives it below them, rather than spreading its question and words down the card. */
.widget {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-content: start;
  align-items: baseline;
  column-gap: var(--spacing-sm);
  padding: var(--spacing-md);
  border: 1px solid var(--color-border);
  border-top: 2px solid var(--color-accent);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.widget > * { grid-column: 1 / -1; }

.widget:hover, .widget:focus-within { border-color: var(--color-accent); }

.widget > .widget-title { grid-column: 1; }

.widget-title {
  margin-bottom: var(--spacing-sm);
  color: var(--color-muted);
  font-size: var(--font-size-2xs);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.widget-link { color: inherit; text-decoration: none; }

/* The card's link covers the card, so the whole card opens the tab. */
.widget-link::after {
  content: "";
  position: absolute;
  inset: 0;
}

/* Every card shows "Drill down ↓", since a phone has no hover (PHONE-01). Hovering over the card
   or focusing its link only emphasises it. */
.widget > .widget-drill {
  grid-row: 1;
  grid-column: 2;
}

.widget-drill {
  color: var(--color-muted);
  font-size: var(--font-size-3xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.15s;
}

.widget:hover .widget-drill, .widget:focus-within .widget-drill { color: var(--color-link); }

.widget-empty, .dashboard-empty { color: var(--color-muted); }

/* The card's question, in words, above its figures */
.widget-question {
  margin-bottom: var(--spacing-sm);
  font-size: var(--font-size-sm);
}

/* The card's figures, one beneath another, each drawn by the figure part, which lays itself out by
   the card's width (its container query). */
.widget-figures {
  display: grid;
  gap: var(--spacing-md);
}
