/* Print-friendly styles */

@media print {
  /* Reset print margins */
  @page {
    margin: 2cm;
    size: A4;
  }
  
  /* Hide unnecessary elements for print */
  .site-header,
  .site-footer,
  .reading-progress,
  .chapter-nav,
  .theme-toggle,
  .search-form,
  .quick-actions,
  .reading-time-indicator,
  .restore-position-prompt,
  .scroll-to-top {
    display: none !important;
  }
  
  /* Optimize body for print */
  body {
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
    background: #fff;
  }
  
  /* Print-optimized typography */
  .book-title,
  .chapter-title {
    color: #000;
    page-break-after: avoid;
    margin-bottom: 1em;
  }
  
  .book-title {
    font-size: 24pt;
    text-align: center;
    margin-bottom: 2em;
  }
  
  .chapter-title {
    font-size: 18pt;
    border-bottom: 2px solid #000;
    padding-bottom: 0.5em;
  }
  
  .book-subtitle {
    font-size: 14pt;
    text-align: center;
    margin-bottom: 1em;
    color: #333;
  }
  
  .book-author {
    font-size: 12pt;
    text-align: center;
    margin-bottom: 3em;
    font-style: italic;
  }
  
  /* Chapter content optimization */
  .chapter-content.prose {
    font-size: 11pt;
    line-height: 1.6;
    max-width: none;
  }
  
  .prose h1 {
    font-size: 16pt;
    margin-top: 2em;
    margin-bottom: 1em;
    page-break-after: avoid;
  }
  
  .prose h2 {
    font-size: 14pt;
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    page-break-after: avoid;
    border-bottom: 1px solid #ccc;
    padding-bottom: 0.25em;
  }
  
  .prose h3 {
    font-size: 12pt;
    margin-top: 1.25em;
    margin-bottom: 0.5em;
    page-break-after: avoid;
  }
  
  .prose h4,
  .prose h5,
  .prose h6 {
    font-size: 11pt;
    margin-top: 1em;
    margin-bottom: 0.5em;
    page-break-after: avoid;
  }
  
  .prose p {
    margin-bottom: 1em;
    text-align: justify;
    orphans: 3;
    widows: 3;
  }
  
  /* Links for print */
  .prose a {
    color: #000;
    text-decoration: underline;
  }
  
  .prose a[href]:after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #666;
  }
  
  /* Don't show URLs for internal links */
  .prose a[href^="/"]:after,
  .prose a[href^="#"]:after {
    content: "";
  }
  
  /* Code blocks */
  .prose code {
    background: #f5f5f5;
    border: 1px solid #ddd;
    padding: 0.1em 0.25em;
    font-size: 9pt;
    font-family: "Courier New", monospace;
  }
  
  .prose pre {
    background: #f8f8f8;
    border: 1px solid #ddd;
    padding: 1em;
    font-size: 9pt;
    line-height: 1.4;
    overflow: visible;
    white-space: pre-wrap;
    page-break-inside: avoid;
  }
  
  .prose pre code {
    background: none;
    border: none;
    padding: 0;
  }
  
  /* Blockquotes */
  .prose blockquote {
    border-left: 3px solid #333;
    margin: 1em 2em;
    padding: 0.5em 1em;
    font-style: italic;
    background: #f9f9f9;
    page-break-inside: avoid;
  }
  
  /* Lists */
  .prose ul,
  .prose ol {
    margin: 1em 0;
    padding-left: 2em;
  }
  
  .prose li {
    margin-bottom: 0.5em;
  }
  
  /* Tables */
  .prose table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
    font-size: 10pt;
    page-break-inside: avoid;
  }
  
  .prose th,
  .prose td {
    border: 1px solid #333;
    padding: 0.5em;
    text-align: left;
  }
  
  .prose th {
    background: #f0f0f0;
    font-weight: bold;
  }
  
  /* Images */
  .prose img {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    page-break-inside: avoid;
    margin: 1em 0;
  }
  
  /* Table of Contents for print */
  .chapter-list {
    list-style: none;
    padding: 0;
  }
  
  .chapter-item {
    margin-bottom: 1em;
    padding: 0.5em;
    border: 1px solid #ddd;
    background: none;
    page-break-inside: avoid;
  }
  
  .chapter-link {
    display: block;
    color: #000;
    text-decoration: none;
  }
  
  .chapter-number {
    font-weight: bold;
    margin-right: 0.5em;
  }
  
  .chapter-title {
    font-size: 12pt;
    font-weight: bold;
    margin-bottom: 0.25em;
  }
  
  .chapter-summary {
    font-size: 10pt;
    color: #333;
    line-height: 1.4;
  }
  
  /* Page breaks */
  .chapter {
    page-break-before: always;
  }
  
  .chapter:first-child {
    page-break-before: avoid;
  }
  
  .toc-page {
    page-break-after: always;
  }
  
  /* Headers and footers */
  .chapter-header {
    margin-bottom: 2em;
    padding-bottom: 1em;
    border-bottom: 2px solid #000;
  }
  
  .chapter-number {
    font-size: 10pt;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5em;
    display: block;
  }
  
  .chapter-summary {
    font-size: 11pt;
    font-style: italic;
    color: #333;
    margin-bottom: 1em;
    text-align: center;
  }
  
  /* Remove interactive elements */
  button,
  .nav-link,
  .action-button {
    display: none !important;
  }
  
  /* Ensure good contrast */
  * {
    color-adjust: exact;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  
  /* Force black text for better printing */
  body,
  .prose,
  .prose *:not(code):not(pre) {
    color: #000 !important;
  }
  
  /* Specific adjustments for chapter metadata */
  .chapter-meta {
    font-size: 10pt;
    color: #666;
    text-align: center;
    margin: 1em 0;
  }
  
  .reading-time::before,
  .chapter-date::before {
    content: none;
  }
}