/*
 * Print version of the stairs constructor (templates/calculator/konstruktor-lestnitsy-print.html.twig): A4 landscape 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 and
 * stairs.css. On screen the sheets are cards, on paper pages.
 *
 * Sheet geometry: page 297 × 210 mm, margin 6 mm → a sheet is 285 × 198 mm. A drawing is 1120 viewBox units wide, which is 277 mm of
 * paper (MmFrame::PAPER_MM_PER_UNIT), so it keeps its «М 1:N» at 100% scale: it is never reduced, whatever its height. The stamp is one
 * line of 7 mm under the body. A drawing taller than the 189 mm that the body leaves (figure 9 is 800 units = 198 mm) is on a sheet of the
 * named page `tall`, whose margins are 2 mm above and below, so that it keeps both its scale and the stamp.
 */
.sc-print { max-width: 297mm; margin: 0 auto; }
.sc-print-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin: 0 0 var(--s-4); }
.sc-print-bar p { flex: 1 1 18rem; margin: 0; }
.sc-print-bar .btn { display: inline-flex; align-items: center; text-decoration: none; }
.sc-print-bar [hidden] { display: none; }

/* On screen the print-only blocks of the engine macros are shown: this page is the print preview. */
.sc-print .print-only { display: block; }
.sc-print .print-header { margin: 0 0 var(--s-4); padding-bottom: var(--s-2); border-bottom: 2px solid var(--c-accent); }
.sc-print .print-header p { margin: 0 0 2px; }
.sc-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; }
.sc-print .print-header__meta, .sc-print .print-footer { font-size: var(--fs-xs); color: var(--c-muted); }
.sc-print .print-header__url { overflow-wrap: anywhere; color: var(--c-text); }
.sc-print .print-footer { margin-top: var(--s-4); padding-top: var(--s-2); border-top: 1px solid var(--c-border); }
.sc-print .calc-inputs > h2 { margin-top: 0; }
.sc-print .calc-inputs h3 { margin: var(--s-4) 0 var(--s-1); font-size: var(--fs-sm); }

.sc-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); }
.sc-sheet__title { margin: 0 0 var(--s-3); font-family: var(--font-display); font-size: var(--fs-h2); }
.sc-sheet__body { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.sc-sheet__fig { flex: 1 1 auto; min-height: 0; margin: 0; overflow-x: auto; }
.sc-sheet--figure { padding-block: var(--s-3); }
.sc-sheet__text { max-width: none; margin: 0 0 var(--s-2); }
.sc-sheet__text.sc-advice { color: var(--c-muted); }
.sc-sheet__list { margin: 0 0 var(--s-3); padding-left: 1.2em; }
.sc-sheet__list li { margin: 0 0 var(--s-2); }

.sc-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); }
.sc-stamp strong { color: var(--c-text); }
.sc-stamp__page { margin-left: auto; font-weight: 600; color: var(--c-text); white-space: nowrap; }
.sc-sheet--tables, .sc-sheet--title, .sc-sheet--inputs, .sc-sheet--warnings { min-height: 12rem; }
.sc-sheet--tables .table-wrap, .sc-sheet--tables .rc-table-wrap { margin-bottom: var(--s-2); }
.sc-sheet--title .sc-verdicts { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media print {
    @page { size: A4 landscape; margin: 6mm; }
    @page tall { size: A4 landscape; margin: 2mm 6mm; }

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

    .sc-sheet { display: block; position: relative; height: 196mm; margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: none; break-after: page; }
    .sc-sheet:last-child { break-after: auto; }
    /* A sheet is exactly one page: the body above, the stamp pinned to the bottom. A drawing takes what the stamp leaves; a table sheet is
       packed to fit by the server and, if it still overflows, flows on rather than being cut. */
    .sc-sheet--figure { overflow: hidden; }
    .sc-sheet__body { display: block; height: 189mm; min-height: 0; }
    .sc-sheet__fig { overflow: visible; display: flex; justify-content: center; align-items: flex-start; height: 100%; }
    /* 1120 viewBox units are 277 mm of paper: the drawing keeps its «М 1:N». No cap on the height: a reduced drawing would lie about its scale. */
    .sc-sheet .sc-sheet__fig svg, .sc-sheet figure svg { flex: none; width: 277mm; height: auto; max-height: none !important; max-width: none !important; min-width: 0; margin: 0; }
    .sc-sheet--tall { page: tall; height: 205mm; }
    .sc-sheet--tall .sc-sheet__body { height: 198.5mm; }
    .sc-stamp { position: absolute; left: 0; right: 0; bottom: 0; flex: none; flex-wrap: nowrap; gap: 0 6mm; height: 7mm; align-items: center; padding-top: 1mm; font-size: 7pt; white-space: nowrap; overflow: hidden; }
    .sc-sheet--tall .sc-stamp { height: 6mm; padding-top: .5mm; }
    .sc-stamp__title { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
    .sc-stamp__object { overflow: hidden; text-overflow: ellipsis; max-width: 120mm; }
    .sc-stamp__page { margin-left: 0; }

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