/*
  The client-side print pipeline's furniture — brief #15.

  Shared by every surface that paginates itself: the printable worksheet
  (src/worksheet-generator.js) and the study guide (src/study-guide-ui.js).
  It used to live in src/worksheet.css, which is loaded on the home page
  only; the study guide runs on the quiz pages, so the rules had to reach
  both without being written twice.

  The three-document design, stated once because both callers build it:

    <x>-flow    the original single-flow document. Hidden on screen and
                shown only under the printing body class, so the LEGACY
                browser-print route stays reachable and unchanged.
    <x>-master  the real pages at natural size, offscreen but RENDERED.
                The PDF rasters exactly these nodes, so they must be
                measurable — never display:none, or every height reads
                as zero and KaTeX measures as nothing at all.
    <x>-pages   the preview: scaled clones of the master. Preview equals
                paper by construction rather than by care.

  Page WIDTH, HEIGHT and PADDING are set inline from
  PrintPaginate.geometry(), not here: the worksheet is US Letter with
  0.5in/0.55in margins and two columns, the guide the same sheet with
  0.62in/0.72in/0.66in and one. Only the parts that are genuinely common
  are in this file.
*/

.wsp-master {
  position: absolute;
  left: -99999px;
  top: 0;
}

.wsp-pages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: flex-start;
}
.wsp-slot { overflow: hidden; }

.wsp-page {
  box-sizing: border-box;
  background: #fff;
  box-shadow: 0 2px 14px rgba(30, 20, 60, 0.14);
  overflow: hidden;
  position: relative;
}
/* The master is machinery, not a picture of paper. */
.wsp-master .wsp-page { box-shadow: none; }

.wsp-cols {
  position: relative;
  display: flex;
  justify-content: space-between;
}
/* The column rule the multicol layout drew, redrawn where the gap is. */
.wsp-cols::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #eceaf2;
}

/* A measured block never splits: that is the atomicity the flow
   algorithm assumes, and it is also what rebuilds the orphan/widow
   protection the print stylesheet used to inherit from the browser.

   flow-root (3 Sep 2026): the wrapper must CONTAIN its child's vertical
   margins. As a plain div it let them collapse through, so a box with
   margin 13px 0 15px measured as its border box alone and then took
   its margins on the page — every box up to 15 px short, accumulating
   down a column, and invisible until the #87 retrofit put enough boxes
   on one page to reach the bound. With a block formatting context the
   height read in measureBlocks() is the height the page uses. See
   docs/RUNBOOK.md, "The paginator measured every box 13–15 px short". */
.wsp-block { break-inside: avoid; display: flow-root; }
