/* Riemann Sums: page layout. No colours here: every colour is the course palette's (../lib/lesson-colors.css), through
   the macros in katex-macros.json (planning/colour.md):
     \lft  pink    the left sum: its heights, its value, and in section 6 the left end 4(i − 1)/n;
     \rgt  blue    the right sum: its heights, its value, and in section 6 the right ends and the right bound;
     \mdp  green   the midpoint sum: its heights, the middles, its value and its miss;
     \trp  violet  the trapezoid sum: each trapezoid's average height, its value and its miss;
     \fit  orange  the rectangles that fit or cover the region (inscribed and circumscribed), their heights and values.
   Widths, the curve, the true value 80/3 and routine arithmetic stay ink. */

/* A figure inside a card of rows is drawn at its own size, centred above the rows it explains. */
:root[data-alive-ui] body main.col .look-card>figure.diagram{margin:0 auto 18px;min-width:0}
:root[data-alive-ui] body main.col .look-card>figure.diagram>svg{width:auto;max-width:100%;height:auto;display:block;margin:0 auto}
/* A figure beside its rows keeps its own width and the rows take the rest; under 640 px the shared look stacks them. */
@media (min-width:641px){
  :root[data-alive-ui] body main.col .look-pair.rs-fit{grid-template-columns:auto minmax(0,1fr)}
}
:root[data-alive-ui] body main.col .look-pair.rs-fit>.look-rows .math-chain{justify-content:center}
/* Rows in a card sit centred under their figure, so figure and rows read as one piece. */
:root[data-alive-ui] body main.col .look-card .math-chain{justify-content:center}
:root[data-alive-ui] body main.col .look-card .row.rs-gap{margin-top:22px}
/* A short fact on a line of its own, outside any card: normal display size, unlit. */
:root[data-alive-ui] body main.col .rs-line{margin:14px 0 18px}
:root[data-alive-ui] body main.col .rs-line .math-chain{justify-content:center}
:root[data-alive-ui] body main.col .rs-line .katex{font-size:1.1em}
/* Two small groups of rows side by side on a wide screen, one under the other on a phone. */
:root[data-alive-ui] body main.col .look-card .rs-duo{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:12px 56px}
:root[data-alive-ui] body main.col .look-card .rs-duo>.row{margin:0}
:root[data-alive-ui] body main.col .look-card .row+.rs-duo{margin-top:16px}
/* Rows with a label: the label beside its maths on a wide screen, so the maths of the rows starts at one place and
   lines up (section 1's right sum under its left sum); on a phone the label sits over its maths. */
:root[data-alive-ui] body main.col .rs-grid{display:grid;grid-template-columns:max-content max-content;gap:14px 24px;align-items:center;width:fit-content;max-width:100%;margin:0 auto}
:root[data-alive-ui] body main.col .rs-grid.rs-3{grid-template-columns:max-content max-content max-content;column-gap:36px}
:root[data-alive-ui] body main.col .look-card .rs-grid>.row{margin:0;min-width:0}
:root[data-alive-ui] body main.col .look-card .rs-grid .math-chain{justify-content:flex-start}
:root[data-alive-ui] body main.col .look-card .rs-grid+.row,:root[data-alive-ui] body main.col .look-card .row+.rs-grid{margin-top:20px}
:root[data-alive-ui] body main.col .rs-lab{font:500 17px/1.35 'STIX Two Text',Georgia,serif}
:root[data-alive-ui] body main.col .rs-lab:not([class*="lc-"]){color:var(--ink)}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .rs-grid,:root[data-alive-ui] body main.col .rs-grid.rs-3{grid-template-columns:minmax(0,1fr);gap:6px;width:100%}
  :root[data-alive-ui] body main.col .rs-grid>.rs-lab:not(:first-child){margin-top:14px}
  :root[data-alive-ui] body main.col .look-card .rs-grid .math-chain{justify-content:center}
  :root[data-alive-ui] body main.col .rs-grid>.rs-lab{text-align:center}
}
/* A figure beside its rows in Key concepts keeps its own width too. */
@media (min-width:641px){
  :root[data-alive-ui] body main.col .look-kpair.rs-fit{grid-template-columns:auto minmax(0,1fr)}
}
/* A practice problem's table, under its statement. */
:root[data-alive-ui] body main.col .prob .st .rs-table{margin:14px 0 4px}
:root[data-alive-ui] body main.col .prob .st .rs-table .math-chain{justify-content:flex-start}
:root[data-alive-ui] body main.col .prob .st .rs-table .katex{font-size:1.1em}
@media (max-width:640px){:root[data-alive-ui] body main.col .prob .st .rs-table .katex{font-size:1em}}
/* A film's title keeps its maths on one line: KaTeX would otherwise break a short sum after its + sign. */
:root[data-alive-ui] body main.col .ex>.st .katex{white-space:nowrap}
/* A chain that reads one move per line on a phone: a wide and a narrow setting of the same maths, one shown per width. */
:root[data-alive-ui] body main.col .rs-narrow{display:none}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .rs-wide{display:none}
  :root[data-alive-ui] body main.col .rs-narrow{display:block}
}
