/* Mulder's chart, unpacked (learn-wiki-mulders-chart.html; drawn by assets/js/mulder.js).
   A lesson of steps, each with its chart and its dot points (one per line drawn), all scrolling with the
   page like the rest of the article (Adam, 18 Oct: "Everything should be relatively fixed in place"): on a
   phone the ring, then the dot points leading the words under it; on a wide screen the chart and its dot
   points together, beside the words, at the article's own size. Then the explorer;
   then every line in words. One colour per mineral (--min-* in components.css). Lines are straight and
   smooth; a line that holds back is solid and rust, one that raises a need is dashed and green, and its
   weight says how sure: colour is never the only cue. */

/* the page's lessons and explorer take the article's full width; its prose keeps its measure */
.article__body:has([data-mulder]) { max-width: none; container: mulder / inline-size; }
.article__body:has([data-mulder]) > :is(p, ul, ol, h2, h3, blockquote, details, .article__note) { max-width: 44rem; }

/* the page's own skip link, to the explorer: first in its tab order, seen only with focus (wiki.py, skip) */
.skip--page:focus { position: fixed; top: calc(var(--hub-top, 7.4rem) + 0.6rem); left: 1rem; }

/* each mineral's colour, and the ink it carries */
.mc--N { --mc: var(--min-n); } .mc--P { --mc: var(--min-p); --mc-on: var(--min-on-p); } .mc--K { --mc: var(--min-k); }
.mc--Ca { --mc: var(--min-ca); } .mc--Mg { --mc: var(--min-mg); } .mc--S { --mc: var(--min-s); }
.mc--Fe { --mc: var(--min-fe); --mc-on: var(--min-on-fe); } .mc--Mn { --mc: var(--min-mn); } .mc--Zn { --mc: var(--min-zn); }
.mc--Cu { --mc: var(--min-cu); } .mc--B { --mc: var(--min-b); } .mc--Mo { --mc: var(--min-mo); }

/* A mineral as a small disc with its symbol: the keys, tiles, dot points and panel */
.mulder__dot {
  display: inline-grid; place-items: center; flex: none; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  background: var(--mc, var(--paper-2)); color: var(--mc-on, var(--ink)); border: 1.5px solid var(--ink);
  font: 650 0.78rem/1 var(--f-display); font-variation-settings: "SOFT" 100, "WONK" 1;
}

