/* A single pose keeps the cover and rounded page edges together. */
.shelf-book {
  --book-depth: clamp(11px, 1.25cqw, 18px); isolation: isolate;
  transform-origin: center bottom;
  transform: perspective(950px) rotateX(7deg) rotateY(-12deg);
}
.shelf-book .book-spine-cover {
  width: calc(100% - var(--book-depth)); top: 3px; height: calc(100% - 5px);
  z-index: 2; transform: none;
  border-radius: 5px 10px 10px 5px; border: 1px solid #fff9;
  box-shadow: inset 2px 0 2px #fff9, 3px 2px 4px #37281e66, -5px 8px 12px #3c261e66;
}
.shelf-book .book-spine-cover::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 4;
  border-radius: inherit;
  background: linear-gradient(90deg,#2d190b55,transparent 3%,#fff7 5%,#0003 8%,transparent 12%,transparent 90%,#fff3 98%,#39221533);
  box-shadow: inset 0 2px 2px #fff9, inset 0 -2px 2px #36241044;
}
.shelf-book .book-page-block {
  position: absolute; z-index: 1; pointer-events: none;
  right: 0; top: 3px; bottom: 3px; width: calc(var(--book-depth) + 9px);
  border-radius: 9px; overflow: hidden; transform: none;
  background: linear-gradient(90deg,#8b756077,transparent 45%,#fff9 78%,#b9a89355),repeating-linear-gradient(90deg,#fffdf4 0 1px,#c4baa9 1px 2px,#fffcef 2px 3px);
  border: 1px solid #d5c7aa;
  box-shadow: 2px 2px 4px #5b3b2433;
}
.shelf-book .book-page-block::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 2px 2px #fffdf4, inset 0 -2px 2px #9f896c77;
}
.shelf-book .book-spine-shine { opacity: .38; width: 9%; }
.shelf-book .book-page-trim-top, .shelf-book .book-page-trim-bottom { opacity: 0; }
.shelf-book .book-cast-shadow { opacity: .9; bottom: -8px; left: -5px; right: -9px; height: 17px; filter: blur(2px); }
.shelf-book:hover { transform: perspective(950px) translateY(-5px) rotateX(7deg) rotateY(-12deg) scale(1.025); }
.shelf-book:active { transform: perspective(950px) translateY(-2px) rotateX(7deg) rotateY(-12deg) scale(.99); }
/* Leave room inside the scrollport for the base, depth and shadows.
   Keep padding-right at 0 so subsequent rack books and dashed cards never bleed into the scenic opening. */
