/*
:filename: wexa_statics/css/print.css
:author: Brigitte Bigi
:contact: contact@sppas.org
:summary: Print stylesheet for Whakerexa — loaded only when printing.

-------------------------------------------------------------------------

This file is part of Whakerexa: https://github.com/brigitte-bigi/Whakerexa

Copyright (C) 2023-2026 Brigitte Bigi, CNRS
Laboratoire Parole et Langage, Aix-en-Provence, France

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

This banner notice must not be removed.

-------------------------------------------------------------------------
*/

/* =======================================================================
   This file is loaded with media="print" — no @media print wrapper needed.
   ======================================================================= */

/* -----------------------------------------------------------------------
   Page setup.
   Firefox ignores @page entirely (margins and @bottom-center).
   Chromium: @page margins are overridden by the browser print dialog — only apply
   when the user explicitly selects "None" in the dialog's margin setting.
   ----------------------------------------------------------------------- */

@page {
    /*margin-top:    var(--print-margin-top);
    margin-right:  var(--print-margin-right);
    margin-bottom: var(--print-margin-bottom);
    margin-left:   var(--print-margin-left);*/
    @bottom-center {
        content: counter(page);
        font-size: 9pt;
        color: rgb(100, 100, 100);
    }
}

/* -----------------------------------------------------------------------
   Base reset for print
   ----------------------------------------------------------------------- */

:root {
    --screen-width: 100%;
    --header-slidein: none;
    --footer-slidein: none;
    --transition: none;
    --font-size: 12pt;
    --typography-spacing-vertical: calc(1.2 * var(--font-size));
    --typography-spacing-horizontal: calc(0.8 * var(--font-size));

    --bg-color: white;
    --fg-color: black;
    --font-size: 11pt;

    --print-margin-top:    2.5cm;
    --print-margin-right:  2.5cm;
    --print-margin-bottom: 2.5cm;
    --print-margin-left:   3cm;
}

html, body {
    width: 100%;
    background: white;
    color: black;
}

/* -----------------------------------------------------------------------
   Header: keep for document identification, simplify visuals
   ----------------------------------------------------------------------- */

body > header {
    background: white;
    color: black;
    border-bottom: 1pt solid black;
    padding: 0.5cm 0;
    margin-bottom: 1cm;
    width: 100%;
}

body > header * {
    background: transparent;
    color: black;
}

body > header nav {
    display: none;
}

/* -----------------------------------------------------------------------
   Footer: keep copyright/info, hide navigation
   ----------------------------------------------------------------------- */

body > footer {
    background: white;
    color: black;
    border-top: 1pt solid black;
    font-size: 10pt;
    margin-top: 1cm;
}

body > footer * {
    background: transparent;
    color: black;
}

body > footer nav {
    display: none;
}

/* -----------------------------------------------------------------------
   Hide screen-only elements
   ----------------------------------------------------------------------- */

dialog,
button,
[role="button"],
.skip,
.print-off {
    display: none;
}

nav.nav-wexa {
    display: none;
}

body:has(nav.nav-wexa.top) {
    padding-top: 0;
}

body:has(nav.nav-wexa.bottom) {
    padding-bottom: 0;
}

/* -----------------------------------------------------------------------
   Pagination
   ----------------------------------------------------------------------- */

figure, table, img, svg {
    break-inside: avoid;
}

section, article, article p {
    orphans: 2;
    widows: 2;
}

/* Force a blank page */
.blank-page {
    page-break-after: always;
    break-after: always;
}

html {
    margin-left: 0;
    height: auto;
}

html, body, main {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    /* @layer base sets overflow: hidden — must be reset for print pagination */
    overflow: visible;
}

body > footer {
    display: none;
}

body > header {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    page-break-after: always;
    break-after: always;
    border: none;
    background: white;
    color: black;
    margin: 0;
    padding: 0;
}

body > header * {
    background: transparent;
    color: black;
}

#toc-content {
    margin-left: 1rem;
}

/* -------------------------------- EXTRAS ------------------------------- */

/* -----------------------------------------------------------------------
   Book layout overrides (when book.css is loaded)
   ----------------------------------------------------------------------- */

.chapter {
    min-height: unset;
    page-break-before: always;
    break-before: always;
    page-break-after: always;
    break-after: always;
}

.chapter > h1::before {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
}

.abstract {
    box-shadow: none;
    border: 1pt solid rgb(140, 40, 40);
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
    margin: var(--typography-spacing-horizontal);
}

nav.book-toc,
aside.book-toc-aside {
    width: 100%;
    padding-top: 1rem;
    padding-bottom: 0.3rem;
    margin: 0;
    font-size: 90%;
    overflow: unset;
    background-color: white;
    color: var(--a-color);
    box-shadow: none;
    text-align: left;
    transform: none;
    display: block;
    page-break-after: always;
    break-after: always;
    page-break-before: always;
    break-before: always;
}
aside.book-toc-aside::after {
    page-break-after: always;
    break-after: always;
}

nav.book-toc *:not([role=button]),
aside.book-toc-aside *:not([role=button]) {
    color: var(--a-color);
}
