/*navbar*/
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: transparent;
  backdrop-filter: blur(10px);
  padding: 0.8rem 0;
  z-index: 1000;
  transition: var(--transition);
}
.navbar.scrolled {
  background: rgba(101, 71, 59, 0.80);
  backdrop-filter: blur(15px);
  padding: 0.4rem 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.navbar nav {
  padding: 0 40px;
}

.navbar ul {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  list-style: none;
}
nav ul li {
  position: relative;
}
.navbar a {
  color: var(--light);
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  padding: 0.6rem 1.2rem;
  border-radius: 30px;
  transition: var(--transition);
}
.navbar a:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

nav ul li:has(ul) > a {
  display: flex;
  align-items: center;
  gap: 6px;
}

nav ul li:has(ul) > a::after {
  content: '▼';
  font-size: 0.7rem;
  transition: transform 0.3s ease;
  margin-left: 4px;
}

nav ul li:hover > a::after,
nav ul li:focus-within > a::after {
  transform: rotate(180deg);
}

/* search */
.nav-search-container { 
  list-style: none; 
}
.nav-search {
  position: relative;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 30px;
  overflow: hidden;
  min-width: 220px;
  height: 40px;
  display: flex;
  align-items: center;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}
.nav-search:focus-within {
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.4);
}
#searchInput {
  background: transparent;
  border: none;
  outline: none;
  color: white;
  padding: 0 50px 0 16px;
  width: 100%;
  height: 100%;
  font-size: 0.95rem;
}
#searchInput::placeholder { color: rgba(255, 255, 255, 0.8); }
#searchBtn {
  position: absolute;
  right: 4px;
  background: transparent;
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
#searchBtn:hover {
  transform: scale(1.1);
}

nav ul ul {
  display: block; 
  position: absolute;
  top: 85%;
  background: rgba(101, 71, 59, 0.97);
  backdrop-filter: blur(15px);
  border-radius: var(--radius);
  width: auto;
  min-width: 190px;     
  padding: 0.75rem 0;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  pointer-events: none;
  transition: all 0.35s ease;
  z-index: 999;
}

nav ul ul li {
  display: block;
  width: 100%;
}

/*show dropdown*/
nav ul li:hover > ul,
nav ul li:focus-within > ul,
nav ul li > ul:hover,
nav ul li > ul:focus-within {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}


nav ul ul::before {
  content: '';
  position: absolute;
  top: -7px;
  left: 20px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid rgba(101, 71, 59, 0.97);
}

nav ul ul a {
  display: block;
  padding: 0.9rem 1.6rem;
  color: #f8f0e6;
  font-weight: 500;
  font-size: 1rem;
  white-space: nowrap;
  transition: var(--transition);
}

nav ul ul a:hover {
  background: var(--accent);
  transform: translateX(6px);
}

/*hamburger menu icon*/
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  position: relative;
  z-index: 1001;
}
.menu-toggle::before,
.menu-toggle::after,
.menu-toggle span {
  content: '';
  position: absolute;
  width: 24px;
  height: 2px;
  background: white;
  left: 8px;
  transition: var(--transition);
}
.menu-toggle::before { top: 12px; }
.menu-toggle span { top: 19px; }
.menu-toggle::after { top: 26px; }

/*active state (X) */
.menu-toggle.active::before { 
  transform: rotate(45deg); 
  top: 19px; 
}
.menu-toggle.active::after { 
  transform: rotate(-45deg); 
  top: 19px; 
}
.menu-toggle.active span{ 
  opacity: 0; 
}

/* hero */
.hero {
  background: linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.6)), url('../images/hero-background.png') center/cover no-repeat;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 1rem;
}
.hero-content {
  max-width: 900px;
  animation: fadeInUp 1.2s ease-out;
}
.hero-content .logo {
  width: 120px;
  height: 120px;
  background: white;
  padding: 12px;
  border-radius: 50%;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}
