/* ─────────────────────────────────────────────────────────────────────────
   ICON DECK — a grid of centred blocks, each an icon over a label.

   The way this product says "here are the things you can go to": the METIS
   settings page's sections, the Coherence hub, and the welcome page's "My
   events and organisations" (issue #376).

   It was not a component until that third caller. /settings/ and the Coherence
   hub each carried their own <style> block under the name .settings-*, and the
   two had already drifted: the hub's copy was missing the rules for a card
   whose icon is an image or a name's initial, so a holon logo rendered wrong
   there. Both copies also hardcoded a cream-and-gold palette that could not
   survive under another app's theme. Renamed rather than kept as .settings-*
   because it is no longer the settings page's private class.

   Markup: crm/partials/icon_deck.html (the grid) and _icon_deck_card.html
   (one card).
   ───────────────────────────────────────────────────────────────────────── */

@layer components {

  /* No max-width: how wide a deck may be is the page's business, not the
     component's. It carried one as .settings-deck, where /settings/ already
     caps itself at 800px — so the cap did nothing there and left the welcome
     page's deck stranded at 720px in a 1900px column. */
  .icon-deck {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-4);
  }

  .icon-deck__card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    padding: var(--space-6) var(--space-4) var(--space-4);
    gap: var(--space-3);
    box-shadow: var(--elev-2);
    transition: transform var(--transition-fast),
                box-shadow var(--transition-fast),
                border-color var(--transition-fast);
  }

  /* Only a card that goes somewhere lifts. A plain block (no url) renders as
     a <div> and must not pretend to be clickable. */
  a.icon-deck__card:hover {
    transform: translateY(-2px);
    border-color: var(--color-accent-ring);
    box-shadow: var(--elev-3);
  }

  .icon-deck__icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    background: var(--color-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
  }

  .icon-deck__icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .icon-deck__icon svg {
    color: var(--color-text-muted);
  }

  /* A name's first letter, when there is no logo — the same avatar the side
     nav uses. The Coherence hub never had this rule, which is the drift this
     component exists to end. */
  .icon-deck__icon .sidenav-user-avatar {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--color-text-muted);
  }

  .icon-deck__label {
    font-size: var(--text-md);
    font-weight: 600;
    text-align: center;
    color: var(--color-text);
    line-height: 1.3;
  }

  .icon-deck__desc {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    text-align: center;
    line-height: 1.3;
  }

  .icon-deck__desc strong {
    color: var(--color-text);
    font-weight: 600;
  }
}
