/* =========================================================================
   Kali Linux for Beginners: site styles.
   Plain documentation: the reader's own system fonts, standard link colours,
   rules instead of cards, square corners, no decoration. What makes a page
   look like this course is its content (lab output, checks, the lab map).
   ========================================================================= */

:root {
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --topbar-h: 60px;
  --sidebar-w: 280px;
  --toc-w: 232px;
  --content-max: 780px;
  --radius: 2px;
  --radius-sm: 2px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1b1b1b;
  --surface: #1b1b1b;
  --surface-2: #242424;
  --surface-3: #2e2e2e;
  --border: #3a3a3a;
  --border-strong: #4d4d4d;
  --text: #dedede;
  --text-2: #c4c4c4;
  --muted: #9a9a9a;
  --accent: #8ab4f8;
  --accent-strong: #aecbfa;
  --accent-ink: #1b1b1b;
  --accent-soft: rgba(138, 180, 248, .14);
  --visited: #c58af9;
  --prompt: #7cc47c;
  --warn: #f28b82;
  --warn-soft: transparent;
  --danger: #f28b82;
  --mark: rgba(255, 213, 79, .35);
  --code-bg: #242424;
  --code-inline-bg: #2e2e2e;
  --topbar-bg: #1b1b1b;
  --shadow: 0 2px 8px rgba(0, 0, 0, .5);
  --l0: var(--muted);
  --l1: var(--muted);
  --l2: var(--muted);
  --l3: var(--muted);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f4f4;
  --surface-3: #e8e8e8;
  --border: #d0d0d0;
  --border-strong: #b0b0b0;
  --text: #1a1a1a;
  --text-2: #333333;
  --muted: #5c5c5c;
  --accent: #0645ad;
  --accent-strong: #0b0080;
  --accent-ink: #ffffff;
  --accent-soft: rgba(6, 69, 173, .08);
  --visited: #5a3696;
  --prompt: #1a6b1a;
  --warn: #b00020;
  --warn-soft: transparent;
  --danger: #b00020;
  --mark: rgba(255, 213, 79, .6);
  --code-bg: #f4f4f4;
  --code-inline-bg: #ececec;
  --topbar-bg: #ffffff;
  --shadow: 0 2px 8px rgba(0, 0, 0, .15);
  --l0: var(--muted);
  --l1: var(--muted);
  --l2: var(--muted);
  --l3: var(--muted);
}

/* ---------------- Base ---------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--topbar-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font-ui);
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 2px; }
/* Links in running text look like links: underlined, with a visited colour. */
.markdown a, .band-lead a, .module-pages a, .ref-group a, .safety a {
  text-decoration: underline; text-underline-offset: 2px;
}
.markdown a:visited, .module-pages a:visited, .ref-group a:visited { color: var(--visited); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent); color: var(--accent-ink); }
img { max-width: 100%; height: auto; }
code, kbd, pre, samp { font-family: var(--font-mono); }
.icon { flex: none; display: inline-block; vertical-align: middle; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 14px;
  background: var(--accent); color: var(--accent-ink); border-radius: var(--radius-sm); font-weight: 600;
}
.skip-link:focus { top: 10px; }
.muted { color: var(--muted); }

