/* Linear Approximation and Differentials: 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):
     \cv  blue    the curve y = f(x): its values f(a), the true values, its rise Δy, V and A
     \tn  pink    the tangent line: L, its slope f′(a), its heights, its rise dy, dA and dV
     \stp orange  the step x − a, and the dx (dr, dC) it becomes
     \ovr violet  the gap when the line is above the curve (an overestimate)
     \und green   the gap when it is below (an underestimate), and so the square's corner (dx)²
   Every rule is scoped under :root[data-alive-ui] body main.col, because the sheet styles outrank a plain selector. */

/* maths in a card is centred, a chain or a row of facts read as one display */
:root[data-alive-ui] body main.col :is(.look-card,.look-rows) .math-chain{justify-content:center}
:root[data-alive-ui] body main.col .look-card .row.la-gap,:root[data-alive-ui] body main.col .look-rows .row.la-gap{margin-top:20px}

/* a chain with two layouts: the wide one up to 640 px, one move per line on a phone, so nothing scrolls sideways */
:root[data-alive-ui] body main.col .la-narrow{display:none}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .la-wide{display:none}
  :root[data-alive-ui] body main.col .la-narrow{display:block}
}

/* a row of short facts: each one whole, wrapping between facts, never inside one */
:root[data-alive-ui] body main.col .row.la-chips{display:flex;flex-wrap:wrap;justify-content:center;align-items:baseline;gap:8px 30px}
:root[data-alive-ui] body main.col .la-chip{white-space:nowrap}
:root[data-alive-ui] body main.col .la-chip .katex{font-size:1.1em}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .row.la-chips{gap:6px 22px}
  :root[data-alive-ui] body main.col .la-chip .katex{font-size:1em}
}

/* one line of maths the sentence points at, set on its own line without a card (a single line is not a lamp block) */
:root[data-alive-ui] body main.col .la-line{margin:18px auto 22px;width:fit-content;max-width:100%}
:root[data-alive-ui] body main.col .la-line .math-chain{margin:0;justify-content:center}
:root[data-alive-ui] body main.col .la-line .katex{font-size:1.1em}
@media (max-width:640px){:root[data-alive-ui] body main.col .la-line .katex{font-size:1em}}

/* a graph beside its rows: the graph at its own 360 px, the rows taking the rest; stacked on a phone */
:root[data-alive-ui] body main.col .look-pair.la-pair{grid-template-columns:auto minmax(0,1fr);gap:8px 22px;padding:16px 20px}
@media (max-width:640px){:root[data-alive-ui] body main.col .look-pair.la-pair{grid-template-columns:1fr;padding:14px}}

/* the two rises, side by side: each case named in words above its formula */
:root[data-alive-ui] body main.col .look-case .la-q{text-align:center;font:500 17px/1.4 'STIX Two Text',Georgia,serif;color:var(--ink)}
:root[data-alive-ui] body main.col .look-case .look-a .math-chain{justify-content:center;margin:0}
:root[data-alive-ui] body main.col .look-case .katex{font-size:1.1em}

/* a goal of two lines */
:root[data-alive-ui] body main.col .look-goal .row+.row{margin-top:4px}

/* a figure standing on its own in a section: the shared look's card, so lighting it never makes a white box appear */
:root[data-alive-ui] body main.col>section>figure.diagram.la-fig{margin:22px 0 26px;padding:16px 20px;background:var(--look-card);border:1px solid var(--look-edge);border-radius:var(--look-r);box-shadow:var(--look-shadow)}

/* Key concepts: a row's name above its maths, so the maths has the card's whole width */
:root[data-alive-ui] body main.col .look-kgrid .kc .kr{display:block;border-top:0;padding:6px 0}
:root[data-alive-ui] body main.col .look-kgrid .kc .kr+.kr{margin-top:6px}
:root[data-alive-ui] body main.col .look-kgrid .kc .kh{display:block;margin:0 0 4px}
:root[data-alive-ui] body main.col .look-kgrid .kc .kv{display:block;overflow:visible}
:root[data-alive-ui] body main.col .look-kgrid .kc .kv .math-chain{margin:0;justify-content:center}
:root[data-alive-ui] body main.col .look-kgrid .kc .review-figure{margin:0 0 12px}
:root[data-alive-ui] body main.col .look-kgrid .kc .review-figure>svg{width:auto;max-width:100%;height:auto;display:block;margin:0 auto}

/* practice: an answer reads as one line, its label, the field, then any unit */
:root[data-alive-ui] body main.col .prob .answer-fields{gap:12px 26px}
:root[data-alive-ui] body main.col .prob .answer-fields label{display:flex;align-items:center;gap:10px;flex-wrap:nowrap;font-size:18px;color:var(--ink)}
:root[data-alive-ui] body main.col .prob .answer-fields input{width:170px}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .prob .answer-fields label{width:100%}
  :root[data-alive-ui] body main.col .prob .answer-fields input{width:auto;flex:1;min-width:0}
}
/* the sphere is narrower than the column: centred in its card */
:root[data-alive-ui] body main.col>section>figure.diagram.la-fig-centre{display:flex;flex-direction:column;align-items:center}
:root[data-alive-ui] body main.col .look-kgrid .kc .kv .row.la-chips{gap:8px 26px}
/* rows named beside their maths (the writers' row names): the names in one column, the maths in the next, so the
   maths of every row in a card starts at one edge; on a phone each name sits above its maths */
:root[data-alive-ui] body main.col .look-card.la-lcard{display:grid;grid-template-columns:max-content minmax(0,1fr);column-gap:26px;row-gap:14px;align-items:center}
:root[data-alive-ui] body main.col .look-card.la-lcard>.row{display:grid;grid-column:1/-1;grid-template-columns:subgrid;align-items:center;margin:0}
:root[data-alive-ui] body main.col .look-card.la-lcard>.row.la-narrow{display:none}
:root[data-alive-ui] body main.col .la-cap{font:500 16.5px/1.35 'STIX Two Text',Georgia,serif;color:var(--body)}
:root[data-alive-ui] body main.col .la-lcard .la-m .math-chain{justify-content:flex-start}
:root[data-alive-ui] body main.col .la-lcard .la-m.la-chips{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:flex-start;gap:8px 30px}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .look-card.la-lcard{grid-template-columns:minmax(0,1fr);row-gap:10px}
  :root[data-alive-ui] body main.col .look-card.la-lcard>.row{grid-template-columns:minmax(0,1fr);row-gap:2px}
  :root[data-alive-ui] body main.col .look-card.la-lcard>.row.la-wide{display:none}
  :root[data-alive-ui] body main.col .look-card.la-lcard>.row.la-narrow{display:grid}
  :root[data-alive-ui] body main.col .la-cap:empty{display:none}
  :root[data-alive-ui] body main.col .la-lcard .la-m.la-chips{gap:6px 22px}
}
@media (max-width:640px){:root[data-alive-ui] body main.col .look-card.la-lcard>.row+.row:has(>.la-cap:not(:empty)){margin-top:8px}}
