/* Digital Book Mosaic: the printed poster and story page, built at true size in millimetres by poster.js.
   On screen they're zoomed to their wrapper (studio-kit.js). Printing uses separate copies in
   #print-host, wrapped in sheets with optional bleed and crop marks, at 100%.
   Pages keep their own colours whatever the site theme. */

.page-fit {
  --scale: 1;
  width: 100%;
}

.page-fit > .mz-poster {
  zoom: var(--scale);
}

.mz-poster {
  --bg: #fbfbf8;
  --fg: #111111;
  --soft: #6b6b66;
  --marker: #e8452c;
  --on-marker: #ffffff;
  --empty: #ecece7;
  --quote: #f4e5d4;
  --quote-ink: #30251d;
  --quote-detail: #85412f;

  position: relative;
  box-sizing: border-box;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Archivo', system-ui, sans-serif;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.mz-poster--ink {
  --bg: #111111;
  --fg: #f4f4f0;
  --soft: #a3a39d;
  --empty: #222222;
  --quote: #332920;
  --quote-ink: #fff2df;
  --quote-detail: #ffbd9e;
}

.mz-field {
  position: absolute;
  inset: 0;
}

.mz-tile {
  position: absolute;
  display: block;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: var(--empty);
  font: inherit;
}

.mz-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mz-tile--marker {
  display: grid;
  place-items: center;
  background: var(--marker);
  color: var(--on-marker);
  font-family: 'Archivo Black', 'Archivo', sans-serif;
  letter-spacing: -0.02em;
  line-height: 1;
}

.mz-tile--quote,
.mz-tile--caption {
  display: grid;
  color: var(--quote-ink);
  background: var(--quote);
  text-align: start;
}

.mz-tile--quote {
  align-items: center;
  border-inline-start: max(0.8mm, calc(var(--tile) * 0.018)) solid var(--marker);
}

.mz-tile--caption {
  grid-template-rows: minmax(0, 1.2fr) minmax(0, 1fr);
}

.mz-quote-copy {
  display: grid;
  align-content: center;
  min-height: 0;
  gap: clamp(0.6mm, calc(var(--tile) * 0.021), 2mm);
  padding: clamp(2mm, calc(var(--tile) * 0.07), 7mm);
  overflow: hidden;
}

.mz-quote-text {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(3.5mm, calc(var(--tile) * 0.10), 14mm);
  line-height: 1.08;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.mz-tile--caption .mz-quote-text {
  font-size: clamp(3mm, calc(var(--tile) * 0.065), 8mm);
  -webkit-line-clamp: 2;
}

.mz-quote-place,
.mz-quote-date {
  overflow: hidden;
  font-size: clamp(2.2mm, calc(var(--tile) * 0.04), 4.5mm);
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mz-quote-date {
  color: var(--quote-detail);
}

button.mz-tile {
  cursor: zoom-in;
}

/* Studio only: a pinned photo shows a small pin badge. Never printed (print copies aren't interactive). */
.mz-tile.is-pinned::after {
  position: absolute;
  top: 6%;
  right: 6%;
  width: 14%;
  aspect-ratio: 1;
  border: 0.5mm solid #fff;
  border-radius: 50%;
  background: var(--marker);
  content: '';
}

.mz-band {
  position: absolute;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: calc(var(--short) * 0.03);
  box-sizing: border-box;
  padding-top: calc(var(--short) * 0.012);
  border-top: calc(var(--short) * 0.0025) solid var(--fg);
}

.mz-title {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-family: 'Archivo Black', 'Archivo', sans-serif;
  font-size: calc(var(--short) * 0.052);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.05;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mz-sub {
  flex: none;
  max-width: 55%;
  margin: 0;
  color: var(--soft);
  font-size: calc(var(--short) * 0.017);
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.35;
  text-align: right;
  text-transform: uppercase;
}

/* ---------- story page ---------- */

.mz-story-head {
  position: absolute;
  padding-bottom: calc(var(--short) * 0.012);
  border-bottom: calc(var(--short) * 0.0025) solid var(--fg);
}

.mz-story-kicker {
  margin: 0 0 calc(var(--short) * 0.008);
  color: var(--marker);
  font-size: calc(var(--short) * 0.016);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mz-story-list {
  position: absolute;
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mz-entry {
  display: flex;
  gap: 3mm;
  min-width: 0;
  min-height: 0;
  padding-block: 3mm;
  overflow: hidden;
  border-top: 0.3mm solid var(--empty);
}

.mz-entry img {
  flex: none;
  width: 24mm;
  height: 24mm;
  object-fit: cover;
}

.mz-entry-text {
  min-width: 0;
}

.mz-entry-text p {
  margin: 0;
}

.mz-entry-when,
.mz-entry-place {
  display: block;
  overflow: hidden;
  font-size: 2.8mm;
  font-weight: 700;
  line-height: 1.22;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mz-entry-place {
  color: var(--soft);
}

.mz-entry-text .mz-entry-caption {
  display: -webkit-box;
  margin-top: 1mm;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 3.65mm;
  line-height: 1.05;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

/* ---------- print sheets ---------- */

#print-host {
  display: none;
}

.mz-sheet {
  position: relative;
  overflow: hidden;
  background: #fff;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.mz-bleed {
  position: absolute;
  background: #fbfbf8;
}

.mz-sheet--ink .mz-bleed {
  background: #111111;
}

.mz-mark {
  position: absolute;
  background: #000;
}

@media print {
  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }

  body > :not(#print-host) {
    display: none !important;
  }

  #print-host {
    display: block !important;
  }

  .mz-sheet {
    break-after: page;
  }

  .mz-sheet:last-child {
    break-after: auto;
  }
}
