/* Navigation Bar Active Link Highlighting */
.navbar .nav-item .nav-link.active {
  background-color: #007bff !important;
  color: white !important;
  font-weight: 600;
  border-radius: 6px;
  padding: 8px 16px;
  margin: 0 4px;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
  transform: translateY(-1px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar .nav-item .nav-link {
  color: #495057 !important;
  padding: 8px 16px;
  margin: 0 4px;
  border-radius: 6px;
  transition: all 0.2s ease;
  position: relative;
  text-decoration: none !important;
}

.navbar .nav-item .nav-link:hover {
  background-color: #f8f9fa;
  color: #007bff !important;
  transform: translateY(-1px);
}

/* Optional: Add subtle animation */
@keyframes activePulse {
  0% { box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3); }
  50% { box-shadow: 0 2px 12px rgba(0, 123, 255, 0.5); }
  100% { box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3); }
}

.navbar .nav-item .nav-link.active {
  animation: activePulse 2s ease-in-out infinite;
}

/* Prevent navbar auto-hide on scroll - keep header fixed and visible */
#quarto-header.headroom {
  will-change: auto !important;
  transition: none !important;
}

#quarto-header.headroom--pinned,
#quarto-header.headroom--unpinned,
#quarto-header.headroom--top,
#quarto-header.headroom--not-top {
  transform: translateY(0) !important;
  position: fixed !important;
  top: 0 !important;
}

/* Footer styling */
.quarto-footer {
  text-align: center;
  padding: 1rem 0;
  color: rgba(0,0,0,0.65);
  font-size: 0.95rem;
}

.quarto-footer a { 
  color: inherit; 
  text-decoration: underline; 
}

/* Readability Improvements */

/* Better line height for improved readability */
body {
  line-height: 1.7;
}

/* Improved paragraph spacing */
p {
  margin-bottom: 1.25rem;
  line-height: 1.8;
}

/* Improved heading spacing */
h1 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  line-height: 1.3;
  font-weight: 700;
}

h2 {
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
  line-height: 1.4;
  font-weight: 600;
}

h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  line-height: 1.4;
  font-weight: 600;
}

/* Better list spacing */
ul, ol {
  margin-bottom: 1.5rem;
  line-height: 1.8;
}

li {
  margin-bottom: 0.5rem;
}

/* Improved table readability */
table {
  margin-bottom: 2rem;
  width: 100%;
  border-collapse: collapse;
}

table th {
  background-color: #f8f9fa;
  font-weight: 600;
  padding: 0.75rem;
  text-align: left;
  border-bottom: 2px solid #dee2e6;
}

table td {
  padding: 0.75rem;
  border-bottom: 1px solid #dee2e6;
}

table tr:hover {
  background-color: #f8f9fa;
}

/* Improved blockquote styling */
blockquote {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  border-left: 4px solid #007bff;
  background-color: #f8f9fa;
  font-style: italic;
  line-height: 1.8;
}

/* Better callout box styling */
.callout {
  margin: 1.5rem 0;
  padding: 1.25rem;
  border-radius: 6px;
}

/* Improve link visibility and accessibility */
a {
  color: #007bff;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: all 0.2s ease;
}

a:hover {
  color: #0056b3;
  text-decoration-thickness: 2px;
}

a:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* Skip link for accessibility */
.skip-link:focus {
  position: static;
  width: auto;
  height: auto;
  padding: 0.5rem 1rem;
  background-color: #007bff;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  z-index: 10000;
}

/* Improve focus visibility for keyboard navigation */
*:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* Better contrast for main content */
main {
  max-width: 1200px;
  color: #212529;
}

/* Improve code readability */
code {
  padding: 0.2rem 0.4rem;
  font-size: 90%;
  background-color: #f8f9fa;
  border-radius: 3px;
}

pre code {
  padding: 1rem;
  display: block;
  overflow-x: auto;
  line-height: 1.6;
}

/* Responsive images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Better spacing for sections */
section {
  margin-bottom: 3rem;
}

/* Improve horizontal rule styling */
hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 2px solid #dee2e6;
}

/* Better center alignment */
center {
  margin: 1rem 0;
}

/* Responsive typography */
@media (max-width: 768px) {
  body {
    font-size: 16px;
  }
  
  h1 {
    font-size: 1.75rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  h3 {
    font-size: 1.25rem;
  }
}

/* Print styles for better readability when printing */
@media print {
  body {
    font-size: 12pt;
    line-height: 1.6;
    color: #000;
  }
  
  a {
    text-decoration: underline;
    color: #000;
  }
  
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }
  
  h1, h2, h3 {
    page-break-after: avoid;
  }
  
  img {
    max-width: 100% !important;
  }
}