/* The media sheet: Sohil's Center of Mass UI notes (2026-09-18) as opt-in components on Paper and Lamp.
   A page opts in with applySheet() from sheet.mjs, which stamps data-alive-ui="sheet" on the root; every rule
   here is scoped to that flag, so pages that do not opt in are untouched. The contract is written up in
   .claude/skills/build-course-page/references/paper-and-lamp.md, section 13.
   - A film or card block rests as a poster: its idea or problem on top, a clean page diagram, and a play
     mark at the bottom left. No player bar until play.
   - On play the diagram folds away, the problem slides to the top of the view and stays, and the film or
     card opens under it. A modern X returns the block to rest.
   - No grey or italic content text, a modern jump bar, and no rules before Key concepts. */

:root[data-alive-ui=sheet]{
  --sheet-ease:cubic-bezier(.2,.7,.2,1);
  --sheet-btn:var(--lc-control);--sheet-btn-hover:var(--lc-control-hover);--sheet-btn-ink:var(--lc-ink);
}

/* ---- the poster: idea or problem on top, the page diagram, the play mark at the bottom left ---- */
:root[data-alive-ui=sheet] :is(.el,.ex):has(>.sheet-media){display:flex;flex-direction:column;position:relative}
:root[data-alive-ui=sheet] :is(.el,.ex):has(>.sheet-media)>.lab{order:0;margin:0 0 6px;padding-right:44px}
:root[data-alive-ui=sheet] :is(.el,.ex):has(>.sheet-media)>.st{order:1;padding-right:44px;scroll-margin-top:24px}
:root[data-alive-ui=sheet] :is(.el,.ex):has(>.sheet-media)>.lab{scroll-margin-top:24px}
:root[data-alive-ui=sheet] :is(.el,.ex)>figure.sheet-poster{order:2;margin:18px auto 0;padding:0 0 64px;max-width:460px;width:100%;box-sizing:border-box;max-height:560px;overflow:hidden;
  transition:max-height .5s cubic-bezier(.4,0,.2,1),opacity .32s ease,margin .5s cubic-bezier(.4,0,.2,1),padding .5s cubic-bezier(.4,0,.2,1)}
/* a poster's picture, never the SVGs KaTeX draws a root or a stretchy bracket with: height:auto collapsed every poster's √ to
   0.4 px (Trigonometric Substitution, 2026-09-26) */
:root[data-alive-ui=sheet] :is(.el,.ex)>figure.sheet-poster svg:not(.katex svg){display:block;width:auto;max-width:100%;height:auto;margin:0 auto;overflow:visible}
:root[data-alive-ui=sheet] :is(.el,.ex)>.sheet-media{order:3}
:root[data-alive-ui=sheet] .el:has(>.sheet-media),:root[data-alive-ui=sheet] .ex:has(>.sheet-media){padding-bottom:18px}

/* the play mark: one accent disc at the block's bottom left, never a bar */
:root[data-alive-ui=sheet] .sheet-play{position:absolute;left:22px;bottom:20px;z-index:2;width:48px;height:48px;border-radius:50%;border:0;padding:0;cursor:pointer;
  background:var(--alive-accent);color:var(--lc-on-accent);box-shadow:0 8px 22px -8px var(--alive-accent-shadow);display:grid;place-items:center;
  transition:transform .25s var(--sheet-ease),background .2s,opacity .25s ease,box-shadow .25s}
:root[data-alive-ui=sheet] .sheet-play svg{width:18px;height:18px;margin-left:3px;display:block}
:root[data-alive-ui=sheet] .sheet-play:hover{background:var(--alive-accent-ink);transform:scale(1.06);box-shadow:0 10px 26px -8px var(--alive-accent-shadow)}
:root[data-alive-ui=sheet] .sheet-play:focus-visible{outline:2px solid var(--alive-accent);outline-offset:3px}
:root[data-alive-ui=sheet] .sheet-play[data-kind=card] svg{margin-left:0}

