/* Reset */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #f5f7fa, #e4ebf5);
  color: #222;
}

/* Layout */
.page {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  padding: 1.5rem;
  background: linear-gradient(180deg, #2c3e50, #34495e);
  color: #ecf0f1;
  position: fixed;
  top: 0;
  bottom: 0;
  overflow-y: auto;     /* enable scrolling */
  overflow-x: hidden;
}

/* Hide scrollbar (Chrome, Edge, Safari) */
.sidebar::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* Firefox */
.sidebar {
  scrollbar-width: none;
}

.sidebar h2 {
  margin-top: 0;
  font-size: 1.3rem;
}

.sidebar a {
  display: block;
  color: #ecf0f1;
  text-decoration: none;
  margin: 0.4rem 0;
  font-size: 0.95rem;
}

.sidebar a:hover {
  text-decoration: underline;
}

.sidebar hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.2);
  margin: 1rem 0;
}

/* Hide very deep TOC levels in sidebar */
.sidebar .page-nav ul ul ul ul {
  display: none;
}

/* Main content */
.content {
  margin-left: 260px;
  padding: 1.5rem 3rem 3rem 3rem;
  max-width: 900px;
}

/* Headings */
.content h1, .content h2, .content h3 {
  scroll-margin-top: 1rem;
  margin-bottom: 0.5rem;     /* vertical skip after header line */
}

.content h1:first-of-type {
  margin-top: 0.1rem;  /* smaller space above the first H1 */
}

/* Reduce space above headers */
.content h1 {
  margin-top: 1.5rem;
}

.content h2 {
  margin-top: 1.3rem;
}

.content h3 {
  margin-top: 1.1rem;
}

/* Tighten list spacing */
.content ul,
.content ol {
  margin-top: 0.4rem;
  margin-bottom: 0.6rem;
  padding-left: 1.4rem;   /* keep bullets readable */
}

/* Responsive */
@media (max-width: 800px) {
  .sidebar {
    position: relative;
    width: 100%;
  }

  .content {
    margin-left: 0;
    padding: 1.5rem;
  }
}

/* Hide TOC in sidebar on mobile */
@media (max-width: 800px) {
  .sidebar .page-nav {
    display: none;
  }
}

/* Hide TOC where it appears in the main content */
.content > ul#markdown-toc {
  display: none;
}

.content > #markdown-toc {
  display: none;
}

/* color new sidebar links like the rest */
.sidebar #sidebar-toc a {
  color: #ecf0f1;
  text-decoration: none;
  display: block;
  margin: 0.4rem 0;
}

.sidebar #sidebar-toc a:hover {
  text-decoration: underline;
}

/* reduce toc indentation */
.sidebar #sidebar-toc ul {
  padding-left: 0.5rem;   /* reduce indentation for nested levels */
  list-style: none;        /* remove bullets */
}

.sidebar #sidebar-toc li {
  margin-left: 0;          /* remove extra li indentation */
}

/* alignment with other links */
.sidebar #sidebar-toc {
  margin-bottom: 1.5rem;   /* space before generic links */
}
