.novel-shelf,
.reader-reviews {
  color: #25251f;
  font-family: Geist, system-ui, sans-serif;
}

.novel-shelf {
  --shelf-rule: #c6b9a7;
  background: #faf7f0;
  padding: clamp(64px, 9vw, 128px) clamp(18px, 6vw, 90px) clamp(60px, 8vw, 116px);
}

.novel-intro, .novel-books, .novel-link {
  max-width: 985px;
  margin-inline: auto;
}

.novel-intro h2,
.reader-intro h2 {
  margin: 0;
  font: 400 clamp(2.7rem, 6vw, 5rem)/1 Newsreader, Georgia, serif;
  letter-spacing: -.04em;
  text-wrap: balance;
}

.novel-intro p,
.reader-intro p {
  max-width: 51ch;
  margin: 12px 0 0;
  color: #50483d;
  line-height: 1.58;
}

.novel-books {
  --shelf-height: clamp(275px, 28vw, 365px);
  --cover-width: calc(var(--shelf-height) * .625);
  --story-width: clamp(304px, 28vw, 355px);
  --spine-width: clamp(42px, 4.4vw, 65px);
  --shelf-transition: 420ms cubic-bezier(.2,.7,.25,1);
  display: flex;
  align-items: end;
  gap: 5px;
  margin-top: clamp(32px, 5vw, 58px);
  min-height: var(--shelf-height);
  border-bottom: 2px solid var(--shelf-rule);
}

.novel-book {
  --spine-color: #254f68;
  --spine-height: var(--shelf-height);
  position: relative;
  flex: none;
  width: var(--spine-width);
  height: var(--spine-height);
  overflow: clip;
  transition: width var(--shelf-transition);
}

.novel-book--paris {
  --spine-color: #7b3942;
  --spine-height: calc(var(--shelf-height) * .90);
}

.novel-book--ali-baba {
  --spine-color: #7c5125;
  --spine-height: calc(var(--shelf-height) * .91);
}

.novel-book--cloud-room {
  --spine-color: #14527f;
  --spine-height: calc(var(--shelf-height) * .95);
}

.novel-book--roommates {
  --spine-color: #83513d;
  --spine-height: calc(var(--shelf-height) * .87);
}

.novel-book.is-open { width: calc(var(--cover-width) + var(--story-width)); }

.novel-toggle {
  position: absolute;
  z-index: 1;
  inset: 0 auto 0 0;
  width: var(--spine-width);
  height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
  user-select: none;
  transition: width var(--shelf-transition);
}

.novel-book.is-open .novel-toggle { width: var(--cover-width); }

