body {
  background-color: #f8fafc; /* --aisi-bg from style guide */
  position: relative; /* Required for scrollspy */
}

.aisi-header {
  background-color: rgb(95, 132, 155); /* --bs-primary */
}

#tutorial-nav-container .nav-link {
  color: #6c757d;
  padding: 0.5rem 1rem;
  border-left: 3px solid transparent;
}

#tutorial-nav-container .nav-link.active,
#tutorial-nav-container .nav-link:hover {
  color: #5f849b; /* --aisi-primary */
  background-color: #e9ecef;
  border-left-color: #5f849b; /* --aisi-primary */
}

/* Nested navigation */
#tutorial-nav-container .nav .nav {
  padding-left: 1.5rem;
}

#tutorial-nav-container .nav-link {
  font-size: 0.9rem;
}

#tutorial-nav-container .nav .nav .nav-link {
  font-size: 0.85rem;
  padding-left: 1.5rem;
}

#tutorial-nav {
  position: sticky;
  top: 100px; /* Adjust based on header height */
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

#tutorial-content {
  line-height: 1.8;
}

#tutorial-content h1,
#tutorial-content h2,
#tutorial-content h3,
#tutorial-content h4 {
  color: #5f849b; /* --aisi-primary from style guide */
  margin-top: 2.5rem; /* Increased margin for scroll spy */
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e0e6ed; /* --aisi-border */
}

#tutorial-content h1 {
  font-size: 2.2rem;
  margin-top: 1rem; /* First element should not have large top margin */
}

#tutorial-content h2 {
  font-size: 1.8rem;
}

#tutorial-content h3 {
  font-size: 1.4rem;
}

#tutorial-content h4 {
  font-size: 1.2rem;
  border-bottom: none;
}

#tutorial-content a {
  color: #5f849b;
  text-decoration: none;
}

#tutorial-content a:hover {
  text-decoration: underline;
}

#tutorial-content code {
  background-color: #e9ecef;
  padding: 0.2em 0.4em;
  margin: 0;
  font-size: 85%;
  border-radius: 3px;
}

#tutorial-content pre {
  background-color: #f8f9fa;
  border: 1px solid #e0e6ed;
  border-radius: 0.5rem;
  padding: 1rem;
  overflow-x: auto;
}

#tutorial-content pre code {
  background-color: transparent;
  padding: 0;
  margin: 0;
  font-size: inherit;
  border-radius: 0;
}

#tutorial-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

/* Responsive Design */
@media (max-width: 992px) {
  #tutorial-nav {
    position: static;
    max-height: none;
    overflow-y: visible;
    margin-bottom: 2rem;
  }
}

@media (max-width: 768px) {
  /* Keep header items on one line on mobile, and shrink them */
  header .container img {
    height: 32px;
  }

  header .container .btn {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
  }

  #tutorial-content h1 {
    font-size: 1.8rem;
  }

  #tutorial-content h2 {
    font-size: 1.5rem;
  }

  #tutorial-content h3 {
    font-size: 1.2rem;
  }
}
