/* Arc Length in Polar Coordinates: page layout. No colours here: every colour is the course palette's (../lib/lesson-colors.css).
   Colour meanings (planning/colour.md), one macro each in katex-macros.json:
     \rr     pink    r: its letter, square, values, the curve's formula as r, and its terms (r sin θ, r² sin²θ, θ⁴, cos²2θ);
     \dr     blue    dr/dθ, its square and its terms;
     \rt     green   the root, the point's speed, in every form until it merges (θ√(θ² + 4), 2|cos(θ/2)|, √4 = 2); a
                     radical is written \rt{\sqrt{\ik{…}}}, so its insides are ink unless they carry their own colour;
     \ik     ink     puts a piece back to the page's ink inside a coloured one;
     \tph    violet  the cardioid's top half, 0 ≤ θ ≤ π, and the 4 it contributes;
     \bth    orange  its bottom half, π ≤ θ ≤ 2π, and its −4 (or 4 under the absolute value);
     \spent  mute    a spent piece: the cross terms that cancel, the trap row. */

/* A chain that reads one move per "=" on a phone: a wide and a narrow copy, one shown per width. */
:root[data-alive-ui] body main.col .al-narrow{display:none}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .al-wide{display:none}
  :root[data-alive-ui] body main.col .al-narrow{display:block}
}

/* A naming row (r = …, dr/dθ = …): each item whole, side by side, wrapping only between items. */
:root[data-alive-ui] body main.col .al-names{display:flex;flex-wrap:wrap;align-items:center;gap:4px 40px}
:root[data-alive-ui] body main.col .al-names>*{margin:0;flex:none;max-width:100%}
:root[data-alive-ui] body main.col .al-names :is(.katex-display,.math-chain){margin:0}
:root[data-alive-ui] body main.col .look-card .row.al-gap{margin-top:22px}

/* The trap: what the root gives without the absolute value. Its maths is mute (\spent) and its card dashed, so a
   student looking back reads it as the try that failed, not a step to copy. */
:root[data-alive-ui] body main.col .look-card.al-trap{border-style:dashed;box-shadow:none}

/* Arc length beside area: each formula under its name. */
:root[data-alive-ui] body main.col .al-name{font:600 12.5px/1.2 var(--lf-label);letter-spacing:.06em;text-transform:uppercase;color:var(--ink);margin-bottom:10px;text-align:center}
:root[data-alive-ui] body main.col .look-case .look-a .math-chain{justify-content:center}
:root[data-alive-ui] body main.col .look-case .katex-display{margin:0}

/* A figure beside its rows, at its own size: the figure takes its own width and the rows the rest. */
@media (min-width:641px){
  :root[data-alive-ui] body main.col .look-pair.al-pair{grid-template-columns:auto minmax(0,1fr)}
}
:root[data-alive-ui] body main.col .look-pair.al-pair .look-rows{justify-self:center}

/* Section figures on a phone: the card's side padding goes to the figure, so it keeps more of its own size. */
@media (max-width:640px){
  :root[data-alive-ui] body main.col>section>figure.diagram{padding-left:6px;padding-right:6px}
}

/* Key concepts: a row's name above its maths, so the maths has the card's width */
:root[data-alive-ui] body main.col .look-kgrid .kc .kr{grid-template-columns:1fr;gap:4px}
:root[data-alive-ui] body main.col .look-kgrid .kc .kv{overflow:visible;display:flex;flex-wrap:wrap;gap:6px 22px}
:root[data-alive-ui] body main.col .look-kgrid .kc .kv :is(.katex-display,.math-chain){margin:0}

/* Practice: the problem's curve beside it, floated right of the answer row so the statement keeps the full width; on a
   phone it sits under the statement, centred. The solution opens below it. */
:root[data-alive-ui] body main.col .prob{display:flow-root}
:root[data-alive-ui] body main.col .prob>figure.al-pfig{float:right;margin:6px 0 8px 12px}
:root[data-alive-ui] body main.col .prob>figure.al-pfig>svg{display:block;width:auto;max-width:100%;height:auto}
:root[data-alive-ui] body main.col .prob>.sol{clear:both}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .prob>figure.al-pfig{float:none;margin:12px auto 4px;width:fit-content}
}

/* Cards of rows centre their maths, as displayed maths does; the rows of a figure pair sit centred in their column. */
:root[data-alive-ui] body main.col .look-card .math-chain{justify-content:center}
:root[data-alive-ui] body main.col .look-card .katex-display{text-align:center}
:root[data-alive-ui] body main.col .look-card .al-names{justify-content:center}

/* Key concepts on a narrow phone: the sheet's side padding goes to the maths, so a whole integral keeps its line. */
@media (max-width:400px){
  :root[data-alive-ui] body main.col .look-kgrid>.kc{padding-left:12px;padding-right:12px}
  :root[data-alive-ui] body main.col .look-kgrid .look-krows{padding-left:10px;padding-right:10px}
}

/* Key concept 1 spans the grid: its two formulas, arc length and area, side by side as the section set them. */
@media (min-width:641px){
  :root[data-alive-ui] body main.col .look-kgrid .kc.wide .krows:has(>.kr+.kr){display:grid;grid-template-columns:1fr 1fr;gap:0 28px;align-items:start}
}