.novel-spine {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 100%;
  padding: 15px 0;
  border-radius: 3px 4px 0 0;
  background: linear-gradient(90deg, #0005, transparent 14% 82%, #0004), var(--spine-color);
  box-shadow: inset 0 0 0 1px #fff3;
  color: #fff8ec;
  writing-mode: vertical-rl;
  font: 500 clamp(.87rem, 1.35vw, 1.17rem)/1 Newsreader, Georgia, serif;
  white-space: nowrap;
  transition: opacity 180ms ease-out;
}

.novel-spine small {
  font: 500 clamp(.58rem, .7vw, .69rem)/1 Geist, system-ui, sans-serif;
}

.novel-spine img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.novel-book.is-open .novel-spine { opacity: 0; }

.novel-reveal {
  position: absolute;
  inset: 0 auto 0 0;
  display: grid;
  grid-template-columns: var(--cover-width) var(--story-width);
  align-items: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity 200ms ease-out, visibility 200ms;
}

.novel-book.is-open .novel-reveal {
  visibility: visible;
  opacity: 1;
}

.novel-front {
  display: block;
  align-self: end;
  width: 100%;
  height: var(--spine-height);
  border-radius: 3px 4px 0 0;
  object-fit: contain;
  object-position: left bottom;
}

.novel-story { padding: 10px clamp(14px, 2vw, 28px); }

.novel-story h3 {
  margin: 0 0 7px;
  font: 400 clamp(1.55rem, 2.9vw, 2.7rem)/1.06 Newsreader, Georgia, serif;
  letter-spacing: -.025em;
}

.novel-story p {
  margin: 0 0 12px;
  font-size: .93rem;
  line-height: 1.57;
}

.novel-story .novel-prequel {
  margin-bottom: 6px;
  color: #6c3841;
  font-size: .75rem;
  font-weight: 600;
}

.novel-story a,
.novel-link a {
  color: #573324;
  font-size: .88rem;
  font-weight: 600;
  text-underline-offset: .24em;
}

.novel-toggle:focus-visible { outline: 3px solid #fff; outline-offset: -5px; }
.novel-story a:focus-visible { outline: 2px solid #7b3942; outline-offset: 3px; }

.reader-reviews {
  --card-top: clamp(24px, 8svh, 72px);
  background: #ede9df;
  padding: clamp(62px, 8vw, 108px) clamp(18px, 5vw, 68px) clamp(60px, 8vw, 104px);
}

.reader-intro { text-align: center; }
.reader-intro p { margin-inline: auto; }

.reader-deck {
  display: grid;
  gap: clamp(34px, 13svh, 122px);
  max-width: 640px;
  margin: clamp(28px, 4vw, 52px) auto 0;
}

.reader-card {
  --art-paper: #ced9bd;
  position: sticky;
  top: var(--card-top);
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  grid-template-rows: 1fr auto;
  gap: 12px clamp(13px, 2.7vw, 33px);
  margin: 0;
  padding: 12px;
  border: 1px solid #d9d1c2;
  border-radius: 18px 18px 30px 18px;
  background: #fffcf6;
  box-shadow: 0 8px 22px #3f301314;
}

.reader-card:nth-child(2) { --art-paper: #ebd3b0; }
.reader-card:nth-child(3) { --art-paper: #dbc2c4; }

.reader-art {
  grid-row: 1 / 3;
  position: relative;
  overflow: hidden;
  min-height: clamp(166px, 27vw, 298px);
  border-radius: 10px 10px 17px 10px;
  background: var(--art-paper);
}

.reader-art img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
}

.reader-card blockquote { margin: 0; align-self: center; padding: 12px 12px 0 0; }

.reader-card blockquote p {
  margin: 0;
  font: 400 clamp(1.12rem, 2.05vw, 1.75rem)/1.28 Newsreader, Georgia, serif;
  letter-spacing: -.012em;
  text-wrap: pretty;
}

.reader-card figcaption {
  display: grid;
  gap: 4px;
  margin-right: 10px;
  padding: 9px 0 4px;
  border-top: 1px solid #d9d1c2;
  color: #544239;
  font-size: .84rem;
}

.reader-card figcaption span { font-size: .76rem; }

@media (max-width: 950px) {
  .novel-books {
    --shelf-height: clamp(204px, 39vw, 277px);
    display: grid;
    grid-template-columns: repeat(var(--shelf-count, 5), minmax(0, 46px)) minmax(0, 1fr);
    gap: 5px;
  }

  .novel-book { display: contents; }

  .novel-toggle,
  .novel-book.is-open .novel-toggle {
    position: relative;
    inset: auto;
    width: 100%;
    height: var(--spine-height);
  }

  .novel-book.is-open .novel-spine { opacity: 1; }
  .novel-book.is-open .novel-spine { box-shadow: inset 0 -4px #fff8ec; }

  .novel-reveal { display: none; }
  .novel-book.is-open .novel-reveal {
    position: relative;
    inset: auto;
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: minmax(70px, 31%) minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    display: grid;
    padding-block: 14px;
  }

  .novel-front { height: auto; align-self: start; max-height: 270px; object-position: top left; }
  .novel-story { padding: 0; }
  .novel-story p { font-size: .88rem; }
}

@media (max-width: 450px) {
  .novel-spine { gap: 8px; padding-block: 9px; font-size: .87rem; }
  .novel-book--ali-baba .novel-spine { font-size: .75rem; }
  .novel-spine small { font-size: .57rem; }
  .reader-card { padding: 8px; }
  .reader-art { min-height: 190px; }
}

@media (prefers-reduced-motion: reduce), (max-height: 590px) {
  .reader-card { position: relative; top: auto; }
  .reader-deck { gap: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .novel-book, .novel-toggle, .novel-spine, .novel-reveal { transition: none; }
}
