/* Extreme Values on a Closed Interval: page layout. No colours here: every colour is the course palette's (../lib/lesson-colors.css),
   through the macros in katex-macros.json. Every rule is scoped :root[data-alive-ui] body main.col, since the sheet styles outrank a
   plain page selector. */

/* A named block (the theorem, the definition's three kinds, the method): its name centred over its rows, in the page's ink, as a
   concept title is set. In a figure pair it spans both columns. */
:root[data-alive-ui] body main.col .xv-title{font:500 19px/1.35 'STIX Two Text',Georgia,serif;color:var(--ink);text-align:center;margin:0 0 14px}
:root[data-alive-ui] body main.col .look-pair>.xv-title{grid-column:1/-1;margin-bottom:4px}

/* Rows with a name beside them (the three kinds of candidate, the method's four steps): the name in a column of its own, so the
   maths lines up on the left edge of the second column. On a phone the name sits over its maths. */
:root[data-alive-ui] body main.col .xv-steps{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:12px 22px;align-items:center}
:root[data-alive-ui] body main.col .xv-steps>.xv-k{font:500 14px/1.35 var(--lf-label);color:var(--ink);letter-spacing:.02em}
:root[data-alive-ui] body main.col .xv-steps>.xv-v .math-chain{margin:0}
:root[data-alive-ui] body main.col .xv-steps>.xv-v .katex-display{margin:0}

/* In a figure pair the rows column is narrow, so each name sits over its maths there at every width. */
:root[data-alive-ui] body main.col .xv-steps.xv-stack{grid-template-columns:minmax(0,1fr);gap:3px}
:root[data-alive-ui] body main.col .xv-steps.xv-stack>.xv-v+.xv-k{margin-top:12px}

/* A candidates table centred in its card, with its result rows under it. */
:root[data-alive-ui] body main.col .xv-table .math-chain{justify-content:center}
:root[data-alive-ui] body main.col .xv-table .row+.row{margin-top:16px}

/* A result line, "absolute maximum value 32, at x = 4": its two halves sit on one line and wrap as wholes on a phone, so a
   value never parts from its "at x". */
:root[data-alive-ui] body main.col .xv-res{display:flex;flex-wrap:wrap;justify-content:center;align-items:baseline;column-gap:.45em}
:root[data-alive-ui] body main.col .xv-res .math-chain{margin:0}
:root[data-alive-ui] body main.col .xv-res .katex-display{margin:0}
:root[data-alive-ui] body main.col .look-rows .xv-res{justify-content:flex-start}
:root[data-alive-ui] body main.col .sol .xv-res{justify-content:flex-start;margin:6px 0}

/* A figure whose rows are short (|x² − 4|) and the Key concepts' three small curves: drawn at their own size, the rows taking the
   rest, so their labels stay readable. */
:root[data-alive-ui] body main.col .look-pair.xv-figwide{grid-template-columns:auto minmax(0,1fr)}
:root[data-alive-ui] body main.col .look-kpair.xv-kfig{grid-template-columns:auto minmax(0,1fr)}

/* A figure beside a few short rows: the two halves equal, so the figure stays near its own size. */
:root[data-alive-ui] body main.col .look-pair.xv-even{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}

/* Key concepts rows here have no name column, so the maths takes the whole row. */
:root[data-alive-ui] body main.col .kc .kr:not(:has(.kh)){grid-template-columns:minmax(0,1fr)}
:root[data-alive-ui] body main.col .kc .kr.xv-narrow{display:none}

/* One chain, two breaks: the wide one on a wide screen, the narrow one on a phone, so nothing scrolls sideways. */
:root[data-alive-ui] body main.col .xv-narrow{display:none}

/* Practice: the four answer boxes on one or two lines (max value and where, then min value and where), and problem 2's graph at its
   own size, under the statement. */
:root[data-alive-ui] body main.col .prob .answer-fields input{width:132px}
:root[data-alive-ui] body main.col .prob .part+.part{margin-top:10px}
:root[data-alive-ui] body main.col .prob figure.lean-given{margin:14px 0 4px 44px;padding:0;border:0;background:none;box-shadow:none}
:root[data-alive-ui] body main.col .prob figure.lean-given>svg:not(.katex svg){width:auto;max-width:100%;height:auto;display:block;margin:0 auto}

@media (max-width:640px){
  :root[data-alive-ui] body main.col .look-pair.xv-figwide,:root[data-alive-ui] body main.col .look-kpair.xv-kfig{grid-template-columns:1fr}
  :root[data-alive-ui] body main.col .look-goal .katex{font-size:1em}
  :root[data-alive-ui] body main.col .prob .answer-fields label{display:flex;width:100%;align-items:center}
  :root[data-alive-ui] body main.col .prob .answer-fields label input{flex:1;min-width:0;width:auto}
  :root[data-alive-ui] body main.col .xv-wide{display:none}
  :root[data-alive-ui] body main.col .xv-narrow{display:block}
  :root[data-alive-ui] body main.col .kc .kr.xv-wide{display:none}
  :root[data-alive-ui] body main.col .kc .kr.xv-narrow{display:grid}
  :root[data-alive-ui] body main.col .look-pair.xv-even{grid-template-columns:1fr}
  :root[data-alive-ui] body main.col .xv-steps{grid-template-columns:minmax(0,1fr);gap:4px}
  :root[data-alive-ui] body main.col .xv-steps>.xv-v+.xv-k{margin-top:10px}
  :root[data-alive-ui] body main.col .prob figure.lean-given{margin-left:0}
}
