/* print.css – Statut (WCAG 2.2: czytelność, reflow w druku, brak elementów zbędnych) */
/* Wklej do osobnego pliku print.css i dołącz: <link rel="stylesheet" href="print.css" media="print"> */

@media print {

    /* Ustawienia strony (wspierane zależnie od przeglądarki) */
    @page {
        margin: 15mm;
    }

    html,
    body {
        background: transparent !important;
    }

    body {
        color: #000;
        font-size: 12pt;
        line-height: 1.5;
    }

    /* Ukryj elementy nawigacyjne i interaktywne, które w druku nie wnoszą wartości */
    header,
    nav,
    footer,
    .toc,
    .back-to-toc {
        display: none !important;
    }

    /* Jeśli globalny layout stosuje siatki/kolumny – wymuś jedną kolumnę */
    .page,
    main,
    .statute-chapter {
        max-width: none !important;
        width: auto !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Nagłówki: bez „osieroconych” tytułów na dole strony */
    h1,
    h2,
    h3,
    h4 {
        color: #000;
        page-break-after: avoid;
        break-after: avoid-page;
        orphans: 3;
        widows: 3;
    }

    /* Rozdziały zaczynaj od nowej strony dla czytelności */
    .statute-chapter {
        page-break-before: always;
        break-before: page;
    }

    .statute-chapter:first-of-type {
        page-break-before: auto;
        break-before: auto;
    }

    /* Paragrafy i listy: unikaj rozrywania nagłówka § od treści */
    .statute-paragraph {
        page-break-inside: avoid;
        break-inside: avoid;
    }

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

    ul,
    ol {
        padding-left: 1.2em;
        margin: 0 0 0.8em;
    }

    /* Linki: pokaż adresy URL tylko dla zewnętrznych odnośników
     (kotwice #... pomijamy jako nieużyteczne w druku) */
    a {
        color: #000;
        text-decoration: underline;
    }

    a[href^="http"]:after,
    a[href^="https"]:after {
        content: " (" attr(href) ")";
        font-size: 10pt;
        word-break: break-word;
    }

    a[href^="#"]:after {
        content: "";
    }

    /* Usuń efekty fokus/outline – w druku nie mają znaczenia */
    *:focus,
    *:focus-visible {
        outline: none !important;
    }

    /* Unikaj obcinania treści */
    * {
        box-shadow: none !important;
        text-shadow: none !important;
        filter: none !important;
    }
}
