/* UPANISHAD READER - Editorial Book Design System */

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

:root {
  /* Color System - Warm Paper Editorial */
  --bg-page: #F5EFE6;
  --bg-sidebar: #FAF6F0;
  --bg-content: #FFFBF5;
  --border-light: #E8DED0;
  --border-medium: #D4C4B0;
  
  --text-primary: #2C2520;
  --text-secondary: #6B5F53;
  --text-tertiary: #9B8F83;
  --text-accent: #C89563;
  
  /* Typography Scale */
  --font-serif: 'Crimson Pro', Georgia, serif;
  --font-sans: 'Inter', -apple-system, sans-serif;
}

body {
  font-family: var(--font-serif);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
}

/* THREE COLUMN EDITORIAL LAYOUT */
.layout {
  display: block;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 0 224px; /* Left padding for fixed sidebar */
}

/* Hide right sidebar */
.right-sidebar {
  display: none;
}

/* LEFT SIDEBAR - Minimal Navigation */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  padding: 32px 16px;
  position: fixed;
  top: 0;
  left: 0;
  width: 200px;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 150;
  scroll-behavior: smooth;
}

/* Scrollbar styling for sidebar */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

.sidebar-brand {
  display: none;
}

.brand-link {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-tertiary);
  text-decoration: none;
  font-family: var(--font-serif);
  font-style: italic;
  transition: color 0.2s ease;
}

.brand-link:hover {
  color: var(--text-primary);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.nav-link {
  padding: 10px 0;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-tertiary);
  text-decoration: none;
  font-family: var(--font-serif);
  transition: color 0.2s ease;
  border-bottom: 1px solid transparent;
  display: block;
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-link.active {
  color: var(--text-primary);
  font-weight: 500;
}

/* Expandable Navigation Items */
.nav-item {
  margin-bottom: 4px;
}

.nav-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  cursor: pointer;
  transition: color 0.2s ease;
  user-select: none;
}

.nav-item-header .nav-link {
  flex: 1;
  padding: 0;
  cursor: pointer;
}

.nav-item-header:hover .nav-link {
  color: var(--text-primary);
}

.nav-toggle {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 14px;
  transition: transform 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
  font-weight: bold;
}

.nav-item-header:hover .nav-toggle {
  color: var(--text-primary);
}

.nav-item.expanded .nav-toggle {
  transform: rotate(90deg);
}

/* Subdivision List */
.nav-subdivisions {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding-left: 12px;
  border-left: 1px solid var(--border-light);
  margin-left: 4px;
}

.nav-item.expanded .nav-subdivisions {
  max-height: 600px;
}

.subdivision-link {
  display: block;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-tertiary);
  text-decoration: none;
  font-family: var(--font-serif);
  transition: all 0.2s ease;
  border-radius: 3px;
}

.subdivision-link:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.02);
}

/* MAIN CONTENT - Center Column */
.main-content {
  background: var(--bg-content);
  padding: 48px 64px;
  border-right: 1px solid var(--border-light);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  font-size: 10px;
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
}

.breadcrumb-item {
  color: var(--text-tertiary);
}

.breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: 500;
}

.breadcrumb-sep {
  color: var(--border-medium);
}

/* Content Header */
.content-header {
  margin-bottom: 40px;
}

.main-title {
  font-size: 32px;
  font-weight: 400;
  font-family: var(--font-serif);
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.2;
}

.title-suffix {
  color: var(--text-accent);
  font-style: italic;
  font-weight: 300;
}

.main-meta {
  font-size: 13px;
  color: var(--text-secondary);
  font-family: var(--font-serif);
  font-style: italic;
  margin-bottom: 32px;
}

/* Text Display Controls */
.text-controls {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.control-btn {
  padding: 0;
  border: none;
  background: transparent;
  font-size: 10px;
  font-weight: 400;
  font-family: var(--font-sans);
  color: var(--text-tertiary);
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: color 0.2s ease;
}

.control-btn:hover {
  color: var(--text-primary);
}

.control-btn.active {
  color: var(--text-primary);
  font-weight: 500;
}

/* Verse Progress */
.verse-progress {
  margin: 32px 0;
  display: flex;
  align-items: center;
  gap: 16px;
}

.progress-text {
  font-size: 11px;
  font-family: var(--font-sans);
  color: var(--text-tertiary);
  white-space: nowrap;
  min-width: 90px;
}

.progress-track {
  flex: 1;
  height: 1px;
  background: var(--border-light);
  position: relative;
}

.progress-indicator {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--text-accent);
  transition: width 0.3s ease;
}

