/* ==========================================================================
   Kate Lorén — typography of the book text.
   ONE source for both the online reader and the EPUB files, so they look the same.
   The build replaces the var(--bk-…) values with fixed ones for EPUB.
   ========================================================================== */

.book {
  font-family: var(--bk-font);
  line-height: var(--bk-lh);
  text-align: var(--bk-align);
  -webkit-hyphens: auto;
  hyphens: auto;
  -webkit-hyphenate-limit-before: 2;
  -webkit-hyphenate-limit-after: 3;
  hyphenate-limit-chars: 6 2 3;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  overflow-wrap: break-word;
  hanging-punctuation: first;
}

.book:lang(uk),
.book :lang(uk) {
  -webkit-hyphenate-limit-after: 2;
  hyphenate-limit-chars: 5 2 2;
}

.book p {
  margin: 0;
  text-indent: 1.4em;
  orphans: 2;
  widows: 2;
}
.book em { font-style: italic; }
.book strong { font-weight: 600; }

/* paragraphs that start flush: chapter opening, after a scene break or a POV label */
.book p.open,
.book p.after,
.book p.pov,
.book p.scene,
.book p.center,
.book p.the-end,
.book p.closing,
.book .epigraph p,
.book .part p,
.book .ch-head p,
.book .titlepage p { text-indent: 0; }

/* ---------- chapter opening ---------- */
.book .ch-head {
  text-align: center;
  margin: 3.4em 0 2.6em;
  -webkit-hyphens: none;
  hyphens: none;
  page-break-inside: avoid;
  break-inside: avoid;
  page-break-after: avoid;
  break-after: avoid;
}
.book .ch-label {
  font-family: var(--bk-display);
  font-weight: 500;
  font-size: 0.86em;
  line-height: 1.2;
  letter-spacing: 0.34em;
  margin-right: -0.34em;
  text-transform: uppercase;
  color: var(--bk-accent);
}
.book .ch-num {
  font-family: var(--bk-display);
  font-weight: 300;
  font-size: 4.6em;
  line-height: 1;
  margin: 0.06em 0 0;
  font-variant-numeric: lining-nums;
}
.book .ch-title {
  font-family: var(--bk-display);
  font-weight: 500;
  font-style: italic;
  font-size: 1.62em;
  line-height: 1.18;
  margin: 0.5em auto 0;
  max-width: 15em;
  text-align: center;
  text-wrap: balance;
}
.book .ch-name {
  font-family: var(--bk-display);
  font-weight: 400;
  font-size: 1.5em;
  line-height: 1.2;
  letter-spacing: 0.3em;
  margin: 0 -0.3em 0 0;
  text-transform: uppercase;
  text-align: center;
  text-wrap: balance;
}
.book .ch-coda .ch-name {
  font-style: italic;
  font-weight: 500;
  font-size: 1.75em;
  letter-spacing: 0.01em;
  margin-right: 0;
  text-transform: none;
}
.book .ch-orn {
  font-family: var(--bk-display);
  font-size: 1.05em;
  line-height: 1;
  margin: 1.15em 0 0;
  color: var(--bk-accent);
}
/* a bonus chapter has no number: the label sits right above a slightly larger title */
.book .ch-bonus .ch-title { font-size: 1.9em; margin-top: 0.7em; }
.book .ch-afterword { margin: 3em 0 2em; }
.book .ch-afterword .ch-orn { margin-top: 0; }

/* drop cap: three lines tall, set in the display face */
.book p.open .dc {
  float: left;
  font-family: var(--bk-display);
  font-weight: 500;
  font-size: calc((2 * var(--bk-lh) + 0.7) * 1.555em);
  line-height: 0.76;
  padding: 0.045em 0.07em 0 0;
  margin: 0 0 -0.12em -0.03em;
  color: var(--bk-accent);
  text-transform: uppercase;
  font-style: normal;
}
.book p.open::first-line {
  text-transform: uppercase;
  letter-spacing: 0.075em;
  font-size: 0.84em;
}

/* ---------- inside a chapter ---------- */
.book p.pov {
  font-family: var(--bk-display);
  font-weight: 500;
  font-style: italic;
  font-size: 1.32em;
  line-height: 1.25;
  text-align: center;
  color: var(--bk-accent);
  margin: 1.5em 0 0.9em;
  -webkit-hyphens: none;
  hyphens: none;
  page-break-after: avoid;
  break-after: avoid;
}
.book .ch-head + p.pov { margin-top: -0.9em; }

.book p.scene {
  font-family: var(--bk-display);
  font-size: 1em;
  line-height: 1;
  text-align: center;
  color: var(--bk-accent);
  margin: 1.55em 0;
  page-break-after: avoid;
  break-after: avoid;
}

