
:root {
  --bg-color: #ffffff;
  --text-color: #333333;
  --accent-color: #3f51b5;
  --ui-bg-color: #f0f0f0;
  --sidebar-bg: #f4f4f4;
  --border-color: #ddd;
}

[data-theme="dark"] {
  --bg-color: #222222;
  --text-color: #e0e0e0;
  --accent-color: #7986cb;
  --ui-bg-color: #333333;
  --sidebar-bg: #1e1e1e;
  --border-color: #444;
}

/* Base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Georgia', serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  transition: background-color 0.3s, color 0.3s;
}

.container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar styles */
.sidebar {
  width: 260px;
  background-color: var(--sidebar-bg);
  padding: 20px;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s ease;
  border-right: 1px solid var(--border-color);
}

.sidebar h2 {
  margin-top: 0;
  margin-bottom: 20px;
  color: var(--accent-color);
}

.nav-group {
  margin-bottom: 20px;
}

.nav-title {
  font-weight: bold;
  display: block;
  margin-bottom: 10px;
  color: var(--accent-color);
}

.nav-list {
  list-style: none;
  padding-left: 10px;
}

.nav-item {
  margin-bottom: 5px;
}

.nav-item a {
  text-decoration: none;
  color: var(--text-color);
  display: block;
  padding: 5px 0;
  transition: color 0.2s;
}

.nav-item a:hover {
  color: var(--accent-color);
}

.nav-item.active a {
  font-weight: bold;
  color: var(--accent-color);
}


/* Indent appendix subsections in the sidebar */
.nav-list .subnav-list {
  margin: 0;
  padding-left: 1.5em;  /* shift the entire sub‐list to the right */
  list-style: none;     /* remove bullets if you’re not using them */
}

.nav-list .subnav-list li {
  margin-bottom: 0.25em; /* optional spacing between items */
}

.nav-list .subnav-list li a {
  font-size: 0.9em;      /* slightly smaller text to distinguish */
  display: block;
}

/* Content styles */
.content {
  flex: 1;
  padding: 40px;
  margin-left: 260px;
  max-width: 800px;
}

/* Enhanced heading styles */
h1, h2, h3 {
  margin-bottom: 25px;
  color: var(--accent-color);
  line-height: 1.3;
}

h1 {
  font-size: 2.5em;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 15px;
}

h2 {
  font-size: 1.8em;
}

h3 {
  font-size: 1.5em;
}

/* Chapter-specific styles */
.chapter-title {
  font-size: 2.8em;
  text-align: center;
  margin-bottom: 40px;
}

.chapter-heading, .appendix-heading {
  font-size: 2em;
  margin-top: 30px;
}

.appendix-title {
  font-size: 2.8em;
  text-align: center;
  margin-bottom: 40px;
}

/* Front matter styling */
.front-matter {
  margin-bottom: 40px;
}

.front-matter-heading {
  font-size: 2.5em;
  margin-top: 40px;
  margin-bottom: 20px;
  text-align: center;
}

.front-matter-item {
  margin-bottom: 25px;
  font-size: 1.1em;
}

p {
  margin-bottom: 1.5em;
}

/* Footnotes - Superscript style */
.footnote {
  position: relative;
  cursor: pointer;
  color: var(--accent-color);
  vertical-align: super;
  font-size: 0.75em;
  font-weight: bold;
  padding: 0 2px;
}

.footnote-tooltip {
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  width: 300px;
  max-width: 90vw;
  background-color: rgba(245, 245, 245, 0.97);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  padding: 12px 15px;
  border-radius: 6px;
  font-size: 1.1rem;
  line-height: 1.5;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
  pointer-events: none;
  font-weight: normal;
  color: var(--text-color);
}

.footnote:hover .footnote-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) scale(1);
}

/* Arrow at the bottom of tooltip */
.footnote-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -8px;
  border-width: 8px;
  border-style: solid;
  border-color: rgba(245, 245, 245, 0.97) transparent transparent transparent;
}

[data-theme="dark"] .footnote-tooltip {
  background-color: rgba(45, 45, 45, 0.97);
}

[data-theme="dark"] .footnote-tooltip::after {
  border-color: rgba(45, 45, 45, 0.97) transparent transparent transparent;
}

/* Images */
.novel-image {
  max-width: 100%;
  height: auto;
  margin: 20px 0;
  display: block;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.novel-image.expanded {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
  max-width: 90vw;
  max-height: 90vh;
  z-index: 1000;
  cursor: zoom-out;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

.image-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 999;
  display: none;
}

.image-overlay.active {
  display: block;
}

/* Navigation */
.chapter-navigation {
  display: flex;
  justify-content: space-between;
  margin-top: 60px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.nav-prev, .nav-next, .nav-home {
  text-decoration: none;
  color: white;
  background-color: var(--accent-color);
  padding: 10px 20px;
  border-radius: 4px;
  transition: background-color 0.2s;
  font-weight: bold;
}

.nav-prev:hover, .nav-next:hover, .nav-home:hover {
  background-color: var(--text-color);
}

/* Buttons */
.menu-toggle, .theme-toggle {
  position: fixed;
  z-index: 200;
  background-color: var(--accent-color);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 12px;
  cursor: pointer;
}

.menu-toggle {
  top: 20px;
  left: 20px;
  display: none;
}

.theme-toggle {
  top: 20px;
  right: 20px;
}

/* Responsive design */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  .content {
    margin-left: 0;
    padding: 20px;
  }
  
  .menu-toggle {
    display: block;
  }
  
  .footnote-tooltip {
    width: calc(100vw - 40px);
    left: 20px;
    transform: translateX(0) scale(0.95);
  }
  
  .footnote:hover .footnote-tooltip {
    transform: translateX(0) scale(1);
  }
  
  h1 {
    font-size: 2em;
  }
  
  .chapter-title, .appendix-title {
    font-size: 2.2em;
  }
}
