/* ==========================================================================
   Grand Tour #95 - "Print stylesheet as a standard, not an afterthought"
   costandprofitability.com  -  prepared 19 Jul 2026, NOT deployed
   --------------------------------------------------------------------------
   The whole file lives inside @media print, so it has ZERO effect on the
   on-screen site. Goal: any page printed or saved to PDF comes out as a
   clean, considered Instrument DOCUMENT - a printed ticket / dossier - not a
   broken web dump. Black ink on white, self-hosted Instrument fonts, link
   destinations spelled out, a calm mono "ticket stub" running header/footer.

   All chrome selectors below were verified against the LIVE rendered HTML of
   /  , /about/ , /build-a-tdabc-model/ (method) and a /blog/ post on 19 Jul.

   Deploy: gt95_print.css  -> theme root
             /www/novo/wp-content/themes/coachfocus-child/gt95_print.css
           gt95_print-enqueue.php -> /www/novo/wp-content/mu-plugins/
   Reversible: delete the two files.
   ========================================================================== */

@media print {

  /* -- page geometry: generous margins leave room for the running stub ---- */
  @page {
    margin: 18mm 18mm 20mm 18mm;
  }

  /* ----------------------------------------------------------------------- *
   * 1.  HIDE ALL NON-CONTENT CHROME
   *     (each class confirmed present in the live markup)
   * ----------------------------------------------------------------------- */

  /* main navigation (custom Instrument nav) + its sub-widgets */
  .nav-praxis,
  #cnp-nav-praxis,
  #cnp-lang-wrap,
  #cnp-search-open,
  .cnp-skip-link,                 /* "skip to content" link */
  /* site footer */
  .footer-praxis,
  /* floating "Ask a question" chat (launcher + panel + all parts) */
  .cc-chat-launch,
  .cc-chat-panel,
  .cc-chat-head,
  .cc-chat-body,
  .cc-chat-foot,
  [class^="cc-chat-"],
  [class*=" cc-chat-"],
  /* share bar (/share/share.css : .cc-share + .bottombar variant + toast) */
  .cc-share,
  .cc-share.bottombar,
  .cc-share-toast,
  /* maker's plate (Built & maintained by ... Porto ... Series 2026) */
  .cnp-makers-plate,
  /* Grand Tour "departure line" / departures board + platform token
     (a split-flap CTA board, navigational chrome - not document content) */
  .cnp-departures,
  [data-screen-label],
  /* Grand Tour floating instruments:
       #gt12-rail  = fixed left "route diagram" itinerary rail
       .gt11-*     = passport panel / launcher (modal, floating) */
  #gt12-rail,
  #gt12-track,
  #gt12-foot,
  .gt11-fixed,
  .gt11-panel,
  .gt11-in-nav,
  /* Qode theme "back to top" button */
  #qodef-back-to-top,
  .qodef-back-to-top,
  [id*="back-to-top"],
  [class*="back-to-top"],
  /* cookie / consent (defensive - none live today, cheap insurance) */
  [class*="cookie"],
  [class*="consent"],
  [id*="cookie"],
  [id*="consent"],
  /* generic on-paper-meaningless controls */
  .cnp-cta-row,
  .cnp-sticky,
  button.cnp-copy,
  [role="dialog"][aria-hidden="false"] {
    display: none !important;
  }

  /* Neutralise ANY remaining fixed / sticky floating UI so nothing floats,
     overlaps, or repeats across pages. (Our own stub header/footer below
     opt back IN explicitly with position:fixed.) */
  body *[style*="position:fixed"],
  body *[style*="position: fixed"],
  .cnp-floating,
  .is-sticky,
  .sticky {
    position: static !important;
  }

  /* view-transition artefacts: never animate on paper */
  ::view-transition-group(*),
  ::view-transition-image-pair(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }

  /* ----------------------------------------------------------------------- *
   * 2.  INK & PAPER  -  black on white, Instrument fonts, readable body
   * ----------------------------------------------------------------------- */

  html, body {
    background: #ffffff !important;
    color: #111111 !important;
    margin: 0 !important;
    padding: 0 !important;
    font-family: "Newsreader", Georgia, "Times New Roman", serif;
    font-size: 11.5pt;
    line-height: 1.5;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* let the content column breathe to the full page width */
  main#content,
  .gd-wrap,
  .praxis .cnp-wrap,
  .cnp-wrap {
    max-width: none !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
  }

  /* kill on-screen cream / tinted panels - print them as plain white paper */
  * {
    background-image: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  [class*="cnp-"],
  section, article, aside, figure, .card, .cnp-card {
    background: transparent !important;
  }

  /* headings: serif, tight, kept with the text that follows them */
  h1, h2, h3, h4, h5, h6 {
    font-family: "Newsreader", Georgia, serif;
    color: #111111 !important;
    font-weight: 600;
    letter-spacing: 0;
    text-wrap: balance;
  }
  h1 { font-size: 22pt; line-height: 1.15; margin: 0 0 .5em; }
  h2 { font-size: 16pt; line-height: 1.2;  margin: 1.1em 0 .4em; }
  h3 { font-size: 13pt; line-height: 1.25; margin: 1em 0 .35em; }
  h4, h5, h6 { font-size: 11.5pt; margin: .9em 0 .3em; }

  /* don't strand a heading at the foot of a page */
  h2, h3, h4 { break-after: avoid; page-break-after: avoid; }
  h1, h2, h3, h4, h5, h6 { break-inside: avoid; }

  p, li { orphans: 3; widows: 3; }
  p { margin: 0 0 .7em; }

  /* a thin burnt-orange accent rule only where the site already draws one,
     rendered hairline for toner economy (mostly black/grey ink) */
  hr,
  .cnp-rule,
  .cnp-hr {
    border: 0 !important;
    border-top: 1px solid #C75B22 !important;   /* Instrument burnt-orange */
    height: 0 !important;
    margin: 1em 0 !important;
  }

  /* ----------------------------------------------------------------------- *
   * 3.  FIGURES, TABLES, CARDS  -  never split across a page
   * ----------------------------------------------------------------------- */

  figure, table, thead, tr, img, svg,
  .card, .cnp-card, .cnp-panel, .cnp-figure,
  blockquote, pre, .wp-block-table {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  thead { display: table-header-group; }   /* repeat header rows */
  tfoot { display: table-footer-group; }

  table {
    width: 100% !important;
    border-collapse: collapse;
    font-size: 10pt;
  }
  th, td {
    border: 1px solid #bbbbbb;
    padding: 4pt 6pt;
    text-align: left;
    vertical-align: top;
  }
  th { font-weight: 600; }

  img, svg {
    max-width: 100% !important;
    height: auto !important;
  }

  /* buttons / CTAs styled as pills: strip them to plain text on paper */
  a.cnp-btn, .cnp-btn, .button, .wp-block-button__link {
    background: transparent !important;
    color: #111111 !important;
    border: 1px solid #999999 !important;
    padding: 2pt 5pt !important;
    text-decoration: none !important;
  }

  /* ----------------------------------------------------------------------- *
   * 4.  LINK DESTINATIONS  -  spell out external URLs (not in-page / nav)
   * ----------------------------------------------------------------------- */

  a { color: #111111 !important; text-decoration: none; }
  a[href^="http"] {
    text-decoration: underline;
    text-decoration-color: #999999;
  }
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 9pt;
    color: #555555;
    word-break: break-all;
  }
  /* ...but NOT for in-page anchors, javascript, mailto, tel, images,
     or anything inside the (hidden anyway) nav */
  a[href^="#"]::after,
  a[href^="javascript"]::after,
  a[href^="mailto"]::after,
  a[href^="tel"]::after,
  a[href=""]::after,
  a:not([href])::after,
  .nav-praxis a::after,
  #cnp-nav-praxis a::after,
  a.image::after,
  a:has(> img)::after {
    content: "" !important;
  }

  /* ----------------------------------------------------------------------- *
   * 5.  TICKET STUB  -  a calm mono running header + footer on every page
   *     (position:fixed repeats per printed page in Chrome/Edge; the 18mm
   *      @page margins reserve the space so it never collides with content)
   * ----------------------------------------------------------------------- */

  body::before {
    content: "COST \0026  PROFITABILITY";
    position: fixed;
    top: 4mm; left: 0; right: 0;
    font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 8pt;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: #333333;
    border-bottom: 0.5pt solid #C75B22;   /* single hairline burnt-orange rule */
    padding-bottom: 1.5mm;
  }

  body::after {
    content: "Instrument document  \00b7  costandprofitability.com";
    position: fixed;
    bottom: 4mm; left: 0; right: 0;
    font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 7.5pt;
    letter-spacing: .12em;
    color: #666666;
    border-top: 0.5pt solid #cccccc;       /* calm grey hairline */
    padding-top: 1.5mm;
    text-align: left;
  }

  /* the H1 sets the "document title" line just under the header rule */
  main#content h1:first-of-type,
  .gd-hero h1 {
    margin-top: 2mm;
  }
}
