:root {
  --base-font-size: 1.1rem;
  --title-font-size: 2.5rem;
  --meta-font-size: 0.9rem;
  --toc-width: 300px;
}

/* Global book layout - Dark Mode Sovereignty */
body.book-body {
  margin: 0;
  padding: 0;
  font-family: 'Literata', "Charter", "Bitstream Charter", serif;
  background: #12100e; /* Deep Charcoal/Chocolate */
  color: #d7ccc8; /* Off-white/Beige for readability */
  font-size: var(--base-font-size);
  -webkit-font-smoothing: antialiased;
}

.book-shell {
  max-width: 1400px;
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--toc-width) 1fr;
}

/* Mobile Top Bar */
.mobile-top-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #0a0908;
  padding: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  align-items: center;
  justify-content: space-between;
  font-family: 'Montserrat', sans-serif;
}

.hamburger-btn {
  background: transparent;
  border: none;
  color: #d7ccc8;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
}

.mobile-site-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 1rem;
  color: #d7ccc8;
  text-decoration: none;
  letter-spacing: 0.05em;
}

@media (max-width: 1100px) {
  .book-shell { grid-template-columns: 1fr; }
  .mobile-top-bar { display: flex; }
  
  .book-toc {
    position: fixed !important;
    left: -100%;
    z-index: 1100;
    transition: left 0.3s ease;
    width: 280px !important;
    box-shadow: 10px 0 30px rgba(0,0,0,0.5);
  }
  
  .book-toc.is-open {
    left: 0;
  }
  
  .book-toc-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1050;
    backdrop-filter: blur(2px);
  }
  
  .book-toc-overlay.is-visible {
    display: block;
  }
}

/* Sidebar Styling */
.book-toc {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 2.5rem 1.5rem;
  background: #0a0908; /* Pure Dark */
  color: #a09080;
  border-right: 1px solid rgba(255,255,255,0.05);
  box-sizing: border-box;
  font-family: 'Montserrat', sans-serif;
}

.font-size-controls {
  display: flex;
  gap: 10px;
  margin-top: 1rem;
  align-items: center;
}

.fs-btn {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  color: #a09080;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
  font-family: 'Montserrat', sans-serif;
}

.fs-btn:hover {
  background: rgba(255,255,255,0.08);
  color: #d7ccc8;
}

.fs-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #5d4037;
  font-weight: 600;
}

/* PWA Banner */
.pwa-banner {
  display: none;
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  background: #1a1614;
  border: 1px solid #5d4037;
  padding: 1.25rem;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  width: 90%;
  max-width: 400px;
  color: #d7ccc8;
  animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
  from { transform: translate(-50%, 100%); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.pwa-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.pwa-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
}

.pwa-text h3 {
  margin: 0;
  font-size: 1rem;
  color: #efebe9;
}

.pwa-text p {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: #a09080;
}

.pwa-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.pwa-btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.pwa-btn-install {
  background: #5d4037;
  color: #efebe9;
}

.pwa-btn-install:hover {
  background: #8a6b4a;
}

.pwa-btn-dismiss {
  background: transparent;
  color: #a09080;
}

.pwa-btn-dismiss:hover {
  color: #d7ccc8;
}

.global-lang-switcher {
  display: flex;
  gap: 5px;
  margin-bottom: 1.5rem;
  background: rgba(255,255,255,0.03);
  padding: 3px;
  border-radius: 6px;
  font-family: 'Montserrat', sans-serif;
}

.g-lang-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: #6d5b4a;
  padding: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.g-lang-btn.active {
  background: #3e2723;
  color: #d7ccc8;
}

.book-site-title {
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: #d7ccc8;
  text-decoration: none;
  display: block;
  letter-spacing: 0.05em;
  line-height: 1.2;
}

.book-site-subtitle {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.75rem;
  color: #6d5b4a;
  margin-top: 0.5rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Lang View Toggling */
.lang-view {
  display: none !important;
}

html[lang="en"] .lang-view.en { display: inline !important; }
html[lang="hi"] .lang-view.hi { display: inline !important; }
html[lang="mr"] .lang-view.mr { display: inline !important; }

html[lang="en"] div.lang-view.en, html[lang="en"] section.lang-view.en, html[lang="en"] p.lang-view.en { display: block !important; }
html[lang="hi"] div.lang-view.hi, html[lang="hi"] section.lang-view.hi, html[lang="hi"] p.lang-view.hi { display: block !important; }
html[lang="mr"] div.lang-view.mr, html[lang="mr"] section.lang-view.mr, html[lang="mr"] p.lang-view.mr { display: block !important; }

/* Navigation */
.book-nav-heading {
  margin: 2.5rem 0 1rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: #5d4037;
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
}

.book-pillar-list { list-style: none; padding: 0; }
.book-pillar-group { margin-bottom: 0.5rem; }
.book-pillar-summary { 
  cursor: pointer; 
  color: #8a6b4a; 
  font-weight: 600; 
  padding: 0.75rem 0; 
  border-bottom: 1px solid rgba(255,255,255,0.03); 
}
.book-section-group { margin: 1.25rem 0 1.25rem 0.5rem; }
.book-section-heading { font-size: 0.7rem; color: #4e342e; margin-bottom: 0.75rem; font-weight: 700; opacity: 0.8; }
.book-point-list { list-style: none; padding: 0; }
.book-point-item a { 
  display: block; 
  font-size: 0.85rem; 
  color: #6d5b4a; 
  text-decoration: none; 
  padding: 6px 0; 
  transition: all 0.2s;
  line-height: 1.4;
}
.book-point-item a:hover { color: #d7ccc8; padding-left: 4px; }
.book-point-item.is-active a { 
  color: #d7ccc8; 
  border-left: 2px solid #5d4037; 
  padding-left: 10px; 
}

/* Main Content */
.book-page {
  background: #12100e;
  padding: 4rem 5rem;
  min-height: 100vh;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  .book-page { padding: 2rem 1.5rem; }
}

.hindi, .marathi {
  font-family: inherit;
}

/* Headings in Dark Mode */
h1, h2, h3, h4 {
  color: #efebe9;
}

/* Links */
a {
  color: #a09080;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
