/* Custom CSS for Part I Introduction Document */

/* Fix TOC scrollspy: sticky navbar (~56px) shifts intersection observer,
   causing active TOC item to lag behind scroll position */
html {
  scroll-padding-top: 65px;
}

h2, h3, h4 {
  scroll-margin-top: 65px;
}

/* Navbar brand title — subtle, smaller weight */
.navbar-brand {
  font-size: 0.85rem !important;
  font-weight: 400 !important;
  opacity: 0.75;
  letter-spacing: 0.02em;
}
/* Color Palette:
   - Primary Green: #4CAF71
   - Black: #000000
   - Purple: #5E4B8B
   - Orange: #E67E3C
*/

/* Enhanced title styling - compact header */
.quarto-title-banner {
  background: linear-gradient(135deg, #5E4B8B 0%, #4CAF71 100%) !important;
  color: white !important;
  padding: 15px 0 !important;
}

.quarto-title .title {
  color: white !important;
  font-size: 1.6em !important;
  font-weight: 600 !important;
  margin-bottom: 5px !important;
}

.quarto-title .subtitle {
  color: rgba(255, 255, 255, 0.9) !important;
  font-size: 1.0em !important;
  font-weight: 400 !important;
}

.quarto-title .date {
  color: rgba(255, 255, 255, 0.85) !important;
  font-size: 0.9em !important;
}

/* Make main chapter headings more prominent */
.chapter-intro h1 {
  background: linear-gradient(135deg, #5E4B8B 0%, #4CAF71 100%);
  color: white;
  padding: 12px 20px;
  margin-top: 30px;
  margin-bottom: 20px;
  border-radius: 6px;
  font-size: 1.5em;
  font-weight: 600;
  box-shadow: 0 4px 8px rgba(94, 75, 139, 0.2);
  letter-spacing: 0.3px;
}

/* Ensure section numbers in chapter headings are white */
.chapter-intro h1 .header-section-number {
  color: white !important;
}

.chapter-intro {
  margin-top: 50px;
  margin-bottom: 30px;
}

/* Style for section headings (h2) */
h2 {
  color: #5E4B8B;
  border-bottom: 2px solid #4CAF71;
  padding-bottom: 8px;
  margin-top: 25px;
  margin-bottom: 15px;
  font-size: 1.35em;
  font-weight: 600;
}

/* Style for subsection headings (h3) */
h3 {
  color: #E67E3C;
  margin-top: 20px;
  margin-bottom: 12px;
  font-size: 1.15em;
  font-weight: 600;
  border-left: 3px solid #E67E3C;
  padding-left: 10px;
}

/* Style for sub-subsection headings (h4) */
h4 {
  color: #5E4B8B;
  margin-top: 15px;
  margin-bottom: 10px;
  font-size: 1.05em;
  font-weight: 600;
}

/* Improve code chunk styling */
pre.sourceCode {
  background-color: #f8f9fa;
  border-left: 4px solid #4CAF71;
  border-radius: 4px;
  padding: 15px;
  margin: 20px 0;
}

/* Smaller font for plain-text blocks (e.g. defaults.txt, file format examples) */
pre.sourceCode.txt, pre.text {
  font-size: 0.8em;
}

/* Style for equations (MathJax) */
mjx-container {
  font-size: 0.85em !important;
}

/* Display equations (block) - slightly smaller */
mjx-container[display="true"] {
  font-size: 0.8em !important;
  margin: 15px 0;
}

/* Style for inline code */
code {
  background-color: #f1f3f5;
  color: #5E4B8B;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
  font-weight: 500;
}

/* Make callout boxes stand out */
.callout {
  border-left: 5px solid #4CAF71;
  background-color: #f0fdf8;
  padding: 15px 20px;
  margin: 20px 0;
  border-radius: 4px;
}

.callout-tip {
  border-left-color: #4CAF71;
  background-color: #f0fdf8;
}

.callout-warning {
  border-left-color: #E67E3C;
  background-color: #fff5f0;
}

.callout-important {
  border-left-color: #5E4B8B;
  background-color: #f8f5ff;
}

/* Improve table styling */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 20px 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-size: 0.9em;
}

table thead {
  background-color: #5E4B8B;
  color: white;
}

table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
}

