/* ═══ A document's own typography — ONE stylesheet for the editor, the portal, the app and the PDF ═══
   Operator, 2026-10-16: "Template numbering / Pagination needs a fix. Check Nancy Eleanor". The editor drew
   a contract with these rules while the PDF used dompdf's defaults — 1em above and below every paragraph,
   inside every list item — so no page the editor showed was a page that printed (template #64: 12 sheets
   on screen, 13 pages from the printer, every break somewhere else).
   The app and the employee app link this file; letterhead_lib.php lhDocCss() inlines it into the PDF of
   every document the editor saved (.rte-root[data-layout="2"]). An older document prints as it always has.
   ⚠ dompdf reads CSS 2.1 — no variables, no :is/:where/:has, no flex or grid, no ::marker — and this file
     is handed to it whole. tests/rte-doc-css.test.js holds it to that. */
/* Words measured as the printer measures them: dompdf never kerns, and a browser that does fits a few more
   words on some lines — template #64's clause 9.2(a) ran to five lines on screen and six in the PDF. */
.rte-root{font-kerning:none}
.rte-root h1{font-size:12.5pt;font-weight:700;text-transform:uppercase;text-align:center;letter-spacing:.03em;margin:8pt 0 5pt}
.rte-root h2{font-size:11pt;font-weight:700;text-decoration:underline;margin:8pt 0 4pt}
.rte-root h3{font-size:10.5pt;font-weight:700;margin:7pt 0 4pt}
.rte-root h4,.rte-root h5,.rte-root h6{font-weight:700;margin:6pt 0 3pt}
.rte-root p{margin:0 0 5pt}
/* ⚠ padding-left stated, not left to the reader: the app's reset (app.css: * { margin:0; padding:0 }) took
   a list's 40px away on screen while dompdf kept its own 40px — on template #64 two nested lists printed
   21mm further right than the editor drew them, each line held fewer words, and the PDF ran a page longer. */
.rte-root ul,.rte-root ol{margin:4pt 0 0 20pt;padding-left:40px}
.rte-root li{margin-bottom:2pt}
/* ⚠⚠ Margins exactly as dompdf adds them — measured, case by case, in both engines (template #64 printed
   every item further apart than the editor drew it). dompdf collapses SIBLINGS' margins, and a last
   paragraph's into its list item's, as a browser does; it never collapses a list's own bottom margin with
   its last item's (9pt where a browser makes 5pt), nor a first paragraph's top margin through its item
   (17pt where a browser makes 12pt — Google Docs puts 6–12pt above the paragraph in every item). So a list
   ends on its last item's margin (no margin of its own below it — nor its last item: dompdf adds that
   item's 2pt to its paragraph's 5pt, at the end of a list only), a list nested in a list starts on its
   first item's, whatever follows a list sets no space above it (dompdf adds it to the space the list's
   last item carries out; a browser takes the larger), and an item's first paragraph sets no space above
   it (!important: Google's inline margins would win). Both engines then add the same.
   (A hair of padding to stop the browser collapsing moved dompdf's page breaks — CSS 2.1's "type 3"
   break at the top of every padded box — and clause 5.3 printed on the next page with 19mm free.) */
.rte-root li > p:first-child{margin-top:0 !important}
.rte-root li:last-child{margin-bottom:0}
.rte-root ol ol,.rte-root ol ul,.rte-root ul ol,.rte-root ul ul{margin-top:0}
.rte-root ol + p,.rte-root ul + p,.rte-root ol + ol,.rte-root ol + ul,.rte-root ul + ol,.rte-root ul + ul,
.rte-root ol + h1,.rte-root ol + h2,.rte-root ol + h3,.rte-root ul + h1,.rte-root ul + h2,.rte-root ul + h3,
.rte-root ol + table,.rte-root ul + table,.rte-root ol + div,.rte-root ul + div{margin-top:0 !important}
/* A paragraph moves to the next page whole, as the editor moves it — a page on screen cannot end inside
   one. dompdf otherwise carried a paragraph's last line or two over, and its pages ran ahead of the
   editor's. One taller than a page still breaks: there is nowhere else for it to go. */
.rte-root p{page-break-inside:avoid}
.rte-root hr{border:none;border-top:1px solid #bbb;margin:8pt 0}
.rte-root blockquote{margin:6pt 0 6pt 24pt;padding-left:10pt;border-left:2.5px solid #ccc;font-style:italic}
.rte-root table{border-collapse:collapse;width:100%;margin:8pt 0}
.rte-root th,.rte-root td{border:1px solid #999;padding:6px 8px;vertical-align:top}
.rte-root th{background:#f0f0f0;font-weight:700}
.rte-root s,.rte-root strike,.rte-root del{text-decoration:line-through}
.rte-root sub{vertical-align:sub;font-size:smaller}
.rte-root sup{vertical-align:super;font-size:smaller}

/* Clause numbering — 1. · 1.1 · (a) · (i), the whole document one outline. The editor works the labels out
   (_rteNumber in app.js) and stores each on its item as data-num, so every reader shows the same number
   without counting for itself: the PDF, the portal and the app print what the editor showed. A reader
   without this file falls back to the list's own 1. 2. 3. — never to no number at all. */
.rte-root.rte-num-legal li.rte-num-item{list-style:none !important}
.rte-root.rte-num-legal [data-num]{position:relative;padding-left:2.8em}
.rte-root.rte-num-legal [data-num]::before{content:attr(data-num);position:absolute;left:0;top:0}

/* Keep with what follows — a clause heading, a lead-in that ends "…shall:" (_rteMarkKeeps). Measured on
   template #64: "Compensation" and "Termination by Expiry of Term" each printed alone at the foot of a page. */
.rte-root .rte-keep{page-break-after:avoid;break-after:avoid}
