/* Accumulation Functions: page layout. No colours here: every colour is the course palette's (../lib/lesson-colors.css).
   The colour roles are katex-macros.json's, from planning/colour.md: \Fh f and its height (blue), \Gt g and the area it
   counts up (pink), \Ed the moving edge x, the top bound (orange), \Dn what counts down: area lost, the bottom bound and
   its minus (violet), \Sl the slope of f, which is g'' (green). */

/* rows in a card are centred: the cards here hold short chains and pairs of facts, read as one centred unit */
:root[data-alive-ui] body main.col :is(.look-card,.look-rows,.look-case) .math-chain{justify-content:center}
/* a single displayed line the eye comes back to (g'(x) = 2x, the root's derivative, g(0) = 0): large and quiet, not a
   card and not lit, like the goal rows */
:root[data-alive-ui] body main.col .fta-line{width:fit-content;max-width:100%;margin:18px auto 22px}
:root[data-alive-ui] body main.col .fta-line .math-chain{margin:0;justify-content:center}
:root[data-alive-ui] body main.col .fta-line .katex{font-size:1.1em}
/* the theorem: the one row of the page the rest follows from, a card of its own, set a little larger */
:root[data-alive-ui] body main.col .fta-theorem{padding:22px 24px}
:root[data-alive-ui] body main.col .fta-theorem .katex{font-size:1.25em}
/* facts that sit side by side on a wide screen and stack whole on a phone: each fact is its own display, so it wraps as a
   whole and never breaks after a relation */
:root[data-alive-ui] body main.col .fta-facts{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:6px 44px}
:root[data-alive-ui] body main.col .fta-facts .math-chain{margin:0}
:root[data-alive-ui] body main.col .look-card .fta-facts+.fta-facts,:root[data-alive-ui] body main.col .look-card .row+.fta-facts,:root[data-alive-ui] body main.col .look-card .fta-facts+.row{margin-top:12px}
:root[data-alive-ui] body main.col .look-goal+.look-goal{margin-top:-12px}
/* fig-1 beside its rows at its own size: the figure takes its width, the rows the rest */
:root[data-alive-ui] body main.col .look-pair.fta-pair{grid-template-columns:auto minmax(0,1fr);gap:8px 16px;padding:18px 16px}
/* two cases: the interval as the case's head */
:root[data-alive-ui] body main.col .look-case .look-q{text-align:center}
:root[data-alive-ui] body main.col .look-case .look-q .katex{font-size:1.05em}
/* a chain written twice, one per width: wide holds more to a line, narrow one move per line */
:root[data-alive-ui] body main.col .fta-narrow{display:none}
/* Key concepts: every entry takes the full width. The labelled rows of 1 to 3 need it so their maths never clips beside
   its label; 4 and 5 carry long notes that read as a 35-character column side by side. A title sits in one span, so
   its inline maths stays with its words beside the number badge. */
:root[data-alive-ui] body main.col .look-kgrid .kc .kr{grid-template-columns:130px minmax(0,1fr)}
:root[data-alive-ui] body main.col .look-kgrid .kr:first-child{border-top:0}
:root[data-alive-ui] body main.col .look-kgrid>.kc{grid-column:1/-1}
:root[data-alive-ui] body main.col .look-kgrid .kn{display:block}
:root[data-alive-ui] body main.col .look-kgrid .kn::before{display:inline-grid;margin-right:10px;vertical-align:.1em}
:root[data-alive-ui] body main.col .look-kgrid .krows{padding:12px 16px;border-radius:12px;background:var(--look-tint)}
:root[data-alive-ui] body main.col .look-kgrid .kc .kr:not(:has(.kh)){grid-template-columns:1fr;justify-items:center}
:root[data-alive-ui] body main.col .look-kgrid .kr:not(:has(.kh)) .katex{font-size:1.1em}
/* practice: a given graph at its own size, not stretched to the card */
:root[data-alive-ui] body main.col .prob figure.diagram{margin:14px 0 10px 44px}
:root[data-alive-ui] body main.col .prob figure.diagram>svg:not(.katex svg){width:auto;max-width:100%;height:auto;display:block;margin:0 auto}
/* a part with several answers: the fields sit on one line where they fit */
:root[data-alive-ui] body main.col .prob .answer-fields.fta-multi{display:flex;flex-wrap:wrap;gap:10px 22px;align-items:center}
:root[data-alive-ui] body main.col .prob .answer-fields.fta-multi input{width:120px}
:root[data-alive-ui] body main.col .prob .choices.fta-inline{display:flex;flex-wrap:wrap;gap:8px}
:root[data-alive-ui] body main.col .prob .choices.fta-inline label{min-width:0;margin:0}
.sol .ln .step{display:block;font:500 17px/1.4 'STIX Two Text',Georgia,serif;letter-spacing:0;text-transform:none;color:var(--ink);margin:0 0 2px}
.sol .ln+.ln{margin-top:14px}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .fta-wide{display:none}
  :root[data-alive-ui] body main.col .fta-narrow{display:block}
  /* a figure keeps its drawn size on a phone: its card gives the side padding back to the drawing */
  :root[data-alive-ui] body main.col>section>figure.diagram{padding:12px 4px}
  :root[data-alive-ui] body main.col .look-pair{padding:14px 4px}
  :root[data-alive-ui] body main.col .prob figure.diagram{margin-left:0}
  :root[data-alive-ui] body main.col .look-kgrid .kc .kr{grid-template-columns:1fr}
  :root[data-alive-ui] body main.col .look-pair.fta-pair{grid-template-columns:1fr;padding:14px 4px}
  :root[data-alive-ui] body main.col .prob .answer-fields.fta-multi input{width:88px}
  /* a given graph keeps its drawn size: it takes the problem card's side padding */
  :root[data-alive-ui] body main.col .prob figure.diagram{margin-left:-10px;margin-right:-10px}
  /* facts stack one to a line on a phone, so none is left alone on a line of its own */
  :root[data-alive-ui] body main.col .look-card .fta-facts{flex-direction:column}
  /* the two cases stay side by side: each is short, and seeing them together is the point */
  :root[data-alive-ui] body main.col .look-compare{grid-template-columns:1fr 1fr;gap:10px}
  :root[data-alive-ui] body main.col .look-case{padding:14px 8px}
  :root[data-alive-ui] body main.col .look-kgrid .krows{padding:10px 10px}
}