.shelf-unit .shelf-books-row:not(.is-empty) {
  height: calc(var(--book-h) + 3.5cqw);
  padding: 1.5cqw 0 1cqw 1cqw;
  transform: translateY(1.2cqw);
  scroll-padding-inline: 0;
  scroll-snap-type: x mandatory;
  overflow-x: auto;
  overflow-y: hidden !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
@media (max-width:600px) {
  .shelf-unit[data-shelf-id] .shelf-books-row:not(.is-empty) {
    height: 195px; padding: 18px 0 12px 12px;
    transform: translateY(14px); scroll-padding-inline: 0;
  }
}

/* The library navigation belongs to signed-in readers; avoid a guest flash. */
#header-nav-capsule[hidden] { display: none !important; }
.shelf-header.is-guest { min-height: 68px; }
.btn-auth-header:hover, .btn-auth-header:focus-visible { color: #fff; }
.btn-auth-header:hover .auth-pill-text, .btn-auth-header:hover .auth-icon,
.btn-auth-header:focus-visible .auth-pill-text, .btn-auth-header:focus-visible .auth-icon { color: #fff; }

/* A category is its own shelf, with an always-available way home for guests. */
.category-view-header {
  display: flex; align-items: center; gap: 22px; margin: 12px 3.3% 20px;
  padding: 16px 20px; border: 1px solid #fff; border-radius: 24px;
  background: linear-gradient(115deg,#fffaf1ed,#f0e7ffdf);
  box-shadow: 0 5px 16px #a0789122;
  font-family: 'Nunito',sans-serif;
}
.category-back-button {
  flex-shrink: 0; padding: 10px 18px; border: 1px solid #fff; border-radius: 24px;
  background: linear-gradient(#fff,#ecdcff); color: #7134af;
  font: 900 15px 'Nunito',sans-serif; cursor: pointer; box-shadow: 0 3px 6px #79569426;
}
.category-back-button:hover { background: #e8d5ff; }
.category-view-title { margin: 0; color: #423075; font-size: 25px; font-weight: 900; }
.category-view-count { margin: 3px 0 0; color: #866b94; font-size: 13px; }
.category-view-title:focus { outline: none; }

/* The same cream, lilac and glossy pastel language as the dashboard. */
#auth-modal.modal-backdrop { background: #6e548877 !important; backdrop-filter: blur(7px) !important; padding: 18px; overflow-y: auto; }
#auth-modal .auth-modal-card {
  width: min(100%,460px); max-width: 460px; max-height: calc(100dvh - 36px); overflow-y: auto;
  padding: 27px 30px 25px; border: 2px solid #fff; border-radius: 30px;
  background: radial-gradient(ellipse at 14% 0,#ffe3ee 0,transparent 43%),radial-gradient(ellipse at 95% 7%,#e4dcff 0,transparent 48%),linear-gradient(#fffdf8,#fff2e4);
  box-shadow: 0 20px 65px #50385b44, inset 0 0 0 6px #fffc;
  color: #4f3973; font-family: 'Nunito',sans-serif;
}
#auth-modal button, #auth-modal input, #auth-modal label, #auth-modal h2, #auth-modal p { font-family: 'Nunito',sans-serif; }
#auth-modal .auth-close-btn { background: #fffaf7; color: #7142a7; border: 1px solid white; box-shadow: 0 2px 6px #ae85a526; }
#auth-modal .auth-close-btn:hover { background: #ecdfff; color: #5a2794; }
#auth-modal .auth-modal-logo { font-size: 43px; margin-bottom: 10px; filter: drop-shadow(0 4px 3px #c0a0e04d); }
#auth-modal .auth-modal-title { font-size: 25px; line-height: 1.15; color: #272269; font-weight: 900; }
#auth-modal .auth-modal-subtitle { margin-top: 9px; color: #8a719a; line-height: 1.5; }
#auth-modal .auth-tabs-nav { background: #ede3f7; border: 1px solid #fff; padding: 5px; }
#auth-modal .auth-tab-btn { color: #805f9c; font-weight: 900; }
#auth-modal .auth-tab-btn.active { background: linear-gradient(#c59aff,#924deb); color: white; box-shadow: inset 0 2px 3px #fff8,0 3px 5px #9866c540; }
#auth-modal .auth-field label { color: #61467b; font-size: 13px; }
#auth-modal .auth-input { background: #fffcf8; color: #4b3868; border: 1px solid #e7d5d0; box-shadow: inset 0 2px 4px #dbc3cd14; }
#auth-modal .auth-input::placeholder { color: #aa96b5; }
#auth-modal .auth-input:focus { border-color: #b184e7; box-shadow: 0 0 0 3px #d8baff44; }
#auth-modal .btn-auth-submit { background: linear-gradient(#be8aff,#8a40e6); border: 1px solid #dcc0ff; box-shadow: inset 0 2px 3px #fff8,0 4px 7px #a576cb44; font-weight: 900; }
#auth-modal .btn-auth-submit:hover { background: linear-gradient(#b879ff,#7430cd); box-shadow: 0 5px 12px #a576cb55; }
#auth-modal .auth-demo-hint { color: #977aa6; background: #f6ecff99; border-color: #dcc6ed; }
#auth-modal .auth-demo-hint strong { color: #7953aa; }
#auth-modal .auth-form-footer { color: #92769e; }
#auth-modal .auth-form-footer a { color: #8c44ce; }
#auth-modal .auth-modal-notice { color: #477e73; background: #e2f9ee; border-color: #b3e6ce; }
#auth-modal .auth-modal-error { color: #ac385f; background: #ffe7ed; border-color: #efb7ca; }
@media(max-width:600px) {
  .shelf-book { --book-depth: 9px; }
  .category-view-header { gap: 12px; padding: 13px; border-radius: 19px; margin-block: 8px 14px; }
  .category-back-button { padding: 9px 11px; font-size: 13px; }
  .category-view-title { font-size: 19px; }
  .category-view-count { font-size: 11px; }
  #auth-modal .auth-modal-card { padding: 25px 21px 22px; }
}
@media(prefers-reduced-motion:reduce) { .shelf-book { transition: none; } #auth-modal .auth-modal-card { animation: none; } }