/* ---- open: the diagram folds away, the problem stays on top, the film or card opens under it ---- */
/* no opacity here: an opacity layer would isolate the film from the page, and its board could not blend away */
:root[data-alive-ui=sheet] .sheet-media{display:grid;grid-template-rows:0fr;visibility:hidden;transition:grid-template-rows .55s cubic-bezier(.4,0,.2,1),margin .55s cubic-bezier(.4,0,.2,1),visibility 0s linear .55s;margin-top:0}
:root[data-alive-ui=sheet] .sheet-media>.sheet-frame{min-height:0;overflow:hidden}
:root[data-alive-ui=sheet] .sheet-open>.sheet-media{grid-template-rows:1fr;visibility:visible;margin-top:16px;transition:grid-template-rows .55s cubic-bezier(.4,0,.2,1),margin .55s cubic-bezier(.4,0,.2,1),visibility 0s}
:root[data-alive-ui=sheet] .sheet-open>figure.sheet-poster{max-height:0;opacity:0;margin-top:0;padding-bottom:0}
:root[data-alive-ui=sheet] .sheet-open>.sheet-play{opacity:0;pointer-events:none;transform:scale(.8)}
:root[data-alive-ui=sheet] .sheet-media iframe{display:block;width:100%;border:0;background:transparent}
:root[data-alive-ui=sheet] .sheet-media[data-kind=film] iframe{aspect-ratio:1280/780}
:root[data-alive-ui=sheet] .sheet-media[data-kind=card] iframe{height:600px}
/* the film's board draws on the paper: in light the dark board is inverted and blended away; in dark its light ink lightens onto the page */
:root[data-alive-ui=sheet]:not([data-theme=dark]) .sheet-media[data-kind=film] iframe{filter:invert(1) hue-rotate(180deg) brightness(1.04);mix-blend-mode:darken}
/* in dark the page is grey and a film or card sits on it as a black box, so it pops out (Sohil, 2026-10-05) */
:root[data-alive-ui=sheet][data-theme=dark] .sheet-media>.sheet-frame{background:var(--lc-board-bg);border-radius:12px}
:root[data-alive-ui=sheet][data-theme=dark] .col :is(.el,.ex),:root[data-alive-ui=sheet][data-theme=dark] .col :is(.el,.ex)[data-lit]{background:var(--lc-board-bg)!important}   /* each idea's and example's whole box is black like its film, so a film or card sits in it seamlessly */
:root[data-alive-ui=sheet][data-theme=dark] .sheet-media[data-kind=film] iframe{mix-blend-mode:normal}

/* ---- the close mark: a modern X, on any open sheet and on an explaining practice problem ---- */
:root[data-alive-ui=sheet] .sheet-close,:root[data-alive-ui=sheet] .alive-close{position:absolute;top:14px;right:14px;width:34px;height:34px;border-radius:50%;border:0;padding:0;cursor:pointer;z-index:3;
  background:var(--sheet-btn);color:var(--sheet-btn-ink);opacity:0;pointer-events:none;transform:scale(.85);
  transition:opacity .28s ease,transform .3s var(--sheet-ease),background .2s}
:root[data-alive-ui=sheet] .sheet-close::before,:root[data-alive-ui=sheet] .sheet-close::after,
:root[data-alive-ui=sheet] .alive-close::before,:root[data-alive-ui=sheet] .alive-close::after{content:"";position:absolute;left:50%;top:50%;width:13px;height:1.75px;margin:-.875px 0 0 -6.5px;background:currentColor;border-radius:2px}
:root[data-alive-ui=sheet] .sheet-close::before,:root[data-alive-ui=sheet] .alive-close::before{transform:rotate(45deg)}
:root[data-alive-ui=sheet] .sheet-close::after,:root[data-alive-ui=sheet] .alive-close::after{transform:rotate(-45deg)}
:root[data-alive-ui=sheet] .sheet-close:hover,:root[data-alive-ui=sheet] .alive-close:hover{background:var(--sheet-btn-hover)}
:root[data-alive-ui=sheet] .sheet-close:focus-visible,:root[data-alive-ui=sheet] .alive-close:focus-visible{outline:2px solid var(--alive-accent);outline-offset:2px}
:root[data-alive-ui=sheet] .sheet-open>.sheet-close,:root[data-alive-ui=sheet] .prob.explaining>.alive-close{opacity:1;pointer-events:auto;transform:none}

