/* ============================================================================
   KitCheck Suite — paper
   ----------------------------------------------------------------------------
   Linked from App.razor with media="print", which is why nothing in this file
   is wrapped in @media print and why nothing in it can reach the screen. Load
   it any other way and it takes the application apart.

   It exists for one artefact: the egenkontrollprogram, printed and handed to a
   miljöinspektör. Paper has no hover, no scroll bar and no back button, so
   every rule below is about what survives losing those — not about tidiness.
   ========================================================================== */

@page {
  size: A4;
  /* Extra on the left: this ends up hole-punched into a binder the kitchen
     keeps, and a margin the punch eats is a margin that took a word with it. */
  margin: 18mm 16mm 18mm 22mm;
}

/* ============================================================================
   1. The application, minus the application
   ========================================================================== */

/* Chrome carries nothing onto paper — the reader cannot press any of it, and a
   nav bar photocopied into a compliance binder is noise an inspector has to
   read past to reach the document.

   !important throughout this block, and only this one: every one of these is
   laid out on screen by a class rule that outranks an element selector, and on
   paper this is the last word rather than a competing opinion. */
.kc-topline,
.kc-appbar,
.kc-navrow,
.kc-impbar,
.kc-steps,
.kc-overlay,
#blazor-error-ui,
#components-reconnect-modal,
button,
.kc-btn {
  display: none !important;
}

/* The shell's frame is a screen device: it centres a column inside a viewport
   that no longer exists once @page owns the margins. */
main.kc-content,
.kc-wrapper {
  max-width: none;
  margin: 0;
  padding: 0;
}

html,
body.kc-root {
  background: #fff;
  color: #000;
  font-size: 11pt;
  /* kitcheck-design.css gives the body a 10px solid black top border as a brand
     detail. A BORDER is not a background, so it is not the thing browsers drop
     when the reader leaves "background graphics" off — it prints, as a solid
     black bar of toner across the top of the document. Screen-only decoration
     has to be removed explicitly, not assumed away. */
  border: 0;
}

/* The hero band is a coloured plate behind a title. Printed, it is a solid
   rectangle of toner around words that would read perfectly well without it. */
.kc-hero {
  background: none;
  box-shadow: none;
  border: 0;
  min-height: 0;
  padding: 0 0 6mm;
  color: #000;
}

/* The blue page frame (.kc-blueframe, kitcheck-design.css) is a screen device like the hero band: a gradient plate
   round the page, with a title block set in white on it. Paper gets neither — the plate and the padding it makes go,
   the white sheets lose their shadow, and a title that survives is black. The certificate page (/utbildning/intyg) is
   the one that is printed, and takes its own title block away besides.

   This is the rule for EVERY page on the frame, not only the training pages (the day board, Platform Administration
   and Produktkvalitet print through it too). That is deliberate: the title is white on the blue, and paper drops the
   blue unless the reader asks for background graphics — so without this a framed page printed an invisible title. */
main.kc-wrapper:has(> .kc-blueframe) {
  background: none;
  padding: 0;
}

.kc-blueframe__sheet {
  box-shadow: none;
}

.kc-root .kc-blueframe__title {
  color: #000;
  text-shadow: none;
}

/* Browsers drop background colours in print unless the user opts in, and each
   of these sets white text on a coloured fill. Left alone they print white on
   white — the document's own title and its table headings among them. This is
   the failure that is invisible on screen and total on paper. */
.kc-hero__title h1,
.kc-hero__title h2,
.kc-hero p,
.kc-grid thead th,
.kc-sec-n {
  color: #000;
  background: none;
}

/* Sticky is a scroll behaviour. There is no scrolling; on some print pipelines
   it leaves the row parked over the text instead. */
.kc-grid thead th { position: static; }

/* ============================================================================
   2. Where the pages are allowed to break
   ========================================================================== */

/* A heading stranded at the foot of a page announces a section that is not
   there. Both spellings: break-after is the current property, page-break-after
   is what several print pipelines still act on. */
h1, h2, h3, h4, h5, h6 {
  page-break-after: avoid;
  break-after: avoid;
  page-break-inside: avoid;
  break-inside: avoid;
  color: #000;
}

/* Paragraphs may break — a compliance section can run for half a page and
   forcing it whole onto the next one wastes paper and eventually gets broken
   anyway. What must not happen is a single line left behind on either side. */
p {
  orphans: 3;
  widows: 3;
}

/* A row split across a page fold is unreadable in a way a paragraph is not:
   the reader loses which column each half belongs to. */
li,
tr {
  page-break-inside: avoid;
  break-inside: avoid;
}

/* A table that runs over the fold keeps its column headings on the second
   page; without this the reader is looking at a grid of unlabelled numbers. */
thead { display: table-header-group; }
tfoot { display: table-footer-group; }

img { max-width: 100%; }

/* ============================================================================
   3. Cross-references (KcProgramText)
   ========================================================================== */

/* Hover cards do not print. There is nothing to hover with, and a card that
   printed would drop a floating box on top of the sentence it explains.
   (kitcheck-design.css already says this inside its own @media print block;
   restated here so the print sheet stands on its own if that block moves.) */
.kc-refcard { display: none; }

/* The ↗ means "opens in a new tab" — a promise paper cannot keep. */
.kc-ref--external::after { content: none; }

/* Everything that was a link becomes ink. .kc-ref is deliberately not reset
   here: its underline is the only thing left on paper telling the reader that
   "nedkylning" points somewhere else in this document, and the design sheet's
   print block already recolours it. Class beats element, so it survives. */
a {
  color: inherit;
  text-decoration: none;
}

/* KNOWN GAP, deliberately not worked around here. A reference the author gave
   its own wording — [[avsnitt:tillagning-nedkylning|nedkylning]], which is how
   every internal reference in the rule pack is written — prints as that wording
   alone, with no section number to look up. The number exists (the resolver
   computes it), but KcProgramText emits it only as link text and hover-card
   text, and neither survives print. Closing this needs one data attribute on
   the anchor, which is that component's call to make, not this sheet's. */
