/*
 * Brochure mode - the brochure's pages: A4, margins, page numbers, and what the
 * brochure-* classes do. Generic: each page gives its brochure its own look under
 * html.brochure-mode in its own stylesheet.
 */

html:not(.brochure-mode) .brochure-only {
  display: none !important;
}

@page {
  size: A4;
  margin: 14mm 12mm 16mm;
  /* the sheet itself: without it the preview's grey desk shows through */
  background: #FFFFFF;
  @bottom-right {
    content: counter(page) " / " counter(pages);
    font: 8pt system-ui, sans-serif;
    color: #8A8F94;
  }
}

@page cover {
  margin: 0;
  @bottom-right {
    content: none;
  }
}

html.brochure-mode,
html.brochure-mode * {
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  scroll-behavior: auto !important;
  transition: none !important;
  animation: none !important;
}

.brochure-mode body {
  margin: 0;
}

/* Paged.js applies page and break rules to its own copy of the content, which
   has no html.brochure-mode around it - so these selectors stand alone. On the
   normal page they only matter when it is printed. */
.brochure-cover {
  page: cover;
  break-after: page;
}

.brochure-page-break {
  break-before: page;
}

.brochure-mode .brochure-keep {
  break-inside: avoid;
}

.brochure-mode .brochure-unfold {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5mm !important;
  overflow: visible !important;
  padding: 0 !important;
  margin: 0 !important;
  max-width: none !important;
}

.brochure-mode .brochure-unfold > * {
  flex: none !important;
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;
  break-inside: avoid;
}

.brochure-mode .brochure-show-all {
  display: block !important;
}

.brochure-mode .brochure-show-all > * {
  opacity: 1 !important;
  visibility: visible !important;
  position: static !important;
  break-inside: avoid;
}

.brochure-mode .brochure-show-all > * + * {
  margin-top: 5mm;
}

.brochure-mode details > summary {
  list-style: none;
}

.brochure-mode details > summary::-webkit-details-marker {
  display: none;
}

.brochure-mode .brochure-url {
  display: block;
  margin-top: 2mm;
  font-size: 9pt;
  color: #636363;
  word-break: break-all;
}

/* The preview's grey desk and sheet shadows are added by brochure-mode.js after
   Paged.js has run: Paged.js drops @media screen rules from the stylesheets it
   processes. */
