/* Line chart (line-chart.js). The script draws an SVG at the top of
   .mw-linechart__plot (its height is --mw-linechart-h), adds one value label
   (.mw-linechart__tag) per series and places the markup annotations
   (.mw-linechart__note) over the plot; when the plot is narrower than the
   script's `narrow` option (.mw-linechart--narrow) they stay listed under it
   and the markers on the line carry their numbers. Grid and axis text colours come from
   --mw-linechart-grid and --mw-linechart-text; give both 4.5:1 or more against
   the page. --mw-linechart-bg is the page colour, painted under annotations
   and dot rings so grid lines never cross their text. Series colours arrive as
   --mw-linechart-c on each series element (the `color` option, else
   --mw-linechart-series-1 / -2, else the text colour). --mw-linechart-num-weight
   is the weight of the note numbers (700). */

.mw-linechart {
  --mw-linechart-h: 420px;
  --mw-linechart-grid: currentColor;
  --mw-linechart-text: currentColor;
  --mw-linechart-bg: Canvas;
  --mw-linechart-stroke: 3px;
  --mw-linechart-note-w: 16rem;
  margin: 0;
}
.mw-linechart__plot { position: relative; }
.mw-linechart__svg {
  display: block;
  width: 100%;
  height: var(--mw-linechart-h);
  overflow: visible;
}
.mw-linechart__grid line { stroke: var(--mw-linechart-grid); stroke-width: 1; shape-rendering: crispEdges; }
.mw-linechart__axis text {
  fill: var(--mw-linechart-text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.mw-linechart__line {
  fill: none;
  stroke: var(--mw-linechart-c);
  stroke-width: var(--mw-linechart-stroke);
  stroke-linejoin: round;
  stroke-linecap: round;
}
.mw-linechart__svg stop { stop-color: var(--mw-linechart-c); }
.mw-linechart__head circle { fill: var(--mw-linechart-c); }
.mw-linechart__dot { stroke: var(--mw-linechart-bg); stroke-width: 3; }

.mw-linechart__tag {
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* Annotations: a plain list without JavaScript; placed over the plot with it,
   or numbered under it on narrow plots. Each shows once the head passes it. */
.mw-linechart__notes { margin: 0; padding: 0; list-style: none; counter-reset: mw-note; }
.mw-linechart--placed:not(.mw-linechart--narrow) .mw-linechart__note {
  position: absolute;
  top: 0;
  left: 0;
  width: max-content;
  max-width: var(--mw-linechart-note-w);
  padding: 6px 10px;
  background: var(--mw-linechart-bg);
}
.mw-linechart--placed .mw-linechart__note {
  opacity: 0;
  visibility: hidden;
  translate: 0 8px;
  transition: opacity .5s var(--mw-ease, cubic-bezier(.16, 1, .3, 1)), translate .5s var(--mw-ease, cubic-bezier(.16, 1, .3, 1)), visibility 0s .5s;
}
.mw-linechart--placed .mw-linechart__note--on {
  opacity: 1;
  visibility: visible;
  translate: 0 0;
  transition-delay: 0s;
}
.mw-linechart--narrow .mw-linechart__notes { display: grid; gap: 14px; margin-top: 24px; }
.mw-linechart--narrow .mw-linechart__note { position: relative; min-height: 26px; padding-left: 38px; counter-increment: mw-note; }
.mw-linechart--narrow .mw-linechart__note::before {
  content: counter(mw-note);
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 2.5px solid var(--mw-linechart-c, currentColor);
  border-radius: 50%;
  font-size: 12px;
  font-weight: var(--mw-linechart-num-weight, 700);
  line-height: 1;
}
.mw-linechart__mark { opacity: 0; transition: opacity .4s var(--mw-ease, cubic-bezier(.16, 1, .3, 1)); }
.mw-linechart__mark--on { opacity: 1; }
.mw-linechart__mark line { stroke: var(--mw-linechart-c); stroke-width: 1.5; }
.mw-linechart__ring { r: 5.5px; fill: var(--mw-linechart-bg); stroke: var(--mw-linechart-c); stroke-width: 2.5; }
.mw-linechart__num { display: none; fill: currentColor; font-size: 12px; font-weight: var(--mw-linechart-num-weight, 700); }
.mw-linechart--narrow .mw-linechart__mark line { display: none; }
.mw-linechart--narrow .mw-linechart__ring { r: 11px; }
.mw-linechart--narrow .mw-linechart__num { display: inline; }

@media (prefers-reduced-motion: reduce) {
  .mw-linechart--placed .mw-linechart__note,
  .mw-linechart__mark { transition: none; }
}
