@import "support/fonts.css";
@import "support/normalize.css";
@import "support/kitabu.css";
@import "support/notes.css";
@import "support/toc.css";

:root {
  --frontcover-color: var(--accent-color);
  --frontcover-padding: 50px;
  --page-height: 22.86cm;
  --page-height: 19.05cm;
}

@page {
  size: 19.05cm 22.86cm portrait;
}

@page chapter:left {
  @bottom-left {
    background: #000;
    color: #fff;
    content: counter(page);
    font-size: 12px;
    margin-left: -100px;
    text-align: center;
    width: 35px;
  }
}

@page chapter:right {
  @bottom-right {
    background: #000;
    color: #fff;
    content: counter(page);
    font-size: 12px;
    margin-right: -100px;
    text-align: center;
    width: 35px;
  }
}

@page frontcover {
  margin: 0;
  background: var(--accent-color) url(../images/cover.png) no-repeat center
    center;
  background-size: cover;
}

@page chapter {
  margin: 100px 100px 50px;
  background: #fff;

  @footnotes {
    border-top: thin solid #777;
    margin-top: 1em;
    padding-top: 0.5em;
  }
}

@page white {
  margin: 0;
  background: #fff;
  display: block;
  height: 100%;
}

* {
  box-sizing: border-box;
}

body {
  font-family: serif;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: var(--frontcover-color);
}

.go-top {
  display: none;
}

.two-columns {
  columns: 2;
  gap: 50px;
}

/* White page */
.white-page {
  page: white;
  page-break-before: always;
  page-break-after: always;
}

.white-page:before {
  content: var(--left-blank-text);
  text-transform: uppercase;
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  top: 50%;
  transform: translatey(-50%);
}

/* Style frontcover */
.frontcover {
  page: frontcover;
  padding: var(--frontcover-padding);
  padding-left: 0;
  text-align: center;
  font-family: sans-serif;
}

.frontcover * {
  display: none;
}

.frontcover .logo {
  height: 150px;
  margin-bottom: 35px;
}

.frontcover .logo img {
  display: none;
}

.frontcover .description {
  display: inline-block;
  width: 400px;
  font-size: 20px;
  color: rgba(255, 255, 255, 0.7);
}

.frontcover .description:after {
  content: "";
  display: block;
  height: 300px;
  margin-top: 50px;
}

.frontcover .creators {
  font-size: 24px;
  padding: var(--frontcover-padding);
  font-weight: bold;
  margin-top: 30px;
  color: rgba(0, 0, 0, 0.4);
  text-transform: uppercase;
}

.frontcover .creators:before {
  content: "By ";
}

/* Section */
.section > h1,
.section--no-toc > h1 {
  text-transform: uppercase;
  font-family: "Open Sans Condensed";
  font-size: 40px;
  color: #fff;
  margin: -100px -100px 75px -100px;
  background: var(--frontcover-color);
  padding: 100px;

  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 100px;
  box-sizing: border-box;
  height: 285px;
}

.section--no-toc > h1:before,
.section.changelog {
  content: "";
  display: block;
  height: 28px;
}

.sections {
  counter-reset: chapter;
}

/* Chapter  */
.chapter {
  page: chapter;
  page-break-before: always;
  counter-increment: chapter;
}

.chapter > h2 {
  margin-top: 40px;
}

.chapter > h1:before {
  content: var(--chapter-text) " " counter(chapter);
  display: block;
  font-size: 16px;
  text-transform: uppercase;
  color: #eeff2a;
}

/* Code highlighting */
.highlight *,
p code,
li code {
  font-size: 12px;
  font-family: monospace;
}

div.highlight {
  padding: 15px;
  font-size: 12px;
}

div.highlight pre {
  margin: 0;
  padding: 0;
}

.highlight .gutter {
  color: #aaa;
  padding-right: 15px;
}

/* Format lexers list */
.lexers {
  margin: 0;
  padding: 0;
  columns: 2;
  list-style: none;
  gap: 50px;
}

.lexers li {
  break-inside: avoid-column;
}

.lexers span {
  font-size: 13px;
}

.lexers li + li {
  margin-top: 15px;
}

/* Table of contents */
.table-of-contents {
  page: chapter;
}

/* Footnotes */
.footnote {
  display: prince-footnote;
  footnote-style-position: inside;
  position: footnote;
}