/* ---------------- Top bar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px; color: var(--text);
  font-family: var(--font-mono); font-weight: 700; font-size: 15px; letter-spacing: -.01em;
  white-space: nowrap; margin-right: 8px;
}
.brand:hover { color: var(--text); text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center; width: 30px; height: 30px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text);
  font-family: var(--font-mono); font-weight: 700; font-size: 13px; letter-spacing: -.04em;
}
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border: 1px solid transparent; border-radius: 2px;
  background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); text-decoration: none; }
.menu-btn { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: none; }

.topnav { display: flex; gap: 2px; margin-left: 4px; }
.topnav a {
  padding: 6px 10px; border-radius: 2px; color: var(--text-2);
  font-size: 14px; font-weight: 500;
}
.topnav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

/* ---------------- Search ---------------- */
.search-wrap { position: relative; flex: 1 1 auto; max-width: 440px; margin-left: auto; }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
#search {
  width: 100%; height: 38px; padding: 0 40px 0 36px;
  border: 1px solid var(--border); border-radius: 2px;
  background: var(--surface); color: var(--text);
  font: 14px var(--font-ui);
  transition: border-color .15s, box-shadow .15s;
}
#search::placeholder { color: var(--muted); }
#search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#search::-webkit-search-cancel-button { display: none; }
.search-kbd {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  pointer-events: none;
}
#search:focus ~ .search-kbd { display: none; }
kbd {
  display: inline-block; min-width: 20px; padding: 0 6px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 2px;
  background: var(--surface-2); color: var(--text-2);
  font-size: 12px; line-height: 18px; text-align: center;
}
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 60;
  max-height: min(70vh, 560px); overflow-y: auto;
  margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.search-results li a {
  display: block; padding: 10px 12px; border-radius: 2px; color: var(--text);
}
.search-results li a:hover, .search-results li[aria-selected="true"] a {
  background: var(--accent-soft); text-decoration: none;
}
.search-results .sr-title { display: block; font-weight: 600; }
.search-results small { display: block; color: var(--accent); font: 12px var(--font-mono); margin: 1px 0 3px; }
.search-results .sr-snippet { display: block; color: var(--muted); font-size: 13px; line-height: 1.5; }
.search-results mark { background: var(--mark); color: var(--text); border-radius: 2px; padding: 0 2px; }
.search-empty { padding: 14px; color: var(--muted); text-align: center; font-size: 14px; }

