/* Cohorts: page-specific styles. Prefix classes with .xr-cohorts- . */

/* The matrix renders through the shared `SortableTable` (frozen
   Site/Time/People columns, header pinned to the page scroll). Bucket <td>s
   get `.xr-cohorts-td` + a heat level class via the table's `cell_class`, so
   the tint covers the whole cell. */
td.xr-cohorts-td {
  /* Beats the table's inline right-align of numeric columns. */
  text-align: center !important;
  font-family: var(--font-mono);
  white-space: nowrap;
}

td.xr-cohorts-empty {
  background: var(--bg-surface-sunken) !important;
}

/* Legacy data-color 1..8: an accent tint growing with the share of the
   period's maximum; 0 keeps the plain surface. `!important`: the tint sits on
   the <td> now and must win over the table's zebra/hover backgrounds. */
td.xr-cohorts-l1 { background: color-mix(in srgb, var(--accent) 12%, var(--bg-surface)) !important; }
td.xr-cohorts-l2 { background: color-mix(in srgb, var(--accent) 24%, var(--bg-surface)) !important; }
td.xr-cohorts-l3 { background: color-mix(in srgb, var(--accent) 36%, var(--bg-surface)) !important; }
td.xr-cohorts-l4 { background: color-mix(in srgb, var(--accent) 48%, var(--bg-surface)) !important; }
td.xr-cohorts-l5 { background: color-mix(in srgb, var(--accent) 54%, var(--bg-surface)) !important; }
/* Levels 6..8 (WCAG AA, >= 4.5:1 with white text). Light: the accent darkened
   towards black. Dark: levels 7/8 keep dark text on the bright accent, level 6
   uses white (dark text measured 3.8:1 there). */
td.xr-cohorts-l6 { background: color-mix(in srgb, var(--accent) 80%, black) !important; color: var(--text-inverse); }
td.xr-cohorts-l7 { background: color-mix(in srgb, var(--accent) 68%, black) !important; color: var(--text-inverse); }
td.xr-cohorts-l8 { background: color-mix(in srgb, var(--accent) 56%, black) !important; color: var(--text-inverse); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) td.xr-cohorts-l6 { background: color-mix(in srgb, var(--accent) 54%, var(--bg-surface)) !important; color: var(--text-primary); }
  :root:not([data-theme='light']) td.xr-cohorts-l7 { background: color-mix(in srgb, var(--accent) 84%, var(--bg-surface)) !important; color: var(--text-inverse); }
  :root:not([data-theme='light']) td.xr-cohorts-l8 { background: var(--accent) !important; color: var(--text-inverse); }
}
:root[data-theme='dark'] td.xr-cohorts-l6 { background: color-mix(in srgb, var(--accent) 54%, var(--bg-surface)) !important; color: var(--text-primary); }
:root[data-theme='dark'] td.xr-cohorts-l7 { background: color-mix(in srgb, var(--accent) 84%, var(--bg-surface)) !important; color: var(--text-inverse); }
:root[data-theme='dark'] td.xr-cohorts-l8 { background: var(--accent) !important; color: var(--text-inverse); }
