/* ---------- GLOBAL ---------- */
body {
  font-family: Arial, sans-serif;
  margin: 0;
  background: #f8f1e7;
  color: #333;
  text-align: center;
  overflow-x: hidden;
}

/* ---------- HEADER ---------- */
header {
  background: #6d4c41;
  color: white;
  padding: 20px;
  position: relative;
  z-index: 5;
}

header h1 {
  margin: 0;
  font-size: 2rem;
}

.back-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  text-decoration: none;
  color: white;
  font-size: 1.2rem;
  background: rgba(255, 255, 255, 0.2);
  padding: 5px 10px;
  border-radius: 5px;
  transition: background 0.2s ease;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* ---------- BOOKSHELF ---------- */
.bookshelf {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 40px;
  max-width: 1000px;
  margin: 40px auto;
  background: #deb887;
  border: 10px solid #6d4c41;
  border-radius: 15px;
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
  overflow-x: auto;
  z-index: 1;
}

/* ---------- BOOK ---------- */
.book {
  position: relative;
  width: 80px;
  height: 250px;
  overflow: visible;
  transition: transform 0.3s ease;
  z-index: 2;
}

/* ---------- SPINE ---------- */ 
.spine { 
  background: #8b4513; 
  color: #fff; 
  writing-mode: vertical-rl; 
  text-orientation: mixed; 
  text-align: center; 
  font-weight: bold; 
  padding: 10px; 
  height: 100%; 
  border-radius: 4px; 
  box-shadow: inset -3px 0 8px rgba(0, 0, 0, 0.5); 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  cursor: pointer; 
  z-index: 3; 
  position: relative; 
  transition: background 0.3s ease;
  } 
  .bookshelf .book:nth-child(1) .spine { 
    background: #6b237a; /* Book 1 spine */ } 
    
    .bookshelf .book:nth-child(2) .spine { 
      background: darkgreen; /* Book 2 spine */ } 
      
      .bookshelf .book:nth-child(3) .spine { 
        background: navy; /* Book 3 spine */ } 
        
        .book:hover .spine 
        { background: #a0522d;

}

/* ---------- COVER (Overlay Book UI) ---------- */
.cover {
  background-size: cover;
  background-position: center;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  transform: scale(0.9);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s ease, opacity 0.4s ease;
  box-shadow: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  
}

.cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 0;
}

/* ---------- COVER CONTENT ---------- */
.cover-content {
  background: #fff;
  color: #333;
  padding: 30px;
  border-radius: 10px;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 1;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  text-align: left;
}


/* ---------- CLOSE BUTTON ---------- */
.close-btn {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 2rem;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  z-index: 2;
}

/* ---------- OPEN STATE ---------- */
.book.open .cover {
  transform: scale(1);
  opacity: 1;
  pointer-events: auto;
}
/* Ensure opened book is always on top */
.book.open {
  z-index: 10000; 
  position: relative;
}
/* ---------- FLIPBOOK ---------- */
.flipbook {
    width: 1000px;
    height: 600px;
}
    .flipbook .page {
    background: white;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
    gap: 10px;
    border: 1px solid rgba(0, 0, 0, 0.11);
}

.page img{
	width: 100%;
	object-fit: cover;
	margin: auto;
}

.flipbook .page small{
	font-size: 14px;
    margin-bottom: 10px;
}

