/*
 * DD-04 KPI / stat tile — app/components/ui/stat_tile_component.rb
 *
 * A hero number: label small/muted above, value dominant, delta beneath.
 * --text-2xl value on desktop, --text-xl + tighter padding below --bp-md
 * (spec §1.5: card padding --space-6 desktop / --space-4 mobile).
 * Token vars only — enforced by test/lint/css_token_lint_test.rb.
 */

.ui-stat-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-6);
  text-decoration: none;
  color: inherit;
}

.ui-stat-tile__label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
}

/*
 * min-width/overflow-wrap are a floor, not the fix: a --text-2xl money value
 * needs ~180px and callers can hand this tile a narrower column than that, at
 * which point the number used to paint outside the tile entirely. Callers
 * still owe it a sensible width — this only guarantees that when they don't,
 * the value stays inside the card.
 */
.ui-stat-tile__value {
  font-size: var(--text-2xl);
  line-height: var(--text-2xl--line-height);
  font-weight: 600;
  color: var(--color-ink);
  min-width: 0;
  overflow-wrap: anywhere;
}

.ui-stat-tile__value-skeleton {
  display: block;
  width: 128px;
  padding-block: var(--space-1);
}

.ui-stat-tile__delta,
.ui-stat-tile__prompt {
  margin-top: var(--space-1);
}

.ui-stat-tile__prompt {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
}

@media (max-width: 767px) {
  .ui-stat-tile {
    padding: var(--space-4);
  }

  .ui-stat-tile__value {
    font-size: var(--text-xl);
    line-height: var(--text-xl--line-height);
  }
}

/* with_icon — 24px icon in a 40px --radius-md tinted frame, top-right */
.ui-stat-tile--with-icon {
  padding-right: calc(var(--space-6) + 40px + var(--space-2));
}

.ui-stat-tile__icon-frame {
  position: absolute;
  top: var(--space-6);
  right: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--color-accent-100);
  color: var(--color-accent-strong);
}

/* emphasis — accent-tinted fill, reserved for a single money tile */
.ui-stat-tile.ui-stat-tile--emphasis {
  background: var(--color-accent-50);
}

/* link — whole tile clickable, chevron reveals on hover */
.ui-stat-tile--link {
  cursor: pointer;
  transition: box-shadow var(--duration-fast) var(--ease-out);
}

.ui-stat-tile--link:hover,
.ui-stat-tile--link.is-hover {
  box-shadow: var(--shadow-sm);
}

.ui-stat-tile__chevron {
  position: absolute;
  bottom: var(--space-6);
  right: var(--space-6);
  display: flex;
  color: var(--color-ink-muted);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}

.ui-stat-tile--link:hover .ui-stat-tile__chevron,
.ui-stat-tile--link.is-hover .ui-stat-tile__chevron {
  opacity: 1;
  transform: translateX(0);
}
