body {
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: var(--background-color);
  font-family: sans-serif;
}

.shelf {
  display: flex;
  gap: 1rem;
  perspective: 800px;
}

.book {
  width: 80px; 
  height: 380px;
  transform-style: preserve-3d;
  transition: transform 0.8s;
  cursor: pointer;
  position: relative;  
  transform-origin: left center;
}

.book:hover {
  transform: rotateY(-90deg);
}

.spine,
.cover {
  position: absolute;
  height: 100%;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.3rem;
  backface-visibility: hidden;
}

.spine {
  width: 80px;
  background: linear-gradient(to bottom, #4A525B 0%, #3C4850 50%, #2E3740 100%);
  color: white;
  transform: rotateY(0deg);
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.cover {
  width: 200px;
  background: linear-gradient(to right, #5A6169, #3C4850);
  color: white;
  transform-origin: left center;
  transform: rotateY(90deg); 
  left: 80px; 
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  padding: 0px;
  color: white;
  text-align: center;
}

.author {
  margin: 10px;
  font-size: 0.90rem;
  font-weight: bold;
  color: #D4AF37;
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 6px;
  border-radius: 3px;
  margin-bottom: 10px;
}

.shelf {
  display: flex;
  gap: 1rem;
  perspective: 800px;
  transition: all 0.3s;
}

.book:hover ~ .book {
  transform: translateX(140px);
}

.book:hover {
  z-index: 10; 
  transform: rotateY(-90deg);
}

.title {
  flex-grow: 1;  
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);

  text-decoration: none;
  color: white;
  flex: 1;
  text-align: center;
  margin-top: -80px;
}

.download {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 1.2rem;
  text-decoration: none;
  color: white;
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s;
}

.download:hover {
  opacity: 1;
  transform: scale(1.2);
}

.spine-author {
  font-size: 0.7rem;
  padding-top: 4px;
  padding-bottom: 4px;
  writing-mode: horizontal-tb;
  background: #D4AF37;
  color: black;
  width: 100%;
  text-align: center;
}

.spine-title {
  height:100%;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.spine-lang {
  font-size: 0.7rem;
  opacity: 0.8;
  writing-mode: horizontal-tb;
  background-color: black;
  width: 100%;
  text-align: center;
}

.spine.navy {
  background: linear-gradient(to bottom, #3A4E78 0%, #1E2A50 50%, #16203B 100%);
}

.cover.navy {
  background: linear-gradient(to right, #4A5E8C, #2C3E50);
}

.spine.burgundy  {
  background:  linear-gradient(to bottom, #A22F3B 0%, #7A1E2A 50%, #641421 100%);
}

.cover.burgundy  {
  background: linear-gradient(to right, #B73848, #8F1F31);
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #181a1b;
    }
}

/* Light mode */
@media (prefers-color-scheme: light) {
    :root {
        --background-color: #ffffff;
    }
}