:root {
  --cv-utskrift-storlek:   10.5pt;
  --cv-utskrift-radavstand: 1.35;
}

.cv-dok {
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.4;
  color: #111;
}
.cv-dok__topp { margin-block-end: 1.1em; }
.cv-dok__namn { font-family: inherit; font-size: 1.6em; margin: 0 0 .1em; letter-spacing: 0; }
.cv-dok__malroll { font-size: 1.1em; margin: 0 0 .5em; }
.cv-dok__profiltext { margin: 0 0 .5em; }
.cv-dok__kontakt { margin: 0; font-size: .95em; }
.cv-dok__foto { float: inline-end; width: 28mm; margin-inline-start: 1em; border-radius: 2px; }
.cv-dok__sektion { margin-block-end: 1em; }
.cv-dok__rubrik {
  font-family: inherit;
  font-size: 1em;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 0 0 .35em;
  padding-block-end: .15em;
  border-block-end: 1px solid #999;
}
.cv-dok__rad { margin-block-end: .6em; break-inside: avoid; }
.cv-dok__radtopp { display: flex; justify-content: space-between; gap: 1em; margin: 0; }
.cv-dok__titel { font-weight: 600; }
.cv-dok__datum { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cv-dok__under { margin: 0; font-size: .95em; color: #333; }
.cv-dok__punkter { margin: .2em 0 0; padding-inline-start: 1.1em; }
.cv-dok__lista { margin: 0 0 .25em; }

/* G-22's offscreen measurement (dokument-vy.js): the container owns the print type size and the
   document inherits it, so the number measured is the printed page and not the screen. The same
   two lines appear under `@media print` for `#print-area .cv-dok`, and for the same reason — a
   `.cv-dok` that keeps its own screen type size is a document nobody measured. */
.cv-matt .cv-dok { font-size: inherit; line-height: inherit; }

#print-area { display: none; }

/* THE RUNNING IDENTIFICATION ON PAGE TWO AND AFTER — spec.md §9.1, and the one place this app
 * uses a mechanism the repository previously believed did not exist.
 *
 * `apps/urvalskalkyl/src/ui/print.js` says *"the `@page` margin boxes that would do it are
 * implemented by no browser"*. MEASURED HERE 2026-09-19, and it is no longer true of Chromium:
 *
 *   node cdp.mjs about:blank print mb5.js      # @page margin box + counter(page)/counter(pages)
 *   -> page 1: (nothing)   page 2: "Sida 2 av 2" + "Anna Andersson · Vårdbiträde"
 *
 * Three things were verified together, because the design needs all three: a margin box renders;
 * `counter(page)`/`counter(pages)` resolve inside it; and `var()` substitutes a whole token
 * stream, counters included, so the SENTENCE stays in the document-language registry and CSS
 * holds no words (spec.md §12.2 rule 1). `utskrift.js` sets the two properties through CSSOM,
 * which `style-src 'self'` permits and which an inline <style> would not be.
 *
 * VERIFIED IN CHROME 153.0.8010.50 AND NOWHERE ELSE — the version this machine runs; the number
 * here read 152 until 2026-09-19, when the done-check re-ran the measurement against a real CV
 * (`Page.printToPDF` -> two pages -> `pdftotext -f 2` -> "Amina Yusuf · Vårdbiträde" and
 * "Sida 2 av 2") and corrected it. Safari and Firefox are unchecked. Where a margin box
 * is unsupported the declaration simply does not render, which is the right failure direction:
 * the page-two line is absent, never wrong. Nothing else on the sheet depends on it.
 *
 * `:first` is what keeps page one clean — the one-page CV the whole document is designed to be
 * carries no line of ours at all (§9.1: no logo, no footer, no "Skapad med CV-byggare"). */

/* The margin boxes do not inherit from the document — they belong to the page — so without a
   font of their own they print in the engine's default serif under a sans-serif CV. Measured in
   Chrome's PDF of a two-page CV, 2026-10-12. The stack is .cv-dok's. */
@page {
  size: A4;
  margin: 18mm 20mm;
  @bottom-left { content: var(--cv-sidfot, ""); font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif; font-size: 8pt; color: #333; }
  @bottom-right { content: var(--cv-sida, ""); font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif; font-size: 8pt; color: #333; }
}

@page :first {
  @bottom-left { content: none; }
  @bottom-right { content: none; }
}

@media print {
  body > *:not(#print-area) { display: none !important; }
  body { background: #fff; color: #000; }

  #print-area {
    display: block;
    font-size: var(--cv-utskrift-storlek);
    line-height: var(--cv-utskrift-radavstand);
    color: #000;
  }

  /* THE LINE THAT MAKES THE SIZE ABOVE REACH THE DOCUMENT. `.cv-dok` declares its own screen
   * type size and is a CHILD of #print-area, so without this it never inherits the print one
   * and the printed page is not the page that was measured. */
  #print-area .cv-dok { font-size: inherit; line-height: inherit; }

  /* No paragraph is left with one line on the wrong side of a fold. */
  #print-area p, #print-area li { orphans: 3; widows: 3; }

  /* Every entry stays whole. NOT the section — see the note above the @page rules. */
  #print-area .cv-dok__rad,
  #print-area .cv-dok__lista { break-inside: avoid; page-break-inside: avoid; }

  /* A heading never ends a page: it goes with what it introduces. */
  #print-area .cv-dok__topp,
  #print-area .cv-dok__rubrik { break-after: avoid; page-break-after: avoid; }
  #print-area .cv-dok__rubrik { break-inside: avoid; border-block-end-color: #000; }

  /* The top third of the PRINTED page — the region §3 reserves and Överblick measures. */
  #print-area .cv-dok__namn { font-size: 1.7em; }
  #print-area .cv-dok__under { color: #222; }
  #print-area .cv-dok__foto { width: 26mm; }

  /* The browser's own colour adjustment must not drop the hairlines under the headings. */
  #print-area { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
