/* Data visuals in the Learn lessons: one figure per lesson, drawn by viz.js from the numbers in the page, with the same
   numbers in a table underneath. Series colours are the dark steps of the validated categorical palette (checked on
   this surface: lightness, chroma, colour-blind separation and contrast all pass); text keeps the page's own inks. */
.viz-wrap { margin-top: 26px; }
.viz {
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --muted: #55666a;
  --grid: rgba(160,196,201,0.12); --axis: rgba(160,196,201,0.3); --surface: #101b1f;
  margin: 0; padding: 16px 18px 14px; border: 1px solid var(--rule); border-radius: 14px; background: var(--surface);
  display: flex; flex-direction: column; gap: 10px; position: relative;
}
.viz figcaption { display: flex; flex-direction: column; gap: 3px; }
.viz figcaption b { font: 600 21px/1.15 var(--display); letter-spacing: 0.02em; color: var(--fg); }
.viz figcaption span { font-size: 14px; line-height: 1.45; color: #c9d6d7; max-width: 70ch; }
.viz-plot { position: relative; width: 100%; min-height: 120px; }
.viz-plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.viz-plot text { font-family: var(--body); fill: var(--dim); font-size: 12px; }
.viz-plot text.lbl { fill: #d3e2e3; }
.viz-plot text.val { fill: var(--fg); font: 500 12px var(--mono); }
.viz-plot text.ttl { fill: var(--dim); font: 500 10.5px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.viz-plot .grid { stroke: var(--grid); stroke-width: 1; }
.viz-plot .axis { stroke: var(--axis); stroke-width: 1; }
.viz-plot .hit { fill: transparent; cursor: default; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: #c9d6d7; }
.viz-legend li { display: inline-flex; align-items: center; gap: 7px; }
.viz-legend i { width: 14px; height: 4px; border-radius: 2px; background: var(--c); }
.viz-legend i.dot { width: 9px; height: 9px; border-radius: 50%; }
.viz-tip { position: absolute; z-index: 3; pointer-events: none; min-width: 120px; max-width: 240px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--rule); background: rgba(6,12,14,0.96); font-size: 12.5px; line-height: 1.4; color: var(--fg); box-shadow: 0 6px 18px rgba(0,0,0,0.35); }
.viz-tip b { display: block; font-weight: 600; margin-bottom: 2px; }
.viz-tip span { display: flex; align-items: center; gap: 6px; color: #c9d6d7; }
.viz-tip span i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.viz-note { margin: 0; font-size: 13px; line-height: 1.5; color: #c9d6d7; max-width: 70ch; }
.viz-src { margin: 0; font-size: 12px; line-height: 1.5; color: var(--dim); }
.viz-table summary { cursor: pointer; font: 500 12px var(--mono); letter-spacing: 0.06em; color: var(--aqua); }
.viz-table .tbl-wrap { margin: 10px 0 0; }
.viz-live { display: inline-flex; align-items: center; gap: 6px; font: 500 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.viz-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #5ccf95; }
@media (max-width: 560px) { .viz { padding: 14px 12px 12px; } .viz figcaption b { font-size: 19px; } }
@media (forced-colors: active) { .viz-legend i { forced-color-adjust: none; } }
/* the food web: tiers from the producers up, invasive species marked in words and with a dashed edge */
.fw-tiers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fw-tier { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 10px; background: rgba(57,135,229,0.07); border: 1px solid rgba(57,135,229,0.22); }
.fw-h { margin: 0; font: 500 11px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.fw-tier ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.fw-side { padding-top: 6px !important; border-top: 1px solid var(--rule); }
.fw-n { display: flex; flex-direction: column; gap: 1px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--rule); background: #0b1518; min-width: 0; }
.fw-n b { font-weight: 600; font-size: 14px; color: var(--fg); }
.fw-n span { font-size: 12px; line-height: 1.35; color: #b9c8ca; }
.fw-n em { font: 500 10px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; font-style: normal; color: var(--amber); }
.fw-n.inv { border-style: dashed; border-color: rgba(243,185,74,0.6); }
.fw-arrow { align-self: center; font: 500 11px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--s1); }
/* the About pages stack every list in a column; legends and the food web's tiers run in rows */
main .viz-legend, main .fw-tier ul { flex-direction: row; }
main .fw-tiers { gap: 6px; padding: 0; }
main .viz-legend li, main .fw-n { max-width: none; }