.hero-content h1 {
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 700;
  color: var(--light);
  margin: 0 0 1rem;
  letter-spacing: -1px;
}
.hero-content p {
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 2rem;
  font-weight: 300;
}
.cta-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.9rem 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 6px 15px rgba(139, 94, 60, 0.4);
}
.cta-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(139, 94, 60, 0.4);
}
.cta-btn #scrollLink {
  color: white;
  text-decoration: none;
}

/*section titles*/
section h2 {
  font-family: 'Girasol', serif;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  color: var(--primary-dark);
  margin: 2.5rem 0 1.5rem 1rem;
  position: relative;
}
section h2::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -8px;
  width: 60px;
  height: 4px;
  background: var(--accent);
  border-radius: 2px;
}
.why-section h2::after{
  display: none;
}

/* trending books section */
.book-slider { overflow: hidden; padding: 1rem 0; }
.book-grid {
  display: flex;
  gap: 1.2rem;
  animation: scrollBooks 25s linear infinite;
  padding: 0 1rem;
}
@keyframes scrollBooks { 
  0% { transform: translateX(0); } 
  100% { transform: translateX(-50%); 
  } 
}
.book-slider:hover .book-grid { 
  animation-play-state: paused;
 }

.book-item:hover {
  transform: translateY(-10px) scale(1.03);
  box-shadow: 0 15px 30px rgba(0,0,0,0.2);
}
.book-item {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  background-color: rgba(99, 32, 36, 0.4);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
  color: white;
  width: 200px;
  flex-shrink: 0;
  box-shadow: var(--shadow);
  transition: var(--transition);
  backdrop-filter: blur(5px);
}
.book-item img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 10px;
}
.book-item h3 {
  font-size: 1.1rem;
  margin: 0.8rem 0 0.4rem;
  color: var(--light);
}
.book-item p {
  font-size: 0.9rem;
  color: #eee;
  font-style: italic;
}

/* mood and genre sections */
.mood-container {
  display: flex;
  gap: 5px;
  justify-content: space-between;
  flex-wrap: nowrap;
  padding: 0 1em;
}
.mood-container a {
  flex: 1 1 0;
  display: block;
  text-decoration: none;
}
.mood-item {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  flex: 1 1 0;
  height: 100px;
  border-radius: 15px;
  overflow: hidden;
  color: white;
  font-weight: bold;
  font-size: 1rem;
  text-align: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
  background-size: cover;
  background-position: center;
  cursor: pointer;
}
.mood-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.4);
  z-index: 0;
}
.mood-item p {
  position: relative;
  z-index: 1;
  margin: 0;
}
.mood-item:hover {
  transform: scale(1.05);
}
.genre-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin: 10px;
}
.genre-container a {
  text-decoration: none;
}
.genre-item {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  flex: 1 1 0;
  height: 100px;
  border-radius: 15px;
  overflow: hidden;
  color: white;
  font-weight: bold;
  font-size: 1rem;
  text-align: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
  background-size: cover;
  background-position: center;
  cursor: pointer;
}
.genre-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.4);
  z-index: 0;
}
.genre-item p {
  position: relative;
  z-index: 1;
  margin: 0;
}
.genre-item:hover {
  transform: scale(1.05);
}

/*based on your last reading section*/
.lastread-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  padding: 2rem 1rem;
  max-width: 1400px;
  margin: 0 auto;
}

.lastread-item1,
.lastread-item2 {
  background: rgba(120, 100, 63, 0.35);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(212, 165, 116, 0.2);
}

.lastread-item1:hover,
.lastread-item2:hover,
.lastread-item3:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* image styling */
.lastread-item1 img,
.lastread-item2 img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  border-bottom: 4px solid var(--accent);
}

