/* ==========================================================================
   Print Stylesheet — Optimized for printing recipes
   Page-break control: steps and panels move whole to the next page
   rather than splitting mid-sentence.
   ========================================================================== */
@media print {
  /* Hide screen chrome */
  .skip-link, .navbar, .back-to-top, .theme-toggle, .contrast-toggle,
  .rating-section, .related-recipes, .social-share, .sidebar,
  .footer-social, .home-recipe-banner, .made-this-button,
  .notes-wrapper, .pagination { display: none !important; }

  /* Reset theme colours for paper */
  :root, .dark-mode, .light-mode, .high-contrast, .dark-mode.high-contrast {
    --color-bg: #ffffff;
    --color-text: #000000;
    --color-text-muted: #000000;
    --color-text-light: #333333;
    --color-border: #999999;
    --color-link: #0000cc;
    --color-bg-alt: #ffffff;
  }

  body { font-size: 12pt; line-height: 1.5; }

  @page { margin: 1.5cm; }

  /* Expand only in-content links, not nav junk (already hidden above) */
  .recipe-content a::after,
  .recipe-details a::after,
  .ingredients-panel a::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }

  /* --- Page-break control --- */

  /* Headings never strand at the bottom of a page alone */
  h1, h2, h3, h4 { break-after: avoid; page-break-after: avoid; }

  /* Paragraph hygiene: no orphan/widow single lines */
  p, li { orphans: 3; widows: 3; }

  /* Method steps and ingredient entries move to next page whole */
  .method-steps li,
  .ingredients-panel li { break-inside: avoid; page-break-inside: avoid; }

  /* Panels/cards never split across pages */
  .recipe-details,
  .ingredients-panel,
  .info-sidebar,
  .nutrition-card,
  .tips-card,
  .alternatives-card,
  .protein-card,
  .recipe-meta,
  .blog-card,
  .embedded-recipe { break-inside: avoid; page-break-inside: avoid; }

  /* Undo screen layout grids — stacking reads better on paper */
  .details-grid { grid-template-columns: 1fr !important; }

  /* Two-sided flow: avoid breaking right after these */
  .hero-image img { max-height: 400px !important; page-break-inside: avoid; break-inside: avoid; }
  img { max-width: 100% !important; page-break-inside: avoid; break-inside: avoid; }

  /* Cards unwind: borders flatten on paper */
  .ingredients-panel,
  .info-sidebar,
  .blog-card,
  .recipe-card,
  .embedded-recipe {
    background: none !important;
    border: none !important;
  }
}