/* Implicit Differentiation: this page's own layout. It defines no colours: every colour on the page is a course palette
   role (lib/lesson-colors.css, through alive/lesson-look.css), set in the maths by the macros in katex-macros.json:
     \der (lc-green)  dy/dx wherever it is part of true working, y', and section 1's paired 2x that stands where dy/dx will;
     \ins (lc-violet) the inside, kept whole: section 1's paired rows (x^2 + 1 and y), section 3's w = xy, practice 6's xy;
     \tp  (lc-pink)   the top of dy/dx: from the row where its pieces first stand apart, to the relation it gives;
     \btm (lc-blue)   the bottom of dy/dx: the coefficients of dy/dx that become it, the bottom, and its relation;
     \pt  (lc-orange) the point where the slope is taken, where it is named or put in (not the points a problem finds).
   Each meaning has its own role. The meanings, and where colour is left out on
   purpose, are planning/colour.md. */

/* a chain broken where it moves on: the wide form on a wide screen, one move to a line on a phone, so nothing scrolls */
:root[data-alive-ui] body main.col .im-narrow{display:none}

/* section 1's paired rows: x^2 + 1 above y, 2x above dy/dx, the rest of the two rows the same (one array, its columns
   pulled together so the brackets hug their inside) */
:root[data-alive-ui] body main.col .im-pair .katex{font-size:1.16em}

/* a chain whose rows say what each move does (section 2's solve, section 4's top and bottom): the labels in a column of
   their own, as wide as the card's longest label, the maths beside them; a row with no label keeps to the maths column */
:root[data-alive-ui] body main.col .im-steps{display:grid;grid-template-columns:max-content minmax(0,1fr);column-gap:22px;row-gap:12px;align-items:center}
:root[data-alive-ui] body main.col .im-steps>.row:not(.im-narrow){display:contents}
:root[data-alive-ui] body main.col .im-steps>.row:not(:has(>.row-label))>*{grid-column:2}
:root[data-alive-ui] body main.col .im-steps .row-label{font:500 15px/1.4 var(--lf-label);min-width:0}
:root[data-alive-ui] body main.col .im-steps .katex-display,:root[data-alive-ui] body main.col .im-steps .math-part{margin:0}

/* a graph beside short rows keeps its own size (these are drawn 339 to 392 px wide, with 16 px labels); the rows take
   what's left. fig-7's six rows need more room than that leaves, so they sit under it, in the same card */
:root[data-alive-ui] body main.col .look-pair.im-own{grid-template-columns:auto minmax(0,1fr)}
:root[data-alive-ui] body main.col .look-pair.im-stack{grid-template-columns:minmax(0,1fr);justify-items:center;gap:14px}
:root[data-alive-ui] body main.col .look-pair.im-stack>.look-rows{width:fit-content;max-width:100%}

/* a written solution's step title on its own line above its sentence: the shared layer has no rule for it, so the title
   ran into the sentence ("Set the numerator to 0A horizontal tangent…"); the rule other pages carry locally */
:root[data-alive-ui] body main.col .sol .ln .step{display:block;font:500 17px/1.4 'STIX Two Text',Georgia,serif;letter-spacing:0;text-transform:none;margin:0 0 2px}

/* section 4's goal: three short lines, read down, so neither question runs off a phone */
:root[data-alive-ui] body main.col .look-goal.im-goal3 .katex{font-size:1.1em}

/* Key concepts: each row's label above its maths, with space rather than rules between rows: beside it, the shared
   label column left a half-width card too little room for the maths */
:root[data-alive-ui] body main.col .look-krows .kr{grid-template-columns:minmax(0,1fr);gap:2px;border-top:0;padding:6px 0}
:root[data-alive-ui] body main.col .look-krows .kr .kh{font-size:16px}
/* a row too long for the card on a phone breaks after its arrow (its two sides are each one group in the TeX) */
:root[data-alive-ui] body main.col .look-krows .kv .katex{white-space:normal}

@media (max-width:640px){
  :root[data-alive-ui] body main.col .im-wide{display:none}
  :root[data-alive-ui] body main.col .im-narrow{display:block}
  :root[data-alive-ui] body main.col .im-steps{grid-template-columns:minmax(0,1fr);row-gap:6px}
  :root[data-alive-ui] body main.col .look-pair.im-own{grid-template-columns:minmax(0,1fr)}
  :root[data-alive-ui] body main.col .look-pair.im-own>.look-rows{justify-self:center}
  :root[data-alive-ui] body main.col .im-steps>.row.im-narrow{display:contents}
  :root[data-alive-ui] body main.col .im-steps>.row.im-wide{display:none}
  :root[data-alive-ui] body main.col .im-steps>.row>*{grid-column:1!important}
  :root[data-alive-ui] body main.col .im-steps>.row+.row>.row-label{margin-top:10px}
  :root[data-alive-ui] body main.col .im-pair .katex{font-size:1em}
  :root[data-alive-ui] body main.col .look-goal.im-goal3 .katex{font-size:1em}
}