/* ---------------- Layout ---------------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) auto;
  max-width: 1600px; margin: 0 auto;
  min-height: calc(100vh - var(--topbar-h));
}
.page-landing .layout { grid-template-columns: minmax(0, 1fr); max-width: none; }
.content { min-width: 0; padding: 40px 56px 72px; }
.page-doc .content > * { max-width: var(--content-max); margin-left: auto; margin-right: auto; }
.page-landing .content { padding: 0; }

/* ---------------- Sidebar ---------------- */
.sidebar {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h)); overflow-y: auto;
  padding: 24px 14px 32px 20px;
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
}
.page-landing .sidebar {
  position: fixed; left: 0; z-index: 70; width: min(var(--sidebar-w), 86vw);
  background: var(--surface); transform: translateX(-100%); visibility: hidden;
  transition: transform .25s var(--ease), visibility .25s;
  box-shadow: var(--shadow);
}
.page-landing .sidebar.open { transform: none; visibility: visible; transition: transform .25s var(--ease), visibility 0s; }
.page-landing .menu-btn { display: inline-grid; }
.nav-section { margin-bottom: 22px; }
.nav-section h3 {
  display: flex; align-items: baseline; gap: 8px;
  margin: 0 0 4px; padding: 0 10px;
  color: var(--text); font: 600 13.5px/1.4 var(--font-ui);
}
.nav-num { flex: none; color: var(--lvl, var(--muted)); font: 600 12px var(--font-mono); }
.nav-count { margin-left: auto; padding-left: 8px; color: var(--muted); font: 500 11.5px var(--font-mono); }
.nav-count.is-done { color: var(--prompt); }
.nav-section ul { list-style: none; margin: 0; padding: 0; }
.nav-section li a {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; border-radius: 2px;
  color: var(--text-2); font-size: 14px; line-height: 1.45;
}
.nav-section li a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-section li a.active {
  color: var(--text); font-weight: 700;
}
.nav-section li a.active::before {
  content: ""; position: absolute; left: -10px; top: 6px; bottom: 6px; width: 3px; border-radius: 2px;
  background: var(--accent);
}
.done-mark {
  width: 14px; height: 14px; flex: none; border-radius: 2px;
  border: 1.5px solid var(--border-strong);
}
.nav-section a.done .done-mark { position: relative; border-color: var(--prompt); background: var(--prompt); }
.nav-section a.done .done-mark::after {
  content: ""; position: absolute; left: 3.5px; top: 1px; width: 4px; height: 7px;
  border: solid var(--bg); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
.progress-wrap {
  margin: 0 0 22px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
}
.progress-label { display: flex; justify-content: space-between; align-items: baseline; font: 12.5px var(--font-mono); color: var(--text-2); }
.progress-bar { height: 6px; margin-top: 8px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
#progress-fill { display: block; height: 100%; width: 0; background: var(--prompt); transition: width .4s var(--ease); }
.link-btn {
  padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer;
  font: 12px var(--font-mono); text-decoration: underline; text-underline-offset: 2px;
}
.link-btn:hover { color: var(--danger); }
/* Export/import sits under the navigation: useful once you have progress, out of the way before. */
.progress-io {
  display: flex; flex-wrap: wrap; gap: 4px 14px;
  margin: 20px 0 8px; padding-top: 14px; border-top: 1px solid var(--border);
}
.progress-io[hidden] { display: none; }
.progress-io .link-btn:hover { color: var(--text); }
.progress-msg { flex-basis: 100%; margin: 0; font: 12px var(--font-mono); color: var(--text-2); }
.progress-msg:empty { display: none; }
.progress-msg.is-error { color: var(--danger); }
.scrim {
  position: fixed; inset: 0; z-index: 65; background: rgba(0, 0, 0, .5);
}

/* Level colour plumbing */
[data-level="0"] { --lvl: var(--l0); }
[data-level="1"] { --lvl: var(--l1); }
[data-level="2"] { --lvl: var(--l2); }
[data-level="3"] { --lvl: var(--l3); }

/* ---------------- Table of contents ---------------- */
.toc {
  position: sticky; top: var(--topbar-h);
  width: var(--toc-w); height: calc(100vh - var(--topbar-h)); overflow-y: auto;
  padding: 40px 20px 32px 8px;
  font-size: 13px; scrollbar-width: thin;
}
.toc-title { margin: 0 0 10px; color: var(--text); font-weight: 600; font-size: 13px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a {
  display: block; margin-left: -1px; padding: 4px 0 4px 12px;
  border-left: 2px solid transparent; color: var(--muted); line-height: 1.4;
}
.toc .toc-d3 a { padding-left: 24px; font-size: 12.5px; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.active { color: var(--accent); border-left-color: var(--accent); }

/* ---------------- Doc header bits ---------------- */
.crumbs {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 18px; color: var(--muted); font: 12.5px var(--font-mono);
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.doc-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0; border: 0; background: none;
  color: var(--muted);
  font: 14px/1.6 var(--font-ui); white-space: nowrap;
}
.level-tag {
  display: inline-block; vertical-align: .1em;
  color: var(--muted); font: 400 .6em/1.6 var(--font-mono); letter-spacing: 0; white-space: nowrap;
}
.badge + .badge::before { content: "\00b7"; margin-right: 8px; }

/* ---------------- Markdown ---------------- */
.markdown { font-size: 16px; }
.markdown > *:first-child { margin-top: 0; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 {
  position: relative; color: var(--text); line-height: 1.25;
}
.markdown h1 {
  margin: 0 0 16px; font: 700 clamp(26px, 3.2vw, 32px)/1.2 var(--font-ui);
}
.markdown h2 {
  margin: 44px 0 14px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
  font: 700 22px/1.3 var(--font-ui);
}
.markdown h3 { margin: 32px 0 10px; font: 700 18px/1.3 var(--font-ui); }
.markdown h4 { margin: 24px 0 8px; font: 700 16px/1.3 var(--font-ui); }
.markdown p, .markdown ul, .markdown ol, .markdown table, .markdown blockquote, .markdown .codeblock, .markdown details {
  margin: 0 0 18px;
}
.markdown ul, .markdown ol { padding-left: 24px; }
.markdown li { margin: 4px 0; }
.markdown li::marker { color: var(--muted); }
.markdown strong { color: var(--text); }
.markdown hr { border: 0; height: 1px; background: var(--border); margin: 40px 0; }
.markdown hr:has(+ h2) { display: none; }
.anchor {
  margin-left: 8px; color: var(--muted); font-weight: 400; opacity: 0;
  transition: opacity .15s;
}
.markdown h2:hover .anchor, .markdown h3:hover .anchor, .markdown h4:hover .anchor, .anchor:focus { opacity: 1; }
.anchor:hover { color: var(--accent); text-decoration: none; }
.anchor { position: relative; }
.anchor.copied { opacity: 1; color: var(--prompt); }
.anchor.copied::after {
  content: "Link copied"; position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%);
  padding: 2px 8px; border-radius: 2px; background: var(--surface-3); color: var(--text);
  font: 500 12px/1.6 var(--font-ui); letter-spacing: 0; white-space: nowrap;
}
/* A heading reached by a link (search result, outline, shared URL) flashes once. */
.markdown :is(h2, h3, h4):target { animation: target-flash 1.6s var(--ease); }
@keyframes target-flash {
  0%, 30% { background: var(--accent-soft); box-shadow: 0 0 0 8px var(--accent-soft); border-radius: 2px; }
  100% { background: transparent; box-shadow: 0 0 0 8px transparent; }
}

/* Folded outline under the title: only where the side outline is hidden. */
.markdown .toc-inline { display: none; margin: 0 0 24px; padding: 0 14px; font-size: 14.5px; }
.markdown .toc-inline summary { padding: 10px 0; }
.toc-inline ol { list-style: none; margin: 0 0 12px; padding: 0; }
.toc-inline li { margin: 0; }
.toc-inline a { display: block; padding: 4px 0; color: var(--text-2); }
.toc-inline .toc-d3 a { padding-left: 16px; color: var(--muted); font-size: 13.5px; }

.markdown :not(pre) > code {
  padding: .12em .4em; border-radius: 2px;
  background: var(--code-inline-bg); color: var(--text);
  font-size: .86em; overflow-wrap: anywhere;
}
.markdown a code { color: inherit; }

/* Code blocks: a slim header with the language and a copy button */
.codeblock {
  position: relative; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--code-bg);
}
.codeblock-bar {
  display: flex; align-items: center; gap: 12px;
  height: 34px; padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.codeblock-lang { color: var(--muted); font: 12px var(--font-mono); text-transform: lowercase; }
.codeblock[data-lang="text"] .codeblock-lang { visibility: hidden; }
/* Expected output: what the lab prints back, set apart from the commands you type */
.codeblock-output { border-left: 3px solid var(--prompt); }
.codeblock-output .codeblock-bar { background: var(--code-bg); }
.codeblock-output .codeblock-lang { color: var(--prompt); text-transform: none; }
.codeblock-output pre { color: var(--text-2); }

/* Glossary terms: the first use on a page links to the definition, which also shows on hover/focus */
.term { position: relative; }
.markdown .term > a {
  color: inherit; text-decoration: underline dotted; text-decoration-color: var(--muted);
  text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.markdown .term > a:hover { color: var(--accent); text-decoration-color: currentColor; }
.term-def {
  display: none; position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 30;
  width: max-content; max-width: min(320px, 80vw); padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: var(--shadow); color: var(--text);
  font: 400 13.5px/1.5 var(--font-ui); text-align: left; white-space: normal;
}
.term:hover .term-def, .term:focus-within .term-def { display: block; }
.term.dismissed .term-def { display: none; }
/* Touch screens have no hover: a tap follows the link to the glossary instead. */
@media (hover: none) { .term:hover .term-def { display: none; } }
.markdown p[id^="term-"] { scroll-margin-top: calc(var(--topbar-h) + 16px); }
.markdown p[id^="term-"]:target { background: var(--accent-soft); border-radius: var(--radius-sm);
  box-shadow: 0 0 0 6px var(--accent-soft); }
.markdown pre {
  margin: 0; padding: 14px 18px 16px; overflow-x: auto;
  font-size: 13.5px; line-height: 1.65; tab-size: 4;
  scrollbar-width: thin;
}
.markdown pre code { background: none; padding: 0; font-size: inherit; }
.copy-btn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: 2px;
  background: var(--surface); color: var(--text-2); cursor: pointer;
  font: 12px var(--font-mono);
  opacity: .75; transition: opacity .15s, color .15s, border-color .15s;
}
.codeblock:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { color: var(--text); border-color: var(--accent); }
.copy-btn.copied { color: var(--prompt); border-color: var(--prompt); opacity: 1; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 0 18px; }
.markdown table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table-wrap table { margin: 0; }
.markdown th, .markdown td { padding: 9px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.markdown th {
  border-bottom-color: var(--border-strong); color: var(--text);
  font-weight: 600; font-size: 14.5px;
}
.align-left { text-align: left !important; }
.align-center { text-align: center !important; }
.align-right { text-align: right !important; }

/* Blockquotes and callouts */
.markdown blockquote {
  padding: 2px 0 2px 16px; border-left: 3px solid var(--border-strong); color: var(--text-2);
}
.markdown blockquote > :last-child { margin-bottom: 0; }
.markdown blockquote.callout-warn { border-left-color: var(--warn); }
.markdown blockquote.callout-warn > p:first-child > strong:first-child { color: var(--warn); }

.markdown details {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  padding: 0 16px;
}
.markdown summary { cursor: pointer; padding: 12px 0; font-weight: 600; }
.markdown details[open] summary { border-bottom: 1px solid var(--border); margin-bottom: 14px; }

/* ---------------- Doc footer: actions + pager ---------------- */
.doc-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px; justify-content: space-between;
  margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border);
}
.doc-actions-main { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.done-next { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14.5px; }
.done-next[hidden] { display: none; }
.doc-actions-links { display: flex; flex-wrap: wrap; gap: 18px; font-size: 14px; }
.doc-actions-links a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.doc-actions-links a:hover { color: var(--accent); }
.done-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border: 1px solid var(--border-strong); border-radius: 2px;
  background: var(--surface); color: var(--text); cursor: pointer;
  font: 600 14px var(--font-ui);
}
.done-btn::before {
  content: ""; width: 16px; height: 16px; border-radius: 2px; border: 1.5px solid var(--muted);
}
.done-btn:hover { border-color: var(--prompt); }
.done-btn[aria-pressed="true"] { border-color: var(--prompt); color: var(--prompt); background: color-mix(in srgb, var(--prompt) 10%, transparent); }
.done-btn[aria-pressed="true"]::before { border-color: var(--prompt); background: var(--prompt); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 28px; }
.pager-btn {
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}
.pager-btn:hover { border-color: var(--accent); text-decoration: none; color: var(--text); }
.pager-btn small { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font: 12px var(--font-mono); }
.pager-btn span { font-weight: 650; }
.pager-btn em { color: var(--muted); font-style: normal; font-size: 13px; }
.pager-next { text-align: right; align-items: flex-end; }

/* ---------------- Site footer ---------------- */
.site-footer { border-top: 1px solid var(--border); }
.footer-inner {
  max-width: 1200px; margin: 0 auto; padding: 32px 24px;
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "brand links" "legal credit";
  gap: 10px 32px; align-items: center;
  color: var(--muted); font-size: 14px;
}
.footer-inner p { margin: 0; }
.footer-brand { grid-area: brand; display: flex; align-items: center; gap: 10px; color: var(--text); font: 700 14px var(--font-mono); }
.footer-brand .brand-mark { width: 26px; height: 26px; font-size: 11px; }
.footer-legal { grid-area: legal; }
.footer-links { grid-area: links; display: flex; flex-wrap: wrap; gap: 18px; justify-content: flex-end; }
.footer-links a { color: var(--text-2); }
.footer-credit { grid-area: credit; text-align: right; font: 12.5px var(--font-mono); }

/* =========================================================================
   Landing page
   ========================================================================= */
.landing { --wrap: 46rem; padding-bottom: 72px; }
.landing > * { max-width: var(--wrap); margin-left: auto; margin-right: auto; padding-left: 24px; padding-right: 24px; }

.landing-intro { padding-top: 40px; }
.landing-intro h1 { margin: 0 0 12px; font: 700 30px/1.2 var(--font-ui); }
.landing-intro p { margin: 0 0 14px; }
.landing-intro a { text-decoration: underline; text-underline-offset: 2px; }
.landing-intro .safety { margin-top: 20px; }

/* Lab output shown on the landing page */
.terminal { margin: 16px 0 0; }
.terminal-body {
  margin: 0; padding: 12px 14px; overflow-x: auto; background: var(--code-bg);
  font-size: 13.5px; line-height: 1.5; color: var(--text-2);
}
.terminal figcaption { margin-top: 6px; color: var(--muted); font-size: 14px; }
.t-prompt { color: var(--prompt); font-weight: 700; }
.t-cmd { color: var(--text); }
.t-hit { color: var(--text); }
.t-dim { color: var(--muted); }

/* Sections */
.band { padding-top: 40px; }
.band h2 { margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); font: 700 22px/1.3 var(--font-ui); }
.band-lead { margin: 0 0 16px; color: var(--text-2); }
.band-lead code, .safety code {
  padding: .12em .4em; border-radius: 2px; background: var(--code-inline-bg); color: var(--text); font-size: .88em;
}

/* Module list */
.modules { list-style: none; margin: 0; padding: 0; }
.module {
  display: grid; grid-template-columns: 2.5em minmax(0, 1fr) auto; gap: 0 16px; align-items: start;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.module-num { color: var(--muted); font: 15px/1.6 var(--font-ui); font-variant-numeric: tabular-nums; }
.module-body h3 { margin: 0 0 2px; font-size: 17px; font-weight: 600; }
.module-body h3 a { text-decoration: underline; text-underline-offset: 2px; }
.module-body p { margin: 0; color: var(--text-2); font-size: 15px; }
.module-pages { display: flex; flex-wrap: wrap; gap: 4px 18px; list-style: none; margin: 8px 0 0; padding: 0; font-size: 14px; }
.module-meta {
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  margin: 0; padding-top: 2px; color: var(--muted); font-size: 14px; line-height: 1.5; text-align: right; white-space: nowrap;
}
.module-level { color: var(--text-2); }
.module-progress:empty { display: none; }
.module-progress.is-done { color: var(--prompt); }

/* Lab */
/* Lab network map (landing page); generated from docker-compose.yml */
.lab-map { display: block; width: 100%; height: auto; margin: 8px 0 28px; overflow: visible; }
.lab-map text { font: 14px var(--font-ui); fill: var(--text-2); }
.lab-map .lm-name { font: 600 15px var(--font-mono); fill: var(--text); }
.lab-map .lm-ip { font: 14px var(--font-mono); fill: var(--accent); }
.lab-map .lm-note { font-size: 13px; fill: var(--muted); }
.lab-map .lm-net { font: 600 13px var(--font-mono); fill: var(--text-2); }
.lab-map .lm-tag { font: 12.5px var(--font-mono); fill: var(--text-2); }
.lab-map .lm-port { fill: var(--muted); }
.lm-box { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1; }
.lm-you { fill: var(--surface-2); stroke-dasharray: 5 4; }
.lm-bus { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.lm-link { stroke: var(--accent); stroke-width: 2; }
.lm-shell { stroke: var(--prompt); stroke-width: 2; }
.lm-forward { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; }
.lm-arrowhead { fill: var(--text-2); }
/* Too small to read on a phone: the table below carries the same facts. */
@media (max-width: 640px) { .lab-map { display: none; } }
.hosts { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.hosts th, .hosts td { padding: 11px 16px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.hosts thead th { border-bottom-color: var(--border-strong); font-size: 14.5px; font-weight: 600; }
.hosts tbody th { font-weight: 400; white-space: nowrap; }
.hosts td { color: var(--text-2); }
.hosts code { color: var(--text); font-size: 13.5px; }
.lab-cmd {
  margin: 16px 0 0; padding: 12px 14px; background: var(--code-bg); overflow-x: auto;
  font-size: 13.5px; line-height: 1.5;
}

/* Reference */
.ref { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 48px; }
.ref-group h3 { margin: 0 0 8px; font-size: 16px; }
.ref-group ul { margin: 0; padding: 0; list-style: none; }
.ref-group li { padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.ref-group li:first-child { border-top: 1px solid var(--border); }

/* Safety */
.safety {
  padding: 12px 16px; border: 1px solid var(--border);
  border-left: 4px solid var(--warn);
}
.safety strong { color: var(--warn); }

/* =========================================================================
   Responsive
   ========================================================================= */
/* Back to top */
.to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 40;
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--border-strong); border-radius: 2px;
  background: var(--surface); color: var(--text-2); cursor: pointer;
}
.to-top:hover { color: var(--text); border-color: var(--accent); }
.to-top[hidden] { display: none; }

@media (max-width: 1280px) {
  .toc { display: none; }
  .markdown .toc-inline { display: block; }
}
@media (max-width: 1080px) {
  .topnav { display: none; }
}
@media (max-width: 960px) {
  .menu-btn { display: inline-grid; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: var(--topbar-h); z-index: 70;
    width: min(var(--sidebar-w), 86vw); height: calc(100vh - var(--topbar-h));
    background: var(--surface); transform: translateX(-100%); visibility: hidden;
    transition: transform .25s var(--ease), visibility .25s;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; visibility: visible; transition: transform .25s var(--ease), visibility 0s; }
  .content { padding: 32px 28px 56px; }
  .module { grid-template-columns: 36px minmax(0, 1fr); }
  .module-meta { grid-column: 2; flex-direction: row; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; text-align: left; white-space: normal; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 10px; gap: 6px; }
  .brand-text { display: none; }
  .brand { margin-right: 0; }
  .search-kbd { display: none; }
  .content { padding: 24px 16px 48px; }
  .landing > * { padding-left: 16px; padding-right: 16px; }
  .landing-intro { padding-top: 24px; }
  .landing-intro h1 { font-size: 26px; }
  .band h2 { font-size: 20px; }
  .module { grid-template-columns: 2em minmax(0, 1fr); gap: 0 10px; }
  .ref { grid-template-columns: minmax(0, 1fr); }
  .hosts thead { display: none; }
  .hosts tbody tr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .hosts th, .hosts td { padding: 0; border: 0; }
  .hosts td:nth-child(n+3) { grid-column: 1 / -1; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .footer-inner { grid-template-columns: minmax(0, 1fr); grid-template-areas: "brand" "legal" "links" "credit"; }
  .footer-links { justify-content: flex-start; }
  .footer-credit { grid-area: credit; text-align: left; }
  .markdown { font-size: 16px; }
  .markdown h2 { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .term-def,
  .topbar, .sidebar, .toc, .toc-inline, .to-top, .scrim, .doc-actions, .pager, .site-footer, .copy-btn, .crumbs,
  .anchor { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .layout { display: block; }
  .content { padding: 0; }
  .page-doc .content > * { max-width: none; }
  .codeblock { border-color: #ccc; break-inside: avoid; }
  .codeblock-bar { display: none; }
  .markdown pre { white-space: pre-wrap; font-size: 9pt; }
  .markdown a { color: #000; text-decoration: underline; }
  .markdown h2 { break-after: avoid; }
}
