:root {
  --bg: #0d1117;
  --text: #c9d1d9;
  --strong: #e6edf3;
  --muted: #9da7b3;
  --line: #30363d;
  --accent: #58a6ff;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.75;
}

main {
  max-width: 80ch;
  margin: 0 auto;
  padding: 64px 24px 96px;
}

a { color: inherit; text-decoration: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1:focus, h2:focus { outline: none; }

/* icon row */
.links {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin: -24px -10px 24px 0;
}
.links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--muted);
}
.links a:hover { color: var(--accent); }

h1 {
  margin: 0 0 32px;
  font-size: clamp(24px, 6vw, 28px);
  line-height: 1.3;
  font-weight: 700;
  color: var(--strong);
}

h2, h3 { color: var(--strong); font-weight: 700; }
h2 { margin: 0 0 12px; font-size: 20px; line-height: 1.4; }
h3 { margin: 0; font-size: 16px; line-height: 1.5; }

p { margin: 0 0 16px; }
.gap { margin-bottom: 40px; }
.view > p:last-of-type { margin-bottom: 0; }

h2.plain { margin: 0 0 8px; }

/* FAQ (native details) */
.faq { border-top: 1px solid var(--line); }
.faq summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 0;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover h3 { color: var(--accent); }
.faq .answer { padding: 4px 0 20px; }
.faq .answer p:last-child { margin-bottom: 0; }

/* chapter list on the start view */
.toc { margin-top: 32px; border-bottom: 1px solid var(--line); }
.toc .row { margin: 0; border-top: 1px solid var(--line); }
.toc .row a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 12px 0;
}
.toc .row a:hover { color: var(--accent); }

/* chapter pages */
.chapter h2 { margin-bottom: 28px; }
.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--strong);
}
a.btn:hover { color: var(--accent); border-color: var(--accent); }
.btn[aria-disabled="true"] { opacity: 0.35; }

/* with JS: one view at a time. Without JS: everything shows as a plain document. */
.js .view { display: none; }
.js .view.active { display: block; }
html:not(.js) .chapter { margin-top: 56px; }
html:not(.js) .pager { display: none; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: auto; }
}
