:root {
  /* This must match the height of your actual site header */
  --lb-header-h: 70px; /* Adjusted slightly based on your screenshot */
}

/* 1. Reset Body to prevent outer scrolling */
html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden; /* Force scroll to happen inside the app */
  background: #f8fafc; /* Optional: light background behind the book */
}

/* 2. Main Container Setup */
#main {
  /* Total screen height minus header and iOS safe area */
  height: calc(100dvh - var(--lb-header-h) - env(safe-area-inset-top));
  display: flex;
  flex-direction: column;
}

.lb-carousel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0; /* Remove any padding that might cause gaps */
}

/* 3. The Book Container */
#book.lb-book {
  width: 100%;
  max-width: 980px;
  height: 100% !important; /* Force StPageFlip to use 100% of parent */
  margin: 0 auto;
}

/* 4. Page Layout (The white cards) */
.lb-page {
  background: #fff;
  height: 100% !important;
  box-shadow: 0 0 10px rgba(0,0,0,0.05); /* Optional: slight shadow to separate from background */
}

.lb-page-inner {
  height: 100% !important;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* 5. MEDIA PAGE (Left side / first page) */
.lb-page--media .lb-media,
.lb-page--media .lb-ms {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.lb-page--media .lb-ms__stage {
  flex: 1; /* This pushes the thumbs to the bottom */
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: #fff;
}

.lb-page--media img, 
.lb-page--media video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain; /* Ensures the image fits without cropping */
}

/* Thumbnails */
.lb-ms__thumbs {
  display: flex;
  gap: 8px;
  padding: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border-top: 1px solid #f1f5f9; /* Visual separator */
  flex-shrink: 0; /* Prevent thumbs from being squished */
}

.lb-ms__thumb {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border: 2px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  pointer-events: auto;
  padding: 0;
  background: none;
}

.lb-ms__thumb.is-active {
  border-color: #602A42; /* Your brand color */
}

.lb-ms__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* 6. CONTENT PAGE (Right side / second page) */
.lb-page--content .lb-content {
  flex: 1;
  min-height: 0; /* Required for flexbox scrolling */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
}

/* 7. Arrows (Fixed on screen) */
.lb-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 99999;
  pointer-events: auto;
  touch-action: manipulation;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
  color: #333;
  font-weight: bold;
  cursor: pointer;
}
.lb-arrow--prev { left: 10px; }
.lb-arrow--next { right: 10px; }