/* Verse Container */
.verse-container {
  max-width: 680px;
}

.verse-block {
  margin-bottom: 64px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border-light);
}

.verse-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 24px;
}

.verse-num {
  font-size: 11px;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.04em;
}

.verse-subtitle {
  font-size: 11px;
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--text-tertiary);
}

/* Verse Text Layers */
.verse-devanagari {
  font-size: 20px;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 20px;
  line-height: 1.8;
  font-family: 'Noto Serif Devanagari', var(--font-serif);
}

.verse-transliteration {
  font-size: 14px;
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.7;
  font-family: var(--font-serif);
}

.verse-translation {
  font-size: 16px;
  font-weight: 300;
  color: var(--text-primary);
  line-height: 1.8;
  margin-bottom: 24px;
  font-family: var(--font-serif);
}

/* Verse Actions */
.verse-actions {
  display: flex;
  gap: 24px;
  padding-top: 16px;
}

.action-btn {
  padding: 0;
  border: none;
  background: transparent;
  font-size: 11px;
  font-weight: 400;
  font-family: var(--font-sans);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-btn:hover {
  color: var(--text-primary);
}

/* Verse Navigation */
.verse-nav {
  display: flex;
  justify-content: space-between;
  margin: 48px 0;
  padding: 0;
}

.nav-btn-prev,
.nav-btn-next {
  padding: 0;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 400;
  font-family: var(--font-serif);
  color: var(--text-accent);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* RIGHT SIDEBAR - Linked Concepts */
.right-sidebar {
  background: var(--bg-page);
  padding: 48px 32px;
  position: sticky;
  top: 0;
  align-self: start;
}

.sidebar-section {
  margin-bottom: 48px;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-section:last-child {
  border-bottom: none;
}

.sidebar-title {
  font-size: 9px;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--text-tertiary);
  letter-spacing: 0.10em;
  margin-bottom: 20px;
}

/* Linked Concepts */
.concept-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.concept-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  padding: 8px 0;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.concept-link:hover {
  border-bottom-color: var(--border-light);
}

.concept-name {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-primary);
  font-family: var(--font-serif);
}

.concept-def {
  font-size: 11px;
  font-style: italic;
  color: var(--text-tertiary);
  font-family: var(--font-serif);
}

/* Cross References */
.reference-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.reference-link {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

.reference-link:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.ref-location {
  font-size: 10px;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--text-accent);
  letter-spacing: 0.06em;
}

.ref-excerpt {
  font-size: 12px;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.6;
  font-family: var(--font-serif);
}

/* Notes */
.note-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.note-link {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

.note-link:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.note-time {
  font-size: 9px;
  font-weight: 400;
  font-family: var(--font-sans);
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
}

.note-preview {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  font-family: var(--font-serif);
}

/* RESPONSIVE */
@media (max-width: 1200px) {
  .layout {
    padding-left: 224px;
  }
  
  .nav {
    margin-left: 200px;
  }
}

@media (max-width: 768px) {
  /* Layout adjustments */
  .layout {
    padding: 0 16px;
  }
  
  /* Hide sidebar on mobile */
  .sidebar {
    display: none;
  }
  
  /* Navigation adjustments */
  .nav {
    display: none;
  }
  
  /* Main content mobile adjustments */
  .main-content {
    padding: 24px 16px;
    border-right: none;
  }
  
  /* Breadcrumb mobile */
  .breadcrumb {
    font-size: 9px;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
  }
  
  /* Header mobile */
  .content-header {
    margin-bottom: 32px;
  }
  
  .main-title {
    font-size: 24px;
    line-height: 1.3;
  }
  
  .main-meta {
    font-size: 12px;
  }
  
  /* Verse blocks mobile */
  .verse-container {
    max-width: 100%;
  }
  
  .verse-block {
    margin-bottom: 48px;
    padding-bottom: 24px;
  }
  
  .verse-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 20px;
  }
  
  .verse-num {
    font-size: 10px;
  }
  
  .verse-subtitle {
    font-size: 10px;
  }
  
  /* Text layers mobile */
  .verse-devanagari {
    font-size: 18px;
    line-height: 1.9;
    margin-bottom: 16px;
  }
  
  .verse-transliteration {
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 16px;
  }
  
  .verse-translation {
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 20px;
  }
  
  /* Actions mobile */
  .verse-actions {
    gap: 16px;
    padding-top: 12px;
    flex-wrap: wrap;
  }
  
  .action-btn {
    font-size: 10px;
  }
  
  /* Footer mobile */
  .footer {
    padding: 48px 0 24px;
    margin-top: 60px;
  }
  
  .container {
    padding: 0 16px;
  }
  
  .footer-grid {
    gap: 32px;
  }
  
  .footer-links {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  
  .footer-col h4 {
    font-size: 14px;
    margin-bottom: 12px;
  }
  
  .footer-col a,
  .footer-col p {
    font-size: 12px;
  }
}

/* Mobile menu checkbox (hidden) */
.mobile-menu-checkbox {
  display: none;
}

/* Mobile menu toggle button (hamburger) - hidden by default */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #a8753a;
  color: white;
  border: 3px solid white;
  cursor: pointer;
  z-index: 250;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: all 0.3s ease;
  text-align: center;
  line-height: 50px;
  margin: 0;
  padding: 0;
  left: auto;
  bottom: auto;
}

.mobile-menu-toggle:active {
  transform: scale(0.95);
}

/* Change hamburger to X when checked */
.mobile-menu-checkbox:checked + .mobile-menu-toggle::before {
  content: '✕';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
}

.mobile-menu-checkbox:checked + .mobile-menu-toggle {
  color: transparent;
}

/* CSS-only overlay */
.mobile-overlay-css {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 140;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Show on mobile */
@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 250;
  }
  
  /* Reduce spacing between navigation items on mobile */
  .nav-link {
    padding: 6px 0;
    font-size: 13px;
  }
  
  .nav-item {
    margin-bottom: 2px;
  }
  
  .nav-subdivisions {
    padding-left: 12px;
    margin-top: 4px;
    margin-bottom: 4px;
  }
  
  .subdivision-link {
    padding: 4px 0;
    font-size: 12px;
  }
  
  /* Hide sidebar by default on mobile */
  .sidebar {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 160;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  /* Show sidebar when checkbox is checked */
  .mobile-menu-checkbox:checked ~ * .sidebar,
  .mobile-menu-checkbox:checked ~ .layout .sidebar {
    display: block !important;
    width: 280px;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    transform: translateX(0);
  }
  
  /* Show overlay when checkbox is checked */
  .mobile-menu-checkbox:checked ~ .mobile-overlay-css {
    display: block;
    opacity: 1;
  }
  
  /* Close menu when clicking overlay - use label to uncheck */
  .mobile-overlay-css {
    cursor: pointer;
  }
  
  .mobile-menu-checkbox:checked ~ .mobile-overlay-css::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }
  
  @keyframes slideInLeft {
    from {
      transform: translateX(-100%);
    }
    to {
      transform: translateX(0);
    }
  }
  
  /* Mobile overlay backdrop */
  .mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 140;
  }
  
  .mobile-overlay.active {
    display: block;
    animation: fadeIn 0.3s ease;
  }
  
  @keyframes fadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }
}