/* ---- the jump bar: modern buttons in the page's style; the anchors glide ---- */
html:is([data-alive-ui=sheet]){scroll-behavior:smooth}
:root[data-alive-ui=sheet] main.col>section,:root[data-alive-ui=sheet] #lesson{scroll-margin-top:24px}
:root[data-alive-ui=sheet] .top .right{gap:4px;padding:4px;border-radius:999px;background:var(--sheet-btn)}
:root[data-alive-ui=sheet] .top .right a{padding:6px 14px;border-radius:999px;color:var(--body);font:500 15px/1.2 var(--lf-nav);transition:background .2s,color .2s,box-shadow .2s}
:root[data-alive-ui=sheet] .top .right a:hover{color:var(--ink);background:var(--sheet-btn-hover)}
:root[data-alive-ui=sheet] .top .right a.on{color:var(--ink);background:var(--panel);box-shadow:0 1px 3px color-mix(in srgb,var(--lc-shadow) 12%,transparent),0 0 0 1px color-mix(in srgb,var(--lc-shadow) 4%,transparent)}
:root[data-alive-ui=sheet][data-theme=dark] .top .right a.on{background:var(--lc-control-hover);box-shadow:none}

/* ---- no grey or italic content text ---- */
:root[data-alive-ui=sheet] .kicker{font-style:normal;color:var(--accent);font:500 15px/1.4 var(--lf-label);letter-spacing:.01em}
:root[data-alive-ui=sheet] .fq .row .row-label,:root[data-alive-ui=sheet] .row-label{font-style:normal;color:var(--ink)}
:root[data-alive-ui=sheet] .prac .ph,:root[data-alive-ui=sheet] .prac .ph .nb{font-style:normal;color:var(--body)}
:root[data-alive-ui=sheet] figcaption,:root[data-alive-ui=sheet] .fq .say,:root[data-alive-ui=sheet] .el>.lab .t,:root[data-alive-ui=sheet] .kc .knote,:root[data-alive-ui=sheet] .hint,:root[data-alive-ui=sheet] .feedback-copy{font-style:normal;color:var(--body)}
:root[data-alive-ui=sheet] .key-idea strong{font-style:normal}
/* Key concepts headings keep their hues: one definition, in ../lib/page.css (.k-indigo …), from the palette */

/* ---- no rules before Key concepts: the heading and the entries' hues separate them ---- */
:root[data-alive-ui=sheet] section.key::before{content:none;display:none}
:root[data-alive-ui=sheet] .kc,:root[data-alive-ui=sheet][data-theme] .kc{border-top:0}

@media(max-width:640px){
  :root[data-alive-ui=sheet] .sheet-play{left:14px;bottom:14px;width:44px;height:44px}
  :root[data-alive-ui=sheet] :is(.el,.ex)>figure.sheet-poster{padding-bottom:56px}
  :root[data-alive-ui=sheet] .sheet-close,:root[data-alive-ui=sheet] .alive-close{top:8px;right:8px}
  :root[data-alive-ui=sheet] .top .right a{padding:6px 10px}
  :root[data-alive-ui=sheet] .sheet-media[data-kind=card] iframe{height:560px}
}
@media(prefers-reduced-motion:reduce){
  /* Match the open rule's specificity too: playback starts immediately in this mode,
     so an unintended unfolding transition can make the film appear offscreen and pause. */
  :root[data-alive-ui=sheet] .sheet-media,:root[data-alive-ui=sheet] .sheet-open>.sheet-media,:root[data-alive-ui=sheet] :is(.el,.ex)>figure.sheet-poster,:root[data-alive-ui=sheet] .sheet-play,:root[data-alive-ui=sheet] .sheet-close{transition:none}
  html:is([data-alive-ui=sheet]){scroll-behavior:auto}
}

