:root {
  --print-flow-guard: 1mm;
}

/*
 * Final paged-media contract.
 *
 * This file is deliberately loaded after every responsive/platform sheet.
 * Browser print engines must see the printable pages as a plain vertical
 * sequence, never as the swipeable/zoomed preview used on a phone screen.
 */
@media print {
  html,
  body {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
  }

  body {
    isolation: auto !important;
  }

  /* Cloudflare's controlled PDF renderer does not need WebKit's pagination
     workaround. Its flow boxes therefore use the complete physical page too,
     with no internal inset on any edge. */
  body:has(.print-render-mode--exact-pdf) {
    --print-flow-guard: 0mm;
  }

  body::before,
  body::after {
    display: none !important;
    content: none !important;
  }

  .site-shell,
  .site-shell > main,
  main,
  .print-workspace,
  .print-sheets,
  .circle-window-print-pages {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    contain: none !important;
    background: #fff !important;
  }

  .site-shell > main,
  main {
    display: block !important;
  }

  .site-navigation,
  .site-header,
  .site-footer,
  .skip-link,
  .cookie-backdrop,
  .cookie-notice,
  .mobile-tabs,
  .mobile-menu,
  .mobile-menu__popover,
  .print-toolbar,
  .print-instructions,
  .print-page-summary {
    display: none !important;
  }

  /* Structural advice belongs on the overview, never as fixed furniture over
     a true-scale fabrication line or on a Safari residual fragment. */
  .print-structural-disclaimer {
    display: none !important;
  }

  .print-sheets,
  .circle-window-print-pages {
    display: block !important;
    gap: 0 !important;
    overscroll-behavior: auto !important;
    scroll-snap-type: none !important;
    -webkit-overflow-scrolling: auto !important;
  }

  .print-sheet,
  .circle-window-print-sheet {
    position: relative !important;
    float: none !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    /* The Safari flow guard belongs only to interactive browser printing.
       Downloaded PDFs set it to zero. Fixed-size SVGs remain visible through
       the physical page edge and are clipped by the PDF page box itself. */
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    zoom: 1 !important;
    scale: none !important;
    transform: none !important;
    transform-origin: top left !important;
    /* Let the paged-media engine choose the existing boundary between two
       sheets. WebKit can create residual pages for near-page-height blocks
       marked `break-inside: avoid`. */
    break-inside: auto !important;
    page-break-inside: auto !important;
    /* A sheet already has the exact physical paper height. Safari creates an
       extra blank page when a forced break is added at that same boundary. */
    break-after: auto !important;
    page-break-after: auto !important;
    print-color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
  }

  /* WebKit rounds an element that is exactly as tall as the physical page up
     to a second fragment. Its interactive print flow stays 1 mm shorter;
     Cloudflare's downloaded PDF uses the full height through the override. */
  .print-sheet,
  .circle-window-print-sheet {
    width: var(--print-page-width) !important;
    height: calc(var(--print-page-height) - var(--print-flow-guard)) !important;
  }

  /* Start from the second sheet, never after the previous one. The default
     flow guard leaves Safari a real breakpoint and prevents an inserted blank. */
  .print-sheet + .print-sheet,
  .circle-window-print-sheet + .circle-window-print-sheet {
    break-before: page !important;
  }

  /* Native Safari otherwise turns the final 1 mm overflow into one trailing
     empty page. Every route guarantees that this last millimetre is blank on
     its final sheet; earlier sheets stay visible edge-to-edge. */
  .print-sheets > .print-sheet:last-child,
  .circle-window-print-pages > .circle-window-print-sheet:last-child {
    overflow: hidden !important;
  }

  .print-template--edge-to-edge,
  .stretch-full-scale-svg.print-template--edge-to-edge {
    top: 0 !important;
    left: 0 !important;
  }
}
/* Measured depth overview. Keep all furniture clear of the title and footer. */
.arch-depth-print-sheet__body {
  inset: 30mm 10mm 17mm;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 4mm;
}
.arch-depth-print-sheet__facts {grid-row:1;grid-template-columns:repeat(5,minmax(0,1fr));gap:2mm;}
.arch-depth-print-sheet__facts > span {padding:2mm 2.5mm;gap:1mm;}
.arch-depth-print-sheet__facts small {font-size:6.5pt;font-weight:400;line-height:1.3;}
.arch-depth-print-sheet__facts b {font-size:11pt;font-weight:700;}
.arch-depth-print-sheet__phases {gap:6mm;}
.arch-depth-print-sheet__phases > section {padding:4mm;border-radius:0;border:.2mm solid #c2c7c9;gap:3mm;}
.arch-depth-print-sheet__phases > section > b {font-size:9pt;letter-spacing:0;border-bottom:.2mm solid #c2c7c9;padding-bottom:2mm;}
.arch-depth-print-sheet .arch-depth-section__diagram {max-height:none;}
.arch-depth-print-sheet .arch-depth-section__field {fill:#f5f7f8;stroke:#a9b7be;stroke-width:.3;}
.arch-depth-print-sheet .arch-depth-section__cell {stroke:#526774;stroke-width:.6;}
.arch-depth-print-sheet .arch-depth-section__cell-code {font-size:1.05px;font-weight:700;fill:#142c40;stroke:none;}
.arch-depth-print-sheet .arch-depth-section__cell.is-standing {fill:#b9dff1;}
.arch-depth-print-sheet .arch-depth-section__cell.is-lying {fill:#efa968;}
.arch-depth-print-sheet .arch-depth-section__cell.is-fitting {stroke-dasharray:3 2;}
.arch-depth-print-sheet__legend {justify-content:flex-start;gap:2mm;font-size:8pt;font-weight:400;}
.arch-depth-print-sheet__legend span {width:4mm;height:4mm;margin-left:5mm;border:.2mm solid #526774;border-radius:.5mm;}
.print-sheet .arch-depth-print-sheet__legend .is-standing {background:#b9dff1!important;}
.print-sheet .arch-depth-print-sheet__legend .is-lying {background:#efa968!important;}
.print-sheet .arch-depth-print-sheet__legend .is-fitting {background:#fff!important;border:.3mm dashed #526774!important;}
.arch-depth-print-sheet__code-help {display:block;border:0;border-top:.2mm solid #c2c7c9;border-radius:0;padding:3mm 0 0;font-size:8pt;line-height:1.5;}
.arch-depth-print-sheet__code-help b {display:block;background:none;padding:0;margin-bottom:1mm;font-size:9pt;}
.print-sheet--a4-portrait .arch-depth-print-sheet__facts {grid-template-columns:repeat(3,minmax(0,1fr));}
.print-sheet--a4-portrait .arch-depth-print-sheet__phases {gap:4mm;}
.print-sheet--a4-portrait .arch-depth-print-sheet__phases > section {padding:3mm;}
.arch-depth-cut-template[data-orientation="standing"] .arch-depth-cut-template__shape {fill:#e3f1f8;}
.arch-depth-cut-template[data-orientation="lying"] .arch-depth-cut-template__shape {fill:#fce5d0;}

.arch-depth-layers-sheet__rows{display:grid;grid-template-rows:repeat(2,minmax(0,1fr));gap:5mm;height:calc(100% - 24mm);padding:5mm 7mm 7mm}
.arch-depth-layers-sheet__row{display:flex;flex-direction:column;min-height:0;border:1px solid #cbd5e1;border-radius:2mm;padding:3mm 4mm;background:#fff}
.arch-depth-layers-sheet__row header{display:flex;align-items:center;justify-content:space-between;color:#233d52;font-size:10pt;border-bottom:1px solid #e2e8f0;padding-bottom:2mm}
.arch-depth-layer-drawing{display:block;width:100%;flex:1;min-height:0;max-height:100%;overflow:visible}
.arch-depth-layers-sheet__row p{font-size:7pt;line-height:1.35;margin:2mm 0 0;color:#526577}
.arch-depth-layers-sheet__rows{position:absolute;top:24mm;bottom:10mm;left:8mm;right:8mm;height:auto;padding:0}

/* Explanatory sheet: exact profile data, intentionally not a full-size mould. */
.print-sheet .lying-marking-sheet__body {position:absolute;inset:30mm 10mm 17mm;display:flex;flex-direction:column;gap:3mm;font:9pt/1.45 Arial,sans-serif;color:#243b4b;}
.print-sheet .lying-marking-sheet__body p {margin:0;font:inherit;}
.print-sheet .lying-marking-sheet__drawing {flex:1;min-height:30mm;max-height:72mm;}
.print-sheet .lying-marking-sheet__drawing svg {display:block;width:100%;height:100%;}
.print-sheet .lying-marking-sheet__body ol {display:grid;grid-template-columns:1fr 1fr;gap:3mm 8mm;margin:0;padding-left:5mm;}
.print-sheet .lying-marking-sheet__body li {padding-left:1mm;}
.print-sheet .lying-marking-sheet__body li b {display:block;color:#19364a;}
.print-sheet--a4-portrait .lying-marking-sheet__body ol {grid-template-columns:1fr;}
.print-sheet--a4-portrait .lying-marking-sheet__drawing {max-height:75mm;}
