/* The Stationery House — shared piece mechanics. Owner: STAT-ART-A. Layout and look live in each collection's own CSS;
   this file holds only the print box, the face/bleed/trim geometry and the render modes the pipeline (art.mjs) toggles.
   Modes (html[data-mode], set by lib/bind.js from ?mode=):
     screen      paper drawn (the die shape filled with the paper token), every finish in its screen colour — the proof
     art         paper NOT drawn (transparent), every finish in its colour — art.png and print.pdf
     mask-<f>    only elements with data-finish=<f>, solid black on transparent — one mask PNG per finish
     diecut      only the die shape, solid black on transparent */
@page { margin: 0; }
html, body { margin: 0; padding: 0; background: transparent; }
html[data-mode="screen"] body { background: #d9d6cf; padding: 10mm; } /* proof only: a neutral desk; never in art, mask or print */
html[data-mode="screen"][data-one-face] body { padding: 0; background: transparent; }
*, *::before, *::after { box-sizing: border-box; }
body { -webkit-print-color-adjust: exact; print-color-adjust: exact; font-kerning: normal; text-rendering: geometricPrecision; }

.faces { display: flex; flex-wrap: wrap; gap: 10mm; align-items: flex-start; }
html[data-one-face] .faces { display: block; }
.face { position: relative; overflow: hidden; flex: none; break-after: page; page-break-after: always; }
.face:last-child { break-after: auto; page-break-after: auto; }
/* the die shape: an SVG covering the whole face (trim + bleed), path drawn in face mm with the trim at (3,3) */
.face > svg.die { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.face > svg.die path { fill: var(--paper); stroke: none; }
/* the trim box: everything printed is placed inside it (bleed elements may run out by up to 3 mm) */
.trim { position: absolute; left: 3mm; top: 3mm; width: var(--tw); height: var(--th); }
/* the safe box: trim minus the piece margin; text lives here (probe T6) */
.safe { position: absolute; }

/* STATX1 (Car A, PLAN §4.3): no one-word last lines. Every text block wraps balanced; the same Chromium draws the proof and
   print.pdf, so the line breaks the couple sees are the line breaks that print. Names that must not wrap keep .nowrap. */
.face .trim * { text-wrap: balance; }

/* STATX1 (Car A, PLAN §4.1): a centred block sits on the OPTICAL centre (45 % from the top), not the mathematical one.
   A 10 % flexible spacer after the block in every centred column lifts its centre by 5 % of the box; it shrinks to
   nothing when the block is tall, so nothing is ever pushed out of the safe box. */
.face .trim .col.fill[style*="justify-content:center"]::after { content: ''; flex: 0 1 10%; }

/* screen helpers: blind (debossed, no ink) shows as a faint shade only on screen; never printed as ink */
[data-finish="blind"] { color: var(--blind); }

/* ---- render modes ---- */
html[data-mode="art"] .face > svg.die path,
html[data-mode^="mask"] .face > svg.die path { fill: transparent; }
html[data-mode="art"] [data-finish="blind"] { visibility: hidden; }          /* blind is pressed, never inked: not in the art */
html[data-mode^="mask"] body, html[data-mode="diecut"] body { visibility: hidden; }
html[data-mode="mask-ink"]  [data-finish="ink"],
html[data-mode="mask-ink2"] [data-finish="ink2"],
html[data-mode="mask-foil"] [data-finish="foil"],
html[data-mode="mask-blind"] [data-finish="blind"] { visibility: visible; filter: brightness(0); }
html[data-mode="mask-ink"]  [data-finish]:not([data-finish="ink"]),
html[data-mode="mask-ink2"] [data-finish]:not([data-finish="ink2"]),
html[data-mode="mask-foil"] [data-finish]:not([data-finish="foil"]),
html[data-mode="mask-blind"] [data-finish]:not([data-finish="blind"]) { visibility: hidden; }
html[data-mode="diecut"] .face > svg.die { visibility: visible; }
html[data-mode="diecut"] .face > svg.die path { fill: #000; }
html[data-mode="diecut"] .face > svg.die path:not(.diecut-path) { visibility: hidden; }

/* QR */
.qr { display: block; width: 100%; height: 100%; }
.qr-ink { fill: var(--ink); }

/* score / fold line: shown on screen only as a guide, never printed */
.score { display: none; } /* fold and score lines are data (data-fold), never drawn */

/* a pressed area (blind or letterpress panel): its mask is the filled region, whatever its screen look */
html[data-mode="mask-blind"] .press-area { fill: #000 !important; stroke: #000 !important; }