/* ---- practice: the solution film sits on the paper like the lesson films; the written solution is page text ---- */
:root[data-alive-ui=sheet] .col .prob .sol.show{background:transparent;border:0;border-radius:0;padding:0;margin:16px 0 0 38px;font:400 17.5px/1.6 var(--lf-solution);color:var(--body)}
:root[data-alive-ui=sheet][data-theme=dark] .col .prob .sol.show{background:transparent}
:root[data-alive-ui=sheet] .prob .sol .txt{border-left:0;padding:4px 0 0;margin-left:0}
@media(max-width:640px){:root[data-alive-ui=sheet] .col .prob .sol.show{margin-left:0}}

/* ---- a Key idea is its label and the idea below it: no bar, no box, no tint (Sohil, 2026-09-18) ---- */
:root[data-alive-ui=sheet] .col .key-idea,:root[data-alive-ui=sheet] .key-idea{border:0;border-radius:0;background:transparent;padding:0;margin:40px 0 34px;width:auto}
:root[data-alive-ui=sheet] .key-idea strong{display:block;font:600 15px/1.3 var(--lf-label);letter-spacing:.01em;font-style:normal;color:var(--accent);margin:0 0 6px}
:root[data-alive-ui=sheet] .key-idea p{margin:0;font-size:1em;line-height:1.6;color:var(--ink)}

/* ---- a figure and its rows are one explanation: the rows sit in the figure's own column, under it ---- */
:root[data-alive-ui=sheet] .figure-pair.with-rows{align-items:start}
:root[data-alive-ui=sheet] .figure-pair.with-rows>figure{display:flex;flex-direction:column;align-items:center}
:root[data-alive-ui=sheet] .fig-rows{align-self:stretch;margin:14px 0 2px;padding:0 4px}
:root[data-alive-ui=sheet] .fig-rows .row{display:flex;flex-direction:column;align-items:flex-start;gap:2px}
:root[data-alive-ui=sheet] .fig-rows .row+.row{margin-top:12px}
:root[data-alive-ui=sheet] .fig-rows .row-label{font:500 15px/1.35 var(--alive-heading-font);color:var(--ink)}
:root[data-alive-ui=sheet] .fig-rows .katex{font-size:1.12em}
/* a card sits live in its block: no poster, no play mark or close of the sheet's own (Sohil, 2026-09-19) */
:root[data-alive-ui=sheet] .sheet-live>.sheet-media{grid-template-rows:1fr;visibility:visible;margin-top:14px;transition:none}
:root[data-alive-ui=sheet] .sheet-live>figure.sheet-poster{display:none}
/* A concept block's title names the idea, so it is set as one: centred, larger, in the ink of the page, the way a
   figure's title reads in a book, not a small coloured label in the corner of a box (Sohil, 2026-09-19). A worked
   example or a practice problem has no title of its own: its problem is its heading. */
:root[data-alive-ui=sheet] .el>.lab{text-align:center;padding:0 44px;margin:2px 0 10px;font:500 21px/1.35 var(--alive-body-font,'STIX Two Text',Georgia,serif);color:var(--ink);letter-spacing:.003em}
@media(max-width:640px){:root[data-alive-ui=sheet] .el>.lab{font-size:19px;padding:0 36px}}
/* Practice: an answer reads as one line, "V = [   ] π", and Check, Hint and Explain sit in one row under it
   (sheet.js moves a single-part problem's Explain into its row). */
:root[data-alive-ui=sheet] .prob .answer-fields label{display:inline-flex;align-items:baseline;flex-wrap:nowrap;gap:8px;font-style:normal}
:root[data-alive-ui=sheet] .prob .answer-fields label>input{grid-column:auto;width:150px;min-height:40px}
:root[data-alive-ui=sheet] .prob .part>.ans{flex-wrap:wrap;align-items:center;gap:10px}

/* A diagram and its equations share a full mathematical surface. Percentage-sized
   SVGs must never negotiate their width against a fit-content heading. */