/* The drawing ------------------------------------------------------------------------------------- */
.mulder__svg { display: block; width: 100%; height: auto; overflow: visible; }
.mulder__ring { fill: none; stroke: var(--ink-3); stroke-width: 1.3; stroke-dasharray: 1.5 6; stroke-linecap: round; opacity: 0.55; }
.mulder__stroke { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.mulder__ln--holds .mulder__stroke { stroke: var(--earth); }
.mulder__ln--needs .mulder__stroke { stroke: var(--leaf); stroke-dasharray: 8 6.5; }
/* the small arrowhead at a one-way line's middle, pointing at the one that loses out */
.mulder__head { stroke: none; }
.mulder__ln--holds .mulder__head { fill: var(--earth); }
.mulder__ln--needs .mulder__head { fill: var(--leaf); }
.mulder__ln.is-strong .mulder__stroke { stroke-width: 4.2; }
.mulder__ln.is-some .mulder__stroke { stroke-width: 2.6; }
.mulder__ln.is-thin .mulder__stroke { stroke-width: 1.6; stroke-opacity: 0.8; }
.mulder__ln.is-thin .mulder__head { fill-opacity: 0.8; }
.mulder__face { fill: var(--mc); stroke: var(--ink); stroke-width: 1.9; }
.mulder__disc.is-added .mulder__face { stroke-dasharray: 4.5 3.5; }
.mulder__sym { font: 650 21px var(--f-display); font-variation-settings: "SOFT" 100, "WONK" 1; fill: var(--mc-on, var(--ink)); pointer-events: none; }
.mulder__halo { fill: none; stroke: var(--wattle); stroke-width: 6; opacity: 0; }
.mulder__disc.is-faint { opacity: 0.28; }

/* A step's chart is drawn when you arrive, never as you scroll (WIKI-5). A dot point lights its line: the rest fade, quickly */
html:not(.no-motion) .mulder__svg.is-live .mulder__ln { transition: opacity 0.2s ease; }
.mulder__chart .mulder__svg.has-lit .mulder__ln:not(.is-lit) { opacity: 0.12 !important; }
.mulder__chart .mulder__svg.has-lit .mulder__disc:not(.is-lit):not(.is-faint) { opacity: 0.45; }

/* The lesson's steps ------------------------------------------------------------------------------- */
.mulder__step { margin-top: 2.4rem; }
.mulder__step > :is(h2, h3) { margin-top: 0; }
.article__body > h2 + .mulder__step, .article__body > p + .mulder__step { margin-top: 1.6rem; }
.mulder__step + :is(h2, p) { margin-top: 2.4rem; }
.mulder__words > :first-child { margin-top: 0; }
/* On a phone: the ring, in the page's flow, then the dot points and the words under it */
.mulder__chart { margin: 0.5rem 0 0.9rem; }
.mulder__chart .mulder__svg { width: min(100%, 18rem); margin-inline: auto; }

/* A step's dot points, one per line drawn, each led by its line between its two minerals: they lead the
   words on a phone, and sit under the chart on a wide screen */
.mulder__lead { margin: 0 0 1.3rem; }
.mulder__chart .mulder__lead--beside { display: none; }
.mulder__points { display: grid; gap: 0.6rem; margin: 0; padding: 0; list-style: none; font-size: 0.92rem; line-height: 1.45; color: var(--ink-2); }
.article__body .mulder__points li { margin: 0; }
.mulder__points b { color: var(--ink); font-weight: 750; }
/* hover or tap one, and its line lights (an extra for the eye: the words say it all, so it asks nothing of a keyboard) */
.mulder__points li[data-line] { border-radius: 6px; transition: background-color 0.2s ease, box-shadow 0.2s ease; }
.mulder__points li.is-lit { background: rgba(244, 202, 76, 0.28); box-shadow: 0 0 0 0.3rem rgba(244, 202, 76, 0.28); }
.mulder__pair { display: inline-flex; align-items: center; gap: 0.1rem; margin-right: 0.45rem; vertical-align: -0.32em; }
.mulder__pair .mulder__dot { width: 1.35rem; height: 1.35rem; font-size: 0.75rem; border-width: 1.3px; }
.mulder__pair .mulder__swatch { width: 1.75rem; }
.mulder__pair--sure .mulder__swatch + .mulder__swatch { margin-left: -0.2rem; }
/* the twelve, round the ring */
.mulder__key { display: flex; flex-wrap: wrap; gap: 0.3rem 0.75rem; margin: 0 0 0.85rem; padding: 0; list-style: none; font-size: 0.84rem; font-weight: 650; color: var(--ink-2); }
.mulder__key li { display: inline-flex; align-items: center; gap: 0.35rem; }
.mulder__key small { font-size: 0.78rem; font-weight: 600; color: var(--ink-3); }
/* "Where it happens": a painted spot beside each place's paragraph (the soil, the root's doors, the plant, stock) */
.mulder__words .mulder__where { display: flow-root; }
.mulder__spot { float: left; display: block; width: 6rem; margin: 0.1rem 1rem 0.3rem 0; }
.mulder__spot img { display: block; width: 100%; height: auto; mix-blend-mode: multiply; }
@media (max-width: 560px) { .mulder__spot { width: 5rem; margin-right: 0.85rem; } }
.mulder__gist { margin-top: 1.1rem; padding: 0.75rem 1rem; background: #fdf3d3; border: 1.5px solid rgba(30, 43, 34, 0.18); border-radius: 11px 9px 13px 10px; font-size: 0.95rem; }
.article__body .mulder__gist b { color: var(--ink); }

/* a line's kind, small: solid or dashed, its weight, and a one-way line's arrowhead at its middle */
.mulder__swatch { flex: none; width: 2.5rem; height: 0.9rem; overflow: visible; }
.mulder__swatch path { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.4; }
.mulder__swatch--holds path { stroke: var(--earth); }
.mulder__swatch--needs path { stroke: var(--leaf); }
.mulder__swatch path.mulder__swatch-head { stroke: none; }
.mulder__swatch--holds .mulder__swatch-head { fill: var(--earth); }
.mulder__swatch--needs .mulder__swatch-head { fill: var(--leaf); }
.mulder__swatch.is-strong path:first-child { stroke-width: 3.6; }
.mulder__swatch.is-some path:first-child { stroke-width: 2.4; }
.mulder__swatch.is-thin path:first-child { stroke-width: 1.4; stroke-opacity: 0.8; }
.mulder__swatch.is-thin .mulder__swatch-head { fill-opacity: 0.8; }

/* The explorer ------------------------------------------------------------------------------------ */
/* On a phone: the minerals, the answer under them, the drawing, then the panel. Wide: the drawing holds
   still on the left, and the minerals, answer and panel are on the right, so a tap moves neither. */
.mulder__explore {
  display: grid; gap: 0.9rem 1.6rem; margin: 1.3rem 0 1.4rem; padding: clamp(0.85rem, 2.6vw, 1.35rem);
  background: var(--paper); border: 1.5px solid rgba(30, 43, 34, 0.24); border-radius: 16px 12px 18px 13px;
}
.mulder__pickhead { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.75rem; margin-bottom: 0.5rem; }
.mulder__label { margin: 0; font: 800 0.7rem/1.2 var(--f-body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.article__body .mulder__tally { margin: 0 0 0 auto; font-size: 0.84rem; font-weight: 700; color: var(--ink-2); }
:is(.mulder__clear, .mulder__chip, .mulder__set, .mulder__back) {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px; padding: 0.4rem 0.95rem;
  border: 1.5px solid rgba(30, 43, 34, 0.3); border-radius: 999px; background: var(--card); color: var(--ink);
  font: 700 0.88rem/1.2 var(--f-body); text-align: left; cursor: pointer;
}
:is(.mulder__clear, .mulder__chip, .mulder__set, .mulder__back, .mulder__row):hover:not(:disabled) { border-color: var(--ink); }
:is(.mulder__clear, .mulder__chip):disabled { opacity: 0.45; cursor: default; }
.mulder__clear { padding-inline: 0.85rem; }
/* the minerals as tiles, four across: the disc over its name */
.mulder__chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.4rem; }
.mulder__chip { flex-direction: column; justify-content: center; gap: 0.2rem; padding: 0.4rem 0.15rem; border-radius: 12px 10px 13px 11px; font-size: 0.76rem; text-align: center; overflow-wrap: normal; hyphens: manual; }
.mulder__chip[aria-pressed="true"] { background: var(--wattle-2); border-color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
/* the answer, in up to three lines, kept that tall so the drawing under it holds still */
.article__body .mulder__answer { min-height: 5.4em; margin: 0.6rem 0 0; padding: 0.55rem 0.8rem; border-left: 4px solid var(--wattle); background: var(--card); border-radius: 0 10px 10px 0; font-size: 0.92rem; font-weight: 650; line-height: 1.4; color: var(--ink); }
.mulder__wheel { width: min(100%, 21rem); justify-self: center; }
.mulder__panel { min-width: 0; }
.mulder__view h3 { display: flex; align-items: center; gap: 0.55rem; margin: 0 0 0.5rem; font-size: var(--step-1); line-height: 1.2; scroll-margin-top: calc(var(--hub-top, 7.4rem) + 1rem); }
.mulder__view h3:focus { outline: none; }
.mulder__view h3:focus-visible { outline: 2px solid var(--canopy); outline-offset: 4px; border-radius: 4px; }
.mulder__view h3 .mulder__swatch { width: 2.2rem; }
.mulder__view h3.is-set { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
.mulder__dots { display: inline-flex; flex: none; gap: 0.15rem; }
.mulder__view > p { margin: 0.45rem 0 0; }
.mulder__view .mulder__sure { display: block; margin-top: 0.45rem; }
.mulder__view .mulder__label { margin: 1.1rem 0 0.45rem; }
.mulder__view .mulder__points { margin-top: 0.9rem; font-size: 0.88rem; }
.mulder__count { font-size: 0.88rem; }
.article__body .mulder__balance { font-weight: 650; color: var(--ink); }
.mulder__rows, .mulder__sets { display: grid; gap: 0.4rem; margin: 0.6rem 0 0; padding: 0; list-style: none; }
.mulder__row {
  display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); align-items: center; gap: 0.1rem 0.65rem; width: 100%;
  min-height: 44px; padding: 0.45rem 0.75rem; border: 1.5px solid rgba(30, 43, 34, 0.18); border-radius: 10px 12px 10px 11px;
  background: var(--card); color: var(--ink); font: 650 0.92rem/1.3 var(--f-body); text-align: left; cursor: pointer;
}
.mulder__row .mulder__swatch { grid-row: span 2; }
.mulder__row small { color: var(--ink-3); font-size: 0.8rem; font-weight: 600; }
/* a set from the lesson: its colours, its name, and its minerals by name */
.mulder__set { width: 100%; border-radius: 12px 10px 13px 11px; font-weight: 600; padding-left: 0.6rem; }
.mulder__set b { font-weight: 800; }
.mulder__set .mulder__dot { width: 0.85rem; height: 0.85rem; border-width: 1.2px; }
.mulder__set .mulder__dots { gap: 2px; }
.mulder__back { margin-bottom: 0.7rem; padding-left: 0.8rem; font-size: 0.84rem; }
.mulder__back::before { content: "←"; }

/* the explorer's drawing: what's picked stands out, the rest steps back and takes no taps; the whole chart
   carries no arrowheads */
.mulder__wheel .mulder__ln, .mulder__wheel .mulder__disc { transition: opacity 0.3s ease; }
.mulder__wheel .mulder__ln.is-off { opacity: 0.06; }
.mulder__wheel .mulder__ln.is-off .mulder__head, .mulder__wheel .is-whole .mulder__head { display: none; }
.mulder__wheel .has-line .mulder__ln:not(.is-line) { opacity: 0.12; }
.mulder__wheel .mulder__ln:is(.is-line, .is-hover) .mulder__stroke { stroke-width: 5.2; }
.mulder__wheel .mulder__disc.is-picked .mulder__halo { opacity: 1; }
.no-motion .mulder__wheel :is(.mulder__ln, .mulder__disc) { transition: none; }

/* Every line, in words; the minerals on the chart */
.mulder__fold { margin-top: 0.6rem; border-top: 1.5px dashed rgba(30, 43, 34, 0.3); }
.mulder__fold + .mulder__fold { margin-top: 0; }
.mulder__fold:last-of-type { border-bottom: 1.5px dashed rgba(30, 43, 34, 0.3); }
.mulder__fold summary { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; padding: 0.5rem 0; font-weight: 700; color: var(--canopy); cursor: pointer; list-style: none; }
.mulder__fold summary::-webkit-details-marker { display: none; }
.mulder__fold summary::before { content: "+"; display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border: 1.5px solid currentColor; border-radius: 50%; font-size: 1rem; line-height: 1; }
.mulder__fold[open] summary::before { content: "−"; }
.mulder__lines { display: grid; gap: 1rem; margin: 0.4rem 0 1.2rem; }
.mulder__line dt { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; color: var(--ink); }
.mulder__line dd { margin: 0.25rem 0 0 3.1rem; color: var(--ink-2); }
.mulder__line dd a, .mulder__minerals a, .mulder__view a { color: var(--canopy); text-decoration-color: var(--wattle); text-decoration-thickness: 2px; }
.mulder__sure { display: block; margin-top: 0.2rem; font-size: 0.84rem; font-weight: 650; color: var(--ink-3); }
.mulder__minerals { display: grid; gap: 0.55rem; margin: 0.4rem 0 1.2rem; padding: 0; list-style: none; color: var(--ink-2); }
.mulder__minerals a { font-weight: 700; }

/* Wide enough: each step's chart and its dot points beside the words, in the page's flow; the explorer's
   drawing on the left, the rest on the right */
@container mulder (min-width: 40rem) {
  .mulder__step { display: grid; grid-template-columns: minmax(0, 1fr) minmax(15rem, 0.9fr); grid-template-rows: auto 1fr; grid-template-areas: "head chart" "words chart"; column-gap: 2.2rem; align-items: start; }
  .mulder__step > :is(h2, h3) { grid-area: head; }
  .mulder__step > .mulder__words { grid-area: words; }
  .mulder__step > .mulder__chart { grid-area: chart; margin: 0.2rem 0 0; }
  .mulder__words > .mulder__lead { display: none; }
  .mulder__chart .mulder__lead--beside { display: block; margin: 0.9rem 0 0; }
  .mulder__chart .mulder__svg { width: min(100%, 24rem); }
  .mulder__explore { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "wheel pick" "wheel panel"; align-items: start; }
  .mulder__pick { grid-area: pick; }
  .mulder__wheel { grid-area: wheel; width: 100%; }
  .mulder__panel { grid-area: panel; }
  .article__body .mulder__balance { display: none; }
}

/* On a phone, the explorer takes the card's edge too */
@media (max-width: 560px) {
  .wiki__article .mulder__explore { margin-inline: calc(0.3rem - clamp(1.4rem, 3.5vw, 2.8rem)); border-radius: 12px; }
}

/* On paper: the steps, each chart small beside its words, the dot points leading them, and every line in
   words; not the explorer */
@media print {
  .hub-page--article .mulder__explore { display: none !important; }
  .hub-page--article .article__body:has([data-mulder]) > * { max-width: none; }
  .hub-page--article .mulder__step { display: grid; grid-template-columns: minmax(0, 1fr) 54mm; grid-template-rows: auto 1fr; grid-template-areas: "head chart" "words chart"; column-gap: 6mm; align-items: start; margin-top: 5mm; break-inside: avoid; }
  .hub-page--article .mulder__words { padding-bottom: 0 !important; }
  .hub-page--article .mulder__words > .mulder__lead { display: block; }
  .hub-page--article .mulder__chart .mulder__lead--beside { display: none; }
  .hub-page--article .mulder__step > :is(h2, h3) { grid-area: head; margin-top: 0; }
  .hub-page--article .mulder__step > .mulder__words { grid-area: words; }
  .hub-page--article .mulder__step > .mulder__chart { grid-area: chart; position: static; width: 54mm; margin: 0; padding: 0; background: none; }
  .hub-page--article .mulder__chart::after { display: none; }
  .hub-page--article .mulder__chart .mulder__svg { width: 54mm !important; }
  .hub-page--article :is(.mulder__key, .mulder__points) { font-size: 8.5pt; }
  .hub-page--article .mulder__dot { width: 4.2mm; height: 4.2mm; font-size: 6pt; }
  .hub-page--article .mulder__gist { padding: 2mm 3mm; font-size: 9.5pt; }
  .hub-page--article .mulder__fold { border: 0; }
  .hub-page--article .mulder__fold summary { padding: 0; min-height: 0; font-size: 13pt; color: var(--ink); }
  .hub-page--article .mulder__fold summary::before { display: none; }
  .hub-page--article .mulder__line { break-inside: avoid; }
  .hub-page--article .mulder__line dd { margin-left: 0; }
}
