/**
 * Print Styles
 *
 * Optimises pages for printing / Save-as-PDF.
 * Imported once in BaseLayout so it applies site-wide.
 */

@media print {
  /* Hide chrome: navigation, footer, related posts, buttons, forms */
  .header,
  .footer,
  .w-nav,
  .w-pagination-wrapper,
  .w-form,
  .button,
  .button-menu,
  .menu-button,
  .w-nav-button {
    display: none !important;
  }

  /* Hide the "Read on" related-posts section on blog pages */
  .related-posts {
    display: none !important;
  }

  /* Reset body for paper */
  body {
    background: white;
    color: black;
    font-size: 12pt;
    line-height: 1.5;
  }

  /* Remove decorative backgrounds */
  .content-component,
  .container {
    background: transparent !important;
    box-shadow: none !important;
  }

  /* Let content use full page width */
  .container,
  .w-container {
    max-width: 100% !important;
    padding: 0 !important;
  }

  .l-max-70-center,
  .l-max-80-center {
    max-width: 100% !important;
  }

  /* Tighten spacing for paper */
  .content-component {
    padding: 0 !important;
  }

  .gap-medium {
    gap: 1rem !important;
  }

  /* Typography adjustments */
  h1 { font-size: 22pt !important; }
  h2 { font-size: 18pt !important; }
  h3 { font-size: 14pt !important; }

  /* Show link URLs inline */
  .w-richtext a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #555;
    word-break: break-all;
  }

  /* Don't expand internal/anchor links */
  .w-richtext a[href^="#"]::after,
  .w-richtext a[href^="/"]::after {
    content: none;
  }

  /* Images: constrain to page, avoid orphans */
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }

  /* Prevent headings from being stranded at page bottom */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }

  /* Keep figures and blockquotes together */
  figure, blockquote, pre, table {
    page-break-inside: avoid;
  }

  /* Sensible page margins */
  @page {
    margin: 2cm;
  }
}
