/* Taylor Polynomials and Error Bounds: page layout. No colours here: every colour is the course palette's (../lib/lesson-colors.css),
   reached through the KaTeX macros in katex-macros.json (\cst \lin \sq \cub \qrt for the constant, x, x², x³ and x⁴ terms;
   \ctr \xp \cm \er for the centre, x, c and M, and the error), as planning/colour.md sets them.
   Every rule is scoped :root[data-alive-ui] body main.col, because the sheet styles outrank a plain page selector. */

/* A chain set once for a wide screen and once, broken more often, for a phone, so nothing scrolls sideways and no line
   breaks inside a term. */
:root[data-alive-ui] body main.col .tp-narrow{display:none}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .tp-wide{display:none}
  :root[data-alive-ui] body main.col .tp-narrow{display:block}
}

/* Row labels on this page name a step ("Second derivative at 0", "Powers of x − 1", "Degree 5"), so they read as words in
   the page's ink: upright, not uppercased (an uppercase X for the variable read as a different letter). */
:root[data-alive-ui] body main.col .row-label{font:500 15px/1.4 var(--lf-label);letter-spacing:0;text-transform:none;font-style:normal;color:var(--ink)}

/* The derivative ladder: each rung's label beside its two lines (the derivative at 0, then what the surviving box is).
   On a phone the label sits over its rung: beside it, the maths broke into four short lines a rung. */
:root[data-alive-ui] body main.col .tp-rung{display:grid;grid-template-columns:184px minmax(0,1fr);column-gap:16px;align-items:center}
:root[data-alive-ui] body main.col .tp-ladder .tp-rung+.tp-rung{margin-top:18px}
:root[data-alive-ui] body main.col .tp-rung .row-label{padding-top:6px}
/* short labels (Degree 4, 5, 6) stay beside their row at every width */
:root[data-alive-ui] body main.col .tp-lrow{display:grid;grid-template-columns:86px minmax(0,1fr);column-gap:16px;align-items:center}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .tp-rung{grid-template-columns:minmax(0,1fr);row-gap:4px}
  :root[data-alive-ui] body main.col .tp-ladder .tp-rung+.tp-rung{margin-top:16px}
  :root[data-alive-ui] body main.col .tp-lrow{grid-template-columns:72px minmax(0,1fr);column-gap:10px}
}

/* Several short facts on one line, each kept whole: they wrap as wholes rather than break inside one. */
:root[data-alive-ui] body main.col .tp-chips{display:flex;flex-wrap:wrap;align-items:baseline;gap:8px 24px}
:root[data-alive-ui] body main.col .tp-chip{white-space:nowrap}
:root[data-alive-ui] body main.col .tp-chip .katex{font-size:1.1em}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .tp-chips{gap:6px 22px}
  :root[data-alive-ui] body main.col .tp-chip .katex{font-size:1em}
}

/* Two cases side by side (powers of x − 1 against powers of x at 1): the label heads its case, and the results sit on the
   same line in both, so "= □" and "= □ + □ + □ + □" are read against each other. */
:root[data-alive-ui] body main.col .tp-cases .look-case{display:flex;flex-direction:column}
:root[data-alive-ui] body main.col .tp-cases .look-q{font:500 15px/1.4 var(--lf-label);color:var(--ink);margin-bottom:10px}

/* A figure beside its rows: half and half, so the figure keeps nearly its own size beside a wide chain. */
:root[data-alive-ui] body main.col .look-pair.tp-even{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px 24px}
:root[data-alive-ui] body main.col .look-pair .look-rows .row+.row{margin-top:16px}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .look-pair.tp-even{grid-template-columns:minmax(0,1fr)}
}

/* Key concepts: an entry with a row and no row head takes the whole width for its maths (the shared two-column row left
   it 120 px). */
:root[data-alive-ui] body main.col .kc .kr:not(:has(.kh)){grid-template-columns:minmax(0,1fr);border-top:0;padding:4px 0}
:root[data-alive-ui] body main.col .kc .kv .math-chain{margin:0}

/* Practice: an answer reads as one line, its left side and its box; a polynomial's box is wider. */
:root[data-alive-ui] body main.col .prob .answer-fields{gap:14px 26px}
:root[data-alive-ui] body main.col .prob .answer-fields label{display:inline-flex;align-items:center;flex-wrap:nowrap;gap:10px;font:400 17px/1.4 'STIX Two Text',Georgia,serif;color:var(--ink)}
:root[data-alive-ui] body main.col .prob .answer-fields label>input{width:150px;flex:none}
:root[data-alive-ui] body main.col .prob .answer-fields label>input.wide{width:280px}
:root[data-alive-ui] body main.col .prob .part+.part{margin-top:22px}
:root[data-alive-ui] body main.col .prob .sol .ln .math-chain{margin:8px 0}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .prob .answer-fields label{flex-wrap:wrap}
  :root[data-alive-ui] body main.col .prob .answer-fields label>input,:root[data-alive-ui] body main.col .prob .answer-fields label>input.wide{width:100%;flex:1 1 180px}
}
/* a statement that opens with a polynomial: on a phone it may break after a + or −, like any sentence */
:root[data-alive-ui] body main.col #p3>.st>div>.katex:first-child{white-space:normal}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .prob .answer-fields label>input,:root[data-alive-ui] body main.col .prob .answer-fields label>input.wide{flex:1 1 84px;min-width:84px}
  :root[data-alive-ui] body main.col .prob .answer-fields label{font-size:16px;gap:8px}
}

/* A chain split at its "=" keeps one baseline, so a part with a fraction and a part without sit on the same line (centred,
   "= 0.025" rode above "3/120"). */
:root[data-alive-ui] body main.col :is(.look-card,.look-rows,.look-case,.look-goal,.look-krows) .math-chain{align-items:baseline}
/* the bound under its case's heading (x = 0.8 or x = 1.2, and its interval) is set in by a step */
:root[data-alive-ui] body main.col .row.tp-sub{margin-top:6px;padding-left:22px}
/* the maths on an answer's left side at the size of the statement's maths (KaTeX's own 1.21em, replaced here, made it a size smaller) */
:root[data-alive-ui] body main.col .prob .answer-fields label .katex{font-size:1.28em}
@media (max-width:640px){:root[data-alive-ui] body main.col .prob .answer-fields label .katex{font-size:1.16em}}
/* maths in a choice at the size of the text around it */
:root[data-alive-ui] body main.col .prob .choices label .katex{font-size:1.21em}
/* A Key concepts title that ends in maths ("about a", "Choosing M") reads as one line of text: the shared flex title made
   the maths a separate item, set apart by the badge's gap. The badge hangs to the left instead. */
:root[data-alive-ui] body main.col .look-kgrid .kn{display:block;position:relative;padding-left:36px}
:root[data-alive-ui] body main.col .look-kgrid .kn::before{position:absolute;left:0;top:50%;transform:translateY(-50%)}
