/* all-pages.html: every page of the guide, after a cover and contents - generated by createPages.xsl, for printing
   the whole guide, and for the PDF that WeasyPrint makes from it (the createVSCodePDF task). With custom.css's print
   styles, which apply to each page too.

   WeasyPrint supports more of CSS for paged media than browsers do, so the PDF also has: page numbers in the contents
   (target-counter and leader), the page's title at the top of each sheet (string-set), and PDF bookmarks from the
   headings (bookmark-level) - browsers ignore these declarations */

/* on screen: one long column */
.all-pages {
  max-width: 960px;
  padding: 0 24px 60px;
}

.all-pages .main {
  height: auto;
  overflow: visible;
  padding: 0;
}

.all-pages-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 0;
  border-bottom: 1px solid #ddd;
  background: #fff;
}

.all-pages-bar button {
  margin: 0 0 0 auto;
  padding: 6px 14px;
  border: 1px solid #0071BC;
  border-radius: 6px;
  background: #0071BC;
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.cover {
  margin: 30px 0 40px;
  padding: 40px 36px;
  border-radius: 8px;
  background: #3b495b;
  color: #fff;
}

.cover img {
  display: block;
  width: 200px;
  margin-bottom: 28px;
}

.cover h1 {
  margin: 0;
  color: #aaeaaa;
  font-size: 40px;
  line-height: 46px;
}

.cover-subtitle {
  margin: 10px 0 0;
  font-size: 20px;
  line-height: 26px;
}

.contents ul {
  margin: 0;
  list-style: none;
}

.contents li {
  margin: 0;
}

.contents-group {
  margin: 20px 0 8px !important;
  color: #8a8a8a;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contents-page {
  margin-bottom: 10px !important;
}

.contents-page > a {
  font-weight: bold;
}

.contents-page ul {
  margin: 3px 0 0 18px;
}

.contents-page ul a {
  font-size: 13px;
  line-height: 20px;
}

.doc-page {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid #ddd;
}

@media screen and (prefers-color-scheme: dark) {
  .all-pages-bar {
    border-bottom-color: #4a4a4a;
    background: #333;
  }

  .cover h1 {
    color: #aaeaaa;
  }

  .doc-page {
    border-top-color: #4a4a4a;
  }
}

/* printed, and in the PDF: A4 sheets, with the guide's title and the page's title at the top, and the page number at
   the bottom - but not on the cover, which fills the first sheet */
@page {
  size: A4;
  margin: 18mm 16mm 20mm;
  font-family: "Segoe UI", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;

  @top-left {
    content: "XSLT and XPath for Visual Studio Code";
    color: #777;
    font-size: 8.5pt;
  }

  @top-right {
    content: string(page-title);
    color: #777;
    font-size: 8.5pt;
  }

  @bottom-center {
    content: counter(page);
    color: #777;
    font-size: 9pt;
  }
}

@page :first {
  margin: 0;

  @top-left {
    content: none;
  }

  @top-right {
    content: none;
  }

  @bottom-center {
    content: none;
  }
}

@media print {
  .all-pages {
    max-width: none;
    padding: 0;
  }

  .all-pages-bar {
    display: none;
  }

  /* the guide's title is at the top of each sheet instead */
  .all-pages .main::before {
    content: none;
    display: none;
  }

  /* a band across the cover, for the logo and title - the rest of the sheet is left white, to save ink */
  .cover {
    margin: 75mm 0 0;
    padding: 16mm 22mm 18mm;
    border-radius: 0;
    break-after: page;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .cover h1 {
    font-size: 30pt;
    line-height: 36pt;
    bookmark-level: none;
  }

  .cover-subtitle {
    font-size: 16pt;
    line-height: 22pt;
  }

  /* custom.css hides the site's nav when printing - but not this one */
  nav.contents {
    display: block !important;
    break-after: page;
  }

  .contents a,
  .contents a:visited {
    color: #222;
  }

  .contents-page {
    break-inside: avoid;
  }

  /* each entry's page number, after a dotted leader */
  .contents li a::after {
    content: leader('.') target-counter(attr(href url), page);
    color: #777;
    font-weight: normal;
  }

  .doc-page {
    margin: 0;
    padding: 0;
    border: none;
    break-before: page;
  }

  .doc-page > .pageTitle {
    string-set: page-title content();
  }

  /* bookmarks: the contents and each page, with their h3 and h4 sections */
  .contents h2,
  .doc-page > .pageTitle {
    bookmark-level: 1;
  }

  .doc-page h3 {
    bookmark-level: 2;
  }

  .doc-page h4 {
    bookmark-level: 3;
  }

  .doc-page h5 {
    bookmark-level: none;
  }
}
