/* Montessori Method Site Styles */
:root {
  --primary-color: #8B4513; /* Saddle brown - earthy, natural */
  --secondary-color: #2F4F4F; /* Dark slate gray */
  --accent-color: #DAA520; /* Goldenrod */
  --text-color: #333;
  --light-bg: #FFF8DC; /* Cornsilk - warm, gentle background */
  --border-color: #D2B48C; /* Tan */
  --quote-bg: #F5F5DC; /* Beige */
}

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

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--light-bg);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
header {
  background-color: var(--primary-color);
  color: white;
  padding: 2rem 0;
  text-align: center;
  border-bottom: 4px solid var(--accent-color);
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

header p {
  font-size: 1.2rem;
  opacity: 0.9;
  font-style: italic;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1001;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: all 0.3s ease;
}

.sidebar-toggle:hover {
  background: var(--accent-color);
  color: var(--text-color);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

/* Hamburger Icon */
.hamburger-icon {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hamburger-icon span {
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: all 0.3s ease;
}

.sidebar-open .hamburger-icon span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.sidebar-open .hamburger-icon span:nth-child(2) {
  opacity: 0;
}

.sidebar-open .hamburger-icon span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Sidebar Overlay */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: -320px;
  width: 320px;
  height: 100vh;
  background: white;
  z-index: 999;
  box-shadow: 4px 0 20px rgba(0,0,0,0.1);
  transition: left 0.3s ease;
  overflow-y: auto;
}

.sidebar.open {
  left: 0;
}

.sidebar-header {
  background: var(--primary-color);
  color: white;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--accent-color);
}

.sidebar-header h3 {
  margin: 0;
  font-size: 1.3rem;
}

.sidebar-close {
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.sidebar-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.sidebar-content {
  padding: 1rem 0;
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-nav li {
  margin: 0;
}

.sidebar-nav a {
  display: block;
  padding: 12px 24px;
  color: var(--text-color);
  text-decoration: none;
  transition: all 0.3s ease;
  border-left: 4px solid transparent;
}

.sidebar-nav a:hover {
  background: var(--light-bg);
  border-left-color: var(--accent-color);
  color: var(--primary-color);
}

.sidebar-nav .featured-link {
  background: linear-gradient(135deg, var(--accent-color), #B8860B);
  color: white;
  font-weight: bold;
  margin: 8px 16px;
  border-radius: 6px;
  border-left: none;
}

.sidebar-nav .featured-link:hover {
  background: linear-gradient(135deg, #B8860B, var(--accent-color));
  transform: translateX(4px);
}

.chapter-number {
  display: inline-block;
  background: var(--secondary-color);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  text-align: center;
  line-height: 28px;
  font-size: 0.85rem;
  font-weight: bold;
  margin-right: 12px;
  flex-shrink: 0;
}

.chapter-title {
  font-size: 0.95rem;
}

.nav-divider {
  height: 1px;
  background: var(--border-color);
  margin: 8px 16px;
}

/* Body scroll lock when sidebar is open */
.sidebar-open {
  overflow: hidden;
}

/* Main Content */
main {
  padding: 2rem 0;
  min-height: calc(100vh - 300px);
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.chapter-card {
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  transition: box-shadow 0.3s, transform 0.2s;
}

.chapter-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.chapter-card h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.chapter-card p {
  margin-bottom: 1rem;
  color: #666;
}

.chapter-card a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: bold;
}

.chapter-card a:hover {
  text-decoration: underline;
}

/* Chapter Content */
.chapter-content {
  max-width: 800px;
  margin: 0 auto;
  background: white;
  padding: 3rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border: 2px solid var(--border-color);
}

.chapter-content h1 {
  color: var(--primary-color);
  border-bottom: 3px solid var(--accent-color);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
}

.chapter-content h2 {
  color: var(--secondary-color);
  margin: 2rem 0 1rem 0;
  font-size: 1.4rem;
}

.chapter-content h3 {
  color: var(--primary-color);
  margin: 1.5rem 0 0.5rem 0;
  font-size: 1.2rem;
}

.chapter-content ul {
  margin: 1rem 0 1rem 2rem;
}

.chapter-content li {
  margin-bottom: 1rem;
}

.chapter-content li strong {
  color: var(--secondary-color);
}

/* Blockquotes for important quotes */
.chapter-content blockquote {
  background-color: var(--quote-bg);
  border-left: 4px solid var(--accent-color);
  padding: 1rem 1.5rem;
  margin: 1rem 0;
  font-style: italic;
  border-radius: 0 4px 4px 0;
}

.chapter-content blockquote p {
  margin: 0;
}

/* Back navigation */
.back-nav {
  margin-bottom: 2rem;
}

.back-nav a {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.back-nav a:hover {
  text-decoration: underline;
}

/* Chapter navigation */
.chapter-navigation {
  margin-top: 3rem;
  padding: 2rem 0;
  border-top: 2px solid var(--border-color);
  background: linear-gradient(135deg, #F5F5DC 0%, #FFF8DC 100%);
}

.nav-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.nav-prev, .nav-next {
  padding: 1.5rem;
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  transition: all 0.3s ease;
}

.nav-prev:hover, .nav-next:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-color: var(--accent-color);
}

.nav-next {
  text-align: right;
}

.nav-prev a, .nav-next a {
  color: inherit;
  text-decoration: none;
  display: block;
}

.nav-label {
  display: block;
  font-size: 0.9rem;
  color: var(--accent-color);
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.nav-title {
  display: block;
  font-size: 1rem;
  color: var(--secondary-color);
  font-weight: normal;
  line-height: 1.3;
}

.nav-prev a:hover, .nav-next a:hover {
  color: var(--primary-color);
}

/* Single navigation item spans full width */
.nav-container:has(.nav-prev:only-child) {
  grid-template-columns: 1fr;
}

.nav-container:has(.nav-next:only-child) {
  grid-template-columns: 1fr;
}

.nav-container:has(.nav-next:only-child) .nav-next {
  text-align: center;
}

/* Footer */
footer {
  background-color: var(--secondary-color);
  color: white;
  text-align: center;
  padding: 2rem 0;
  margin-top: 3rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  header h1 {
    font-size: 2rem;
  }
  
  .sidebar {
    width: 100vw;
    left: -100vw;
  }
  
  .sidebar.open {
    left: 0;
  }
  
  .sidebar-toggle {
    top: 15px;
    left: 15px;
    padding: 10px 14px;
    font-size: 0.85rem;
  }
  
  .toggle-text {
    display: none;
  }
  
  .chapter-content {
    padding: 2rem 1.5rem;
    margin: 0 10px;
  }
  
  .chapter-grid {
    grid-template-columns: 1fr;
  }
  
  .nav-container {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .nav-next {
    text-align: left;
  }
  
  .chapter-navigation {
    padding: 1.5rem 1rem;
  }
  
  .nav-prev, .nav-next {
    padding: 1rem;
  }
}

/* Print styles */
@media print {
  header, nav, footer, .back-nav {
    display: none;
  }
  
  .chapter-content {
    box-shadow: none;
    border: none;
    padding: 0;
    margin: 0;
  }
  
  body {
    background: white;
  }
}