table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e9ecef;
}

table tbody tr:hover {
  background-color: #f8f9fa;
}

table tbody tr:nth-child(even) {
  background-color: #fafbfc;
}

/* Style for figures and plots */
figure {
  margin: 30px 0;
  text-align: center;
}

figure img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border: 1px solid #e9ecef;
}

figcaption {
  font-style: italic;
  color: #6c757d;
  margin-top: 10px;
  font-size: 0.95em;
}

/* Improve list styling */
ul, ol {
  line-height: 1.4;
  margin: 15px 0;
}

li {
  margin-bottom: 6px;
}

/* List markers */
ul li::marker {
  color: #4CAF71;
  font-weight: bold;
}

ol li::marker {
  color: #5E4B8B;
  font-weight: bold;
}

/* Style for emphasis */
strong {
  color: #000000;
  font-weight: 700;
}

em {
  color: #5E4B8B;
}

/* Links */
a {
  color: #4CAF71;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-bottom 0.2s ease;
}

a:hover {
  color: #3d8f5c;
  border-bottom: 1px solid #4CAF71;
}

/* Improve horizontal rules */
hr {
  border: none;
  border-top: 2px solid #4CAF71;
  margin: 40px 0;
  opacity: 0.3;
}

/* Style for blockquotes */
blockquote {
  border-left: 4px solid #E67E3C;
  background-color: #fff8f5;
  padding: 15px 20px;
  margin: 20px 0;
  font-style: italic;
  color: #495057;
}

/* Breadcrumb navigation styling */
.breadcrumb-item a {
  color: #3D2F5C !important;
}

.breadcrumb-item.active {
  color: #4CAF71 !important;
  font-weight: 600;
}

.breadcrumb-item + .breadcrumb-item::before {
  color: #6c757d;
}

/* Improve document navigation (TOC) */
.sidebar {
  background-color: #f8f9fa;
}

.sidebar-item {
  padding: 8px 15px;
  transition: background-color 0.2s ease;
}

.sidebar-item:hover {
  background-color: #e9ecef;
}

.sidebar-item.active {
  background-color: #4CAF71;
  color: white;
  border-left: 3px solid #5E4B8B;
}

/* Code output */
.cell-output pre {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 12px;
}

/* Buttons and interactive elements */
.btn {
  background-color: #4CAF71;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.btn:hover {
  background-color: #3d8f5c;
}

/* Print-friendly adjustments */
@media print {
  .chapter-intro h1 {
    background: linear-gradient(135deg, #5E4B8B 0%, #4CAF71 100%);
    color: white;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  pre.sourceCode {
    border-left: 4px solid #000;
    page-break-inside: avoid;
  }

  figure {
    page-break-inside: avoid;
  }

  table thead {
    background-color: #5E4B8B;
    color: white;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
  .quarto-title-banner {
    padding: 10px 0 !important;
  }

  .quarto-title .title {
    font-size: 1.3em !important;
  }

  .quarto-title .subtitle {
    font-size: 0.9em !important;
  }

  .chapter-intro h1 {
    font-size: 1.2em;
    padding: 10px 15px;
  }

  h2 {
    font-size: 1.15em;
  }

  h3 {
    font-size: 1.05em;
  }

  h4 {
    font-size: 1em;
  }
}

/* References section styling */
#refs {
  font-size: 0.85em;
  line-height: 1.5;
  color: #495057;
}

#refs div {
  margin-bottom: 12px;
  padding-left: 1.5em;
  text-indent: -1.5em;
  text-align: left;
}

#refs a {
  color: #4CAF71;
  font-size: 0.95em;
}

#refs .csl-entry {
  margin-bottom: 10px;
  padding-left: 1.5em;
  text-indent: -1.5em;
}

/* Make author names slightly bold for easier scanning */
#refs .csl-entry .author {
  font-weight: 500;
}

/* Scrollbar styling (for modern browsers) */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #4CAF71;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3d8f5c;
}
