/* Paper and Lamp, for any lab page, on the site's tokens (light and dark). Assembled on 2026-09-17 from
   center-of-mass-alive/paper/skin.css (the material and the lamp) and paper-embed/skin.css (the site tokens
   and colour with a purpose), then extended for the shared lesson markup: figure rows, example statements,
   and pending media that has no film or interactive yet. The contract is written up in
   .codex/skills/build-course-page/references/paper-and-lamp.md. */
:root[data-theme]{
  /* every colour here is a course palette token (../lib/lesson-colors.css); the page's own names (--bg, --ink, --accent, …)
     are set once in ../lib/page.css (2026-10-03: this file used to set them again, with different values) */
  --alive-accent:var(--lc-action);--alive-accent-ink:var(--lc-action-ink);--alive-accent-shadow:color-mix(in srgb,var(--lc-action) 45%,transparent);--alive-glow:color-mix(in srgb,var(--lc-glow) 30%,transparent);
  --alive-halo-fill:linear-gradient(180deg,color-mix(in srgb,var(--lc-white) 78%,transparent),color-mix(in srgb,var(--lc-white) 40%,transparent));
  --alive-halo:0 0 0 1px color-mix(in srgb,var(--lc-glow) 32%,transparent),0 18px 60px -14px color-mix(in srgb,var(--lc-glow) 38%,transparent),0 0 90px 12px color-mix(in srgb,var(--lc-glow) 16%,transparent);
  /* a whole block's glow: half the reach of the first halo at the same brightness, so it stays on its block instead of
     spreading over the ones beside it (Sohil, 2026-09-27) */
  --alive-halo-near:0 0 0 1px color-mix(in srgb,var(--lc-glow) 32%,transparent),0 9px 30px -7px color-mix(in srgb,var(--lc-glow) 38%,transparent),0 0 45px 6px color-mix(in srgb,var(--lc-glow) 16%,transparent);
  --alive-halo-edge:transparent;
  --alive-slate-shadow:0 34px 64px -30px color-mix(in srgb,var(--lc-black) 55%,transparent),0 2px 6px -1px color-mix(in srgb,var(--lc-black) 22%,transparent);
  --alive-note:var(--lc-pink);--alive-ok:var(--lc-green);--alive-ok-bg:color-mix(in srgb,var(--lc-green) 12%,var(--lc-panel));
  --alive-bar-bg:transparent;--alive-bar-edge:transparent;
  --alive-sheet-solid:var(--lc-panel);
  --alive-bar-btn:var(--lc-control);--alive-bar-btn-hover:var(--lc-control-hover);--alive-bar-hover:var(--lc-control);--alive-bar-track:var(--lc-control-hover);
}
:root[data-theme=dark]{
  /* the lamp glow in dark: 30% softer than in light (Sohil, 2026-10-04) */
  --limit-input:var(--lc-action);--limit-output:var(--lc-green);
  --alive-glow:color-mix(in srgb,var(--lc-glow) 18%,transparent);
  --alive-halo-fill:linear-gradient(180deg,color-mix(in srgb,var(--lc-white) 7.5%,transparent),color-mix(in srgb,var(--lc-white) 3.5%,transparent));
  --alive-halo:0 0 0 1px color-mix(in srgb,var(--lc-glow) 15%,transparent),0 18px 60px -14px color-mix(in srgb,var(--lc-glow) 27%,transparent),0 0 90px 12px color-mix(in srgb,var(--lc-glow) 7%,transparent);
  --alive-halo-near:0 0 0 1px color-mix(in srgb,var(--lc-glow) 15%,transparent),0 9px 30px -7px color-mix(in srgb,var(--lc-glow) 27%,transparent),0 0 45px 6px color-mix(in srgb,var(--lc-glow) 7%,transparent);
  --alive-slate-shadow:none;
}
body{background-image:none}

h1{font-weight:500}
.sec .num{color:var(--mute)}

