/* ===============================
   Compact Print Styles (Foundation + WordPress)
   =============================== */

@page {
  size: A4 portrait;
  margin: 14mm 14mm 16mm 14mm; /* tight but readable */
}

@media print {
  /* --- Base reset for print --- */
  *, *::before, *::after { box-sizing: border-box !important; }
  html, body { margin: 0 !important; padding: 0 !important; }
  body {
    background: #fff !important;
    color: #111 !important;
    font: 12pt/1.45 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif !important;
    -webkit-print-color-adjust: exact; /* keep colors when needed */
    print-color-adjust: exact;
  }

  /* Hide Automattic/VIP debug overlays & bars */
  #a8c-debug,
  #a8c-debug-bar,
  .a8c-debug,
  .a8c-debug-bar,
  [id*="a8c-debug"],
  [class*="a8c-debug"],
  [id*="debug-bar"],
  [class*="debug-bar"] {
    display: none !important;
    visibility: hidden !important;
  }

  /* If the overlay is position:fixed with a pseudo-element, nuke fixed debug UI broadly */
  [class*="debug"], [id*="debug"] {
    position: static !important;
  }

  /* --- Hide non-content chrome & interactive UI --- */
  header.header,
  footer.footer,
  .no-pdf,
  .site-header,
  .site-footer,
  .sidebar,
  .navigation,
  .post-actions,
  .comments-area,
  .cookie-banner,
  .share-menu,
  [role="navigation"],
  .screen-reader-text {
    display: none !important;
  }

  /* --- Containers / wrappers (strip gutters) --- */
  .wrap,
  .container,
  .grid-container,
  .grid-container.full,
  .content-area,
  .site-main,
  main,
  .entry-header,
  .entry-footer {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* --- Foundation grid: collapse to single column --- */
  .grid-x {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .cell,
  .small-12,
  .medium-12,
  .large-12 {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin: 0 !important;
  }
  .grid-margin-x > .cell { /* remove horizontal gutters */
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* --- Article content --- */
  .entry-content,
  .post-content,
  article {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* --- Typography tightening --- */
  h1 { font-size: 22pt; margin: 0 0 10pt !important; }
  h2 { font-size: 16pt; margin: 14pt 0 8pt !important; }
  h3 { font-size: 13pt; margin: 12pt 0 6pt !important; }
  p  { margin: 0 0 9pt !important; }
  ul, ol { margin: 0 0 10pt 20pt !important; }
  li { margin: 0 0 4pt !important; }
  blockquote {
    margin: 10pt 0 !important;
    padding: 8pt 12pt !important;
    border-left: 3px solid #ddd;
  }
  hr { border: 0; border-top: 1px solid #ddd; margin: 12pt 0 !important; }

  /* --- Keep sections together when sensible --- */
  h1, h2, h3 { page-break-after: avoid; }
  h1 + p, h2 + p, h3 + p { page-break-before: avoid; }
  p, blockquote, ul, ol, table, figure, pre { page-break-inside: avoid; }
  p, li { orphans: 2; widows: 2; }

  /* --- Links: show cleaned URLs (remove to hide) --- */
  /*a[href]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    word-break: break-all;
  }*/

  a[href]::after { content: ""; }
  

  /* --- Long strings should wrap, never overflow --- */
  a, code, pre, table { word-break: break-word; overflow-wrap: anywhere; }

  /* --- Media --- */
  img, svg, video, iframe, embed {
    max-width: 100% !important;
    height: auto !important;
  }
  figure { margin: 8pt 0 !important; }
  figcaption { font-size: 10pt; color: #555; }


  .entry-contributor img.contributor-image-circle {
      border-radius: 50% !important;
      display: inline-block !important;
      -o-object-fit: cover !important;
      object-fit: cover !important;
      height: 145px !important;
      margin-right: 32px !important;
      width: 145px !important;
  }

  /* --- Gutenberg blocks fit page width --- */
  .alignfull, .alignwide {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  .wp-block-image,
  .wp-block-embed,
  .wp-block-video { margin: 8pt 0 !important; }

  /* --- Gutenberg Columns: stack vertically --- */
  .wp-block-columns { display: block !important; margin: 0 !important; }
  .wp-block-column  { width: 100% !important; margin: 0 0 10pt !important; }

  /* --- Tables --- */
  table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 8pt 0 !important;
  }
  th, td {
    border: 1px solid #e5e5e5 !important;
    padding: 6pt 8pt !important;
    vertical-align: top !important;
  }
  thead { display: table-header-group; } /* repeat header on new pages */
  tfoot { display: table-footer-group; }

  /* --- Code blocks --- */
  pre, code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace !important;
  }
  pre {
    white-space: pre-wrap !important;
    border: 1px solid #eee;
    padding: 8pt !important;
    background: #fafafa !important;
  }

  /* --- Remove heavy backgrounds that waste ink --- */
  .has-background { background: transparent !important; }
}