/* /assets/css/reading.css */

/* Reading-specific layout */
.reading-container {
  max-width: 800px; /* Tighter column for better line length */

}

/* Typography Hierarchy */
.reading-body {
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--ink);
}

.chapter-title {
  text-align: left;
  margin-top: var(--space-7);
  margin-bottom: var(--space-5);
  color: var(--oak);
}

.reading-body h2 { border-bottom: 2px solid var(--rule); padding-bottom: 10px; margin-top: 2em; }
.reading-body h3 { font-style: italic; margin-top: 1.5em; }
.reading-body h4 { font-style: italic; margin-top: 1.5em; }
.reading-body h5 { font-size:17px;font-style: italic; margin-top: 1.5em; }

/* Table of Contents */
.toc-box {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  padding: var(--space-5);
  border-radius: var(--radius);
  margin-bottom: var(--space-7);
}

.toc-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.toc-list a {
  font-family: var(--serif);
  font-size: 15px;
}
/* Nested TOC Styling */
.toc-list p {
  list-style: none;
  padding-left: var(--space-4); /* Consistent indentation */
  margin-top: 4px;
}

/* Level specific styling */
p.level-1{ 
  font-weight: 700;  
  letter-spacing: 0.5px;
  color: var(--oak); 
  text-decoration: underline;
}

p.level-2  { margin-left: 20px; /* Indentation for the entire block */
    text-indent: -20px; /* Moves the first line back to align with the margin */
    padding-left: 20px; /* Ensures subsequent lines are aligned */;
  font-weight: 600; 
  color: var(--leather);
  text-decoration: underline;
}

p.level-3 { 
  font-style: italic; margin-left: 40px; /* Indentation for the entire block */
    text-indent: -40px; /* Moves the first line back to align with the margin */
    padding-left: 40px; /* Ensures subsequent lines are aligned */;
  text-decoration: underline;
}

p.level-4 { 
  font-size: 0.9em; 
  font-family: var(--sans); 
  color: var(--ink);
margin-left: 60px; /* Indentation for the entire block */
    text-indent: -60px; /* Moves the first line back to align with the margin */
    padding-left: 60px; /* Ensures subsequent lines are aligned */;
  text-decoration: underline;
}

/* Mobile adjustment for deep nesting */
@media (max-width: 600px) {
  .toc-list p {
    padding-left: var(--space-3); /* Tighter padding on mobile */
  }
}
/* Images & Captions */
.reading-figure {
  margin: var(--space-6) 0;
  text-align: center;
}

.reading-figure img {
  margin: 0 auto;
  box-shadow: var(--shadow);
  border: 4px solid #fff;
}

.reading-caption {
  font-family: var(--sans);
  font-size: 14px;
  margin-top: var(--space-2);
  color: var(--oak-soft);
  font-style: italic;
}

/* Tables */
.reading-table-wrapper {
  overflow-x: auto;
  margin: var(--space-5) 0;
}

table.reading-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 15px;
}

.reading-table th {
  background: var(--oak);
  color: var(--paper);
  padding: 12px;
  text-align: left;
}

.reading-table td {
  padding: 10px;
  border-bottom: 1px solid var(--rule);
}

/* Footnotes */
.footnotes {
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  font-size: 0.95rem;
}

.footnote-ref {
  vertical-align: super;
  font-size: 0.75em;
  font-weight: bold;
  margin-left: 2px;
}

/* Navigation between chapters */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-7);
  padding: var(--space-5) 0;
  border-top: 1px solid var(--rule);
}
/* --- Mobile Refinements --- */
@media (max-width: 700px) {
  .reading-container {
    width: 100%; /* Utilize full width on small screens */
  }

  .reading-body {
    font-size: 1.05rem; /* Slightly smaller for mobile comfort */
    line-height: 1.6;
  }

  .chapter-title {
    font-size: var(--h2);
    margin-top: var(--space-5);
  }

  .toc-list {
    grid-template-columns: 1fr; /* Stack chapters in a single column */
    gap: 8px;
  }

  .reading-table {
    font-size: 13px; /* Prevent horizontal overflow */
  }

  .chapter-nav {
    flex-direction: column;
    gap: var(--space-4);
    text-align: center;
  }
}
/* --- Print Stylesheet --- */
@media print {
  /* Hide UI elements */
  .site-header, 
  .site-footer, 
  .nav-toggle, 
  .back-to-top, 
  .toc-box, 
  .chapter-nav,
  #nightToggle {
    display: none !important;
  }

  /* Reset layout for paper */
  .reading-container {
    max-width: 100%;
    margin: 0;
  }

  .reading-body {
    font-size: 12pt; /* Standard print size */
    color: #000;
  }

  .chapter-title {
    page-break-before: always; /* Each chapter starts on a new page */
    color: #000;
  }
}
.return-to-top {
  margin-top: 3rem;
  text-align: left;
}

.return-to-top a {
  display: inline-block;
  padding: 10px 16px;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid currentColor;
}

.return-to-top a:hover {
  text-decoration: underline;
}