/* Logistic Growth: the page's own blocks. No colours here: every colour is the course palette's (../lib/lesson-colors.css),
   reached through the macros in katex-macros.json (planning/colour.md): \room pink (the room left, 1 − P/1000 and its
   forms), \cc blue (the carrying capacity, 1000 and M), \rate green (dP/dt and its values), \cvup orange (concave up),
   \cvdn violet (concave down). Every rule is scoped to main.col because the sheet styles outrank a plain selector. */

/* a name over a card's maths ("Unlimited growth", "The logistic equation"): it says which result the row is, so it sits
   above the maths, centred, in the size the row labels had; above, rather than beside, so a phone never pushes the maths
   under it */
:root[data-alive-ui] body main.col .lg-name{font:500 14.5px/1.4 var(--lf-label);color:var(--body);text-align:center;margin:0 0 8px}
:root[data-alive-ui] body main.col .look-card>.row+.lg-name{margin-top:24px}
:root[data-alive-ui] body main.col :is(.lg-center,.look-compare .look-a) .math-chain{justify-content:center}
:root[data-alive-ui] body main.col .look-compare .look-q.lg-name{margin-bottom:10px}

/* cases: what is given on the left, what follows on the right, the arrows lined up down the card (the run of forms, the
   sign rows, the three starts). On a phone each case stacks, what follows indented under what is given. */
:root[data-alive-ui] body main.col .lg-cases{display:grid;grid-template-columns:auto minmax(0,1fr);gap:12px 14px;align-items:center}
:root[data-alive-ui] body main.col .lg-cases .math-chain{margin:0}
:root[data-alive-ui] body main.col .lg-when .math-chain{justify-content:flex-end}
:root[data-alive-ui] body main.col .look-card>.lg-cases{width:fit-content;max-width:100%;margin-left:auto;margin-right:auto}
:root[data-alive-ui] body main.col .lg-cases.lg-top{align-items:start}   /* a case whose result takes two lines names its start beside the first */
:root[data-alive-ui] body main.col .lg-then>.math-chain+.math-chain,:root[data-alive-ui] body main.col .lg-then>*+*{margin-top:4px}
:root[data-alive-ui] body main.col .look-card>.lg-cases+.row,:root[data-alive-ui] body main.col .look-card>.row+.lg-cases{margin-top:12px}
:root[data-alive-ui] body main.col .look-card>.lg-cases+.lg-name{margin-top:24px}

/* the table of rates (section 1): the student reads across a row (P, the exponential rate, the room left, the rate) and
   down a column (the room shrinking to 0 and below); columns parted by space */
:root[data-alive-ui] body main.col .lg-table{border-collapse:collapse;margin:0 auto}
:root[data-alive-ui] body main.col .lg-table :is(th,td){padding:6px 20px;text-align:center;vertical-align:middle;font-weight:400}
:root[data-alive-ui] body main.col .lg-table th{padding-bottom:12px}
:root[data-alive-ui] body main.col .lg-table .katex{font-size:1.1em}

/* a result the section ends on, set on its own line and quiet like a goal row ("fastest growth at P = M/2") */
:root[data-alive-ui] body main.col .lg-line{width:fit-content;max-width:100%;margin:18px auto 24px}
:root[data-alive-ui] body main.col .lg-line .math-chain{margin:0;justify-content:center}
:root[data-alive-ui] body main.col .lg-line .katex{font-size:1.1em}

/* a figure with the rows that read it, under it: the figure at its own size, the rows full width */
:root[data-alive-ui] body main.col .lg-figcard>figure.diagram{margin:0 0 16px;display:flex;justify-content:center}
:root[data-alive-ui] body main.col .lg-figcard>figure.diagram>svg:not(.katex svg){width:auto;max-width:100%;height:auto;display:block;margin:0 auto}

/* practice: several answers, one under another (three boxes side by side don't fit the problem's column) */
:root[data-alive-ui] body main.col .prob .answer-fields.lg-multi{display:flex;flex-direction:column;align-items:flex-start;gap:10px}

/* one chain, two breaks: one or two moves to a line on a wide screen, one move to a line on a phone */
:root[data-alive-ui] body main.col .lg-narrow{display:none}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .lg-wide{display:none}
  :root[data-alive-ui] body main.col .lg-narrow{display:block}
  :root[data-alive-ui] body main.col .lg-cases{grid-template-columns:1fr;gap:2px}
  :root[data-alive-ui] body main.col .look-card>.lg-cases{width:auto;margin-left:0;margin-right:0}
  :root[data-alive-ui] body main.col .lg-when .math-chain{justify-content:flex-start}
  :root[data-alive-ui] body main.col .lg-then{padding-left:18px}
  :root[data-alive-ui] body main.col .lg-then+.lg-when{margin-top:12px}
  :root[data-alive-ui] body main.col .lg-table :is(th,td){padding:5px 9px}
  :root[data-alive-ui] body main.col .lg-table th{padding-bottom:10px}
  :root[data-alive-ui] body main.col .lg-table .katex{font-size:1em}
  /* a figure keeps three quarters of its drawn size on a 360 px phone: its card gives up most of its side padding (the
     SVG has its own margin) and reaches a little into the page's */
  :root[data-alive-ui] body main.col>section>figure.diagram,:root[data-alive-ui] body main.col .lg-figcard{margin-left:-10px;margin-right:-10px;padding-left:5px;padding-right:5px}
  :root[data-alive-ui] body main.col .lg-figcard>.lg-cases{padding:0 9px}
}

/* section 4's goal: one line on a wide screen; on a phone it breaks only between the equation, its start and what is asked */
:root[data-alive-ui] body main.col .lg-goal{text-align:center}

/* cases whose given part is short stay side by side on a phone too; a long one takes the full width (lg-full) */
@media (max-width:640px){
  :root[data-alive-ui] body main.col .lg-cases.lg-keep{grid-template-columns:auto minmax(0,1fr);gap:12px 10px}
  :root[data-alive-ui] body main.col .lg-keep>.lg-when .math-chain{justify-content:flex-end}
  :root[data-alive-ui] body main.col .lg-keep>.lg-then{padding-left:0}
  :root[data-alive-ui] body main.col .lg-keep>.lg-when+.lg-then{margin-top:0}
  :root[data-alive-ui] body main.col .lg-keep>.lg-full{grid-column:1/-1}
  :root[data-alive-ui] body main.col .lg-keep>.lg-when.lg-full .math-chain{justify-content:flex-start}
  :root[data-alive-ui] body main.col .lg-keep>.lg-then.lg-full{padding-left:18px;margin-top:-8px}
}
/* in a Key concept the cases read from the left, under the row above them */
:root[data-alive-ui] body main.col .lg-cases.lg-left{margin-top:12px}
:root[data-alive-ui] body main.col .lg-left>.lg-when .math-chain{justify-content:flex-start}
:root[data-alive-ui] body main.col .look-kgrid .look-rows+.look-three{margin-top:14px}
/* problem 4's three boxes line up under one another */
:root[data-alive-ui] body main.col .prob .answer-fields.lg-multi>label{display:grid;grid-template-columns:3.2em auto;align-items:center}
