:root {
  --primary-color: #00572b;
  --secondary-color: #007a3d;
  --background-color: #fff;
  --text-color: #333;
  --border-color: #ddd;
  --sidebar-width: 280px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--background-color);
}

.site-container {
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--primary-color);
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .menu-open .sidebar {
    transform: translateX(0);
  }
  .content {
    margin-left: 0 !important;
  }
}

.sidebar-content {
  padding: 1rem;
}

.brand {
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 1rem;
}

.brand-link {
  color: #fff;
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: bold;
}

.menu-heading {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: rgba(255,255,255,0.9);
}

.menu-list {
  list-style: none;
}

.menu-item {
  margin-bottom: 0.25rem;
}

.menu-item a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  display: block;
  padding: 0.5rem;
  border-radius: 4px;
  transition: background 0.2s;
}

.menu-item a:hover,
.menu-item.active a {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.menu-sublist {
  list-style: none;
  padding-left: 1rem;
  margin-top: 0.25rem;
}

.menu-sublist .menu-item a {
  font-size: 0.9rem;
  padding: 0.3rem 0.5rem;
}

.menu-section > a {
  font-weight: bold;
}

.back-link {
  display: block;
  margin-top: 1rem;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover {
  color: #fff;
}

.content {
  margin-left: var(--sidebar-width);
  padding: 2rem 3rem;
}

@media (max-width: 768px) {
  .content {
    padding: 1rem;
  }
}

.header {
  display: flex;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  margin-right: 1rem;
}

@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }
}

.site-title {
  font-size: 1.5rem;
  color: var(--primary-color);
  text-decoration: none;
}

.home-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.5rem;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  transition: background 0.2s, border-color 0.2s;
}

.home-link:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.5);
}

.article {
  margin-bottom: 3rem;
}

.article h1 {
  margin-bottom: 1.5rem;
  color: var(--primary-color);
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.book-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  transition: box-shadow 0.2s;
}

.book-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.book-card h2 {
  margin-bottom: 0.5rem;
}

.book-card h2 a {
  color: var(--primary-color);
  text-decoration: none;
}

.book-description {
  color: #666;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.book-meta {
  font-size: 0.85rem;
  color: #888;
}

.book-author {
  margin-right: 1rem;
}

.pages-list {
  margin-top: 1rem;
}

.page-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color);
}

.page-item a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

.page-item a:hover {
  text-decoration: underline;
}

.page-item p {
  margin-top: 0.25rem;
  color: #666;
  font-size: 0.9rem;
}

.prose {
  line-height: 1.8;
  text-align: justify;
  overflow-x: hidden;
}

.prose h2 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--secondary-color);
}

.prose p {
  margin-bottom: 1rem;
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}

@media (max-width: 768px) {
  .prose img {
    width: 100%;
    height: auto;
  }

  .chapter-nav {
    flex-direction: column;
    gap: 0.5rem;
  }

  .prev-link,
  .next-link {
    width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chapter-nav .next-link {
    margin-left: 0;
  }
}

.prose blockquote {
  border-left: 4px solid var(--primary-color);
  padding-left: 1rem;
  margin: 1rem 0;
  color: #555;
  font-style: italic;
}

hr {
  border: none;
  height: 1px;
  background: var(--border-color);
  margin: 2rem 0;
}

.chapter-nav-top {
  margin-top: 0;
  margin-bottom: 2rem;
  padding-top: 1rem;
  border-top: none;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.chapter-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.prev-link,
.next-link {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--primary-color);
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.2s;
}

.prev-link:hover,
.next-link:hover {
  background: var(--secondary-color);
}

.chapter-nav .next-link {
  margin-left: auto;
}

.toc {
  position: fixed;
  right: 2rem;
  top: 6rem;
  width: 200px;
  font-size: 0.85rem;
}

@media (max-width: 1100px) {
  .toc {
    display: none;
  }
}

.toc h3 {
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.toc ul {
  list-style: none;
}

.toc li {
  margin-bottom: 0.5rem;
}

.toc a {
  color: #666;
  text-decoration: none;
}

.toc a:hover {
  color: var(--primary-color);
}

.footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  color: #888;
  font-size: 0.9rem;
}
