/* --------------------------------------------------------------------------- customer-grid / route print sheet (W46-T20, instruction 10, ruling R6, C6) Route export is the browser's own Save as PDF. No new dependency, no renderer: a print stylesheet plus a body level portal, which is the pattern the catalog export already proves in this codebase (catalogPrint.ts plus the print block in index.css keyed off `cg-cat-printing`). THREE THINGS THIS FILE OWES, and each one is load bearing: 1. ISOLATION. When a person prints a route, the app shell, the grid, the map and every panel must not print. `body > *` is hidden and the one portal is revealed, exactly as the catalog block does it. Its class names are NOT reused: `cg-cat-printing` un-hides only `.cg-cat-print-portal`, so borrowing it would print a blank page with no error anywhere. 2. THE HEIGHT RESET. index.css sets `html, body, #root { height: 100% }`, and the shell above that scrolls inside its own panes. Left alone, a flowing stop list is clipped to ONE page: the stops past the fold never lay out, so they are absent from the PDF and Chromium emits no link annotation for them either. The reset below is the whole reason the tail of a long route reaches paper. 3. VISIBLE ANCHORS. A PDF link annotation is emitted by the print engine for a real `` that is VISIBLE in the print layout. Nothing here may hide, collapse or zero out a stop link, and `break-inside: avoid` keeps a stop from being torn across a page boundary. ⚠ NO `@page` RULE ON PURPOSE. `@page` is global to the document and cannot be scoped to a class, so a margin declared here would also reach the catalog export, which sets its own `@page { margin: 0 }` from generated CSS. The browser's default page margin is honest and costs nothing. That also keeps this sheet free of literal lengths in the type scale sense: every size below is a `--lp-fs-*` token, per DESIGN.md and the R5 font gate. Tokens come from the `:root` block in index.css, which is where they must be read from here: this portal mounts on `document.body`, OUTSIDE the grid surface, so any token declared on a wrapper element would be undefined in it. --------------------------------------------------------------------------- */ /* Parked off screen rather than display:none while a print is in flight, so the sheet has real layout the moment the dialog opens. It is mounted only for the duration of a print, so on screen this rule is all it ever is. */ .cg-w46-route-print-portal { position: fixed; left: -20000px; top: 0; } /* ── the control itself, on screen ────────────────────────────────────────── It lives in the Route panel beside the Maps links, so it borrows that block's vocabulary rather than inventing one. The button resets native chrome, which is the house rule for every button in this app. */ .cg-w46-route-export { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.5rem 0 0; border-top: 1px solid var(--lp-line); } .cg-w46-route-export h3 { margin: 0; font-size: var(--lp-fs-2xs); font-weight: 600; color: var(--lp-ink); } .cg-w46-route-export p { margin: 0; font-size: var(--lp-fs-3xs); color: var(--lp-muted); } .cg-w46-route-export-open { align-self: flex-start; border: 0; padding: 4px 7px; border-radius: var(--lp-r-sm); background: var(--lp-primary); color: var(--cg-white); font-family: inherit; font-size: var(--lp-fs-3xs); font-weight: 600; cursor: pointer; } .cg-w46-route-export-open:hover:enabled { opacity: 0.9; } .cg-w46-route-export-open:disabled { opacity: 0.55; cursor: default; } .cg-w46-route-export-open:focus-visible { outline: 2px solid var(--lp-blue-deep); outline-offset: 2px; } @media print { html.cg-w46-route-printing, html.cg-w46-route-printing body { height: auto !important; min-height: 0 !important; max-height: none !important; overflow: visible !important; margin: 0; padding: 0; background: var(--cg-white); -webkit-print-color-adjust: exact; print-color-adjust: exact; } html.cg-w46-route-printing body > * { display: none !important; } html.cg-w46-route-printing body > .cg-w46-route-print-portal { display: block !important; position: static !important; left: auto !important; top: auto !important; } .cg-w46-route-print-sheet { color: var(--lp-ink); font-size: var(--lp-fs-sm); line-height: 1.45; } .cg-w46-route-print-title { margin: 0; font-size: var(--lp-fs-lg); font-weight: 600; color: var(--lp-primary); } .cg-w46-route-print-meta { margin: 0.25rem 0 0.75rem; font-size: var(--lp-fs-2xs); color: var(--lp-muted); } .cg-w46-route-print-stops { margin: 0; padding: 0; list-style: none; } /* A stop torn across a page boundary is how an anchor loses its annotation. */ .cg-w46-route-print-stop { display: flex; gap: 0.6rem; padding: 0.4rem 0; border-top: 1px solid var(--lp-line); break-inside: avoid; page-break-inside: avoid; } .cg-w46-print-pos { flex: 0 0 auto; min-width: 1.6rem; font-weight: 600; color: var(--lp-primary); } .cg-w46-print-body { display: flex; flex-direction: column; gap: 0.1rem; } .cg-w46-print-name { font-weight: 600; } .cg-w46-print-address, .cg-w46-print-nolink { font-size: var(--lp-fs-2xs); color: var(--lp-muted); } /* The clickable half. Underlined and coloured so a reader can see on paper that it was a link, and never hidden, so the engine emits the annotation. */ .cg-w46-print-link { font-size: var(--lp-fs-2xs); color: var(--lp-primary); text-decoration: underline; } }