/* Net Change and Average Value: page layout. No colours here: every colour is the course palette's (../lib/lesson-colors.css).
   Colour macros (katex-macros.json, meanings in planning/colour.md): \rte the rate (violet), \amt the amount (green),
   \gain what adds (blue), \loss what takes away (pink), \avg the average value (orange). */

/* A set of short facts or givens that wrap whole, one fact never split across lines (goal rows, sign facts, candidates). */
:root[data-alive-ui] body main.col .nc-set{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:6px 34px}
:root[data-alive-ui] body main.col .nc-set>*{flex:none;max-width:100%;margin:0}
:root[data-alive-ui] body main.col .look-goal .nc-set+.nc-set{margin-top:4px}

/* A worked chain: the wide break holds two moves to a line, the narrow one takes one "=" per line. */
:root[data-alive-ui] body main.col .nc-narrow{display:none}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .nc-wide{display:none}
  :root[data-alive-ui] body main.col .nc-narrow{display:block}
}

/* A figure beside its rows keeps its own drawn size; the rows take what's left. */
@media (min-width:641px){
  :root[data-alive-ui] body main.col .look-pair{grid-template-columns:max-content minmax(0,1fr)}
}

/* A practice problem's graph is drawn at its own size, not stretched to the column. */
:root[data-alive-ui] body main.col .prob figure.diagram{margin:14px 0 6px}
:root[data-alive-ui] body main.col .prob figure.diagram>svg{width:auto;max-width:100%;height:auto;display:block;margin:0 auto}

/* Inside a card a set of facts reads from the left, like the rows around it; a goal stays centred. */
:root[data-alive-ui] body main.col .look-card .nc-set{justify-content:flex-start}
:root[data-alive-ui] body main.col .look-goal .nc-set>span{white-space:nowrap}

/* The two cases of a comparison read as two matching columns: heading and working centred in each. */
:root[data-alive-ui] body main.col .look-case :is(.look-q,.look-a) .math-chain{justify-content:center}

/* On a phone the goal takes the text size, like the cards' maths, so its givens fit on their lines. */
@media (max-width:640px){
  :root[data-alive-ui] body main.col .look-goal .katex{font-size:1.05em}
}
/* On a small phone a figure standing alone keeps more of its drawn width: its card's side padding narrows. */
@media (max-width:420px){
  :root[data-alive-ui] body main.col>section>figure.diagram{padding-left:8px;padding-right:8px}
}
