/* Exponential Growth and Decay: page layout. No colours here: every colour is the course palette's (../lib/lesson-colors.css).
   Colour meanings (planning/colour.md), one macro each in katex-macros.json: \kr pink, k (the rate over the amount) and
   every number that becomes it; \fst green, the factor over one stretch of a set length (×2 every 3 hours, ×½ every
   half-life); \frd orange, the factor between two readings, over the whole time between them (×4, the 0.4 left);
   \gap blue, the gap T − 20 and the amount minus the value it approaches; \room violet, the room temperature and that
   value. Amounts, rates, times and answers stay ink. */

/* A card's rows sit centred, like the goal above them. */
:root[data-alive-ui] body main.col :is(.look-card,.look-krows) .row{display:flex;justify-content:center}
:root[data-alive-ui] body main.col .look-card .row.eg-gap{margin-top:20px}

/* A run of short pieces (givens, or steps joined by →): each piece wraps whole, so a line never breaks inside one. */
:root[data-alive-ui] body main.col .eg-chips{display:flex;flex-wrap:wrap;justify-content:center;align-items:baseline;gap:8px 30px}
:root[data-alive-ui] body main.col .eg-chips.eg-steps{gap:8px 14px}
:root[data-alive-ui] body main.col .eg-chip{white-space:nowrap;min-width:0}
:root[data-alive-ui] body main.col .eg-chip .math-chain{margin:0;flex-wrap:nowrap}
:root[data-alive-ui] body main.col .eg-chip .katex-display{margin:0}
:root[data-alive-ui] body main.col .look-goal.eg-chips{gap:8px 36px}
:root[data-alive-ui] body main.col .look-card .eg-chips+.row,:root[data-alive-ui] body main.col .look-card .row+.eg-chips,:root[data-alive-ui] body main.col .look-card .eg-chips+.eg-chips{margin-top:12px}
:root[data-alive-ui] body main.col .look-card .eg-chips.eg-gap{margin-top:20px}

/* One chain at two widths: one line on a wide screen, one move per line on a phone. */
:root[data-alive-ui] body main.col :is(.eg-narrow,.look-card .row.eg-narrow){display:none}
@media (max-width:640px){
  :root[data-alive-ui] body main.col :is(.eg-wide,.look-card .row.eg-wide,.look-card .eg-chips.eg-wide){display:none}
  :root[data-alive-ui] body main.col :is(.eg-narrow,.look-card .row.eg-narrow){display:flex;justify-content:center}
}

/* A figure with the rows it shows, in one card: the figure at its own size, the rows under it. */
:root[data-alive-ui] body main.col .look-card.eg-stack>figure.diagram{display:block;width:fit-content;max-width:100%;margin:0 auto;justify-self:center;align-self:center}
:root[data-alive-ui] body main.col .look-card.eg-stack>figure.diagram>svg:not(.katex svg){display:block;width:auto;max-width:100%;height:auto;margin:0 auto}
:root[data-alive-ui] body main.col .look-card.eg-stack figure.diagram+*{margin-top:16px}
:root[data-alive-ui] body main.col .look-card.eg-stack>*+figure.diagram{margin:20px auto 0}

/* Section 2's two ways of growing, one above the other, their names beside them and their numbers starting together. */
:root[data-alive-ui] body main.col .eg-vs{display:grid;grid-template-columns:auto auto;justify-content:center;align-items:center;gap:10px 22px}
:root[data-alive-ui] body main.col .eg-vs .math-chain{margin:0;justify-content:flex-start}
:root[data-alive-ui] body main.col .eg-vs .katex-display{margin:0;text-align:left}
:root[data-alive-ui] body main.col .eg-lab{font:500 13px/1.4 var(--lf-label);letter-spacing:.05em;text-transform:uppercase;color:var(--body);text-align:right}

/* Key concepts: each row's name over its maths, the maths centred; space, not rules, between rows. */
:root[data-alive-ui] body main.col .look-kgrid .look-krows .kr{display:block;padding:6px 0;border-top:0}
:root[data-alive-ui] body main.col .look-kgrid .look-krows .kr+.kr{margin-top:6px}
:root[data-alive-ui] body main.col .look-kgrid .look-krows .kh{display:block;text-transform:none;text-align:center;margin-bottom:4px}
:root[data-alive-ui] body main.col .look-kgrid .look-krows .kv{display:flex;justify-content:center;overflow:visible;max-width:none}
:root[data-alive-ui] body main.col .look-kgrid .look-krows .kv .math-chain{margin:0;justify-content:center}
:root[data-alive-ui] body main.col .look-kgrid .look-krows .kv .katex-display{margin:0}

/* A goal is one equation, so the lamp passes over it: one line on a wide screen, its givens on two lines on a phone. */
:root[data-alive-ui] body main.col .look-goal.eg-narrow{display:none}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .look-goal.eg-wide{display:none}
  :root[data-alive-ui] body main.col .look-goal.eg-narrow{display:block}
}
/* Section 4's age chain needs the full column on one line: under 820 px it goes one move per line. */
:root[data-alive-ui] body main.col .look-card .row.eg-narrow-md{display:none}
@media (max-width:820px){
  :root[data-alive-ui] body main.col .look-card .row.eg-wide-md{display:none}
  :root[data-alive-ui] body main.col .look-card .row.eg-narrow-md{display:flex;justify-content:center}
}
/* Newton's law in Key concepts: two pieces side by side, or aligned on its "=" on a narrow phone. */
:root[data-alive-ui] body main.col .look-kgrid .eg-narrow-kc{display:none}
@media (max-width:420px){
  :root[data-alive-ui] body main.col .look-kgrid .eg-wide-kc{display:none}
  :root[data-alive-ui] body main.col .look-kgrid .eg-narrow-kc{display:block}
}
/* Key concepts: one column on this page. Each entry is a formula with a five- to eight-line note; at half width the
   notes ran 15 lines in a 240 px column and Newton's law broke inside its formula. */
:root[data-alive-ui] body main.col .look-kgrid{grid-template-columns:1fr}
:root[data-alive-ui] body main.col .look-kgrid .kn>span{flex:1;min-width:0}
:root[data-alive-ui] body main.col .look-kgrid .kn .katex{white-space:nowrap}

/* Practice: a unit after its answer box. */
:root[data-alive-ui] body main.col .prob .answer-fields label>.katex:last-child{margin-left:8px}
:root[data-alive-ui] body main.col .sol .eg-chips{margin:8px 0}

@media (max-width:640px){
  /* On a phone a figure takes the card's width: the side padding a card of text needs would draw a figure and its
     labels under three quarters of their size (the figures are drawn 420 px wide, the column is about 340). */
  :root[data-alive-ui] body main.col>section>figure.diagram{padding:14px 6px}
  :root[data-alive-ui] body main.col .look-card.eg-stack{padding:14px 6px}
  :root[data-alive-ui] body main.col .look-card.eg-stack>:not(figure){padding:0 8px}
  :root[data-alive-ui] body main.col .eg-vs{grid-template-columns:auto;justify-items:center;gap:4px}
  :root[data-alive-ui] body main.col .eg-vs .eg-lab{text-align:center}
  :root[data-alive-ui] body main.col .eg-vs .eg-lab:not(:first-child){margin-top:12px}
  :root[data-alive-ui] body main.col .eg-chips{gap:6px 22px}
  :root[data-alive-ui] body main.col .look-kgrid .look-krows{padding:10px 8px}
}