/* NAVIGATION FROM INDEX */
.nav {
  position: relative;
  top: 0;
  z-index: 200;
  padding: 16px 24px;
  margin-bottom: 0;
  margin-left: 200px;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(255, 251, 245, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #A8753A, #C89563);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.brand-name {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--text-primary);
}

.nav-links {
  display: none;
  gap: 8px;
}

@media (min-width: 768px) {
  .nav-links {
    display: flex;
  }
}

.nav-links a {
  padding: 10px 18px;
  border-radius: 999px;
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  transition: all 0.2s;
}

.nav-links a:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.04);
}

.nav .btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  text-decoration: none;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #A8753A, #C89563);
  color: white;
  box-shadow: 0 8px 20px rgba(168, 117, 58, 0.25);
  transition: all 0.3s ease;
}

.nav .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(168, 117, 58, 0.35);
}

/* FOOTER */
.footer {
  padding: 64px 0 32px;
  background: var(--bg-content);
  border-top: 1px solid var(--border-light);
  margin-top: 80px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 48px;
}

.footer-grid {
  display: grid;
  gap: 48px;
  margin-bottom: 48px;
}

@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 48px;
}

.footer-col h4 {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.footer-col a,
.footer-col p {
  display: block;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-tertiary);
  text-decoration: none;
  font-family: var(--font-serif);
  transition: color 0.2s;
}

.footer-col a:hover {
  color: var(--text-primary);
}

.footer-bottom {
  padding-top: 32px;
  border-top: 1px solid var(--border-light);
  text-align: center;
}

.footer-bottom p {
  font-size: 12px;
  color: var(--text-tertiary);
  font-family: var(--font-sans);
}

/* Adjust layout for nav/footer */
.layout {
  margin-top: 0;
}
