:root {
  --bg-color: #121212;
  --sidebar-bg: #1a1a1a;
  --text-color: #e0e0e0;
  --text-muted: #a0a0a0;
  --accent-color: #d4af37; /* Gold for "Sacred" */
  --accent-hover: #f1c40f;
  --border-color: #333;
  --font-serif: 'Merriweather', serif;
  --font-sans: 'Lato', sans-serif;
  --font-header: 'Cinzel', serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-serif);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

/* --- Layout --- */
.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 300px;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  transition: transform 0.3s ease;
  z-index: 100;
}

.content {
  flex: 1;
  padding: 4rem 2rem;
  max-width: 900px; /* Optimal reading width */
  margin: 0 auto;
}

/* --- Typography --- */
h1, h2, h3 {
  font-family: var(--font-header);
  color: var(--accent-color);
  margin-top: 2rem;
}

h1 { font-size: 2.5rem; line-height: 1.2; border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; }
h2 { font-size: 1.8rem; color: #fff; }
h3 { font-size: 1.4rem; color: var(--text-muted); }

p { font-size: 1.1rem; margin-bottom: 1.5rem; }

a { color: var(--accent-color); text-decoration: none; transition: 0.2s; }
a:hover { color: var(--accent-hover); }

/* --- Sidebar --- */
.sidebar-header {
  padding: 2rem;
  font-family: var(--font-header);
  font-size: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

.toc { padding: 1rem; }

details { margin-bottom: 1rem; }
summary {
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: bold;
  color: #fff;
  padding: 0.5rem;
  list-style: none; /* Hide default triangle in some browsers */
}
summary:hover { color: var(--accent-color); }

.toc ul { list-style: none; padding-left: 1rem; margin: 0; }
.toc li a {
  display: block;
  padding: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-muted);
  border-left: 2px solid transparent;
}
.toc li a:hover, .toc li a.active {
  color: #fff;
  border-left-color: var(--accent-color);
  background: rgba(255, 255, 255, 0.05);
}

/* --- Mobile --- */
.mobile-header { display: none; }
.overlay { display: none; }

@media (max-width: 768px) {
  .app-container { display: block; }
  
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
    width: 280px;
    box-shadow: 2px 0 10px rgba(0,0,0,0.5);
  }
  
  .sidebar.active { transform: translateX(0); }

  .mobile-header {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 90;
  }

  .mobile-title {
    font-family: var(--font-header);
    font-size: 1.2rem;
    color: var(--accent-color);
    margin-left: 1rem;
  }

  /* Hamburger */
  .hamburger {
    background: none;
    border: none;
    cursor: pointer;
    width: 30px;
    height: 24px;
    position: relative;
  }
  .hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: #fff;
    position: absolute;
    transition: 0.3s;
  }
  .hamburger span:nth-child(1) { top: 0; }
  .hamburger span:nth-child(2) { top: 11px; }
  .hamburger span:nth-child(3) { top: 22px; }

  .hamburger.open span:nth-child(1) { transform: rotate(45deg); top: 11px; }
  .hamburger.open span:nth-child(2) { opacity: 0; }
  .hamburger.open span:nth-child(3) { transform: rotate(-45deg); top: 11px; }

  .overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 99;
    display: none;
  }
  .overlay.active { display: block; }

  .content { padding: 2rem 1rem; }
}

/* --- Pagination --- */
.pagination {
  display: flex;
  justify-content: space-between;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}
.prev, .next {
  font-family: var(--font-sans);
  font-weight: bold;
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: 4px;
}
.prev:hover, .next:hover {
  border-color: var(--accent-color);
  background: var(--sidebar-bg);
}