/* text content */
.text-content {
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex-grow: 1;
}
.text-content h3 {
  color: var(--primary-dark);
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0;
}
.text-content p {
  color: #555;
  font-size: 0.95rem;
  line-height: 1.5;
}
.text-content button {
  align-self: flex-start;
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.65rem 1.4rem;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  margin-top: auto;
}
.text-content button:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(106, 63, 58, 0.3);
}

.book-viewer {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80vw;
  height: 80vh;
  max-width: 90vw;
  max-height: 90vh;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  padding: 20px;
  box-sizing: border-box;
  overflow: hidden;
}

.book-viewer.active {
  opacity: 1;
  pointer-events: auto;
}

.book-outer {
  width: 100%;
  max-width: 1300px;
  height: 85vh;
  position: relative;
  perspective: 2500px;
}

.book {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  transform-style: preserve-3d;
  box-shadow: 0 40px 120px rgba(0,0,0,0.9);
  border-radius: 16px;
  overflow: hidden;
  background: #1a120d;
}

.hardcover.left {
  position: relative;
  width: 50%;
  height: 100%;
  background: linear-gradient(135deg, #8B5E3C, #6A3F3A);
  padding: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.4);
  overflow: hidden;
}

.hardcover video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  display: none;
  background: black;
}

.hardcover video[controls] {
  outline: none;
}

.hardcover audio{
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}

/*audio styling*/
.hardcover audio {
  object-fit: contain;
  background: linear-gradient(135deg, #2c1810, #000);
  padding: 40px;
  box-sizing: border-box;
}

/*hide video and audio by default*/
#bookVideo,
#bookAudio {
  display: none;
}

/*show when JavaScript adds .active class*/
#bookVideo.active,
#bookAudio.active {
  display: block;
}

#bookVideo::cue {
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-family: 'Poppins', sans-serif;
  font-size: 1.4rem;
  font-weight: 500;
  text-shadow: 1px 1px 3px black;
  padding: 6px 10px;
  border-radius: 4px;
}

.pages-container {
  width: 50%;
  height: 100%;
  background: #f8f0e6;
  padding: 50px 40px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 20px 0 40px -20px rgba(0,0,0,0.3);
}

.pages-scroll {
  height: 100%;
  overflow-y: auto;
  padding-right: 20px;
  font-family: 'Georgia', serif;
  font-size: 1.18rem;
  line-height: 2.1;
  color: #222;
  text-align: justify;
}

.pages-scroll::-webkit-scrollbar { 
  width: 12px; 
}
.pages-scroll::-webkit-scrollbar-track { 
  background: #e5d3b7; 
  border-radius: 10px;
}
.pages-scroll::-webkit-scrollbar-thumb { 
  background: #8B5E3C; 
  border-radius: 10px;
  border: 3px solid #f8f0e6;
}
.pages-scroll::-webkit-scrollbar-thumb:hover { 
  background: #6A3F3A; 
}

.exit-book {
  position: absolute;
  top: 30px;
  right: 30px;
  background: #8B5E3C;
  color: white;
  border: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 2rem;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  transition: 0.3s;
}

.exit-book:hover {
  background: #c0392b;
  transform: scale(1.15);
}

.book-title-overlay {
  position: absolute;
  bottom: 40px;
  left: 52%;
  transform: translateX(-50%);
  text-align: center;
  color: #8B5E3C;
  z-index: 10;
}

.book-title-overlay h3 {
  font-family: 'Girasol', serif;
  font-size: 2.2rem;
  margin: 0;
  text-shadow: 2px 2px 10px rgba(0,0,0,0.3);
}

.book-title-overlay p {
  margin: 8px 0 0;
  font-style: italic;
  opacity: 0.9;
}

@media (max-width: 900px) {
  .book {
    flex-direction: column;
    transform: rotateX(5deg);
  }
  .hardcover.left, .pages-container {
    width: 100%;
    height: 50%;
  }
  .pages-container { padding: 30px 25px; }
  .book-title-overlay { left: 50%; bottom: 20px; }
}

