body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
  color: #1f2328;
}

/* Topic pages: sidebar + content (only when a nav.toc exists) */
body:has(> nav.toc) { display: flex; }

nav.toc {
  flex: 0 0 20rem;
  box-sizing: border-box;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
  padding: 1.5rem 1rem;
  background: #f6f8fa;
  border-right: 1px solid #d0d7de;
}
nav.toc ul { list-style: none; margin: 0; padding: 0; }
nav.toc li { margin: 0 0 .5rem; }
nav.toc a { text-decoration: none; }
nav.toc a:hover { text-decoration: underline; }

/* Current page: bold, not clickable */
nav.toc li.active > a {
  pointer-events: none;
  color: #1f2328;
  font-weight: 700;
}

main {
  flex: 1;
  min-width: 0;
  max-width: 52rem;
  padding: 1.5rem 2rem;
}

@media (max-width: 800px) {
  body:has(> nav.toc) { display: block; }
  nav.toc { position: static; height: auto; border-right: 0; }
}

/* General content */
h1, h2, h3 { line-height: 1.25; }
h1 { border-bottom: 1px solid #d0d7de; padding-bottom: .3em; }
a { color: #0969da; }
pre, code { background: #f6f8fa; border-radius: 6px; }
pre { padding: 1rem; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid #d0d7de; padding: .5rem .75rem; text-align: left; }
th { background: #f6f8fa; }
.note { border-left: 4px solid #0969da; background: #f0f7ff; padding: .75rem 1rem; }

/* Landing pages (html5/ and html5-admin/) */
body > h1.topictitle1 {
  margin: 2rem auto 1.5rem;
  max-width: 52rem;
  text-align: center;
  font-size: 2rem;
  font-weight: 600;
  border-bottom: none;
}
body > nav:not(.toc) { padding: 0 1rem 3rem; }
nav ul.map { list-style: none; padding: 0; margin: 2rem auto; max-width: 40rem; }
nav ul.map li { margin: 0 0 1rem; }
nav ul.map a {
  display: block;
  padding: .75rem 1rem;
  background: #f6f8fa;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  font-size: 1.05rem;
  font-weight: 500;
  text-decoration: none;
}
nav ul.map a:hover { background: #eef1f4; }
