/* Load after all route styles. Native print previews remain the verification step. */
@page {
  size:A4 portrait;
  margin:17mm;
}

@media print {
  :root {
    color-scheme:light;
    --paper:#fff;
    --white:#fff;
    --ink:#111;
    --muted:#333;
    --blue:#111;
    --blue-dark:#111;
    --line:#aaa;
    --soft:#fff;
    --amber:#333;
    --amber-soft:#fff;
    --green:#111;
    --green-soft:#fff;
  }
  html { font-size:11pt;scroll-behavior:auto; }
  body {
    margin:0;
    padding:0!important;
    background:#fff!important;
    color:#111!important;
    font-size:11pt;
    line-height:1.5;
    overflow-wrap:anywhere;
  }
  body *,body *::before,body *::after {
    color:#111!important;
    background:transparent!important;
    box-shadow:none!important;
    text-shadow:none!important;
  }
  .container { width:100%!important;max-width:none; }
  img,svg,video,iframe { max-width:100%!important; }
  img,svg { height:auto; }
  p,li,dd,dt { orphans:3;widows:3; }
  main :is(p,li,dd,dt,td,th,label,input,select,textarea,summary) {
    font-size:11pt!important;
    line-height:1.5;
  }
  main :is(small,.small,.eyebrow,.label,.page-meta,.tool-help,.seo-review-note,
    .chain-tag,.assurance-card-foot,.preview-columns,.preview-status,.status-pill,
    .demo-label,.wb-status,.wb-reference,.pf-kicker),.preview-task i {
    font-size:10pt!important;
  }
  .preview-task strong { font-size:11pt!important; }
  /* Keep secondary text that is useful on paper within the readable print range. */
  main :is(.chain-panel a,.tool-meta,.watch-state>span:last-child:not(.label),
    .watch-entry .text-link,.spotlight-outcome,.pf-footnote a,.pf-why strong,
    .pf-setting-note strong,.wb-local-badge,caption) {
    font-size:10pt!important;
  }
  h1,h2,h3,h4,summary,caption {
    break-inside:avoid;
    page-break-inside:avoid;
    break-after:avoid;
    page-break-after:avoid;
  }
  main h1 { font-size:27pt!important;line-height:1.15!important; }
  main h2 { font-size:18pt!important;line-height:1.25!important; }
  main h3 { font-size:14pt!important;line-height:1.3!important; }
  main h4 { font-size:12pt!important;line-height:1.4!important; }

  /* Retain identity and the existing disclaimer; remove navigation and controls. */
  .site-header,.site-footer { display:block!important;position:static!important; }
  .site-header { border:0;margin:0 0 5mm;break-inside:avoid;break-after:avoid; }
  .identity-row { min-height:0;padding:0;display:block; }
  .brand-cluster { display:flex;justify-content:space-between;align-items:center;gap:5mm; }
  .site-header .brand { padding:0!important;min-width:0;flex-shrink:1; }
  .site-header .brand-mark { width:8mm;height:10mm;flex-shrink:0; }
  .brand-mark path { fill:#111!important; }
  .site-header .wordmark { font-size:22pt; }
  .site-header .brand-sub { font-size:10pt;letter-spacing:.03em;margin-top:1mm; }
  .site-header .independence-pill { display:block;max-width:none;border:0;padding:0;font-size:10pt; }
  .navigation-row,.header-actions,.menu-toggle,.site-header nav,
  .review-bar,.breadcrumb,.article-nav,.reading-progress,.reader-toolbar,.back-top,
  .search-dialog,.wb-dialog,.skip-link,[role="tablist"],
  .tool-actions,.compare-picker,.compare-actions,.filter-bar,.catalogue-controls,
  .button-row,.article-cta,.contact-banner,.tool-aside,button,progress,video,iframe {
    display:none!important;
  }
  .site-footer {
    margin-top:8mm;padding:4mm 0 0;border-top:1pt solid #888;
    break-inside:avoid;page-break-inside:avoid;
  }
  .footer-grid { display:block;padding:0;margin:0; }
  .footer-column,.footer-brand .brand { display:none!important; }
  .footer-brand p { max-width:none;margin:0 0 3mm;font-size:10pt!important; }
  .footer-disclaimer { max-width:none;border:0;padding:0;font-size:10pt!important;line-height:1.5; }
  .footer-bottom {
    display:block;margin-top:3mm;font-size:10pt!important;
    break-inside:avoid;page-break-inside:avoid;
  }
  .footer-bottom>span { display:block; }

  /* site.js opens details before print and restores their original state afterward. */
  main details,main details:not([open]) { display:block!important;break-inside:auto; }
  main details::details-content { content-visibility:visible!important; }
  main details>summary { display:block;list-style:none;font-weight:600; }
  main details>summary::marker { content:""; }
  main details>summary::-webkit-details-marker { display:none; }
  main [role="tabpanel"],main [role="tabpanel"][hidden] {
    display:block!important;
    content-visibility:visible!important;
    min-height:0;
    margin-top:4mm;
    break-inside:auto!important;
  }
  .chain-panel { min-height:0;padding:4mm 0;border-top:1px solid #aaa; }
  #main .chain-panel {
    break-inside:avoid!important;page-break-inside:avoid!important;
  }
  .chain-tag,.eyebrow { break-after:avoid;page-break-after:avoid; }
  main .tool-form,main .tool-sources { display:block!important; }
  .tool-group { margin:4mm 0;padding:3mm; }
  .tool-choice { min-height:0;padding:2mm 0; }
  .tool-field,.tool-choice,.contact-form .field {
    break-inside:avoid;page-break-inside:avoid;
  }
  .tool-result { margin:5mm 0;padding:4mm; }
  .tool-sources { margin-top:5mm;padding-top:3mm; }

  /* Method and limitations remain readable alongside the chosen finder route. */
  .pf-shell .pf-heading,.pf-shell .pf-footnote,.pf-shell .pf-method,.pf-shell .pf-enquiry {
    display:block!important;
    padding:3mm 0!important;
  }
  .pf-shell .pf-heading { padding-top:0!important; }
  .pf-enquiry>.btn,.pf-controls,.pf-progress,.pf-card-link,.pf-practical>.btn { display:none!important; }
  .pf-review,.pf-primary,.pf-reading,.pf-practical { padding:4mm; }

  /* Print the destination of public external links, with long URLs allowed to wrap. */
  .source-list a::after { content:none; }
  a[href^="http://"]::after,a[href^="https://"]::after {
    content:" (" attr(href) ")";
    font:400 10pt/1.45 var(--sans);
    white-space:normal;
    overflow-wrap:anywhere;
  }
  a[href^="#"]::after,a[href^="/"]::after,
  a[href^="https://cqcaudit.me.uk/"]::after,
  a[href^="https://www.cqcaudit.me.uk/"]::after,
  a[href^="https://cqcaudit-private-review.mihailflorin.chatgpt.site/"]::after {
    content:none;
  }

  /* Let long content paginate while keeping individual records and headings together. */
  .hero-grid,.finder-layout,.regulation-feature,.workbench-showcase,.sector-home,
  .start-here-layout,.article-layout,.tool-layout,.contact-layout,.about-grid,
  .service-spotlights,.resource-grid,.regulation-cards {
    display:block;
  }
  .section,.hero,.page-hero,.directory,.workbench-page,.comparison-page,.start-here-layout {
    padding:0 0 6mm;
  }
  .article-layout,.tool-layout,.contact-layout { padding:4mm 0; }
  .prose section { margin-bottom:6mm; }
  #worked-example>h2+p.small {
    break-inside:avoid;page-break-inside:avoid;
    break-after:avoid;page-break-after:avoid;
  }
  .tool-card,.service-spotlight,.path-card,.directory-card,.regulation-card,.resource-card,
  .guide-brief,.deliverable-summary,.sector-start,.note,.tool-notice,figure,
  .watch-row,.watch-entry,.preview-task,.sector-pills a {
    break-inside:avoid;
    page-break-inside:avoid;
  }
  .workbench-showcase { padding:4mm; }
  .workbench-preview { margin-top:4mm; }
  .assurance-card { margin:5mm 0;width:100%;max-width:none;padding:4mm; }
  .service-spotlight,.regulation-card,.resource-card { margin-bottom:4mm;padding:4mm; }
  .table-scroll,.comparison-scroll { overflow:visible!important;width:100%;max-width:100%; }
  table { width:100%!important;max-width:100%;table-layout:fixed;break-inside:auto; }
  thead { display:table-header-group; }
  tfoot { display:table-footer-group; }
  tr { break-inside:avoid;page-break-inside:avoid; }
  th,td { overflow-wrap:anywhere; }
  .comparison-table { min-width:0!important;font-size:10.5pt!important; }
  .comparison-table :is(th,td,li,p,ul) { font-size:10.5pt!important;line-height:1.4; }
  .comparison-table th,.comparison-table td { padding:3mm 2mm; }
  .comparison-table thead th { font-size:11pt!important; }
  .comparison-table thead th:first-child { width:18%;font-size:10.5pt!important; }
  .comparison-table ul { padding-left:3.5mm; }
  .comparison-table li+li { margin-top:2mm; }
  .comparison-table caption { font-size:10pt!important; }
}
