@media print {
  /* ── Hide chrome ── */
  .app-sidebar,
  .app-topbar,
  nav,
  aside,
  footer,
  [data-no-print],
  button,
  #sidebar-overlay {
    display: none !important;
  }

  /* ── Remove shell layout offsets ── */
  .app-main {
    margin-left: 0 !important;
    margin-top: 0 !important;
  }

  /* ── Reset backgrounds to white/black for ink efficiency ── */
  html,
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* ── Article max-width reset ── */
  article,
  .post-body,
  [style*="max-width: 760px"] {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* ── Typography scale ── */
  h1 {
    font-size: 24pt;
    margin-top: 0;
    color: #000 !important;
  }
  h2 { font-size: 16pt; color: #000 !important; }
  h3 { font-size: 14pt; color: #000 !important; }

  p,
  li {
    line-height: 1.65;
    color: #222 !important;
  }

  /* Post-body classes override */
  :global(.post-p),
  :global(.post-h1),
  :global(.post-h2),
  :global(.post-h3),
  :global(.post-strong) {
    color: #000 !important;
  }

  :global(.post-code) {
    background: #f3f3f3 !important;
    color: #333 !important;
    border: 1px solid #ddd;
  }

  :global(.post-link) {
    color: #1a5276 !important;
  }

  :global(.post-hr) {
    border-top: 1px solid #ccc !important;
  }

  /* ── Show URLs as footnotes for printed links ── */
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #555;
    word-break: break-all;
  }

  /* ── Page-break controls ── */
  h1,
  h2,
  h3 { page-break-after: avoid; }

  blockquote,
  pre { page-break-inside: avoid; }

  img {
    max-width: 100%;
    page-break-inside: avoid;
  }

  /* ── Hero image: keep if present, constrain height ── */
  img[alt=""] {
    max-height: 300px;
    object-fit: cover;
    width: 100%;
    border-radius: 0 !important;
    margin-bottom: 1rem;
  }

  /* ── "Other posts" section: hide on print ── */
  section[style*="margin-top: 3.5rem"] {
    display: none !important;
  }

  /* ── Print header with memoir branding ── */
  body::before {
    content: "Memoir · memoir.synccy.com";
    display: block;
    font-size: 8pt;
    color: #888;
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
  }
}
