/* The real printed spread sits directly on the shared table. */
#home-book-mount {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
}
#hero-album.home-spread {
  position: relative;
  width: 100%;
  min-width: 0;
  aspect-ratio: var(--spread-ratio, 1.41);
  line-height: 0;
}
.home-paper {
  position: relative;
}
/* A lay-flat binding pulls only the paper next to the sewn fold down to the table. */
#hero-album:not(.showing-cover) {
  --paper-edge: polygon(
    0 0.3%,
    36% 0.3%,
    41% 0,
    44% 0,
    46% 0.18%,
    47.5% 0.45%,
    49% 1.02%,
    50% 1.55%,
    51% 1.02%,
    52.5% 0.45%,
    54% 0.18%,
    56% 0,
    59% 0,
    64% 0.3%,
    100% 0.3%,
    100% 99.65%,
    64% 99.65%,
    58% 99.36%,
    55% 99.32%,
    53% 99.4%,
    51.5% 99.65%,
    50% 100%,
    48.5% 99.65%,
    47% 99.4%,
    45% 99.32%,
    42% 99.36%,
    36% 99.65%,
    0 99.65%
  );
}
#hero-album:not(.showing-cover) .home-paper,
#hero-album:not(.showing-cover)::before {
  clip-path: var(--paper-edge);
}
#hero-album:not(.showing-cover)::before {
  content: '';
  position: absolute;
  inset: 2px 0 -2px;
  background: #cdbfa8;
}
#hero-album .home-spread-image,
.reader-sheet img {
  display: block;
  width: 100%;
  height: auto;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
}
#hero-album.showing-cover .home-spread-image {
  border-radius: 1px 2px 2px 1px;
  box-shadow:
    0 1px 0 #deceb4,
    0 2px 2px -1px #6b513955;
}
#hero-album:not([data-ready]) {
  visibility: hidden;
}
#hero-album.showing-cover .home-spread-image {
  width: 50%;
  margin-left: 50%;
}
#hero-album.showing-cover .paper-fold {
  display: none;
}
.paper-fold {
  pointer-events: none;
  position: absolute;
  left: 50%;
  inset-block: 0;
  width: clamp(10px, 2.8%, 28px);
  translate: -50% 0;
  background: linear-gradient(
    90deg,
    transparent,
    #80684907 23%,
    #74593612 42%,
    #5d452c23 49%,
    #fff8 54%,
    #fff8ed1c 71%,
    transparent
  );
}
.home-turn-leaf {
  position: absolute;
  inset-block: 0;
  width: 50%;
  right: 0;
  background-size: 200% 100%;
  background-position: var(--leaf-side) center;
  transform-origin: left center;
  pointer-events: none;
}
.home-turn-leaf[data-forward='false'] {
  right: auto;
  left: 0;
  transform-origin: right center;
}

.spread-reader-dialog {
  width: min(96vw, 1800px);
  max-width: 100%;
  height: 94dvh;
  max-height: 100%;
  padding: 0;
  border: 1px solid var(--ui-control-line);
  background: var(--ui-page);
  color: var(--ui-ink);
}
.spread-reader-dialog[open] {
  display: flex;
  flex-direction: column;
}
.spread-reader-dialog::backdrop {
  background: #18252ad6;
}
.reader-toolbar {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 0.7rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--ui-line);
  font: 14px/1.4 var(--studio-ui, sans-serif);
}
.reader-toolbar button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.5rem;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.reader-toolbar button:disabled {
  opacity: 0.4;
  cursor: default;
}
.reader-toolbar button:focus-visible {
  outline: 2px solid var(--ui-green);
}
.reader-toolbar output {
  font-variant-numeric: tabular-nums;
}
#reader-size {
  margin-left: auto;
}
#reader-close {
  font-size: 22px;
}
.reader-scrollport {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y pinch-zoom;
  background: var(--ui-page);
}
.reader-sheet {
  position: relative;
  width: max(1600px, 100%);
  margin-inline: auto;
  aspect-ratio: var(--spread-ratio);
}
.spread-reader-dialog[data-size='fit'] .reader-sheet {
  width: min(100%, calc((94dvh - 4.5rem) * var(--spread-ratio)));
}
@media (max-width: 700px) {
  .spread-reader-dialog {
    width: 100%;
    height: 100dvh;
    border: 0;
  }
  .reader-toolbar {
    gap: 0.35rem;
    padding: 0.35rem 0.4rem;
  }
  .spread-reader-dialog[data-size='fit'] .reader-sheet {
    width: 100%;
  }
}
