/* Flipbook, dressed in the portfolio's colours: cream paper, navy ink, pink accents. */
:root {
  color-scheme: light;
  --navy: #1D3B8D;
  --ink: #111833;
  --cream: #F4EFE6;
  --paper: #f6eddf;
  --rule: rgba(17, 24, 51, .14);
  --quiet: rgba(17, 24, 51, .6);
  font-family: Inter, system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--cream); }
.reader {
  width: min(100%, 82rem);
  margin-inline: auto;
  padding: clamp(1rem, 3vw, 2.4rem) clamp(1rem, 4vw, 3.25rem);
}
.reader-header {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: .75rem;
}
.reader-header p { margin: 0; color: var(--quiet); font-size: .875rem; }
h1 {
  margin: 0;
  font: 600 clamp(1.8rem, 4vw, 3.4rem)/1 "Inter Tight", Inter, sans-serif;
  letter-spacing: -.04em;
  color: var(--navy);
}
.reader-stage {
  position: relative;
  margin-block: clamp(1rem, 3vw, 2rem) clamp(1rem, 2vw, 1.5rem);
  margin-inline: auto;
  width: min(100%, 62rem);
  width: min(100%, 62rem, max(40rem, calc((100svh - 16rem) * 1.2963)));
  min-width: 0;
}
/* inside the case study the frame grows to fit the book, so size by width only */
.is-embed, .is-embed body { background: transparent; }
.is-embed .reader { padding: 0; width: 100%; }
.is-embed .reader-header { display: none; }
.is-embed .reader-stage { width: min(100%, 62rem); margin-top: 0; }
#book { margin-inline: auto; transition: transform .42s ease; }
#book.is-front-cover { transform: translateX(-25%); }
#opening-art {
  position: absolute; inset: 0;
  background: var(--paper);
  isolation: isolate; pointer-events: none; z-index: 25;
}
#opening-art img { display: block; width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.book-page { background: #fcfbf8; overflow: hidden; }
.book-page img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; pointer-events: none; }
.book-page--paper { background: var(--paper); }
.book-page--paper img { mix-blend-mode: multiply; }
.book-page--cover { background: #fbefbf; }
.book-page--cover img { object-fit: cover; mix-blend-mode: multiply; transform: scale(1.02); }

.reader-controls {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .75rem;
  max-width: 62rem; margin-inline: auto;
  border-top: 1px solid var(--rule);
  padding-top: .9rem;
}
.reader-controls[hidden] { display: none; }
.hint { margin: 0; font-size: .8125rem; color: var(--quiet); }
.pagination { grid-column: 2; display: flex; align-items: center; gap: .6rem; }
.sound { grid-column: 3; justify-self: end; }
button {
  min-width: 44px; min-height: 44px;
  border: 0; border-radius: 999px;
  background: var(--navy); color: #fff;
  font: 600 1rem/1 Inter, sans-serif;
  cursor: pointer;
  transition: transform .3s ease, opacity .3s ease;
}
button:hover:not(:disabled) { transform: translateY(-2px); }
button:disabled { opacity: .3; cursor: default; }
.sound { padding: 0 1rem; background: transparent; color: var(--navy); box-shadow: inset 0 0 0 1px var(--rule); font-size: .8125rem; }
:focus-visible { outline: 2px solid #FF9E9A; outline-offset: 3px; }
output {
  min-width: 6.5em; text-align: center;
  color: var(--quiet); font-size: .875rem; font-variant-numeric: tabular-nums;
}
@media (max-width: 44rem) {
  .reader-stage, .is-embed .reader-stage { width: min(100%, 25rem); }
  .reader-controls { grid-template-columns: auto 1fr; }
  .hint { display: none; }
  .pagination { grid-column: 1; }
}
@media (prefers-reduced-motion: reduce) { #book, button { transition: none; } }
