/* ==========================================================================
   1. DOCUMENT SETUP & RESET
   ========================================================================== */
html {
  box-sizing: border-box;
}

*, *:before, *:after {
  box-sizing: inherit;
}

body {
  font-family:'adega_serifregular', serif;
  line-height: 1.8;
  color: #2b2b2b;
  background: #fbf9f6; /* Soft paper color reduces eye strain */
  margin: 0;
  padding: 0;
  
  /* Lock the main window viewport for structured landscape view */
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  overflow: hidden; 
}

/* ==========================================================================
   2. FIXED TOP HEADER (3-Zone Alignment)
   ========================================================================== */
.book-header {
  position: relative; /* Anchor for absolute centered title */
  height: 60px;
  background: rgba(251, 249, 246, 0.95);
  border-bottom: 1px solid #eadecc;
  flex-shrink: 0; /* Prevents header compression */
  z-index: 10;
  padding: 0 40px;
  display: flex;
  justify-content: space-between; 
  align-items: center;
}

/* Left Zone: Dropdown & Page Marker */
.book-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  position: relative;
  z-index: 12;
}

#toc-dropdown {
  font-family:'adega_serifregular', serif;
  font-size: 0.95rem;
/*  font-weight: bold; */
  color: #6C011E;
/*  color: #333;*/
  background: #ffffff;
  border: 1px solid #eadecc;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

#toc-dropdown:hover {
  border-color: #0066cc;
}

.divider {
  color: #ccc;
}

/* Center Zone: Book Title */
.book-title {
  font-size: 1rem;
  letter-spacing: 2px;
  color: #6C011E;
  text-align: center;
  
  /* Absolute structural centering across landscape screens */
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap; 
}

/* Right Zone: Language Switcher Pill */
.lang-switcher {
  background: #eadecc;
  padding: 3px;
  border-radius: 20px;
  display: flex;
  position: relative;
  z-index: 12;
}

.lang-switcher button {
  border: none;
  background: transparent;
  padding: 6px 16px;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.85rem;
  border-radius: 17px;
  transition: all 0.3s;
}

.lang-switcher button.active {
  background: #ffffff;
  color: #111;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* ==========================================================================
   3. THE MAIN VIEWPORT FRAME
   ========================================================================== */
.book-container {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  width: 100%;
  max-width: 750px; /* Constrains reading line length on landscape screens */
  margin: 0 auto;
  
  /* Reserves layout block precisely between top and bottom bars */
  flex-grow: 1;
  height: calc(100vh - 140px); 
}

/* ==========================================================================
   4. STACKED SCROLLABLE BOOK PAGES
   ========================================================================== */
.book-page {
  grid-column: 1;
  grid-row: 1;
  width: 100%; /* Fixes left-side bunching layout bug */
  height: 100%;
  
  /* Start hidden by default */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;

  /* Enable standalone page scrolling */
  overflow-y: auto;
  padding: 40px 20px;
  box-sizing: border-box;

  /* Custom elegant scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: #eadecc transparent;
}

/* Webkit browser scrollbar styling adjustments */
.book-page::-webkit-scrollbar {
  width: 6px;
}

.book-page::-webkit-scrollbar-thumb {
  background-color: #eadecc;
  border-radius: 10px;
}

/* Reveal active book page */
.book-page.active {
  opacity: 1;
  visibility: visible;
}

/* ==========================================================================
   5. SINGLE DUAL-LANGUAGE CELL CROSS-FADE
   ========================================================================== */
.bio-block {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  width: 100%; /* Force grid cells to expand fully */
  margin-bottom: 2rem;
}

.text-en, .text-de {
  grid-column: 1;
  grid-row: 1;
  width: 100%; /* Force child content text containers to take full area */
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Hide inactive language logic rules */
body.lang-en .text-de,
body.lang-de .text-en {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ==========================================================================
   6. FIXED FOOTER NAVIGATION CONTROLS
   ========================================================================== */
.page-navigation {
  height: 80px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
  background: #fbf9f6;
  border-top: 1px solid #f2e9dc;
  flex-shrink: 0; /* Prevents button compression */
  z-index: 10;
}

.page-navigation button {
  background: #2b2b2b;
  color: #fff;
  border: none;
  padding: 10px 24px;
  font-family: inherit;
  font-size: 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.page-navigation button:disabled {
  background: #ccc;
  color: #999;
  cursor: not-allowed;
}

