.bookshelf {
  position: fixed;
  inset: 0;
  z-index: 2800;
  display: flex;
  flex-direction: column;
  color: #303030;
  background: #777;
  font-family: Helvetica, Arial, sans-serif;
  transition: opacity 580ms ease;
}
.bookshelf[hidden] { display: none; }
.bookshelf-toolbar {
  flex: 0 0 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-block: 1px solid #d2d2d2;
  background: repeating-linear-gradient(2deg, #aaa 0, #b8b8b8 1px, #a5a5a5 2px, #bcbcbc 4px);
  box-shadow: 0 2px 6px #0009;
  text-shadow: 0 1px #ddd;
  z-index: 2;
}
.bookshelf-toolbar h1 { margin: 0; font-size: 23px; font-weight: 600; }
.bookshelf-toolbar a { color: #333; font-size: 13px; text-decoration: none; }
.bookshelf-toolbar span { font-size: 12px; color: #444; }
.bookshelf-interior {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  padding: 0 clamp(12px, 3vw, 48px) 24px;
  background:
    linear-gradient(90deg, #0005, transparent 8%, transparent 92%, #0005),
    repeating-linear-gradient(91deg, #ffffff03 0px, #00000007 2px, transparent 4px, #ffffff06 8px),
    linear-gradient(90deg, #757575, #949494 46%, #797979);
  box-shadow: inset 0 8px 24px #0009;
}
.bookshelf-row {
  position: relative;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 20px 0 17px;
}
.bookshelf-row::after {
  content: "";
  position: absolute;
  inset: auto -5px 0;
  height: 14px;
  border-top: 1px solid #dfdfdf;
  background: linear-gradient(#bbb 0%, #a7a7a7 40%, #858585 90%, #626262);
  box-shadow: 0 9px 10px #0008, 0 -5px 14px #0003;
  pointer-events: none;
}
.shelf-book {
  height: min(100%, 230px);
  max-width: 70%;
  aspect-ratio: 1414 / 2000;
  padding: 0;
  border: 0;
  position: relative;
  z-index: 1;
  background: #111;
  box-shadow: -4px 1px 3px #0009, 7px 4px 13px #0008;
  cursor: pointer;
  transform-origin: center;
}
.shelf-book img { display: block; width: 100%; height: 100%; object-fit: fill; }
.shelf-book::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #fff3, #0004 3%, transparent 7%, transparent 98%, #ffffff20);
  pointer-events: none;
}
.shelf-book:focus-visible { outline: 3px solid #fff; outline-offset: 6px; }
.bookshelf.opening { opacity: 0; pointer-events: none; }
.bookshelf.opening .shelf-book { z-index: 5; }
body.library-view .scene,
body.library-view > .moscow-clock,
body.library-view .site-tabs { visibility: hidden; }
.library-return {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 100;
  padding: 10px 16px;
  border: 1px solid #ffffff40;
  border-radius: 8px;
  background: #242424cc;
  color: #eee;
  font: 14px Helvetica, Arial, sans-serif;
  cursor: pointer;
}
body.library-view .library-return { visibility: hidden; }
@media (max-width: 720px) {
  .bookshelf-toolbar { padding-inline: 14px; }
  .shelf-book { height: min(100%, 190px); }
  .library-return { left: 12px; bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .bookshelf { transition: none; }
}
