/* Chain Rule: 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:
     \ins  (lc-blue)   the inside, kept whole, its name w, and its value at a point;
     \dins (lc-green)  the inside's derivative, where it comes out as a factor;
     \lyr  (lc-pink)   in several layers only (section 5 and practice 5), the middle layer and its derivative.
     \out  (lc-orange) the outside function and the outside's derivative (the outermost layer in section 5).
   The meanings, and where colour is left out on purpose, are planning/colour.md. */

/* Section 1: the power-rule guess and the expanded result, their results aligned so "short by a factor of 3" is seen */
:root[data-alive-ui] body main.col .ch-cmp{display:grid;grid-template-columns:auto auto auto;justify-content:center;align-items:center;gap:16px 12px}
:root[data-alive-ui] body main.col .ch-cmp .ch-lab{font:500 15px/1.35 var(--lf-label);max-width:6.5em}
:root[data-alive-ui] body main.col .ch-cmp .ch-work{text-align:right}
:root[data-alive-ui] body main.col .ch-cmp .katex{font-size:1em;white-space:nowrap}

/* two goals side by side (sections 4 and 6): one equation, set at display size, that wraps between the two on a phone.
   One piece of maths, so the lamp leaves it quiet like any goal (Paper and Lamp §2) */
:root[data-alive-ui] body main.col .ch-goal2{text-align:center}
:root[data-alive-ui] body main.col .ch-goal2 .katex{font-size:1.21em}
/* the two goals are two groups of one line of TeX: the gap between them is set here, so on a phone the second starts flush */
:root[data-alive-ui] body main.col .ch-goal2 .katex-html{display:flex;flex-wrap:wrap;justify-content:center;align-items:baseline;gap:6px 2.4em}

/* section 4's cases: each column's maths centred, so sin(x²) and (sin x)² read as two columns down the section */
:root[data-alive-ui] body main.col .ch-cases .look-case{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center}
:root[data-alive-ui] body main.col .ch-cases .look-case .katex-display,:root[data-alive-ui] body main.col .ch-cases .look-case .math-part{margin:0}
:root[data-alive-ui] body main.col .ch-cases .look-case .katex{font-size:1.1em}

/* the table: one aligned table, centred in its card */
:root[data-alive-ui] body main.col .ch-table{display:flex;justify-content:center}
:root[data-alive-ui] body main.col .ch-table .math-chain{margin:0}

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

/* Key concepts: the rows sit on the tinted sheet, separated by space rather than rules, each row's label above its maths:
   beside it, the shared 150 px label column left a half-width card 78 px 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}
/* displayed rows on the sheet: no extra margin around each */
:root[data-alive-ui] body main.col .look-krows .kv .math-chain{margin:0}

/* the practice tables sit in the statement's column, narrower than the page on a phone */
:root[data-alive-ui] body main.col .prob .st .math-chain{margin:12px 0 4px}

/* Problem 10: the graphs of f and g, each on its own axes, side by side and stacked on a phone */
:root[data-alive-ui] body main.col .prob .st .ch-graphs{display:flex;flex-wrap:wrap;align-items:flex-end;gap:10px 28px;margin:14px 0 4px}
:root[data-alive-ui] body main.col .prob .st .ch-graphs .prob-figure{margin:0;max-width:none}
:root[data-alive-ui] body main.col .prob .st .ch-graphs .prob-figure>svg{width:auto;max-width:100%;height:auto}

/* an answer read as one line: "y = [  ]", "[  ] °C per second" */
:root[data-alive-ui] body main.col .prob .answer-fields label{align-items:center}

@media (max-width:640px){
  :root[data-alive-ui] body main.col .ch-wide{display:none}
  :root[data-alive-ui] body main.col .ch-narrow{display:block}
  :root[data-alive-ui] body main.col .ch-cmp{grid-template-columns:auto;justify-content:start;gap:4px}
  :root[data-alive-ui] body main.col .ch-cmp .ch-lab{margin-top:8px;max-width:none}
  :root[data-alive-ui] body main.col .ch-cmp .ch-lab:first-child{margin-top:0}
  :root[data-alive-ui] body main.col .ch-cmp .ch-work{text-align:left}
  :root[data-alive-ui] body main.col .ch-cmp .ch-work:empty{display:none}
  :root[data-alive-ui] body main.col .ch-cmp .katex{font-size:1em}
  :root[data-alive-ui] body main.col .ch-cases .look-case .katex{font-size:1em}
  :root[data-alive-ui] body main.col .prob .st .math-chain .katex{font-size:.9em}
}
