/* COSYmanuals Print & Offline Stylesheet
   Optimized for physical printing, PDF export, and offline teacher/student booklets.
*/

@media print {
  /* 1. Page Setup & Margins */
  @page {
    size: A4 portrait;
    margin: 20mm 15mm 20mm 15mm;
  }

  body {
    background: #ffffff !important;
    color: #111111 !important;
    font-family: "Georgia", "Times New Roman", serif;
    font-size: 11pt;
    line-height: 1.5;
    margin: 0;
    padding: 0;
  }

  /* 2. Hide Web Navigation & Interactive Widgets */
  #cosy-nav,
  header.sd-sticky-header,
  .sd-jump-links,
  .practice-cta-banner,
  .quiz-reset,
  .quiz-score,
  button,
  .btn-practice-link,
  footer.site {
    display: none !important;
  }

  /* 3. Container & Layout Reset */
  .container {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* 4. Typography & Color Adjustments */
  h1 {
    font-size: 22pt;
    color: #000000 !important;
    margin-bottom: 8pt;
    page-break-after: avoid;
  }

  h2 {
    font-size: 16pt;
    color: #222222 !important;
    margin-top: 14pt;
    margin-bottom: 6pt;
    page-break-after: avoid;
  }

  h3 {
    font-size: 13pt;
    color: #333333 !important;
    margin-top: 10pt;
    margin-bottom: 4pt;
    page-break-after: avoid;
  }

  p, ul, ol {
    orphans: 3;
    widows: 3;
  }

  /* 5. Box Callouts for Print */
  .box {
    border: 1pt solid #999999 !important;
    background: #fdfdfd !important;
    padding: 10pt 12pt !important;
    margin-bottom: 12pt !important;
    border-radius: 2pt !important;
    page-break-inside: avoid;
  }

  .outcome-banner {
    border-left: 3pt solid #1c8f56 !important;
    background: #f4fbf7 !important;
  }

  .box.mint {
    border-left: 3pt solid #107050 !important;
    background: #f0f9f5 !important;
  }

  .box.why {
    border-left: 3pt solid #d97706 !important;
    background: #fffbe8 !important;
  }

  .box.native {
    border-left: 3pt solid #4f46e5 !important;
    background: #f5f3ff !important;
  }

  /* 6. Tables & Lists Optimization */
  .table-wrap {
    overflow: visible !important;
    margin-bottom: 14pt;
    page-break-inside: avoid;
  }

  table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 10pt;
  }

  table th, table td {
    border: 1pt solid #cccccc !important;
    padding: 6pt 8pt !important;
    text-align: left;
  }

  table th {
    background-color: #f2f2f2 !important;
    color: #000000 !important;
    font-weight: bold;
  }

  /* 7. Offline Notes & Teacher Annotations Block */
  .print-teacher-notes {
    display: block !important;
    margin-top: 20pt;
    border: 1pt dashed #888888;
    padding: 12pt;
    min-height: 80pt;
    page-break-inside: avoid;
  }

  .print-teacher-notes::before {
    content: "📝 Teacher / Student Offline Notes:";
    font-weight: bold;
    display: block;
    margin-bottom: 6pt;
    color: #555555;
  }

  /* 8. Links & References */
  a {
    color: #000000 !important;
    text-decoration: underline !important;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 8pt;
    color: #555555;
  }
}

/* Screen Fallback for Print Preview Container */
@media screen {
  .print-teacher-notes {
    margin-top: 24px;
    border: 2px dashed #cbd5e1;
    padding: 16px;
    background: #f8fafc;
    border-radius: 6px;
  }
  .print-teacher-notes::before {
    content: "📝 Teacher / Student Offline Notes (Print Area):";
    font-weight: 700;
    display: block;
    margin-bottom: 8px;
    color: #64748b;
  }
}
