/* Everything drawn: the page at the top that reads itself, the diagrams in
   the chapters, the covers and the shelf. They are made of plain shapes in
   the page's own black, white and blue, and the words in them are real
   text. No pictures are loaded. */

/* ---------- The opening, and the page that reads itself ---------- */

.live { margin: 1.6em 0 0; }
.live-page {
  position: relative;
  padding: 0.9em 1.2em 1.3em 1.75em;
  border: var(--rule) solid var(--ink);
  font-size: 0.9em; line-height: 1.5;
}
.live-page p { text-indent: 0; }
.live-page p + p { text-indent: 1.5em; }
.live-page .live-head {
  margin-bottom: 0.9em; padding-bottom: 0.6em;
  border-bottom: 2px solid var(--ink);
  font: 800 11px/1 var(--sans);
  letter-spacing: 0.11em; text-transform: uppercase;
}
.live-page .live-title { margin-bottom: 0.45em; font: 900 1.5em/1.05 var(--sans); letter-spacing: -0.03em; text-align: left; }
.live-page .live-title + p { text-indent: 0; }
.live-mark { text-decoration: underline var(--accent) 0.13em; text-underline-offset: 0.2em; text-decoration-skip-ink: none; }
.live figcaption { margin-top: 0.6em; font: 0.72em/1.42 var(--sans); text-align: left; hyphens: manual; -webkit-hyphens: manual; }

/* On a wide screen the words stand on the left and the page beside them. */
@media (min-width: 1000px) {
  html:not(.paged) .book > .cover:not(.work) {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 27em); column-gap: 4em; align-items: start;
    max-width: 68em;
  }
  html:not(.paged) .cover-words, html:not(.paged) .cover > nav { grid-column: 1; }
  html:not(.paged) .cover > .live { grid-column: 2; grid-row: 1 / span 2; margin-top: 0; }
  html:not(.paged) .cover:not(.work) h1 { font-size: 5.6em; }
}

/* ---------- Diagrams ---------- */

