/* Introduction to Limits: page layout. No colours here: every colour is the course palette's (../lib/lesson-colors.css),
   through the macros in katex-macros.json (\inp blue, the inputs approaching a; \fn violet, the function and its heights;
   \lm pink, the height approached; \val green, the value at the point; planning/colour.md).
   A single line of maths that stands on its own (a function's definition, a goal with "= ?", a one-line result) is set
   large and quiet with look-goal and isn't lit; two or more rows, a figure, or a comparison is a card and is lit. */

/* rows in this page's cards are centred: each card is one short group read as a unit, not a left-aligned derivation */
:root[data-alive-ui] body main.col :is(.look-card,.look-case) .math-chain{justify-content:center}
:root[data-alive-ui] body main.col :is(.look-card,.look-case) .katex-display{text-align:center}
/* a chain's parts sit a relation's width apart, so "lim f(x) = 3" reads as one line rather than two pieces */
:root[data-alive-ui] body main.col :is(.look-card,.look-case,.look-three,.look-krows,.look-goal) .math-chain{column-gap:.3em}

/* two statements about one x side by side (the limit and the value, two readings), wrapping to two lines on a phone
   rather than breaking inside either */
:root[data-alive-ui] body main.col .row.lim-duo{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;column-gap:52px;row-gap:10px}
:root[data-alive-ui] body main.col .row.lim-duo>*{flex:0 0 auto;margin:0}
:root[data-alive-ui] body main.col .look-card .row.lim-last{margin-top:18px}

/* a figure on its own: a card, drawn at its own size (never stretched to the column, so its labels keep their size) */
:root[data-alive-ui] body main.col .look-card.lim-fig{padding:16px 22px;width:fit-content;max-width:100%;margin-left:auto;margin-right:auto;box-sizing:border-box}
:root[data-alive-ui] body main.col .look-card.lim-fig>figure.diagram{margin:0}
:root[data-alive-ui] body main.col .look-card.lim-fig>figure.diagram>svg{width:auto;max-width:100%;height:auto;display:block;margin:0 auto}

/* a one-line result reads a little smaller than a goal: it answers the goal, it doesn't open the part */
:root[data-alive-ui] body main.col .look-goal.lim-result{margin:18px auto 22px}
:root[data-alive-ui] body main.col .look-goal.lim-result .katex{font-size:1.08em}
:root[data-alive-ui] body main.col .look-goal+.look-goal.lim-goal-2{margin-top:-8px}

/* beside another statement, a pair of rows that belong together */
:root[data-alive-ui] body main.col .lim-duo>.lim-stack>.row+.row{margin-top:10px}

/* §2's two sides: the piece each side uses, then its limit */
:root[data-alive-ui] body main.col .look-case .look-q .math-chain,:root[data-alive-ui] body main.col .look-case .look-a .math-chain{justify-content:center}

/* §3's three points: the head on the card's own white, since its blue a would sit on the shared cyan tint (coloured text
   needs a neutral ground); a thin rule under it keeps the head apart */
:root[data-alive-ui] body main.col .lim-grid .look-head{background:var(--look-card)}
:root[data-alive-ui] body main.col .lim-grid .look-cell{padding:9px 10px}

@media (max-width:640px){
  /* on a phone each point is a small card: its two one-sided limits side by side, then its value beside its limit */
  :root[data-alive-ui] body main.col .lim-grid .look-col{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-areas:"h h" "l r" "v L"}
  :root[data-alive-ui] body main.col .lim-grid .look-head{grid-area:h}
  :root[data-alive-ui] body main.col .lim-grid .look-cell:nth-child(2){grid-area:v}
  :root[data-alive-ui] body main.col .lim-grid .look-cell:nth-child(3){grid-area:l}
  :root[data-alive-ui] body main.col .lim-grid .look-cell:nth-child(4){grid-area:r;border-left:1px dashed var(--rule)}
  :root[data-alive-ui] body main.col .lim-grid .look-cell:nth-child(5){grid-area:L;border-left:1px dashed var(--rule)}
  :root[data-alive-ui] body main.col .lim-grid .look-cell{border-top:1px dashed var(--rule)}
}

/* a short last phrase of a title kept with its maths, so the maths never sits alone on a line */
:root[data-alive-ui] body main.col .lim-nw{white-space:nowrap}

/* §3's tables, one per side, each titled with its side */
:root[data-alive-ui] body main.col .lim-tables .row-title{font:500 17px/1.4 'STIX Two Text',Georgia,serif;color:var(--ink);text-align:center;margin:0 0 10px;letter-spacing:0;text-transform:none}
:root[data-alive-ui] body main.col .lim-tables .row{display:flex;justify-content:center}

/* a chain that needs a different break on a phone */
:root[data-alive-ui] body main.col .lim-narrow{display:none}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .lim-wide{display:none}
  :root[data-alive-ui] body main.col .lim-narrow{display:block}
  :root[data-alive-ui] body main.col .look-card.lim-fig{padding:10px 8px}
  :root[data-alive-ui] body main.col .row.lim-duo{column-gap:32px}
}

/* Key concepts: rows centred on their quiet sheet; the value-and-limit figure at its own size beside its rows */
@media (min-width:641px){:root[data-alive-ui] body main.col .lim-kc-fig .look-kpair{grid-template-columns:auto minmax(0,1fr)}}
:root[data-alive-ui] body main.col .look-krows .math-chain{justify-content:center}
:root[data-alive-ui] body main.col .look-krows .row+.row{margin-top:8px}

/* practice: the given graph under its statement, at its own size */
:root[data-alive-ui] body main.col .prob figure.lean-given{margin:14px 0 16px 44px}
:root[data-alive-ui] body main.col .prob figure.lean-given>svg{width:auto;max-width:100%;height:auto;display:block;margin:0 auto}
:root[data-alive-ui] body main.col .prob .st .math-chain{justify-content:center;margin:10px 0 4px}
/* problem 2's six parts in two columns on a wide screen, its one Hint under them */
:root[data-alive-ui] body main.col .prob .lim-parts{display:grid;grid-template-columns:1fr 1fr;gap:4px 24px;margin-left:44px}
:root[data-alive-ui] body main.col .prob .lim-parts>.part{margin-left:0;min-width:0}
:root[data-alive-ui] body main.col .prob .lim-parts .answer-fields input{width:120px}
:root[data-alive-ui] body main.col .prob .lim-hint-part{margin-top:2px}
/* problem 8's three choices in one row, each a quiet pill with its radio */
:root[data-alive-ui] body main.col .prob .choices{display:flex;flex-wrap:wrap;gap:10px;margin:12px 0 4px}
:root[data-alive-ui] body main.col .prob .choices label{min-width:0;padding:8px 18px 8px 12px;font-size:18px}
:root[data-alive-ui] body main.col .prob .answer-fields .choices input[type=radio]{width:auto;min-height:0;padding:0;margin:0;border:0;box-shadow:none;background:none;accent-color:var(--accent)}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .prob figure.lean-given{margin-left:0}
  :root[data-alive-ui] body main.col .prob .lim-parts{grid-template-columns:1fr;margin-left:0}
}
