/*
 * Print version of the thermal calculator (templates/calculator/teplotekhnicheskiy-raschet-steny-print.html.twig): A4 portrait
 * sheets with a stamp. Loaded only on .../pechat, after engine.css (its @media print rules make the tokens light and hide the site
 * chrome), roof.css, thermal.css and thermal-page.css. On screen the sheets are cards, on paper pages.
 *
 * Sheet geometry: page 210 x 297 mm, margin 10 mm: a sheet is 190 x 277 mm. A print figure is 720 viewBox units wide, which is
 * 186 mm of paper (Sheet::Print), so it keeps its scale at 100%; the stamp is one line of 8 mm under the body.
 */
.th-print { max-width: 210mm; margin: 0 auto; }
.th-print-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin: 0 0 var(--s-4); }
.th-print-bar p { flex: 1 1 18rem; margin: 0; }
.th-print-bar .btn { display: inline-flex; align-items: center; text-decoration: none; }
.th-print-bar [hidden] { display: none; }

/* On screen the print-only blocks of the engine macros are shown: this page is the print preview. */
.th-print .print-only { display: block; }
.th-print .print-header { margin: 0 0 var(--s-3); padding-bottom: var(--s-2); border-bottom: 2px solid var(--c-accent); }
.th-print .print-header p { margin: 0 0 2px; }
.th-print .print-header__title { font-family: var(--font-display); font-size: var(--fs-h1); font-weight: 700; line-height: 1.2; margin: 4px 0 6px; }
.th-print .print-header__meta, .th-print .print-footer { font-size: var(--fs-xs); color: var(--c-muted); }
.th-print .print-header__url { overflow-wrap: anywhere; color: var(--c-text); }
.th-print .print-footer { margin-top: var(--s-3); padding-top: var(--s-2); border-top: 1px solid var(--c-border); }
.th-print .calc-inputs > h2 { margin-top: 0; }
.th-print .calc-inputs h3 { margin: var(--s-3) 0 var(--s-1); font-size: var(--fs-sm); }

.th-sheet { display: flex; flex-direction: column; margin: 0 0 var(--s-5); padding: var(--s-4); border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface); box-shadow: var(--shadow); }
.th-sheet__title { margin: 0 0 var(--s-3); font-family: var(--font-display); font-size: var(--fs-h2); }
.th-sheet__body { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.th-sheet__fig { margin: 0 0 var(--s-2); overflow-x: auto; }
.th-sheet__fig svg { min-width: 0; }
.th-stamp { display: flex; flex-wrap: wrap; gap: 2px var(--s-4); margin-top: auto; padding-top: var(--s-2); border-top: 1px solid var(--c-border-strong); font-size: var(--fs-xs); color: var(--c-muted); }
.th-stamp strong { color: var(--c-text); }
.th-stamp__page { margin-left: auto; font-weight: 600; color: var(--c-text); white-space: nowrap; }
.th-sheet--title .th-verdicts { grid-template-columns: minmax(0, 1fr); }
.th-reservation { margin-top: var(--s-3); }

@media print {
    @page { size: A4 portrait; margin: 10mm; }

    html { font-size: 9pt; }
    .th-print { max-width: none; }
    .th-print-bar { display: none !important; }

    .th-sheet { display: block; position: relative; height: 276mm; margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: none; overflow: hidden; break-after: page; }
    .th-sheet:last-child { break-after: auto; }
    .th-sheet__body { display: block; height: 267mm; min-height: 0; overflow: hidden; }
    /* 720 viewBox units are 186 mm of paper: the drawing keeps its scale (the caption «М 1:N» is true only at exactly this width).
       The height is whatever the drawing needs (fig. 1 of 12 layers is 214 mm, fig. 4 of a framed wall 267 mm); ThermalPrintPlan puts such
       a figure on a sheet of its own. The cap is the room of a sheet under its title: a taller drawing is reduced, never clipped. */
    .th-sheet .th-sheet__fig { margin: 0 0 2mm; overflow: visible; }
    .th-sheet .th-sheet__fig svg, .th-sheet figure svg { width: 186mm; height: auto; max-height: 250mm; max-width: none !important; min-width: 0; margin: 0; }
    .th-stamp { position: absolute; left: 0; right: 0; bottom: 0; flex-wrap: nowrap; gap: 0 5mm; height: 8mm; align-items: center; padding-top: 1mm; font-size: 7pt; white-space: nowrap; overflow: hidden; }
    .th-stamp__title { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
    .th-stamp__object { overflow: hidden; text-overflow: ellipsis; max-width: 62mm; }
    .th-stamp__page { margin-left: 0; }

    .th-sheet__title { margin: 0 0 3mm; font-size: 12pt; }
    .th-sheet .table { font-size: 7.5pt; }
    .th-sheet .table th, .th-sheet .table td { padding: 1.5pt 4pt; white-space: normal; }
    .th-sheet .th-table .num { white-space: nowrap; }
    .th-sheet .rc-table th[scope="row"] { position: static; }
    .th-sheet .table thead { display: table-header-group; }
    .th-sheet .table tfoot { display: table-row-group; }
    .th-sheet .rc-table caption { padding: 0 0 2pt; }
    .th-sheet .rc-note-line { margin: 0 0 3mm; font-size: 7pt; }
    .th-sheet .table-wrap { margin-bottom: 1mm; }
    .th-print .result-main { grid-template-columns: repeat(2, 1fr); gap: 3mm; margin-bottom: 3mm; }
    .th-print .result-main dd { font-size: 14pt; }
    .th-print .result-main dd.rc-note { font-size: 7.5pt; font-weight: 400; }
    .th-print .callout { margin-bottom: 3mm; padding: 2mm 3mm; font-size: 8pt; }
    .th-print .th-verdict { padding: 2mm 3mm; margin: 0; break-inside: avoid; }
    .th-print .th-verdicts { gap: 2mm; margin-bottom: 3mm; }
    .th-print .th-verdict > p { font-size: 8pt; margin-bottom: 1mm; }
    .th-print .th-verdict__headline { font-size: 9pt; }
    .th-print .kv__item { flex-basis: 60mm; padding: 1mm 3mm 1mm 0; }
    .th-print .calc-inputs .kv__item { flex-basis: 60mm; font-size: 8pt; }
    .th-print .calc-inputs h3 { margin: 2mm 0 0; }
    .th-print .print-header { margin-bottom: 3mm; }
}
