/* Chrome for fitness-ui's rider dashboard components (ActivityTotals,
   ActivityMonthBars, ActivityHeatmap, ActivityTypeSplit, ActivityBests). A
   sibling of one-web's rules, not a mirror: geometry uses the design
   system's spacing and radius tokens, colour uses sites' own.

   sites has no --brand-color token (checked against main.css's :root); its
   nearest equivalent is --color-accent, used throughout below. The tile
   layout itself - four across on desktop, two-up on a phone - needs no
   rules here: activity-totals.html and activity-bests.html render into
   .grid[data-columns="..."][data-tablet-columns="..."], which utils.css
   already styles. What's missing is the tile furniture and the three chart
   shapes: bars, heatmap and type-split rows.

   These blocks are divs, not sections: sites gives every <section> 5rem of
   padding-block for full-width tenant page regions, and a dashboard stacks five
   blocks rather than one. Spacing is owned here instead, and the heading rhythm
   uses h2's own --h2-padding-block hook rather than overriding the global rule. */

.activity-totals,
.activity-month-bars,
.activity-heatmap,
.activity-type-split,
.activity-bests {
  --h2-padding-block: var(--space-2);
  margin-block: var(--space-6);
}

.activity-year-picker {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-block: var(--space-4);
}

.activity-year-picker .pill.is-active {
  background-color: var(--color-accent);
  color: var(--color-base);
}

.activity-total {
  padding: var(--space-4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  text-align: center;
}

.activity-total .value {
  font-size: var(--font-size-xl, 1.5rem);
  font-weight: 600;
}

.activity-bars {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--space-1);
  align-items: end;
  block-size: 8rem;
}

.activity-bar {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  block-size: 100%;
  position: relative;
}

/* The value a native title= tooltip would take a second to show. Hover only,
   deliberately: twelve columns on a phone are about 32px each and a distance
   needs more than that, so showing them all at once collides into noise.
   Touch keeps the bar heights, which is the shape a small screen is read for.
   aria-hidden because the bar's title already carries the same figure plus the
   activity count to assistive tech, and the chart takes no tab stops. */
.activity-bar-value {
  position: absolute;
  inset-block-start: 0;
  inset-inline: 50%;
  translate: -50% 0;
  width: max-content;
  padding-inline: var(--space-1);
  font-size: smaller;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 120ms ease;
  pointer-events: none;
}

.activity-bar:hover .activity-bar-value,
.activity-bar:active .activity-bar-value {
  opacity: 1;
}

.activity-bar-fill {
  background-color: var(--color-accent);
  border-radius: var(--radius-sm);
  min-block-size: 1px;
}

.activity-bar-label {
  font-size: smaller;
  text-align: center;
}

.activity-heatmap-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 1fr);
  gap: 2px;
  overflow-x: auto;
}

.activity-heatmap-cell {
  inline-size: 10px;
  block-size: 10px;
  border-radius: 2px;
  background-color: color-mix(in srgb, currentColor 8%, transparent);
}

.activity-heatmap-cell[data-intensity="1"] {
  background-color: color-mix(in srgb, var(--color-accent) 25%, transparent);
}

.activity-heatmap-cell[data-intensity="2"] {
  background-color: color-mix(in srgb, var(--color-accent) 50%, transparent);
}

.activity-heatmap-cell[data-intensity="3"] {
  background-color: color-mix(in srgb, var(--color-accent) 75%, transparent);
}

.activity-heatmap-cell[data-intensity="4"] {
  background-color: var(--color-accent);
}

.activity-type-row {
  display: grid;
  grid-template-columns: 8rem 1fr auto;
  gap: var(--space-2);
  align-items: center;
  padding-block: var(--space-1);
}

.activity-type-bar {
  background-color: color-mix(in srgb, currentColor 8%, transparent);
  border-radius: var(--radius-sm);
  block-size: 0.5rem;
}

.activity-type-bar > span {
  display: block;
  block-size: 100%;
  background-color: var(--color-accent);
  border-radius: inherit;
}

.activity-best {
  padding: var(--space-4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}
