/* Trigonometric Substitution: this page's own blocks, in the shared lesson look (../alive/lesson-look.css).
   No colours here. The meanings are planning/colour.md, and katex-macros.json maps each onto the course palette
   (../lib/lesson-colors.css, both themes): \rt the square root and its θ form (pink), \dxc dx and its θ form (blue),
   \xs x outside the root and its θ form (green), \nm the number side of the triangle (orange), \ang θ standing alone
   as an angle (violet). Every rule is scoped :root[data-alive-ui] body main.col …, because the sheet styles outrank a
   plain page selector. */

/* A triangle beside its rows: the triangle keeps its own 320 px (labels at 17 px), the rows take the rest. The shared
   look-pair's .9fr column is about 290 px at 1280, which would shrink the triangle and its labels. Stacks under 640. */
@media (min-width:641px){
  :root[data-alive-ui] body main.col .look-pair.tsx-pair{grid-template-columns:auto minmax(0,1fr)}
}
/* figures.mjs sets each figure's own width as an inline max-width, which outranks the look's max-width:100%; on a
   phone narrower than the figure (a 320 px triangle in a 318 px card at 360) it must still fit its card */
:root[data-alive-ui] body main.col .look-pair>figure.diagram>svg{max-width:100%!important}

/* Beside a triangle: the ratios read off it, the identity that clears the root, then the substitution box, and under
   the box an arrow that links to the same box in the worked result (page-local.js scrolls the reader's window). */
:root[data-alive-ui] body main.col .tsx-flow{display:flex;flex-direction:column;align-items:center;gap:4px}
:root[data-alive-ui] body main.col .tsx-flow .math-chain{justify-content:center}
:root[data-alive-ui] body main.col .tsx-flow>.tsx-id{margin:10px 0 12px;align-self:stretch;text-align:center}
:root[data-alive-ui] body main.col .tsx-flow>.tsx-id .math-chain{justify-content:center}
/* green text needs a neutral ground: a white box with a green outline (a green-tinted box read green on green) */
:root[data-alive-ui] body main.col .tsx-sub{padding:8px 18px;border-radius:12px;background:var(--look-card);border:1.5px solid color-mix(in srgb,var(--lc-green) 60%,var(--rule))}
:root[data-alive-ui] body main.col .tsx-arrow{display:block;width:0;height:0;margin:8px auto 2px;border-left:8px solid transparent;border-right:8px solid transparent;border-top:10px solid color-mix(in srgb,var(--lc-green) 55%,var(--rule));cursor:pointer;transition:border-top-color .15s}
:root[data-alive-ui] body main.col .tsx-arrow:hover,:root[data-alive-ui] body main.col .tsx-arrow:focus-visible{border-top-color:var(--lc-green);outline:none}

/* A worked result: the recap of what is substituted, as chips that wrap whole; then the chain, two "=" to a line on a
   wide screen and one on a phone; the ratio the last step reads off the triangle beside the chain's last line. */
:root[data-alive-ui] body main.col .tsx-sub-inline{display:flex;flex-wrap:wrap;gap:6px 22px;align-items:baseline;width:fit-content;max-width:100%;margin:0 0 16px}
:root[data-alive-ui] body main.col .tsx-sub-inline[id]{scroll-margin-top:96px}
:root[data-alive-ui] body main.col .tsx-sub-inline.tsx-arrived,:root[data-alive-ui] body main.col details.tsol.tsx-arrived>.txt{animation:tsx-flash 1.6s ease-out}
@keyframes tsx-flash{0%{box-shadow:0 0 0 3px color-mix(in srgb,var(--lc-green) 45%,transparent)}100%{box-shadow:0 0 0 3px transparent}}
:root[data-alive-ui] body main.col .tsx-chip{white-space:nowrap}
:root[data-alive-ui] body main.col .tsx-chip .katex{font-size:1.08em}
:root[data-alive-ui] body main.col .look-card .row.tsx-ratio,:root[data-alive-ui] body main.col .look-card .row.tsx-side{margin-top:16px}
:root[data-alive-ui] body main.col .tsx-narrow{display:none}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .tsx-wide{display:none}
  :root[data-alive-ui] body main.col .tsx-narrow{display:block}
}
@media (min-width:641px){
  :root[data-alive-ui] body main.col .tsx-result:has(>.tsx-ratio){display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:32px}
  :root[data-alive-ui] body main.col .tsx-result:has(>.tsx-ratio)>*{grid-column:1/-1}
  :root[data-alive-ui] body main.col .tsx-result:has(>.tsx-ratio)>.row.tsx-wide:not(.tsx-side){grid-column:1;grid-row:2}
  :root[data-alive-ui] body main.col .tsx-result:has(>.tsx-ratio)>.row.tsx-ratio{grid-column:2;grid-row:2;align-self:end;margin:0 0 4px}
}

/* A failed first try: one line the student checks, set as a display line of its own, not a card and not lit. */
:root[data-alive-ui] body main.col .tsx-try{margin:14px 0 18px}
:root[data-alive-ui] body main.col .tsx-try .math-chain{justify-content:center;margin:0}

/* Key concepts, choosing the substitution: root | substitution | identity, one root to a line; on a phone the
   identity takes the line under its root and substitution. */
:root[data-alive-ui] body main.col .tsx-ktable{display:grid;grid-template-columns:max-content max-content minmax(0,1fr);gap:12px 26px;align-items:center}
:root[data-alive-ui] body main.col .tsx-kr{display:contents}
:root[data-alive-ui] body main.col .tsx-ktable .math-chain{margin:0;justify-content:flex-start}
:root[data-alive-ui] body main.col .tsx-ktable .katex-display{margin:0}
@media (max-width:640px){
  :root[data-alive-ui] body main.col .tsx-ktable{grid-template-columns:max-content minmax(0,1fr);gap:6px 16px}
  :root[data-alive-ui] body main.col .tsx-kr>:nth-child(3){grid-column:1/-1;margin-bottom:14px}
}

/* practice solutions: each step's heading in the page's type */
:root[data-alive-ui] body main.col .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}
:root[data-alive-ui] body main.col .sol .ln+.ln{margin-top:14px}