/* ---- the lamp: one object under the eye. Formula groups keep the first version's hugging halo (shared.css);
   diagrams, films, interactives, the example, Key concepts formula groups and solutions get the same halo on their own box. ---- */
.figure-pair,main.col>section>figure.diagram,.el,.ex,.kc .kb,.prob{background:transparent;box-shadow:none;border-radius:18px;transition:background .12s ease,box-shadow .12s ease}
/* The lit state wins over a page's own styling of the block (!important): Trigonometric Substitution gave its films,
   cards and maths blocks a white card with its own shadow, at a higher specificity, and the halo silently lost, so the
   lamp lit some blocks and not others (2026-09-27). A page whose blocks are cards sets --alive-lit-fill to the card's
   own colour, so a lit card keeps its fill and gains the glow. A page's own block type joins the lamp with data-lamp. */
.kb[data-lit]{background:var(--alive-halo-fill);box-shadow:var(--alive-halo);transition:background .26s ease .05s,box-shadow .26s ease .05s}   /* Key concepts keep the first lamp exactly (Sohil, 2026-09-27: "amazingly done") */
.figure-pair[data-lit],main.col>section>figure.diagram[data-lit],.el[data-lit],.ex[data-lit],.prob.explaining[data-lit],[data-lamp][data-lit]{background:var(--alive-lit-fill,var(--alive-halo-fill))!important;box-shadow:var(--alive-halo-near)!important;transition:background .26s ease .05s,box-shadow .26s ease .05s}
/* A group of cards (two cases side by side, three in columns: data-lamp="group") lights its cards, each with its own
   glow, and paints nothing of its own: lit as one box, it showed a square white panel behind the rounded cards, filling
   the gap between them (Trigonometric Substitution, 2026-09-27). */
[data-lamp=group][data-lit]{background:transparent!important;box-shadow:none!important}
[data-lamp=group]>*{transition:box-shadow .12s ease}
[data-lamp=group][data-lit]>*{box-shadow:var(--alive-halo-near)!important;transition:box-shadow .26s ease .05s}
.fq{margin:26px 0 4px}
.work{margin-top:20px}
.key-idea{margin:34px 0 30px}
.figure-pair{padding:22px 20px 16px;margin:30px 0 0;gap:32px}
.figure-pair figcaption{padding:0}
main.col>section>figure.diagram{padding:20px 22px 14px;max-width:454px;margin:30px auto 8px;box-sizing:border-box}
.diagram figcaption{margin-top:10px}
.kc .kb{padding:14px 18px 12px;margin-top:8px;overflow:visible}
.kc .kb .katex-display{margin:8px 0}
.prob .sol .txt{border-left:0;padding:8px 0 4px;margin-left:38px}
.prob .sol>.media-built{padding:0;margin-top:0;width:auto;background:transparent;box-shadow:none}

/* ---- a film is one object: its title, its figure, its animation, its transcript ---- */
.el{display:flex;flex-direction:column;margin-top:48px;padding:18px 22px 12px}
.el>.lab{order:0;margin:0 0 14px;font:500 17.5px/1.45 var(--alive-heading-font);color:var(--ink);letter-spacing:0;text-transform:none}
.el>.lab .t{display:inline;font:italic 400 16px/1.5 var(--alive-caption-font);color:var(--mute);margin:0 0 0 6px}
.el>.media-built,.el>.media-placeholder{order:1}
.el>.transcript-review{order:2;margin:10px 0 0}
.el+.el,.el+.ex,.ex+.el,.ex+.ex{margin-top:56px}
.ex{padding:22px 24px 14px;margin-top:56px}
.ex .lab{margin-bottom:8px}
.ex>.transcript-review{margin-top:8px}
.ex>figure.diagram{margin:22px 0 10px}
/* the animation draws on the paper. The board is inverted and blended so its background disappears into the sheet. */
:root:not([data-theme=dark]) .media-built .film{filter:none}
.media-built>.film,.media-built>.film.poster,.media-built>.film:not(.poster):has(+.filmbar){background:transparent;box-shadow:none;border-radius:8px}
.media-built>.film iframe{filter:invert(1) hue-rotate(180deg) brightness(1.06);mix-blend-mode:darken;background:transparent}
.media-built>.film .veil{background:var(--alive-sheet-solid)}
.media-built>.filmbar{background:transparent;border:0;border-top:1px solid var(--rule);border-radius:0;padding:8px 2px 2px;margin-top:8px}
.media-built>.film.poster+.filmbar{border-top-width:0;margin-top:0}
.media-interactive iframe{background:transparent}
.film.poster .play{right:10px;bottom:10px}