:root[data-alive-ui=sheet] .fq.figure-formula>.f{width:100%}
:root[data-alive-ui=sheet] .fq.figure-formula>.f>figure{width:100%;max-width:520px;margin:18px auto}
:root[data-alive-ui=sheet] .fq.figure-formula>.f>figure>svg{display:block;width:100%;max-width:100%;height:auto;margin-inline:auto}

/* Playback owns the diagram; the statement and givens stay as its reference.
   This rule follows responsive poster padding, so a folded phone poster is zero height too. */
:root[data-alive-ui=sheet] :is(.el,.ex).sheet-open>figure.sheet-poster{padding-bottom:0}
:root[data-alive-ui=sheet] .prob.explaining:has(.media-film) .prob-figure{display:none}
:root[data-alive-ui=sheet] .prob .media-film{position:relative;width:100%;height:auto;aspect-ratio:auto;margin:0 0 6px;background:transparent;overflow:visible;filter:none}
:root[data-alive-ui=sheet] .prob .media-film iframe{position:static;display:block;width:100%;border:0;aspect-ratio:1280/860;background:transparent}
:root[data-alive-ui=sheet]:not([data-theme=dark]) .prob .media-film iframe{filter:invert(1) hue-rotate(180deg) brightness(1.04);mix-blend-mode:darken}
:root[data-alive-ui=sheet][data-theme=dark] .prob .media-film iframe{filter:none;mix-blend-mode:normal;background:var(--lc-board-bg);border-radius:12px}

/* A table poster uses the available content width. Its columns choose their
   count from that width, not the viewport or a graph-poster size cap. */
:root[data-alive-ui=sheet] :is(.el,.ex)>figure.sheet-poster:has(table){max-width:none}
:root[data-alive-ui=sheet] .limit-tables{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,260px),1fr));gap:16px 24px;margin:16px 0;min-width:0}

/* ---- an algebra film (opt in: data-poster="math" on its .ex; Sohil, 2026-09-26) ----
   Its problem has no honest picture, so the problem itself is the poster, written once: at rest the block shows only
   that (.sheet-math, the problem with "= ?", and only the words it needs). On play the poster folds away and the
   block's .st, the same problem without "= ?", slides in on top and stays as the statement while the film plays.
   A film whose problem is a picture keeps its title and its diagram poster, as before. */
:root[data-alive-ui=sheet] .ex[data-poster=math]>.st{max-height:0;opacity:0;overflow:hidden;margin:0;padding-top:0;padding-bottom:0;
  transition:max-height .5s cubic-bezier(.4,0,.2,1),opacity .35s ease .12s,margin .5s cubic-bezier(.4,0,.2,1)}
:root[data-alive-ui=sheet] .ex[data-poster=math].sheet-open>.st{max-height:260px;opacity:1;margin:0 0 6px}
/* 1.25em: at 1.45em the problem read oversized beside the page's own maths (Sohil, 2026-09-27: "the txt in film poster enlarged weirdly") */
:root[data-alive-ui=sheet] .sheet-math{display:flex;flex-direction:column;align-items:center;gap:6px;padding:14px 8px 4px;font-size:1.25em;color:var(--ink)}
:root[data-alive-ui=sheet] .sheet-math .math-chain{justify-content:center;margin:0}
@media(max-width:640px){:root[data-alive-ui=sheet] .sheet-math{font-size:1.1em;padding-top:10px}}

/* 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 */
:root[data-alive-ui=sheet]:not([data-theme=dark]) .sheet-media[data-kind=film] iframe:fullscreen{mix-blend-mode:normal}
:root[data-alive-ui=sheet]:not([data-theme=dark]) .sheet-media[data-kind=film] iframe:-webkit-full-screen{mix-blend-mode:normal}
:root[data-alive-ui=sheet]:not([data-theme=dark]) .prob .media-film iframe:fullscreen{mix-blend-mode:normal}
:root[data-alive-ui=sheet]:not([data-theme=dark]) .prob .media-film iframe:-webkit-full-screen{mix-blend-mode:normal}