.book p.center {
  text-align: center;
  margin: 0.9em 0;
  -webkit-hyphens: none;
  hyphens: none;
}

.book .epigraph {
  margin: 1.2em auto 2.2em;
  max-width: 23em;
  text-align: center;
  -webkit-hyphens: none;
  hyphens: none;
}
.book .epigraph p {
  text-align: center;
  margin: 0 0 0.85em;
  text-wrap: balance;
}

.book p.the-end {
  font-family: var(--bk-display);
  font-style: italic;
  font-weight: 500;
  font-size: 1.4em;
  text-align: center;
  margin: 2.6em 0 1.2em;
  color: var(--bk-accent);
}
.book p.closing {
  font-style: italic;
  text-align: center;
  margin: 1.2em auto 0;
  max-width: 24em;
  -webkit-hyphens: none;
  hyphens: none;
}

/* ---------- part divider ---------- */
.book .part {
  text-align: center;
  margin: 4.5em 0 4em;
  page-break-after: always;
  break-after: page;
}
.book .part-title {
  font-family: var(--bk-display);
  font-weight: 400;
  font-size: 1.7em;
  line-height: 1.25;
  letter-spacing: 0.32em;
  margin-right: -0.32em;
  text-transform: uppercase;
  -webkit-hyphens: none;
  hyphens: none;
}
.book .part .epigraph { margin-top: 2.2em; margin-bottom: 0; }

/* ---------- title page ---------- */
.book .titlepage {
  text-align: center;
  margin: 2.2em 0 3.2em;
  -webkit-hyphens: none;
  hyphens: none;
}
.book .tp-author {
  font-family: var(--bk-display);
  font-weight: 500;
  font-size: 0.95em;
  letter-spacing: 0.42em;
  margin-right: -0.42em;
  text-transform: uppercase;
  color: var(--bk-accent);
}
.book .tp-title {
  font-family: var(--bk-display);
  font-weight: 400;
  font-size: 2.7em;
  line-height: 1.06;
  margin: 0.55em 0 0;
  text-wrap: balance;
}
.book .tp-sub {
  font-family: var(--bk-display);
  font-style: italic;
  font-weight: 500;
  font-size: 1.4em;
  line-height: 1.2;
  margin: 0.5em 0 0;
  text-wrap: balance;
}
.book .tp-series {
  font-family: var(--bk-display);
  font-size: 0.86em;
  letter-spacing: 0.3em;
  margin: 1.6em -0.3em 0 0;
  text-transform: uppercase;
}
.book .tp-orn {
  font-family: var(--bk-display);
  color: var(--bk-accent);
  margin: 1.4em 0 0;
  line-height: 1;
}

/* ---- the author's look (tools/lib/look.rb) ---- */
/* ---------- chapter opening: a very large pale number ---------- */
.book .ch-orn .bar { display: inline-block; width: 2.2em; border-top: 0.12em solid; vertical-align: middle; }
.book .ch-chapter .ch-label { font-size: 0.8em; letter-spacing: 0.42em; margin-right: -0.42em; }
.book .ch-chapter .ch-num { font-size: 6.4em; line-height: 0.9; margin: 0.04em 0 0; opacity: 0.3; }
.book .ch-title { font-style: normal; font-size: 1.05em; line-height: 1.45; letter-spacing: 0.2em; text-transform: uppercase;
  margin: 1.05em auto 0; max-width: none; padding: 0 1em; }
.book .ch-orn { margin-top: 1.05em; line-height: 0.6; }
.book .ch-afterword .ch-orn { margin-top: 0; }
.book p.pov { font-style: normal; font-size: 0.95em; letter-spacing: 0.26em; text-transform: uppercase; }

/* ---------- title page: the title in capitals over a bar ---------- */
.book .tp-orn .bar { display: inline-block; width: 7em; border-top: 0.07em solid; vertical-align: middle; }
.book .tp-orn { margin-top: 2em; line-height: 0.6; }
.book .tp-title { letter-spacing: 0.04em; text-transform: uppercase; }
.book .tp-sub { font-style: normal; font-size: 1em; letter-spacing: 0.24em; text-transform: uppercase; margin-top: 1.1em; }

/* ---------- between scenes: three asterisks ---------- */
.book p.scene { font-size: 1.45em; line-height: 1; letter-spacing: 0.9em; text-indent: 0.9em; margin: 1.15em 0 0.55em; }
.book p.scene span { position: relative; top: 0.22em; }

/* ---------- first paragraph: an italic initial, the first line set like the rest ---------- */
.book p.open .dc { font-style: italic; padding-right: 0.11em; }
.book p.open::first-line { text-transform: none; letter-spacing: 0; font-size: 1em; }
