/* Donut chart (donut-chart.js). The script draws the ring as an SVG at the
   start of .mw-donut__ring (one group per slice: a thicker halo under the
   arc, shown on highlight) and counts .mw-donut__total and each
   .mw-donut__value. Colours come from --mw-c on each legend item. A
   highlighted slice gets .mw-donut__slice--on, its item .mw-donut__item--on,
   and the figure .mw-donut--focus. --mw-donut-radius rounds a legend item (its
   focus ring, 10px) and --mw-donut-swatch-radius its swatch (4px). */

.mw-donut { --mw-donut-size: 320px; margin: 0; }
.mw-donut__ring {
  position: relative;
  width: var(--mw-donut-size);
  max-width: 100%;
  aspect-ratio: 1;
}
.mw-donut__svg { display: block; width: 100%; height: 100%; overflow: visible; }
.mw-donut__arc { fill: none; stroke-linecap: butt; pointer-events: stroke; }
.mw-donut__halo {
  fill: none;
  stroke-linecap: butt;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--mw-ease, cubic-bezier(.16, 1, .3, 1));
}
.mw-donut__slice--on .mw-donut__halo { opacity: 1; }

.mw-donut__center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  margin: 0;
  padding: 24%;
  text-align: center;
  pointer-events: none;
}
.mw-donut__total { font-variant-numeric: tabular-nums; }

.mw-donut__legend { margin: 0; padding: 0; list-style: none; }
.mw-donut__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  border-radius: var(--mw-donut-radius, 10px);
  cursor: default;
}
.mw-donut__item:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.mw-donut__swatch {
  width: 14px;
  height: 14px;
  border-radius: var(--mw-donut-swatch-radius, 4px);
  background: var(--mw-c, currentColor);
  transition: transform .2s var(--mw-ease, cubic-bezier(.16, 1, .3, 1));
}
.mw-donut__item--on .mw-donut__swatch { transform: scale(1.45); }
.mw-donut__value { font-variant-numeric: tabular-nums; text-align: right; }

@media (prefers-reduced-motion: reduce) {
  .mw-donut__halo,
  .mw-donut__swatch { transition: none; }
}
