/* ── Book pages in the "Photo essay" design (book-render.js) ─────────────────
   Each page is laid out at its printed size (96 px to the inch) and scaled to
   fit wherever it is shown: the admin editor, the book viewers and the print
   view. --W and --H are the page width and height. */

.bk-sheet {
  --mt: 72px;   /* top margin, 0.75 in */
  --ms: 86px;   /* side margins, 0.9 in */
  --mb: 77px;   /* bottom margin, 0.8 in */
  position: absolute;
  left: 0;
  top: 0;
  width: var(--W);
  height: var(--H);
  transform-origin: 0 0;
  overflow: hidden;
  box-sizing: border-box;
  background: #fff;
  color: #241a12;
  font-family: 'EB Garamond', Georgia, serif;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.bk-sheet *, .bk-sheet *::before, .bk-sheet *::after { box-sizing: border-box; }

.bk-folio {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 38px;
  text-align: center;
  font: 12px 'EB Garamond', Georgia, serif;
  color: #8b7355;
}

/* Cover */
.bk-cover { background: #1a0f05 center / cover no-repeat; }
.bk-cover::before { content: ''; position: absolute; inset: 0; }
.bk-cover.bk-at-left::before   { background: linear-gradient(90deg, rgba(12, 7, 2, 0.88) 0%, rgba(12, 7, 2, 0.55) 42%, rgba(12, 7, 2, 0) 70%); }
.bk-cover.bk-at-right::before  { background: linear-gradient(270deg, rgba(12, 7, 2, 0.88) 0%, rgba(12, 7, 2, 0.55) 42%, rgba(12, 7, 2, 0) 70%); }
.bk-cover.bk-at-center::before { background: radial-gradient(ellipse at center, rgba(12, 7, 2, 0.7) 0%, rgba(12, 7, 2, 0.25) 60%, rgba(12, 7, 2, 0.1) 100%); }
.bk-cover.bk-at-bottom::before { background: linear-gradient(0deg, rgba(12, 7, 2, 0.88) 0%, rgba(12, 7, 2, 0.5) 40%, rgba(12, 7, 2, 0) 70%); }
.bk-cover.bk-plain::before { background: none; }
.bk-cover-words { position: absolute; max-width: 52%; color: #ede4d3; }
.bk-at-left .bk-cover-words   { left: 72px; top: 82px; }
.bk-at-right .bk-cover-words  { right: 72px; top: 82px; text-align: right; }
.bk-at-center .bk-cover-words { left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; max-width: 80%; }
.bk-at-bottom .bk-cover-words { left: 72px; bottom: 82px; }
.bk-cover h1 { font: 400 85px/0.92 'Cormorant Garamond', Georgia, serif; margin: 0; letter-spacing: 0.02em; }
.bk-cover-sub { font: italic 400 27px/1.2 'Cormorant Garamond', Georgia, serif; margin: 17px 0 0; }
.bk-cover-author { margin: 43px 0 0; font: 16px 'EB Garamond', Georgia, serif; letter-spacing: 0.3em; text-transform: uppercase; }

/* Back cover: a lead line and the blurb over the photo */
.bk-back.bk-at-left::before  { background: linear-gradient(90deg, rgba(12, 7, 2, 0.9) 0%, rgba(12, 7, 2, 0.75) 45%, rgba(12, 7, 2, 0) 75%); }
.bk-back.bk-at-right::before { background: linear-gradient(270deg, rgba(12, 7, 2, 0.9) 0%, rgba(12, 7, 2, 0.75) 45%, rgba(12, 7, 2, 0) 75%); }
.bk-back-words { position: absolute; top: 82px; width: 413px; color: #ede4d3; font: 15.33px/1.55 'EB Garamond', Georgia, serif; }
.bk-at-left .bk-back-words, .bk-at-bottom .bk-back-words { left: 72px; }
.bk-at-right .bk-back-words  { right: 72px; }
.bk-at-center .bk-back-words { left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; }
.bk-at-bottom .bk-back-words { top: auto; bottom: 82px; }
.bk-back-words p { margin: 0 0 11.5px; }
.bk-back-words .bk-back-lead { font: italic 400 29.33px/1.15 'Cormorant Garamond', Georgia, serif; margin: 0 0 24px; }
.bk-back-words .bk-back-author { margin: 29px 0 0; font-size: 13.33px; letter-spacing: 0.25em; text-transform: uppercase; opacity: 0.8; }

/* Title page and dedication: centred in the type area */
.bk-centre {
  position: absolute;
  top: var(--mt);
  left: var(--ms);
  right: var(--ms);
  bottom: var(--mb);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.bk-title h1 { font: 400 61px/1 'Cormorant Garamond', Georgia, serif; margin: 0; letter-spacing: 0.04em; }
.bk-title-sub { font: italic 400 23px/1.25 'Cormorant Garamond', Georgia, serif; margin: 12px 0 0; }
.bk-title-rule { width: 77px; height: 1px; background: #8b7355; margin: 38px 0; }
.bk-title-kind { font: 14px 'EB Garamond', Georgia, serif; letter-spacing: 0.25em; text-transform: uppercase; color: #8b7355; margin: 0; }
.bk-title-author { font: 17px/1.6 'EB Garamond', Georgia, serif; margin: 86px 0 0; white-space: pre-line; }
.bk-dedication p { max-width: 442px; font: italic 400 20px/1.6 'Cormorant Garamond', Georgia, serif; margin: 0; white-space: pre-line; }

/* Chapters and running text: two columns that fill the type area */
.bk-flow {
  position: absolute;
  top: var(--mt);
  left: var(--ms);
  right: var(--ms);
  bottom: var(--mb);
  display: flex;
  flex-direction: column;
}
.bk-head { flex: none; margin: 0 0 34px; }
.bk-label { margin: 0 0 6px; font: 13px 'EB Garamond', Georgia, serif; letter-spacing: 0.3em; text-transform: uppercase; color: #8b4a1c; }
.bk-head h2 { font: 400 45px/1.05 'Cormorant Garamond', Georgia, serif; margin: 0; }
.bk-subtitle { font: italic 400 20px/1.3 'Cormorant Garamond', Georgia, serif; margin: 6px 0 0; color: #5a4632; }
.bk-cols {
  flex: 1 1 auto;
  min-height: 0;
  column-count: 2;
  column-gap: 43px;
  column-fill: auto;
  font-size: 14.67px;
  line-height: 1.55;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow: hidden;
}
.bk-cols > * { margin: 0; }
.bk-cols p { text-indent: 1.4em; orphans: 3; widows: 3; }
.bk-balance .bk-cols { column-fill: balance; }
.bk-cols hr.bk-break { display: none; }
.bk-cols .bk-first,
.bk-cols .bk-cont,
.bk-cols h3 + p { text-indent: 0; }
.bk-cols .bk-first::first-letter {
  float: left;
  font: 400 51px/0.8 'Cormorant Garamond', Georgia, serif;
  padding: 4px 6px 0 0;
  color: #8b4a1c;
}
.bk-cols .bk-split { text-align-last: justify; }
.bk-cols h3 { font: 400 20px/1.3 'Cormorant Garamond', Georgia, serif; margin: 0.6em 0 0.3em; text-align: left; }

/* Photos: inset with the caption underneath, or full bleed */
.bk-photo {
  position: absolute;
  top: var(--mt);
  left: var(--ms);
  right: var(--ms);
  bottom: var(--mb);
  display: flex;
  align-items: center;
  justify-content: center;
}
.bk-photo figure { margin: 0; display: flex; flex-direction: column; align-items: center; position: relative; }
.bk-photo img {
  display: block;
  max-width: calc(var(--W) - 2 * var(--ms));
  max-height: calc(var(--H) - var(--mt) - var(--mb) - 67px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.bk-photo.bk-no-caption img { max-height: calc(var(--H) - var(--mt) - var(--mb)); }
/* Maps and other artwork: no shadow */
.bk-photo.bk-plain-photo img { box-shadow: none; }
.bk-photo figcaption { margin-top: 15px; text-align: center; font: 13.3px/1.45 'EB Garamond', Georgia, serif; color: #5a4632; }
.bk-photo figcaption em { font-size: 15.3px; color: #241a12; }
.bk-photo .bk-overlay-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font: 14px Georgia, serif;
  text-align: center;
}
.bk-bleed { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.bk-empty-photo {
  width: calc(var(--W) - 2 * var(--ms));
  height: calc(var(--H) - var(--mt) - var(--mb) - 67px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  color: #aaa;
  font: 16px Georgia, serif;
}

/* A sheet scaled into a box (thumbnails, previews, viewer pages) */
.bk-box { position: relative; overflow: hidden; }

.book-viewer-loading { color: rgba(255, 255, 255, 0.6); font: 0.9rem Georgia, serif; padding: 3rem; }