/* ---- Key concepts: entries on the page, formula groups on sheets ---- */
.key .grid{gap:0 44px}
.kc,:root[data-theme] .kc{border:0;border-top:1px solid var(--rule);border-radius:0;background:transparent;padding:24px 0 28px;box-shadow:none}
.kc .kn{font-size:19px}

@media(max-width:640px){
  .key .grid{gap:0}
  .figure-pair{padding:16px 12px 12px}
  main.col>section>figure.diagram{padding:14px 12px 12px}
  .el{padding:14px 14px 10px}
  .ex{padding:16px 14px 12px}
  .prob .sol .txt{padding:12px 14px}
  .prob .sol>.media-built{padding:12px 10px 8px}
}

/* ---- the poster carries the problem, traced in after the figure; the header rises into place on play ---- */
.el{position:relative}
.el>.lab{transition:opacity .5s ease .3s,transform .55s cubic-bezier(.2,.7,.2,1) .3s}
.el:has(.film.poster)>.lab{position:absolute;left:22px;top:18px;opacity:0;transform:translateY(16px);pointer-events:none;margin:0}
.el:has(.film.poster)>.media-built{margin-top:0}
.film-preview .poster-problem{position:absolute;left:4.5%;top:5.5%;max-width:76%;font-size:clamp(14px,3.3vw,22px);line-height:1.35;color:var(--ink);text-align:left;visibility:hidden;transition:transform .55s cubic-bezier(.2,.7,.2,1),opacity .45s ease}
.film-preview .poster-problem .katex{font-size:1em;color:inherit;white-space:normal}
.film-preview .poster-problem .katex .base{white-space:normal;width:auto;display:inline}
.film-preview .poster-problem .katex .katex-html{white-space:normal}
.film-preview .poster-problem .typeset-ink{display:inline;position:relative}
/* the problem rises out as the header arrives */
.film:not(.poster) .film-preview{display:block;opacity:0;transition:opacity .45s ease .15s;pointer-events:none}
.film:not(.poster) .film-preview .poster-problem{transform:translateY(-42px);opacity:0}
.film:not(.poster) .film-preview svg{opacity:0;transition:opacity .3s}
/* thumbnail composition: problem at the top, figure settled beneath it */
.film-preview:has(.poster-problem) svg{transform:translateY(7%) scale(.9);transform-origin:50% 60%}
.film-preview .poster-problem{font-size:clamp(14px,3.1vw,21px);max-width:80%;left:4%;top:5%}

/* ---- Key Idea: a short insight to carry through the lesson, set apart on its own small sheet ---- */
.key-idea{padding:0;margin:36px 0 32px;width:fit-content;max-width:100%}
.key-idea strong{font:italic 400 15px/1.4 var(--alive-caption-font);color:var(--alive-accent-ink)}

/* ---- practice: Explain. The video is the explanation, the text is optional. ---- */
.prob{display:flex;flex-direction:column}
.prob>.st{order:0;scroll-margin-top:26px}
.prob>.part{order:1}
.prob>.solution-actions{order:2}
.prob>.sol{order:3}
.prob button.sol-b{background:var(--alive-accent);border-color:var(--alive-accent);color:var(--lc-on-accent);padding-left:14px;display:inline-flex;align-items:center;gap:8px}
.prob button.sol-b::before{content:"";width:0;height:0;border-style:solid;border-width:5px 0 5px 8px;border-color:transparent transparent transparent var(--lc-on-accent)}
.prob button.sol-b:hover{background:var(--alive-accent-ink);border-color:var(--alive-accent-ink)}
.prob.explaining button.sol-b{background:transparent;border-color:var(--rule);color:var(--ink)}
.prob.explaining button.sol-b::before{display:none}
/* while explaining, the answer row steps aside and the problem sits directly over the video; the open height is a number so
   it can animate, and big enough for a matrix of answer fields (2026-10-25: 200px hid a 2x2 answer's last row) */
