:root {
  --night: #16130f;
  --paper: #eee4cf;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--night);
  scrollbar-color: rgba(238, 228, 207, .28) transparent;
  scrollbar-width: thin;
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background: var(--night);
}

.library {
  position: relative;
  width: 100%;
  height: 280vh;
  min-height: 1500px;
  background: var(--night);
}

.library::after {
  position: fixed;
  z-index: 3;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: .14;
  mix-blend-mode: screen;
  background-image:
    radial-gradient(circle at 12% 31%, rgba(255,255,255,.32) 0 .55px, transparent .7px),
    radial-gradient(circle at 73% 69%, rgba(255,255,255,.16) 0 .55px, transparent .7px);
  background-size: 7px 9px, 11px 13px;
}

.library__canvas {
  position: fixed;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100dvh;
  cursor: grab;
  opacity: 0;
  touch-action: pan-y;
  transition: opacity .8s cubic-bezier(.22, 1, .36, 1);
}

.is-ready .library__canvas { opacity: 1; }
.library__canvas.is-over-book { cursor: pointer; }
.library__canvas:focus-visible { outline: 1px solid rgba(238, 228, 207, .8); outline-offset: -7px; }

.library__loading {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  place-content: center;
  background: var(--night);
  transition: opacity .6s ease, visibility .6s;
}

.is-ready .library__loading {
  visibility: hidden;
  opacity: 0;
}

.loading-mark {
  display: flex;
  gap: 3px;
  align-items: end;
  height: 26px;
}

.loading-mark i {
  display: block;
  width: 4px;
  height: 22px;
  background: var(--paper);
  transform-origin: bottom;
  animation: book-load 1.2s ease-in-out infinite alternate;
}

.loading-mark i:nth-child(2) { height: 26px; animation-delay: -.35s; background: #a83e35; }
.loading-mark i:nth-child(3) { height: 18px; animation-delay: -.7s; }
.loading-mark i:nth-child(4) { height: 24px; animation-delay: -1s; }

.library__fallback {
  position: fixed;
  z-index: 20;
  inset: 0;
  margin: 0;
  padding: 38vh 24px 0;
  color: var(--paper);
  background: var(--night);
  font: 16px/1.5 Georgia, serif;
  text-align: center;
}

.library__fallback a {
  display: block;
  margin-top: 12px;
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes book-load {
  to { transform: scaleY(.55); opacity: .4; }
}

@media (max-width: 620px) {
  .library {
    height: 220vh;
    min-height: 1200px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
