/* The compendium is an open book. Left stationery, right stationery, ribbons on the right. */
.stage {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 52px);
  padding: 0.4rem 8.5rem 1rem 1rem;
}

.book {
  position: relative;
  height: min(84vh, 860px);
  display: flex;
  perspective: 2200px;
  filter: drop-shadow(0 22px 28px rgba(0, 0, 0, 0.45));
}

.leaf {
  position: relative;
  height: 100%;
  aspect-ratio: 0.74;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-position: center;
}

.leaf.left {
  background-image: url("parchment-page.jpg");
  cursor: w-resize;
}

.leaf.right {
  background-image: url("parchment-right.jpg");
  cursor: e-resize;
}

.face {
  position: absolute;
  top: 17%;
  bottom: 11%;
  overflow: hidden;
  color: #2a2340;
  font-size: 1.08rem;
  line-height: 1.38;
  text-align: left;
}

.leaf.left .face { left: 24%; right: 8%; }
.leaf.right .face { left: 9%; right: 23%; }

.face .kicker, .measure .kicker {
  margin: 0;
  font-family: Cinzel, serif;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6d5cae;
}

.face h2, .measure h2 {
  margin: 0.15rem 0 0.45rem;
  font-family: Cinzel, serif;
  font-weight: 500;
  font-size: 1.28rem;
  letter-spacing: 0.03em;
}

.face h3, .measure h3 {
  margin: 0.7rem 0 0.25rem;
  font-family: Cinzel, serif;
  font-weight: 500;
  font-size: 1.02rem;
}

.face p, .measure p { margin: 0 0 0.42rem; }

.face .write {
  position: absolute;
  left: 0;
  bottom: -0.15rem;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font-family: Cinzel, serif;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6d5cae;
}

.face.writing .ink {
  position: absolute;
  left: 0;
  right: 0;
  top: 4.4rem;
  bottom: 1.5rem;
  border: 0;
  padding: 0;
  resize: none;
  outline: none;
  background: transparent;
  color: #2a2340;
  font: inherit;
  line-height: 1.38;
}

.face .ink-tools {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.2rem;
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
}

.face .ink-tools button {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font-family: Cinzel, serif;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6d5cae;
}

.face .ink-note {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 0.85rem;
  color: #6a3a48;
}

.face .folio {
  position: absolute;
  right: 0;
  bottom: -0.2rem;
  font-family: Cinzel, serif;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  color: #8d82a4;
}

.cover-title {
  margin-top: 18%;
  text-align: center;
  font-family: Cinzel, serif;
  letter-spacing: 0.18em;
  font-size: 0.85rem;
  color: #6d5cae;
}

.marks {
  position: absolute;
  top: 16%;
  bottom: 12%;
  right: 0;
  width: 0;
  z-index: 4;
}

.mark {
  position: absolute;
  left: 0;
  width: 18px;
  overflow: hidden;
  border: 0;
  border-radius: 0 7px 7px 0;
  padding: 0.28rem 0.35rem 0.35rem 0.45rem;
  text-align: left;
  cursor: pointer;
  color: #f7f3fb;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.25);
  transition: width 0.22s ease;
}

.mark:hover, .mark:focus-within { width: 232px; }

.mark b {
  display: block;
  font-family: Cinzel, serif;
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.mark .nums {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  max-width: 210px;
  margin-top: 0.28rem;
  opacity: 0;
  transition: opacity 0.2s ease 0.14s;
}

.mark:hover .nums, .mark:focus-within .nums { opacity: 1; }

.mark .nums button {
  border: 0;
  background: rgba(255, 252, 255, 0.2);
  color: inherit;
  font-family: Cinzel, serif;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  padding: 0.12rem 0.32rem;
  cursor: pointer;
}

.mark .nums button.on { background: rgba(255, 252, 255, 0.85); color: #2a2340; }

.flipper {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  transform-style: preserve-3d;
  z-index: 3;
  pointer-events: none;
}

.flipper.next { right: 0; transform-origin: left center; animation: turnNext 0.7s ease-in-out forwards; }
.flipper.prev { left: 0; transform-origin: right center; animation: turnPrev 0.7s ease-in-out forwards; }

.flipper .side {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.flipper .side.front { background-image: url("parchment-right.jpg"); }
.flipper.next .side.back { transform: rotateY(180deg); background-image: url("parchment-page.jpg"); }
.flipper.prev .side.front { background-image: url("parchment-page.jpg"); }
.flipper.prev .side.back { transform: rotateY(180deg); background-image: url("parchment-right.jpg"); }

.flipper.prev .side.front .face { left: 24%; right: 8%; }
.flipper.next .side.back .face { left: 24%; right: 8%; }
.flipper.next .side.front .face { left: 9%; right: 23%; }
.flipper.prev .side.back .face { left: 9%; right: 23%; }

@keyframes turnNext { to { transform: rotateY(-180deg); } }
@keyframes turnPrev { to { transform: rotateY(180deg); } }

.measure {
  position: fixed;
  left: -4000px;
  top: 0;
  overflow: hidden;
  visibility: hidden;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.08rem;
  line-height: 1.38;
  color: #2a2340;
}

@media (prefers-reduced-motion: reduce) {
  .flipper.next, .flipper.prev { animation: none; }
  .mark { transition: none; }
}
