/* ==========================================================================
 * chat/static/print.css
 *
 * Print stylesheet for isitlegal.cy. Linked with media="print" from every
 * page (the three SPA templates directly; the eight server-rendered page
 * types via article_page._PAGE_HEAD_LINKS), so it costs nothing at screen
 * render time and only activates on Ctrl+P / Save-as-PDF.
 *
 * Why this matters for THIS product: the audience is lawyers. Lawyers
 * print — court bundles, research memos, client files. A statute article
 * or case page that prints cleanly (no nav chrome, no buttons, black on
 * white, citation URLs visible) is a real workflow feature, not polish.
 *
 * Design decisions:
 *   - Black text on white; strip backgrounds (saves ink, photocopies well).
 *   - Hide interactive chrome: site header/footer, buttons, search
 *     controls, filter sidebars, toggles, skip links.
 *   - Show the URL after in-body links. On paper a link is dead unless
 *     the reader can see where it points — standard legal-print practice.
 *     Fragment-only (#...) and javascript: links are excluded.
 *   - Avoid page-breaks inside citation cards / result items / amendment
 *     lists, and immediately after headings (orphaned headings).
 *   - A discreet footer note identifies the source, so a page pulled out
 *     of a bundle is still attributable.
 * ========================================================================== */

@media print {

  /* ---- Base: ink-friendly, high-contrast ---- */
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

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

  /* ---- Hide interactive / navigational chrome ---- */
  header.site,
  footer.site,
  nav,
  button,
  .controls,
  .query-section,
  .skip-link,
  .lang-toggle,
  .mode-toggle,
  .filter-sidebar,
  .library-filters,
  .pagination,
  .site-header,
  .site-footer,
  .auth-nav,
  [data-noprint],
  .error-banner:empty {
    display: none !important;
  }

  /* ---- Reading column: full width on paper ---- */
  main,
  main.prose,
  main.app,
  .answer-section,
  .final-answer {
    max-width: 100% !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* ---- Links: show destination for in-body absolute links ---- */
  a[href^="http"]::after,
  a[href^="/"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    font-weight: normal;
    word-break: break-all;
  }
  /* But not for fragment-only anchors or explicit opt-outs
     (e.g. TOC anchors, citation pills that already show their ref). */
  a[href^="#"]::after,
  a.citation-link::after,
  a[data-noprint-url]::after {
    content: "" !important;
  }

  /* ---- Page-break hygiene ---- */
  h1, h2, h3, h4 {
    page-break-after: avoid;
    break-after: avoid;
  }
  .doc-header,
  .case-card,
  .citation-card,
  .result-item,
  .amendment-list li,
  blockquote,
  table,
  figure {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  p {
    orphans: 3;
    widows: 3;
  }

  /* ---- Tables: visible hairlines survive photocopying ---- */
  table, th, td {
    border: 1pt solid #000 !important;
    border-collapse: collapse;
  }
  th, td {
    padding: 4pt 6pt;
  }

  /* ---- Source attribution on every printed page ---- */
  main::after {
    content: "Πηγή: isitlegal.cy — Έρευνα κυπριακού δικαίου / Source: isitlegal.cy";
    display: block;
    margin-top: 18pt;
    padding-top: 6pt;
    border-top: 0.5pt solid #000;
    font-size: 8pt;
    color: #000;
  }

  /* ---- Sensible margins ---- */
  @page {
    margin: 2cm 1.8cm;
  }
}
