/* ==========================================================================
   IX · STATS — hover axis for the stat card grid.
   Keyed off body[data-rbs-stats="rest | lift | focus"]. The count-up reveal
   is imperative (js/areas/stats.js); everything here is hover feedback, so
   it runs at every motion level — transforms drop under reduced motion,
   color and opacity stay (gentler, never dead).

   Knobs:  --rbs-stats-dim   sibling opacity, focus variant (default .7)
           --rbs-stats-dur   count duration — JS-read, no CSS use here
   ========================================================================== */

/* The numeral settles 1.02 → 1 from its left edge (WAAPI, stats.js). */
.rb-statcardgrid__value {
  transform-origin: left center;
}

/* --------------------------------------------------------------------------
   REST — shipped. No hover behavior; nothing to declare.
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   LIFT — 4px rise + shadow-md; the chip inverts to brand.
   Transitions live on the base state so the exit retargets mid-flight.
   -------------------------------------------------------------------------- */
@media (hover: hover) and (pointer: fine) {
  body[data-rbs-stats="lift"] .rb-statcardgrid__card {
    transition:
      transform var(--rb-sys-duration-2) var(--rb-sys-ease-swift),
      box-shadow var(--rb-sys-duration-2) var(--rb-sys-ease-swift);
  }

  body[data-rbs-stats="lift"] .rb-statcardgrid__card:hover {
    transform: translateY(-4px);
    box-shadow: var(--rb-ref-shadow-md);
  }

  body[data-rbs-stats="lift"] .rb-statcardgrid__chip {
    transition:
      background-color var(--rb-sys-duration-2) ease,
      border-color var(--rb-sys-duration-2) ease,
      color var(--rb-sys-duration-2) ease;
  }

  body[data-rbs-stats="lift"] .rb-statcardgrid__card:hover .rb-statcardgrid__chip {
    background: var(--rb-sys-cta-primary-bg);
    border-color: var(--rb-sys-cta-primary-bg);
    color: var(--rb-sys-cta-primary-fg);
  }
}

/* --------------------------------------------------------------------------
   FOCUS — spotlight. The hovered card's media eases up inside the card's
   overflow clip; every other card steps back to the dim knob. The numeral
   wink is imperative (stats.js). 500ms is editorial, so Tempo applies.
   -------------------------------------------------------------------------- */
@media (hover: hover) and (pointer: fine) {
  body[data-rbs-stats="focus"] .rb-statcardgrid__media {
    transition: transform
      calc(var(--rb-sys-duration-4) * var(--rbs-motion-scale, 1))
      var(--rb-sys-ease-swift);
  }

  body[data-rbs-stats="focus"] .rb-statcardgrid__card:hover .rb-statcardgrid__media {
    transform: scale(1.04);
  }

  body[data-rbs-stats="focus"] .rb-statcardgrid__card {
    transition: opacity var(--rb-sys-duration-2) ease;
  }

  /* Cards live in two columns, so plain sibling combinators cannot reach
     across — :has() on the shared grid carries the spotlight. Browsers
     without :has() simply never dim: a quiet, acceptable degrade. */
  body[data-rbs-stats="focus"]
    .rb-statcardgrid .rb-grid:has(.rb-statcardgrid__card:hover)
    .rb-statcardgrid__card:not(:hover) {
    opacity: var(--rbs-stats-dim, 0.7);
  }
}

/* --------------------------------------------------------------------------
   REDUCED MOTION — keep color and opacity feedback, drop the transforms.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  body[data-rbs-stats="lift"] .rb-statcardgrid__card:hover {
    transform: none;
  }

  body[data-rbs-stats="focus"] .rb-statcardgrid__card:hover .rb-statcardgrid__media {
    transform: none;
  }
}

/* Focus-variant wink — purely visual: the numeral ticks up a breath and
   settles. The printed value never changes (these are proof points). */
.rbs-stat-wink {
  display: inline-block;
  transform-origin: left center;
  animation: rbs-stat-wink 440ms var(--rb-sys-ease-swift);
}
@keyframes rbs-stat-wink {
  0%   { transform: scale(1); }
  32%  { transform: scale(1.045); }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .rbs-stat-wink { animation: none; }
}
