/* Print Styles for Blog Posts */
@media print {
  /* Reset page margins */
  @page {
    margin: 1.5cm 2cm;
    size: auto;
  }

  /* Base styles for print */
  :root {
    --color-primary: #000;
    --color-text: #000;
    --color-background: #fff;
    --font-size-base: 12pt;
    --line-height-base: 1.5;
  }

  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  html,
  body {
    font-size: 12pt;
    line-height: 1.5;
    background: #fff !important;
    color: #000 !important;
  }

  /* Hide non-essential elements */
  .header,
  .footer,
  .scheme-toggle,
  .section-nav,
  nav.social,
  .toc,
  .tags,
  .draft-label,
  #theme-toggle,
  .reading-time,
  .word-count,
  [class*="nav"],
  [class*="sidebar"],
  [class*="share"],
  [class*="comment"],
  [class*="related"],
  button,
  iframe,
  video,
  audio {
    display: none !important;
  }

  /* Layout adjustments */
  .container,
  .container-wide,
  .wrapper,
  main,
  article,
  .post {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
  }

  /* Post header styling */
  .post-header {
    margin-bottom: 1.5em;
    padding-bottom: 1em;
    border-bottom: 1px solid #ccc;
  }

  .post-header .title {
    font-size: 24pt;
    line-height: 1.2;
    margin: 0 0 0.5em 0;
  }

  .post-header .meta {
    display: block !important;
  }

  .post-header .date {
    font-size: 10pt;
    color: #666 !important;
  }

  .post-header .description {
    font-size: 11pt;
    font-style: italic;
    margin-top: 0.5em;
  }

  /* Typography */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    page-break-inside: avoid;
    orphans: 3;
    widows: 3;
  }

  h1 { font-size: 20pt; }
  h2 { font-size: 16pt; margin-top: 1.5em; }
  h3 { font-size: 14pt; margin-top: 1.2em; }
  h4, h5, h6 { font-size: 12pt; }

  p, li, blockquote {
    orphans: 3;
    widows: 3;
  }

  /* Links */
  a,
  a:visited {
    color: #000 !important;
    text-decoration: underline;
  }

  /* Show URLs after links (except internal anchors and images) */
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #666 !important;
    word-wrap: break-word;
  }

  a[href^="#"]:after,
  a[href^="javascript"]:after,
  a.no-print-url:after {
    content: "";
  }

  /* Images */
  img {
    max-width: 100% !important;
    height: auto !important;
    page-break-inside: avoid;
  }

  figure {
    page-break-inside: avoid;
    margin: 1em 0;
  }

  figcaption {
    font-size: 10pt;
    font-style: italic;
    text-align: center;
  }

  /* Code blocks */
  pre,
  code,
  .highlight {
    font-family: "Courier New", Courier, monospace !important;
    font-size: 9pt !important;
    background: #f5f5f5 !important;
    border: 1px solid #ddd !important;
    page-break-inside: avoid;
  }

  pre {
    padding: 0.5em !important;
    overflow-x: visible !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
  }

  code {
    padding: 0.1em 0.3em !important;
  }

  .highlight pre {
    border: none !important;
  }

  /* Syntax highlighting - make all code black for readability */
  .highlight span {
    color: #000 !important;
  }

  /* Inline code */
  :not(pre) > code {
    background: #f0f0f0 !important;
    border: 1px solid #ddd !important;
    border-radius: 2px;
  }

  /* Blockquotes */
  blockquote {
    border-left: 3px solid #666 !important;
    margin: 1em 0;
    padding: 0.5em 1em;
    font-style: italic;
    page-break-inside: avoid;
  }

  /* Tables */
  table {
    border-collapse: collapse;
    width: 100%;
    page-break-inside: avoid;
    margin: 1em 0;
  }

  th, td {
    border: 1px solid #333 !important;
    padding: 0.5em;
    text-align: left;
  }

  th {
    background: #f0f0f0 !important;
    font-weight: bold;
  }

  thead {
    display: table-header-group;
  }

  tr {
    page-break-inside: avoid;
  }

  /* Lists */
  ul, ol {
    margin: 1em 0;
    padding-left: 2em;
  }

  li {
    margin-bottom: 0.3em;
  }

  /* Horizontal rules */
  hr {
    border: none;
    border-top: 1px solid #666;
    margin: 1.5em 0;
  }

  /* Page breaks */
  .page-break {
    page-break-before: always;
  }

  .no-page-break {
    page-break-inside: avoid;
  }

  /* Abbreviations */
  abbr[title]:after {
    font-size: 9pt;
  }

  /* Print-specific footer with page info */
  body::after {
    display: block;
    font-size: 9pt;
    color: #666 !important;
    text-align: center;
    margin-top: 2em;
    padding-top: 1em;
    border-top: 1px solid #ccc;
  }
}