.drawing { padding: 0.9em 0; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.drawing svg { display: block; width: 100%; max-width: 30em; height: auto; margin: 0 auto; }
.drawing .sheet { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.drawing .frame { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.drawing .t, .drawing .rule, .drawing .dark { fill: var(--ink); }
.drawing .q { fill: var(--quiet); }
.drawing .a { fill: var(--accent); }
.drawing .o { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.drawing .pen { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.drawing .pen.marker { stroke-width: 10; opacity: 0.5; }
.drawing .grid { stroke: var(--quiet); stroke-width: 1; }
.drawing .err { fill: none; stroke: var(--quiet); stroke-width: 2; }
.drawing text.w { fill: var(--ink); font: 20px var(--serif); }
.drawing text.w.on { fill: var(--on-accent); }
.drawing text.l { fill: var(--ink); font: 700 10px var(--sans); letter-spacing: 0.06em; }

/* The four papers. */
.papers-row { display: flex; }
.papers-row span {
  flex: 1; margin-left: -2px; padding: 0.7em 0.2em 0.6em;
  border: 2px solid var(--ink);
  font: 700 0.62em/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; text-align: center;
}
.papers-row span:first-child { margin-left: 0; }
.papers-row b { display: block; margin-bottom: 0.25em; font: 400 3.4em/1.1 var(--face); letter-spacing: 0; text-transform: none; }
.p-paper { background: #F6F2E9; color: #0B0B0B; }
.p-white { background: #FFFFFF; color: #0B0B0B; }
.p-dusk { background: #26272A; color: #E4E0D6; }
.p-black { background: #000000; color: #EFEBE2; }

/* A page of the notebook, which fills with what the reader marks. */
.notebook-page { margin: 1.15em 0; padding: 0 0.9em 0.4em; border: 2px solid var(--ink); text-align: left; hyphens: manual; -webkit-hyphens: manual; }
.notebook-page figcaption { margin: 0 -0.9em; padding: 0.6em 0.9em 0.55em; border-bottom: var(--rule) solid var(--ink); font: 900 1.05em/1 var(--sans); letter-spacing: -0.02em; }
.notebook-page ol { margin: 0; padding: 0; list-style: none; }
.notebook-page li { padding: 0.6em 0 0.65em; border-bottom: 1px solid var(--ink); }
.notebook-page .entry-quote { font: 0.9em/1.4 var(--face); }
.notebook-page .entry-note { font-size: 0.72em; }
.notebook-page p { padding: 0.7em 0; font: 0.76em/1.42 var(--sans); text-indent: 0; }
.notebook-page ol:not(:empty) + p { display: none; }

/* ---------- Covers ---------- */

/* A cover is two units wide and three tall, and everything on it is sized
   from its width (cqw), so a small one and a large one break their lines
   alike. Those sizes only work on what is inside the cover, never on the
   cover itself, which is why spacing is given to its children. */
.cover-art {
  position: relative; display: block; overflow: hidden;
  aspect-ratio: 2 / 3;
  container-type: inline-size;
  border: 2px solid var(--ink);
  text-align: left; text-indent: 0; hyphens: manual; -webkit-hyphens: manual;
}
.cover-art b, .cover-art i, .cover-art u, .cover-art s { display: block; font-style: normal; text-decoration: none; }
.cover-art b { font: 700 11cqw/1.04 var(--serif); letter-spacing: -0.01em; text-wrap: balance; }
.cover-art i { font: 700 4cqw/1.2 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; }

/* 1. A frame, the title in the middle. */
.c-frame { background: var(--accent); color: var(--on-accent); }
.c-frame .in {
  position: absolute; inset: 5cqw;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 6cqw 6cqw 16cqw;
  border: 3px double currentColor;
  text-align: center;
}
.c-frame u { width: 16cqw; height: 0.9cqw; margin: 6cqw 0 0; background: currentColor; }
.c-frame i { position: absolute; left: 0; right: 0; bottom: 7cqw; }

/* 2. A label on plain paper, and a seal. */
.c-label { background: var(--paper); color: var(--ink); }
.c-label .plate { display: block; margin: 12cqw 8cqw 0; padding: 6cqw 4cqw; border: 2px solid var(--ink); text-align: center; }
.c-label b { font-size: 9.5cqw; }
.c-label i { margin-top: 4cqw; color: var(--accent); font-size: 3.6cqw; }
.c-label .seal {
  position: absolute; left: 50%; bottom: 14cqw;
  display: grid; place-items: center;
  width: 20cqw; height: 20cqw; margin-left: -10cqw;
  border: 2px solid var(--accent); border-radius: 50%;
  color: var(--accent);
  font: italic 11cqw/1 var(--serif);
}

/* 3. A disc, the author above and the title at the foot. */
.c-disc { background: var(--ink); color: var(--paper); }
.c-disc::before { content: ""; position: absolute; top: -8cqw; right: -34cqw; width: 92cqw; height: 92cqw; border-radius: 50%; background: var(--accent); }
.c-disc i { position: absolute; top: 9cqw; left: 8cqw; padding-top: 4cqw; border-top: 1.6cqw solid var(--paper); }
.c-disc b { position: absolute; left: 8cqw; right: 8cqw; bottom: 9cqw; font-size: 12.5cqw; }

/* 4. Tiles and quarter circles over a band. */
.c-pattern { background: var(--paper); }
.c-pattern .tiles { position: absolute; inset: 0 0 34% 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); }
.c-pattern s { background: var(--ink); }
.c-pattern .k1 { background: var(--accent); border-radius: 0 0 100% 0; }
.c-pattern .k2 { border-radius: 100% 0 0 0; }
.c-pattern .k3 { background: var(--paper); }
.c-pattern .k4 { border-radius: 50%; }
.c-pattern .k5 { background: var(--accent); }
.c-pattern .k6 { border-radius: 0 100% 0 0; }
.c-pattern .k7 { background: var(--paper); }
.c-pattern .k8 { background: var(--accent); border-radius: 0 0 0 100%; }
.c-pattern .k9 { border-radius: 50%; }
.c-pattern .foot { position: absolute; inset: 66% 0 0 0; display: block; padding: 6cqw 7cqw; background: var(--ink); color: var(--paper); }
.c-pattern b { font-size: 9.6cqw; }
.c-pattern i { margin-top: 3cqw; font-size: 3.4cqw; }

/* 5. Plain, with a rule at the foot. */
.c-plain { background: var(--paper); color: var(--ink); }
.c-plain b { margin: 10cqw 8cqw 0; }
.c-plain i { margin: 4cqw 8cqw 0; color: var(--accent); font: italic 5.4cqw/1.2 var(--serif); letter-spacing: 0; text-transform: none; }
.c-plain u { position: absolute; left: 8cqw; right: 8cqw; bottom: 10cqw; height: 2px; background: var(--ink); }
.c-plain u::before { content: ""; position: absolute; left: 0; bottom: 0; width: 18cqw; height: 2.2cqw; background: var(--accent); }

/* 6. One very large letter. */
.c-initial { background: var(--ink); color: var(--paper); }
.c-initial b { margin: 9cqw 8cqw 0; font-size: 9.4cqw; }
.c-initial i { margin: 3.5cqw 8cqw 0; font-size: 3.4cqw; }
.c-initial .big { position: absolute; left: 3cqw; bottom: -30cqw; color: var(--accent); font: 700 150cqw/1 var(--serif); }

/* The six layouts in a row; three across on a phone. */
.six { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6em; padding: 0.9em 0; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
@media (min-width: 620px) {
  html:not(.paged) .six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* ---------- The shelf ---------- */

.shelf { margin: 1.3em 0 0; padding: 0; list-style: none; text-align: left; hyphens: manual; -webkit-hyphens: manual; }
.shelf li { border-top: 2px solid var(--ink); }
.shelf li:last-child { border-bottom: 2px solid var(--ink); }
.shelf a { display: grid; grid-template-columns: 6.4em minmax(0, 1fr); column-gap: 1.1em; align-items: start; padding: 1em 0; text-decoration: none; }
.shelf .about { display: block; }
.shelf .about > * { display: block; }
.shelf .about b { font: 900 1.25em/1.05 var(--sans); letter-spacing: -0.03em; }
.shelf .about i { margin-top: 0.3em; font-style: italic; }
.shelf .about span { margin-top: 0.5em; font: 0.76em/1.42 var(--sans); }
.shelf .about em {
  display: table; margin-top: 0.8em; padding: 0.55em 0.75em 0.5em;
  border: 2px solid var(--ink);
  font: 800 0.66em/1 var(--sans); letter-spacing: 0.11em; text-transform: uppercase;
}
@media (hover: hover) {
  .shelf a:hover .about em { background: var(--ink); color: var(--paper); }
}

/* ---------- A file of the reader's own ---------- */

/* Where a file is asked for: a blunt box to drop it on, and a button. */
.drop {
  margin: 1.4em 0 0; padding: 1.4em 1.2em 1.2em;
  border: var(--rule) dashed var(--ink);
  font: 0.8em/1.45 var(--sans);
  text-align: left; hyphens: manual; -webkit-hyphens: manual;
}
.drop.over { border-style: solid; background: var(--ink); color: var(--paper); }
.drop p { text-indent: 0 !important; }
html:not(.js) .drop { display: none; }
.file { position: relative; display: inline-grid; place-items: center; margin: 0.8em 0 0; }
.file input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.file:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.drop.over .file { border-color: var(--paper); }
.drop-says { min-height: 1.45em; margin-top: 0.9em !important; font-weight: 700; }

/* A link that is a button: on to the next chapter, back to the contents. */
a.btn { display: inline-grid; place-items: center; text-decoration: none; white-space: normal; text-align: center; line-height: 1.2; padding: 8px 12px; }
.own-more { margin-top: 2.4em; padding-top: 1em; border-top: 6px solid var(--ink); }

/* The chapters of a long book, as many as there are. */
.contents.own { display: block; columns: 2; column-gap: 1.2em; }
.contents.own li { break-inside: avoid; }
.contents.own a { align-items: baseline; padding: 0.7em 0; min-height: 0; }
@media (max-width: 480px) {
  .contents.own { columns: 1; }
}

/* What a file of the reader's own may have in it. */
.book .quote { margin: 0.7em 0 0.7em 1.4em; padding-left: 0.8em; border-left: 3px solid var(--ink); text-indent: 0; }
.chapter.plain > ul { margin: 0.7em 0; padding-left: 1.3em; text-align: left; }
.chapter.plain > pre { margin: 0.9em 0; }
.book strong { font-weight: 700; }
