/* Derivatives of Parametric Curves: 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:
     \xs  blue    the x side: x, its formula, dx/dt and the run;
     \ys  green   the y side: y, its formula, dy/dt and the rise;
     \slp pink    the slope dy/dx and its tangent line;
     \tm, \tp     orange / violet, section 2 and practice 3 only: the two times at a crossing (t = −√3, t = √3);
     \ccd, \ccu   orange / violet, section 4 and practice 6–7 only: concave down, concave up. */

/* a chain or goal written twice: the wide break above 640 px, the narrow one (one move per line) below */
:root[data-alive-ui] body main.col .pd-narrow{display:none}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .pd-wide{display:none}
  :root[data-alive-ui] body main.col .pd-narrow{display:block}
}

/* a figure beside its rows takes its own width, and the rows the rest: at the shared .9fr/1.1fr split these
   400 px figures were drawn at about 70% of their size, their labels with them */
:root[data-alive-ui] body main.col .look-pair.pd-pair{grid-template-columns:auto minmax(0,1fr);column-gap:16px}
/* a wide, short figure sits over its rows, and the rows sit side by side under it */
:root[data-alive-ui] body main.col .look-pair.pd-stack{grid-template-columns:1fr;gap:14px}
:root[data-alive-ui] body main.col .look-pair.pd-stack>.look-rows{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:30px 56px}
:root[data-alive-ui] body main.col .look-pair.pd-stack>.look-rows>.row{margin:0}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .look-pair.pd-pair{grid-template-columns:1fr}
  /* on a phone the figure may use the card's side padding, so it stays near its own size */
  :root[data-alive-ui] body main.col :is(.look-pair.pd-pair,.look-pair.pd-stack)>figure.diagram{margin:0 -8px}
  :root[data-alive-ui] body main.col>section>figure.diagram{padding:14px 6px}
}

/* the lesson's one formula, and its second-derivative partner, sit centred in their card */
:root[data-alive-ui] body main.col .look-card.pd-formula .math-chain{justify-content:center}
:root[data-alive-ui] body main.col .look-card .row.pd-gap{margin-top:20px}

/* practice: two answer groups in one part sit side by side when there is room */
:root[data-alive-ui] body main.col .prob .pd-fields{display:flex;flex-wrap:wrap;gap:6px 36px}
:root[data-alive-ui] body main.col .prob .pd-fields legend{font:500 17px/1.4 'STIX Two Text',Georgia,serif;color:var(--ink);margin-bottom:2px}

/* choices: a plain group of pills (the field box the text inputs get would otherwise draw round each tick box) */
:root[data-alive-ui] body main.col .prob fieldset.choices{border:0;padding:0;margin:6px 0 4px;min-width:0}
:root[data-alive-ui] body main.col .prob fieldset.choices input{width:auto;height:auto;min-width:0;min-height:0;margin:0;padding:0;border:0;box-shadow:none;background:none;flex:none}
:root[data-alive-ui] body main.col .prob fieldset.choices legend{padding:0}
/* the options sit in a row that wraps, so a choice group stays short; the fields' collapse on Explain keeps working */
:root[data-alive-ui] body main.col .prob fieldset.choices{display:flex;flex-wrap:wrap;gap:8px 10px}
:root[data-alive-ui] body main.col .prob fieldset.choices legend{width:100%;margin-bottom:4px}
:root[data-alive-ui] body main.col .prob fieldset.choices label{margin:0;min-width:0}
:root[data-alive-ui] body main.col .prob .answer-fields.choice-fields{max-height:420px}
:root[data-alive-ui] body main.col .prob.explaining .answer-fields.choice-fields{max-height:0}

/* Key concepts: a formula row with no label head takes the whole width (the shared .kr keeps a 120 px label column) */
:root[data-alive-ui] body main.col .kc .pd-krows .kr{grid-template-columns:minmax(0,1fr)}
:root[data-alive-ui] body main.col .kc .pd-krows .kr{border:0;padding-top:0;margin-top:0}
:root[data-alive-ui] body main.col .kc .pd-krows .kv{display:flex;justify-content:center}
:root[data-alive-ui] body main.col .kc .pd-krows .math-chain{justify-content:center}
:root[data-alive-ui] body main.col .kc .knote+.pd-krows{margin-top:12px}

/* this page's cards hold short groups of rows: they sit centred in their card, and a figure sits centred over its rows */
:root[data-alive-ui] body main.col :is(.look-card,.look-case) .math-chain{justify-content:center}
:root[data-alive-ui] body main.col .look-pair.pd-stack>figure.diagram{justify-self:center}
/* a row beside a figure that it leads into: the row first, the figure on the right */
:root[data-alive-ui] body main.col .look-pair.pd-pair.pd-pair-r{grid-template-columns:minmax(0,1fr) auto}
:root[data-alive-ui] body main.col .look-pair.pd-pair-r .math-chain{justify-content:center}
@media (max-width:640px){:root[data-alive-ui] body main.col .look-pair.pd-pair.pd-pair-r{grid-template-columns:1fr}}
