/* Data chart: line and bar charts with a key, highlights, a table view and a source line.
   Builds on the shared .explorer, .btn and .cx styles in styles.css. */
.data-chart {
  --dc-s0: #2563a8; /* each series colour is at least 5:1 on the card */
  --dc-s1: #b4530a;
  --dc-s2: #18795a;
  --dc-s3: #8a3fb0;
  min-width: 0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .data-chart {
    --dc-s0: #6cb2f5;
    --dc-s1: #ffa05c;
    --dc-s2: #4fd1a1;
    --dc-s3: #c9a0ff;
  }
}
/* The same colours when the student picks the dark theme with the toggle (data-theme="dark"), also on a device that prefers light. */
:root[data-theme="dark"] .data-chart {
  --dc-s0: #6cb2f5;
  --dc-s1: #ffa05c;
  --dc-s2: #4fd1a1;
  --dc-s3: #c9a0ff;
}

.dc-name { font-size: 1.15rem; overflow-wrap: anywhere; }

/* The announcement is also on screen: it is the readout of the chart, and of the last action. */
.dc-readout { margin: 0 0 0.8rem; min-height: 1.5em; padding: 0.5rem 0.7rem; border-radius: 10px; background: var(--accent-soft); font-weight: 600; overflow-wrap: anywhere; }

.dc-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.6rem; }
.dc-toggle { min-height: 44px; }
.dc-toggle[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* The picture. Each series has a colour, a marker and a dash (or a fill pattern), so colour is never the only cue. */
.dc-chart-wrap { max-width: 460px; border-radius: 10px; }
.dc-grid { stroke: var(--grid); stroke-width: 1; }
.dc-zero { stroke: var(--axis); stroke-width: 1.5; }
.dc-tick, .dc-category { font-size: 13px; font-weight: 600; fill: var(--muted); font-variant-numeric: tabular-nums; }
.dc-category { fill: var(--text); }
.dc-axis-title { font-size: 13px; font-weight: 700; fill: var(--text); }

.dc-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.dc-point { stroke-width: 1.5; }
.dc-s0.dc-line, .dc-s0.dc-point { stroke: var(--dc-s0); }
.dc-s1.dc-line, .dc-s1.dc-point { stroke: var(--dc-s1); }
.dc-s2.dc-line, .dc-s2.dc-point { stroke: var(--dc-s2); }
.dc-s3.dc-line, .dc-s3.dc-point { stroke: var(--dc-s3); }
.dc-s0.dc-point { fill: var(--dc-s0); }
.dc-s1.dc-point { fill: var(--dc-s1); }
.dc-s2.dc-point { fill: var(--dc-s2); }
.dc-s3.dc-point { fill: var(--dc-s3); }

/* Bars: the first series is solid, the others are striped, gridded and dotted (the fill is set on the bar as url(#pattern)). */
.dc-bar { stroke-width: 1.5; }
.dc-bar.dc-s0 { fill: var(--dc-s0); stroke: var(--dc-s0); }
.dc-bar.dc-s1 { stroke: var(--dc-s1); }
.dc-bar.dc-s2 { stroke: var(--dc-s2); }
.dc-bar.dc-s3 { stroke: var(--dc-s3); }
.dc-pat-back.dc-s1 { fill: color-mix(in srgb, var(--dc-s1) 18%, var(--surface)); }
.dc-pat-back.dc-s2 { fill: color-mix(in srgb, var(--dc-s2) 18%, var(--surface)); }
.dc-pat-back.dc-s3 { fill: color-mix(in srgb, var(--dc-s3) 18%, var(--surface)); }
.dc-pat-mark { stroke-width: 1.6; }
.dc-pat-mark.dc-s1 { stroke: var(--dc-s1); }
.dc-pat-mark.dc-s2 { stroke: var(--dc-s2); }
.dc-pat-dot.dc-s3 { fill: var(--dc-s3); }

/* Highlights: a ring round a point or an outline round a bar, with the value written beside it. */
.dc-ring, .dc-outline { fill: none; stroke: var(--text); stroke-width: 2.5; }
.dc-ring { stroke-dasharray: 4 2.5; }
.dc-underlay { stroke: var(--text); stroke-opacity: 0.28; stroke-width: 9; stroke-linecap: round; }
.dc-value { font-size: 13px; font-weight: 800; fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }

/* The key says the same as the picture: the same marker, dash or pattern, with the name of the series. */
.dc-legend { list-style: none; margin: 0.5rem 0 0.3rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; font-size: 0.9rem; }
.dc-legend li { display: flex; align-items: center; gap: 0.5rem; min-width: 0; overflow-wrap: anywhere; }
.dc-swatch { flex: none; width: 28px; height: 14px; }

/* The marked points, in words. */
.dc-marked { margin: 0.4rem 0 0.6rem; font-size: 0.92rem; }
.dc-marked-title { margin: 0 0 0.2rem; font-weight: 700; }
.dc-marked ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.25rem; }
.dc-marked li { display: flex; gap: 0.5rem; align-items: baseline; }
.dc-marked li::before { content: ''; flex: none; box-sizing: border-box; width: 0.8rem; height: 0.8rem; border: 2.5px dashed var(--text); border-radius: 50%; transform: translateY(0.1rem); }

/* Table view. */
.dc-table-box { margin-bottom: 0.6rem; overflow-x: auto; } /* a safety net for a very narrow screen or many series: the table scrolls here, not the page */
.dc-table-probe, .dc-table-rem { height: 0; } /* no height; fitTable (data-chart.js) watches them: the first is as wide as the box, the second is 1rem wide (it resizes with the text size) */
.dc-table-rem { width: 1rem; }
.dc-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.dc-table caption { text-align: left; font-weight: 700; padding-bottom: 0.3rem; overflow-wrap: anywhere; }
.dc-table th, .dc-table td { border: 1px solid var(--border); padding: 0.3rem 0.4rem; text-align: left; overflow-wrap: anywhere; }
/* Headers break at spaces only (a word such as Kategorie is never split); a table wider than its card scrolls in its box. */
.dc-table th { overflow-wrap: break-word; }
.dc-table thead th { background: var(--surface-2); font-size: 0.78rem; line-height: 1.25; vertical-align: bottom; }
.dc-table tbody th { font-weight: 500; }
.dc-table .dc-num { text-align: right; }
.dc-table td.is-marked { font-weight: 800; background: var(--accent-soft); outline: 2px dashed var(--text); outline-offset: -3px; }
.dc-flag { display: block; white-space: nowrap; font-weight: 600; font-size: 0.78rem; } /* on its own line, and never split: "(höchster)" stays whole */

/* A table that would be wider than its card (the widget adds is-tight; one that fits is left as it is): a flag may take two lines,
   breaking at spaces only, the headers and flags are set a little smaller (11 px, as in the climate-graph table) and the cells give
   up most of their side padding. */
.dc-table.is-tight .dc-flag { white-space: normal; overflow-wrap: normal; font-size: 0.6875rem; }
.dc-table.is-tight thead th { font-size: 0.72rem; }
.dc-table.is-tight th, .dc-table.is-tight td { padding-inline: 0.1rem; }

/* Source line, under the chart or the table. */
.dc-source { margin: 0.6rem 0 0; font-size: 0.88rem; color: var(--muted); overflow-wrap: anywhere; }
.dc-source--illustrative { font-weight: 700; }