.prob .answer-fields,.prob .part>.ans{transition:opacity .35s ease,max-height .45s cubic-bezier(.4,0,.2,1),margin .45s cubic-bezier(.4,0,.2,1);max-height:720px;overflow:hidden}
.prob.explaining .answer-fields,.prob.explaining .part>.ans{opacity:0;max-height:0;margin:0;pointer-events:none}
.prob.explaining>.solution-actions{order:4;margin:14px 0 0 38px}
.prob .sol.show{display:flex;flex-direction:column;margin-top:14px}
.prob .sol>.media-built{order:1;margin-top:0}
.prob .sol>.transcript-review{order:2}
.prob .sol>.alive-written{order:3;align-self:flex-start;margin:14px 0 0 38px;font:400 15px/1.5 var(--lf-ui);color:var(--mute);background:transparent;border:0;padding:4px 0;cursor:pointer;display:inline-flex;align-items:center;gap:9px}
.prob .sol>.alive-written::before{content:"";width:6px;height:6px;border:solid var(--mute);border-width:0 1.5px 1.5px 0;transform:rotate(-45deg) translateY(-1px);transition:transform .3s}
.prob .sol>.alive-written[aria-expanded=true]::before{transform:rotate(45deg) translateY(-2px)}
.prob .sol>.alive-written:hover{color:var(--ink)}
.prob .sol>.txt{order:4;margin-top:14px}
.prob .sol>.txt:not(.show){display:none}

/* ---- lesson films: the idea and its task are one heading above the figure, in ink, inside the sheet ---- */
:root[data-alive-header=concept] .el:has(.film.poster)>.lab{position:static;opacity:1;transform:none;pointer-events:auto;margin:0 0 14px}
:root[data-alive-header=concept] .el>.lab{font:500 18px/1.45 var(--alive-heading-font);color:var(--ink)}
:root[data-alive-header=concept] .el>.lab .t{display:inline;font:400 18px/1.45 var(--alive-body-font);color:var(--body);margin-left:6px}
:root[data-alive-header=concept] .el:has(.film.poster)>.media-built{margin-top:0}

/* while explaining, the problem above is the reference: no sketch of it flashes before the teacher starts writing */
.prob.explaining .film-preview{display:none}
.prob.explaining .sol>.media-built{padding-top:10px}
/* when a lesson film starts, its sketch fades under the first strokes instead of vanishing in one frame */
.el .film:not(.poster) .film-preview,.ex .film:not(.poster) .film-preview{display:block;opacity:0;transition:opacity .7s ease .1s;pointer-events:none}

