/********************/
/* Styles for print */
/********************/

/* Default @page margins set here (loaded globally). Menu and grocery
   pages override via page-specific stylesheets loaded after this one
   via content_for(:head). Keep margins ≤ 0.75in — Safari misrenders
   larger @page margins as blank space at the top of page 1. */
@media print {
  @page {
    margin: 0.5in 0.75in;
  }

  html {
    font-size: 12pt;
    margin: 0;
    padding: 0;
    background: white;
  }

  body {
    margin: 0;
    padding: 0;
    background: white;
    color: black;
  }

  /* --- Global hides: interactive chrome --- */
  nav,
  .notify-bar,
  .editor-dialog,
  .search-overlay,
  .app-version,
  #export-actions,
  [data-open-editor] {
    display: none !important;
  }

  /* --- Main content card: strip decoration --- */
  main {
    margin: 0;
    padding: 0;
    border: none;
    background: white;
    box-shadow: none;
    max-width: none;
    min-height: 0;
  }

  main::before,
  body::after {
    display: none;
  }

  /* --- Links: plain black text --- */
  a {
    color: black;
    text-decoration: none;
  }

  /* --- Recipe-specific print styles --- */

  article.recipe {
    font-size: 11pt;
  }

  /* Kill blank space: header margins and decorative rule */
  article.recipe header {
    margin-bottom: 0.5rem;
  }

  article.recipe header::after {
    display: none;
  }

  article.recipe header h1 {
    font-size: 2rem;
    margin: 0 0 0.25rem;
  }

  article.recipe header p {
    font-size: 1rem;
    margin-top: 0;
  }

  /* Hide interactive elements and screen-only content */
  .scale-bar,
  .recipe-actions,
  .recipe-tags,
  .nutrition-label,
  .nutrition-footnote {
    display: none !important;
  }

  /* --- Compact spacing --- */
  article.recipe section {
    margin-top: 1.5rem;
  }

  article.recipe section h2 {
    margin-bottom: 0.5rem;
  }

  article.recipe .instructions p {
    line-height: 1.5;
  }

  article.recipe footer {
    margin-top: 2rem;
    padding-top: 1rem;
  }

  article.recipe footer::after {
    display: none;
  }

  /* --- Checkbox bullets on ingredients --- */
  .ingredients li::before {
    content: "";
    display: inline-block;
    width: 0.7rem;
    height: 0.7rem;
    border: 1px solid black;
    border-radius: 1px;
    margin-right: 0.4rem;
    vertical-align: middle;
    position: relative;
    top: -0.05em;
  }

  /* --- Checkbox bullets on instruction paragraphs --- */
  .instructions p::before {
    content: "";
    float: left;
    width: 0.7rem;
    height: 0.7rem;
    border: 1px solid black;
    border-radius: 1px;
    margin: 0.25em 0.4rem 0 0;
  }

  /* --- Checkbox bullets on section headings --- */
  article.recipe section h2::before,
  article.recipe section h3::before {
    content: "";
    display: inline-block;
    width: 0.7rem;
    height: 0.7rem;
    border: 1px solid black;
    border-radius: 1px;
    margin-right: 0.4rem;
    vertical-align: middle;
    position: relative;
    top: -0.05em;
  }

  /* --- Pagination: keep headings with following content --- */
  article.recipe section h2,
  article.recipe section h3 {
    break-after: avoid;
  }

  .embedded-recipe {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  /* Embedded recipe headings are informational, not actionable steps */
  .embedded-recipe h3::before {
    content: none;
  }

  /* Hide "go to recipe" links on embedded recipes */
  .embedded-recipe-link {
    display: none;
  }

  /* Scaled quantity highlight: transparent in print */
  .scalable.scaled {
    background-color: transparent;
  }
}
