/* Composition of Limits: page layout. No colours here: every colour is the course palette's (../lib/lesson-colors.css). */

/* A row whose maths has a second part (a reason in brackets, "although …", the consequence after ⇒): the parts sit on one
   line when there's room and the second drops under the first on a phone, so nothing is cut mid-expression. */
:root[data-alive-ui] body main.col .cl-wrap{display:flex;flex-wrap:wrap;justify-content:center;align-items:baseline;gap:6px 22px}
:root[data-alive-ui] body main.col .cl-wrap>.math-chain,:root[data-alive-ui] body main.col .cl-wrap>.katex-display{margin:0}

/* Every row in a card is centred, like the goal above it, whether its maths is one part or two. */
:root[data-alive-ui] body main.col .look-card .row{text-align:center}
:root[data-alive-ui] body main.col .look-card .row>.math-chain{justify-content:center}
/* The rule's two clauses read as one sentence of maths: a word space between them, not a gap. */
:root[data-alive-ui] body main.col .cl-wrap.cl-tight{column-gap:.4em}

/* The side table: every case on this page is one chain per side of x, "side of x : where the inside goes ⇒ what the
   outside gives". Columns line the sides up, so the student reads down a column to compare the two sides (a blue and a
   pink result) and across a row to follow one side through the composition. The conclusion sits under it, centred. */
:root[data-alive-ui] body main.col .cl-sides{display:grid;grid-template-columns:repeat(3,max-content);justify-content:center;align-items:baseline;gap:12px 14px}
:root[data-alive-ui] body main.col .cl-sides.cl-why4{grid-template-columns:repeat(4,max-content)}
:root[data-alive-ui] body main.col .cl-sides .katex{white-space:nowrap}
:root[data-alive-ui] body main.col .cl-x{grid-column:1;justify-self:end}
:root[data-alive-ui] body main.col .cl-in{grid-column:2}
:root[data-alive-ui] body main.col .cl-then{grid-column:3}
:root[data-alive-ui] body main.col .cl-why{grid-column:4;padding-left:8px}
:root[data-alive-ui] body main.col .look-card .cl-end{margin-top:16px}

/* Key concepts rows carry no label head, so the maths takes the whole row; Key concept 2's quarter-turn figure keeps its
   own width beside its rows. */
:root[data-alive-ui] body main.col .look-krows .kr{grid-template-columns:minmax(0,1fr)}
:root[data-alive-ui] body main.col .look-krows .kv{justify-content:center}
:root[data-alive-ui] body main.col .look-krows .kr{border-top:0}
:root[data-alive-ui] body main.col .look-kgrid .look-kpair{grid-template-columns:max-content minmax(0,1fr)}
/* An answer's left side is read at the statement's size and stays on one line. */
:root[data-alive-ui] body main.col .prob .answer-fields label{font-size:18px}
:root[data-alive-ui] body main.col .prob .answer-fields label .katex{white-space:nowrap}

@media (max-width:640px){
  /* On a phone each side takes two lines, the consequence under where the inside goes, so no cell breaks after ⇒:
     x → 1⁻ : g(x) → 2⁻ / ⇒ f(g(x)) → 3. */
  :root[data-alive-ui] body main.col .cl-sides,:root[data-alive-ui] body main.col .cl-sides.cl-why4{grid-template-columns:repeat(2,max-content);gap:4px 10px}
  :root[data-alive-ui] body main.col .cl-then,:root[data-alive-ui] body main.col .cl-why{grid-column:2;padding-left:0}
  :root[data-alive-ui] body main.col .cl-sides>.cl-x~.cl-x,:root[data-alive-ui] body main.col .cl-sides>.cl-in~.cl-in{margin-top:12px}
  :root[data-alive-ui] body main.col .look-kgrid .look-kpair{grid-template-columns:minmax(0,1fr)}
  /* A figure standing in a section keeps its card but gives up side padding on a phone, so the pair of graphs is drawn
     near its own size and its labels stay readable. */
  :root[data-alive-ui] body main.col>section>figure.diagram{padding:14px 8px}
}
