/**
 * @info Print — the open letter on A4
 * @path assets/css/site/print.css
 *
 * Black on white. On top the logo, centred; then one column in the middle
 * of the page, at most about 65 characters wide, flush left: the heading,
 * the date, the letter, then Links, Chronik, Dank and the footer as a
 * colophon, all in one flow, no forced page breaks. The screen's grid is
 * switched off (main and footer are plain blocks): Safari prints with the
 * window's width, so the desktop grid would otherwise come along.
 * Nothing of the web is left: no menus, no stuck header, no page nav. What
 * can't be clicked is written out once, in [brackets]: the Links' addresses
 * (data-url, snippets/links.php) and the address to nominate; not in the
 * running text, where they would only repeat the Links. Every page but the
 * first carries the site and its number, centred (an @page margin box;
 * Chrome and Edge print it, Safari leaves it out).
 */

@page {
  size: A4;
  margin: 18mm 18mm 20mm;

  /* the folio, centred under the column: the site and the page */
  @bottom-center {
    content: "questions.worldchildforum.org · " counter(page) "/" counter(pages);
    font: 7.5pt / 1 "Helvetica Neue", Helvetica, Arial, sans-serif;
    vertical-align: top;
  }
}

@page :first {
  @bottom-center { content: none; }
}

@media print {

  /*----------  Sizes in points, space in millimetres  ----------*/

  :root {
    --size-ui:   8pt;
    --size-text: 10.5pt;
    --size-huge: 34pt;
    --size-logo: 16mm;

    --space-gutter: 0;
    --space-gap:    5mm;
    --space-air:    10mm;
    --space-rule:   2.5mm;
  }

  /* the colours of the screen are for the screen */
  body,
  main h1 { color: var(--color-black); }

  a { text-decoration: none; }

  /*----------  Gone: everything to click through  ----------*/

  [data-skip],
  [data-langs],
  [data-here],
  [data-toc],
  [data-crumbs] > ol > li:not(:first-child) { display: none; }

  /*----------  The header: the logo, centred  ----------*/

  body > header {
    position: static;
    justify-content: center;
    padding: 0;
    border: 0;
    animation: none;
  }

  [data-crumbs] {
    flex: none;

    & * { animation: none; }
  }

  [data-logo] { inline-size: var(--size-logo); margin: 0; }

  /*----------  One column in the middle of the page  ----------*/

  :root { --column: 120mm; }   /* about 65 characters of the letter's 10.5pt */

  body > main,
  body > footer {
    display: block;
    padding: 0;
  }

  body > main > *,
  body > footer > * {
    max-inline-size: var(--column);
    margin-inline: auto;
  }

  /*----------  The heading, the date, the letter  ----------*/

  main h1 {
    max-inline-size: none;
    padding-block-start: 16mm;
    line-height: 1.04;
  }

  [data-date] { margin-block-start: 6mm; }

  [data-text] {
    max-inline-size: none;
    margin-block-start: 10mm;
    line-height: 1.45;
    letter-spacing: 0;
    hyphens: auto;
    orphans: 3;
    widows: 3;

    & p + p { margin-block-start: .9em; }
  }

  h2,
  h3 { break-after: avoid; }

  li { break-inside: avoid; }

  /* "Für 2027 nominieren": no orange box, the address instead */
  [data-nominate] {
    margin-block-start: 6mm;
    padding: 0;
    background: none;
    color: var(--color-black);
    font-size: var(--size-ui);

    & [data-url] { display: inline; margin-inline-start: .3em; }
  }

  /* the AI note: a hairline instead of the grey */
  [data-ai] {
    background: none;
    border: .5pt solid var(--color-black);
  }

  /* an address written out, in brackets */
  [data-url]::before { content: "["; }
  [data-url]::after  { content: "]"; }

  /*----------  Links, Chronik, Dank: in the flow, each behind a rule  ----------*/

  body > main > section {
    display: block;
    margin-block-start: 12mm;
    padding-block-start: var(--space-rule);
    border-block-start: .5pt solid var(--color-black);

    & > * { max-inline-size: none; }
    & > h2 { margin-block-end: 4mm; }
  }

  [data-links] [data-url] {
    display: block;
    font-size: var(--size-ui);
    overflow-wrap: anywhere;
  }

  /*----------  The footer: a colophon at the end, in the same column  ----------*/

  body > footer {
    --color-rule: var(--color-black);
    --rule: .5pt solid var(--color-rule);

    margin-block-start: 16mm;
    padding-block-start: 0;
    border: 0;
    background: none;
    color: var(--color-black);
    font-size: var(--size-ui);
    break-inside: avoid;

    &::before { content: none; }   /* the screen's rule: here it sits on the first child */
    & > :first-child { padding-block-start: 8mm; border-block-start: var(--rule); }   /* the rule as wide as the column */
    & [data-years] { display: block; margin-block-end: 8mm; }
    & [data-years] > * { max-inline-size: none; }
    & [data-years] [data-whatif] { margin-block-end: 5mm; font-size: var(--size-text); line-height: 1.35; }
    & [data-years] > p,
    & [data-years] a { font-size: var(--size-ui); }
    & [data-years] > p { margin-block-start: 0; }
    & [data-years] a { padding-block: 1.5mm; }
    & [data-years] a[aria-current] span { text-decoration: none; }
    & [data-about] { max-inline-size: var(--column); margin-block-end: 6mm; }
    & address { display: block; }
    & address p + p { margin-block-start: 2mm; }
    & nav:not([data-years]) { display: none; }   /* Impressum, Datenschutz: nothing to click */
  }
}
