/*
 * Print stylesheet for Usucapio web subdomains.
 *
 * Goal: when a lawyer prints a paragraph / commentary / decision to PDF
 * or to actual paper for a brief, the result should look like a clean
 * black-on-white legal document — not a screenshot of the web UI.
 *
 * - Hide chrome: nav, search, footer, sidebars, tabs, action buttons.
 * - Force a print-friendly serif (Source Serif 4 if web fonts loaded,
 *   else the system serif fallback) at 11pt body / 1.4 line height.
 * - Avoid breaking paragraphs across pages.
 * - Print the URL after every link so citations remain traceable on paper
 *   ("…viz § 2954 (https://zakony.usucapio.com/2012/89/par_2954)…").
 *
 * Imported from `Layout.astro` via `<style is:global>`.
 */
@media print {
  /* ----- page setup ----- */
  @page {
    margin: 1.8cm 1.6cm 2cm 1.6cm;
  }

  html,
  body {
    background: #fff !important;
    color: #000 !important;
    font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif !important;
    font-size: 11pt !important;
    line-height: 1.4 !important;
  }

  /* ----- hide chrome ----- */
  .usuc-head,
  .usuc-foot,
  .usuc-search,
  .usuc-sidebar,
  .usuc-tabs,
  .usuc-actions,
  .skip-link,
  nav,
  header[role='banner'],
  footer[role='contentinfo'],
  [data-print-hide],
  button,
  .no-print {
    display: none !important;
  }

  /* Layout reset — single column, full bleed within page margins. */
  main,
  #main,
  .container,
  .container--wide,
  .container--narrow {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* ----- typography ----- */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    color: #000 !important;
    font-family: 'Source Serif 4', Georgia, serif !important;
    font-weight: 700;
  }
  h1 { font-size: 18pt; }
  h2 { font-size: 14pt; }
  h3 { font-size: 12pt; }
  h4, h5, h6 { font-size: 11pt; }

  p,
  li,
  blockquote,
  .paragraph-body,
  .commentary-body,
  .decision-body {
    page-break-inside: avoid;
    orphans: 3;
    widows: 3;
  }

  pre, code {
    font-size: 10pt;
    background: transparent !important;
    border: none !important;
    color: #000 !important;
  }

  /* ----- links: print the URL after them ----- */
  a,
  a:link,
  a:visited {
    color: #000 !important;
    text-decoration: underline;
  }
  /* Show absolute URL after external links, and pretty internal links. */
  a[href^='http']:after,
  a[href^='/']:after {
    content: ' (' attr(href) ')';
    font-size: 9pt;
    color: #333;
    word-break: break-all;
  }
  /* In-page anchors and javascript: don't get a noisy URL. */
  a[href^='#']:after,
  a[href^='javascript:']:after,
  a[href^='mailto:']:after,
  a.no-print-url:after {
    content: '';
  }

  /* ----- tables and figures ----- */
  table {
    page-break-inside: avoid;
    border-collapse: collapse;
  }
  th, td {
    border: 0.5pt solid #000 !important;
    padding: 4pt 6pt;
  }
  img, svg {
    max-width: 100% !important;
    page-break-inside: avoid;
  }

  /* ----- citation block: stays together with its paragraph ----- */
  .citation,
  .ref,
  .ref-block {
    page-break-inside: avoid;
  }
}