/* ---- one element: header on top, video beneath, one clean close mark ---- */
.el,.ex,.prob{position:relative}
.transcript-review{display:none!important}
.alive-close{position:absolute;top:14px;right:16px;width:28px;height:28px;border-radius:50%;border:0;background:transparent;color:var(--ink);cursor:pointer;padding:0;opacity:0;pointer-events:none;transform:scale(.85);transition:opacity .3s ease,transform .3s cubic-bezier(.2,.8,.2,1),background .2s,color .2s;z-index:3}
.alive-close::before,.alive-close::after{content:"";position:absolute;left:50%;top:50%;width:13px;height:1.5px;margin:-.75px 0 0 -6.5px;background:currentColor;border-radius:1px}
.alive-close::before{transform:rotate(45deg)}.alive-close::after{transform:rotate(-45deg)}
.alive-close:hover{background:color-mix(in srgb,var(--lc-ink) 9%,transparent)}
.el>.lab,.ex>.lab,.prob>.st{padding-right:44px}
.alive-close:focus-visible{outline:2px solid var(--alive-accent);outline-offset:2px}
.el:has(.film:not(.poster))>.alive-close,.ex:has(.film:not(.poster))>.alive-close,.prob.explaining>.alive-close{opacity:1;pointer-events:auto;transform:none}
/* the example's printed figure folds away while its film plays, and returns on close */
.ex>figure.diagram{max-height:640px;transition:max-height .55s cubic-bezier(.4,0,.2,1),opacity .35s ease,margin .55s cubic-bezier(.4,0,.2,1)}
.ex:has(.film:not(.poster))>figure.diagram{max-height:0;opacity:0;margin-top:0;margin-bottom:0;overflow:hidden}
/* practice: the whole problem is the block; the Explain pill leaves when the video is open */
.prob{padding:34px 22px 18px;margin:0 -22px}
.prob+.prob{border-top:1px solid var(--rule)}
.prob.explaining>.solution-actions{display:none}
.prob .sol.show{transition:opacity .35s ease,transform .35s ease}
.prob.closing .sol.show{opacity:0;transform:translateY(-8px)}
/* the text solution keeps the earlier quiet disclosure (above: a small chevron, then "Text solution", caption font,
   left under the video). The later right-aligned underlined link that overrode it read as a stray line with a gap
   (Sohil, 2026-09-19); it is gone everywhere, so no page restyles this. */
.prob .sol>.txt{order:4;margin-top:14px}
@media(max-width:640px){.prob{padding:28px 14px 16px;margin:0 -14px}.alive-close{top:8px;right:8px}}

/* ---- colour with a purpose ---- */
.sec .num{color:var(--accent)}
:root[data-alive-header=concept] .el>.lab{color:var(--accent)}
:root[data-alive-header=concept] .el>.lab .t{color:var(--body)}
.kc .kn{color:var(--kh,var(--accent))}
/* each Key concept keeps its own hue: defined once, in ../lib/page.css (.k-indigo …) */
.key-idea strong{color:var(--accent)}

/* ---- dark: the film's own light ink draws on the dark page; nothing is inverted ---- */
:root[data-theme=dark] .media-built>.film iframe{filter:none;mix-blend-mode:lighten}

/* a formula row that wraps onto two lines keeps a small vertical gap between its parts */
.fq .f .row{gap:8px 16px}
/* a labelled formula block (a technique block): the label is a quiet serif heading in the accent, never uppercase */
.fq .lab,.fq>.lab{font:500 16.5px/1.4 var(--alive-heading-font);letter-spacing:0;text-transform:none;color:var(--accent);margin:0 0 12px}
/* ---- figure rows and triples take the lamp like the figure pair ---- */
.figure-three,.figure-row{background:transparent;box-shadow:none;border-radius:18px;transition:background .12s ease,box-shadow .12s ease;padding:18px 16px 12px;margin:26px 0 0}
.figure-three[data-lit],.figure-row[data-lit]{background:var(--alive-lit-fill,var(--alive-halo-fill))!important;box-shadow:var(--alive-halo-near)!important;transition:background .26s ease .05s,box-shadow .26s ease .05s}
.figure-three figcaption,.figure-row figcaption{font:italic 400 14.5px/1.5 var(--alive-caption-font);color:var(--mute)}
.figure-three .caption-title,.figure-row .caption-title{font-style:normal;font-weight:500;color:var(--ink)}
/* nested figures inside an example or a formula block belong to that block's lamp */
.ex .figure-pair,.ex .figure-three,.ex .figure-row,.fq .figure-pair{padding:0;margin-top:18px}
.ex .figure-pair[data-lit],.ex .figure-three[data-lit],.ex .figure-row[data-lit],.fq .figure-pair[data-lit]{background:transparent!important;box-shadow:none!important}
/* an example's statement reads as one line of ink under its heading */
.ex .st{display:block;font-size:1em;color:var(--ink);line-height:1.6;margin:0 0 6px}
.ex .st>span{display:inline}
.ex .st .katex{font-size:1.02em}
.ex>.media-placeholder{margin-top:16px}
/* a two-part film heading: the idea in accent, the task in ink, one line */
.el>.lab .t{display:inline;margin:0 0 0 6px}
/* comparison table inside a formula block, in the page's serif */
.cmp{font-family:var(--alive-body-font);font-size:16.5px}
.cmp th{font-weight:500;color:var(--ink)}
.cmp td{border-color:var(--rule)}

