/* ============================================
   THE VISITOR'S GUIDE - Book Demo Section
   ============================================ */

.demo-book-section {
  margin-top: 4rem;
  padding: 2rem 0;
  animation: fadeInUp 1s ease 0.8s forwards;
  opacity: 0;
}

.demo-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 2rem;
  color: var(--text-primary);
  opacity: 0.9;
}

[data-theme="dark"] .demo-title {
  color: var(--text-primary-dark);
}

.book-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

/* Book spread container - 3D perspective */
.book-spread {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  max-width: 900px;
  width: 100%;
  transition: transform 0.4s ease;
  perspective: 2000px;
  transform-style: preserve-3d;
  margin: 2rem auto;
  filter: drop-shadow(0 25px 80px rgba(0, 0, 0, 0.4));
}

.book-spread:hover {
  transform: scale(1.03) rotateY(-2deg);
}

[data-theme="dark"] .book-spread {
  filter: drop-shadow(0 25px 80px rgba(0, 0, 0, 0.7));
}

/* Individual book pages - 3D effect */
.book-page {
  position: relative;
  overflow: hidden;
  background: linear-gradient(to right, #fafaf8 0%, #ffffff 10%);
  transform-style: preserve-3d;
  box-shadow: 
    inset 0 0 30px rgba(0, 0, 0, 0.05),
    0 0 1px rgba(0, 0, 0, 0.1);
}

.book-page img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 350px;
  object-fit: cover;
}

/* Left page with realistic shadows */
.left-page {
  border-radius: 4px 0 0 4px;
  border: 1px solid #d4d4d4;
  border-right: none;
  transform: rotateY(2deg);
  transform-origin: right center;
  background: linear-gradient(to right, #ffffff 0%, #fafaf8 95%, #f0f0f0 100%);
}

.left-page::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 30px;
  background: linear-gradient(to right, 
    transparent 0%, 
    rgba(0, 0, 0, 0.06) 50%, 
    rgba(0, 0, 0, 0.08) 100%);
  pointer-events: none;
}

/* Right page with realistic shadows */
.right-page {
  border-radius: 0 4px 4px 0;
  border: 1px solid #d4d4d4;
  border-left: none;
  transform: rotateY(-2deg);
  transform-origin: left center;
  background: linear-gradient(to left, #ffffff 0%, #fafaf8 95%, #f0f0f0 100%);
}

.right-page::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 30px;
  background: linear-gradient(to left, 
    transparent 0%, 
    rgba(0, 0, 0, 0.06) 50%, 
    rgba(0, 0, 0, 0.08) 100%);
  pointer-events: none;
}

/* Leatherbound book spine - thinner and clearer */
.book-spine {
  width: 25px;
  min-height: 100%;
  background: 
    linear-gradient(90deg, 
      #5a3015 0%, 
      #7a4020 15%, 
      #8B4513 30%, 
      #A0522D 50%, 
      #8B4513 70%, 
      #7a4020 85%, 
      #5a3015 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 
    inset 0 0 20px rgba(0, 0, 0, 0.5),
    inset 1px 0 5px rgba(0, 0, 0, 0.3),
    inset -1px 0 5px rgba(0, 0, 0, 0.3);
  transform: translateZ(5px);
  align-self: stretch;
}

/* Leather texture overlay */
.book-spine::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.1) 2px,
      rgba(0, 0, 0, 0.1) 4px
    ),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 20px,
      rgba(0, 0, 0, 0.05) 20px,
      rgba(0, 0, 0, 0.05) 21px
    );
  opacity: 0.5;
}

/* Gold embossed text on spine - smaller and clearer */
.spine-text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: #FFD700;
  text-shadow: 
    0 1px 2px rgba(0, 0, 0, 0.8),
    0 0 10px rgba(255, 215, 0, 0.4);
  letter-spacing: 1.5px;
  position: relative;
  z-index: 1;
  white-space: nowrap;
}

/* Add gilded edges effect */
.book-page::before {
  content: '';
  position: absolute;
  top: -1px;
  bottom: -1px;
  width: 2px;
  background: linear-gradient(to bottom,
    #D4AF37 0%,
    #FFD700 50%,
    #D4AF37 100%);
  opacity: 0.3;
}

.left-page::before {
  right: -1px;
}

.right-page::before {
  left: -1px;
}

/* Dark mode adjustments */
[data-theme="dark"] .book-page {
  border-color: #333;
  background: linear-gradient(to right, #1a1a1a 0%, #222 10%);
}

[data-theme="dark"] .left-page {
  background: linear-gradient(to right, #222 0%, #1a1a1a 95%, #111 100%);
}

[data-theme="dark"] .right-page {
  background: linear-gradient(to left, #222 0%, #1a1a1a 95%, #111 100%);
}

[data-theme="dark"] .book-spine {
  background: 
    linear-gradient(90deg, 
      #2a1408 0%, 
      #4a2810 10%, 
      #6B3410 25%, 
      #8B4513 50%, 
      #6B3410 75%, 
      #4a2810 90%, 
      #2a1408 100%);
  box-shadow: 
    inset 0 0 40px rgba(0, 0, 0, 0.8),
    inset 2px 0 10px rgba(0, 0, 0, 0.6),
    inset -2px 0 10px rgba(0, 0, 0, 0.6);
}

/* Add embossed decorative lines on spine */
.book-spine::after {
  content: '';
  position: absolute;
  top: 10%;
  bottom: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  background: linear-gradient(to bottom,
    transparent 0%,
    rgba(255, 215, 0, 0.2) 10%,
    rgba(255, 215, 0, 0.2) 90%,
    transparent 100%);
  box-shadow: 
    0 0 4px rgba(255, 215, 0, 0.2),
    0 0 8px rgba(139, 69, 19, 0.4);
}

/* Page navigation buttons */
.book-preview {
  position: relative;
}

.page-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--brand-gradient);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: all 0.3s ease;
  z-index: 10;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.page-nav:hover:not(:disabled) {
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.5);
}

.page-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-nav-left {
  left: -80px;
}

.page-nav-right {
  right: -80px;
}

.page-nav svg {
  width: 24px;
  height: 24px;
}

/* Page indicator */
.page-indicator {
  text-align: center;
  margin-top: 1.5rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

[data-theme="dark"] .page-indicator {
  color: var(--text-secondary-dark);
}

/* Page flipping animation */
.book-spread.flipping .left-page {
  animation: flipLeft 0.6s ease-in-out;
}

.book-spread.flipping .right-page {
  animation: flipRight 0.6s ease-in-out;
}

@keyframes flipLeft {
  0% {
    transform: rotateY(2deg);
  }
  50% {
    transform: rotateY(90deg);
    opacity: 0.5;
  }
  100% {
    transform: rotateY(2deg);
    opacity: 1;
  }
}

@keyframes flipRight {
  0% {
    transform: rotateY(-2deg);
  }
  50% {
    transform: rotateY(-90deg);
    opacity: 0.5;
  }
  100% {
    transform: rotateY(-2deg);
    opacity: 1;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .demo-book-section {
    margin-top: 3rem;
  }
  
  .demo-title {
    font-size: 1.5rem;
  }
  
  .book-page img {
    max-width: 180px;
  }
  
  .book-spine {
    width: 20px;
  }
  
  .spine-text {
    font-size: 9px;
  }
  
  .page-nav-left {
    left: -40px;
  }
  
  .page-nav-right {
    right: -40px;
  }
  
  .page-nav {
    width: 36px;
    height: 36px;
  }
  
  .page-nav svg {
    width: 18px;
    height: 18px;
  }
}