/* ---- pending media: the place a film or interactive will take, at rest, on the sheet. No black box, no control. ---- */
.media-placeholder{position:relative;box-sizing:border-box;display:block;width:100%;aspect-ratio:16/9;min-height:0;padding:0;background:var(--alive-sheet-solid);border:1px solid var(--rule);border-radius:8px;color:transparent;overflow:hidden}
.media-placeholder p,.media-placeholder .media-type{display:none}
/* the mark: a ring (::after) with its icon cut from the mute colour (::before, a mask), so both take the palette's
   mute in either theme; an icon painted inside a data URI can't follow a token (2026-10-03) */
.media-placeholder::before,.media-placeholder::after{content:"";position:absolute;left:50%;top:50%;width:44px;height:44px;margin:-22px 0 0 -22px;opacity:.38}
.media-placeholder::after{border-radius:50%;border:1.5px solid var(--mute);box-sizing:border-box}
.media-placeholder::before{background:var(--mute);-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M7 4.5v11l9-5.5z'/%3E%3C/svg%3E") no-repeat 55% 50%/16px;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M7 4.5v11l9-5.5z'/%3E%3C/svg%3E") no-repeat 55% 50%/16px}
.media-placeholder[data-media-kind=interactive]{aspect-ratio:auto;min-height:clamp(260px,44vw,420px)}
.media-placeholder[data-media-kind=interactive]::after{border-radius:10px}
.media-placeholder[data-media-kind=interactive]::before{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M4 12h3M13 12h7'/%3E%3Ccircle cx='10' cy='12' r='3'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M4 12h3M13 12h7'/%3E%3Ccircle cx='10' cy='12' r='3'/%3E%3C/svg%3E");-webkit-mask-position:50% 50%;mask-position:50% 50%;-webkit-mask-size:22px;mask-size:22px}
/* practice problems sit on the page, never striped */
.prob:nth-of-type(even),.prob:nth-child(even),.prob:nth-of-type(odd){background:transparent}
.prob.explaining[data-lit]{background:var(--alive-lit-fill,var(--alive-halo-fill))!important}
/* a pending solution film: a short strip under the problem, then the written solution */
.prob .sol>.media-placeholder,.sol .media-placeholder{aspect-ratio:auto;min-height:64px;width:auto;margin:0}
.prob .sol>.media-placeholder::before,.sol .media-placeholder::before,.prob .sol>.media-placeholder::after,.sol .media-placeholder::after{width:32px;height:32px;margin:-16px 0 0 -16px}
.prob .sol>.media-placeholder::before,.sol .media-placeholder::before{-webkit-mask-size:12px;mask-size:12px}
.prob .sol.show{margin-top:14px}
.prob .sol>.alive-written{order:3}
.prob .sol>.txt{order:4}
.prob .sol>.txt.show{display:block}
.prob .sol .txt{margin-left:0;padding:8px 0 4px}
.prob .txt .ln{padding:8px 0}
@media(max-width:640px){
  .figure-three,.figure-row{padding:12px 10px 10px}
  .media-placeholder[data-media-kind=interactive]{min-height:240px}
}

/* full screen has no page behind the film, only the black backdrop, and darken against black is black: the film went
   full screen as a black screen in light mode (2026-10-10). In full screen it shows as it is, inverted, unblended */
.media-built>.film iframe:fullscreen{mix-blend-mode:normal}
.media-built>.film iframe:-webkit-full-screen{mix-blend-mode:normal}
