/* ============================================================
   Repetier-Server Handbuch — Design System
   IBM Plex Sans / IBM Plex Mono · Repetier blue · light + dark
   ============================================================ */

:root {
  /* Brand — Repetier blue, refined via oklch */
  --brand:        oklch(0.55 0.135 247);
  --brand-strong: oklch(0.47 0.14 248);
  --brand-soft:   oklch(0.95 0.03 247);
  --brand-line:   oklch(0.88 0.05 247);

  /* Neutrals — cool tinted */
  --bg:        oklch(0.985 0.003 247);
  --surface:   oklch(1 0 0);
  --surface-2: oklch(0.975 0.004 247);
  --sidebar:   oklch(0.992 0.003 247);
  --ink:       oklch(0.24 0.012 250);
  --ink-2:     oklch(0.42 0.012 250);
  --ink-3:     oklch(0.56 0.012 250);
  --line:      oklch(0.91 0.006 250);
  --line-2:    oklch(0.945 0.005 250);

  /* Semantic accents (callouts) */
  --tip:    oklch(0.6 0.13 162);
  --tip-bg: oklch(0.97 0.04 162);
  --warn:   oklch(0.62 0.15 62);
  --warn-bg:oklch(0.97 0.05 70);
  --danger: oklch(0.58 0.18 25);
  --danger-bg: oklch(0.97 0.04 25);

  /* Pro/Free badge */
  --pro:    oklch(0.55 0.135 247);

  --radius: 9px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px oklch(0.5 0.02 250 / 0.06), 0 1px 1px oklch(0.5 0.02 250 / 0.04);
  --shadow-md: 0 4px 16px oklch(0.4 0.03 250 / 0.10), 0 1px 3px oklch(0.4 0.03 250 / 0.06);
  --shadow-lg: 0 18px 50px oklch(0.3 0.04 250 / 0.22);

  --sidebar-w: 290px;
  --toc-w: 232px;
  --header-h: 60px;

  --font-sans: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

[data-theme="dark"] {
  --brand:        oklch(0.7 0.13 247);
  --brand-strong: oklch(0.78 0.12 247);
  --brand-soft:   oklch(0.32 0.06 247);
  --brand-line:   oklch(0.4 0.07 247);

  --bg:        oklch(0.205 0.012 257);
  --surface:   oklch(0.245 0.013 257);
  --surface-2: oklch(0.275 0.014 257);
  --sidebar:   oklch(0.225 0.012 257);
  --ink:       oklch(0.94 0.006 250);
  --ink-2:     oklch(0.78 0.008 250);
  --ink-3:     oklch(0.62 0.01 250);
  --line:      oklch(0.34 0.012 257);
  --line-2:    oklch(0.3 0.012 257);

  --tip:    oklch(0.72 0.13 162);
  --tip-bg: oklch(0.32 0.05 162);
  --warn:   oklch(0.78 0.13 70);
  --warn-bg:oklch(0.34 0.05 70);
  --danger: oklch(0.72 0.16 25);
  --danger-bg: oklch(0.33 0.06 25);

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
  --shadow-md: 0 4px 16px oklch(0 0 0 / 0.4);
  --shadow-lg: 0 18px 50px oklch(0 0 0 / 0.55);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================ HEADER ============================ */
.header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px;
  background: color-mix(in oklch, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
  z-index: 50;
}

.brand-lockup { display: flex; align-items: center; gap: 11px; flex-shrink: 0; text-decoration: none; }
.brand-lockup:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px;
  display: grid; place-items: center; flex-shrink: 0;
}
.brand-mark img { width: 30px; height: 30px; display: block; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text b { font-weight: 600; font-size: 15px; color: var(--ink); letter-spacing: -0.01em; white-space: nowrap; }
.brand-text span { font-size: 11px; color: var(--ink-3); font-family: var(--font-mono); letter-spacing: 0.02em; }

.ver-badge {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  color: var(--brand-strong); background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  padding: 2px 8px; border-radius: 100px; flex-shrink: 0;
}

.header-spacer { flex: 1; }

/* Search */
.search {
  position: relative; flex: 0 1 360px; min-width: 0;
}
.search input {
  width: 100%; height: 38px; padding: 0 38px 0 38px;
  font-family: var(--font-sans); font-size: 14px; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); outline: none; transition: border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search .s-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 16px; height: 16px; pointer-events: none; }
.search .s-kbd {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-3);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; background: var(--surface);
}
.search-results {
  position: absolute; top: 46px; left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  max-height: 60vh; overflow-y: auto; padding: 6px; display: none; z-index: 60;
}
.search-results.show { display: block; }
.sr-item { display: block; padding: 9px 12px; border-radius: var(--radius-sm); cursor: pointer; }
.sr-item:hover, .sr-item.active { background: var(--brand-soft); text-decoration: none; }
.sr-item .sr-cat { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.sr-item .sr-title { font-size: 14px; color: var(--ink); font-weight: 500; }
.sr-item mark { background: color-mix(in oklch, var(--brand-soft) 60%, yellow 10%); color: inherit; border-radius: 3px; padding: 0 1px; }
.sr-empty { padding: 18px; text-align: center; color: var(--ink-3); font-size: 14px; }

.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--ink-2); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--brand-soft); color: var(--brand-strong); border-color: var(--brand-line); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .sun { display: none; }
[data-theme="dark"] .icon-btn .sun { display: block; }
[data-theme="dark"] .icon-btn .moon { display: none; }

.menu-toggle { display: none; }

/* ============================ LAYOUT ============================ */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  padding-top: var(--header-h);
  min-height: 100vh;
}

/* ============================ SIDEBAR ============================ */
.sidebar {
  position: sticky; top: var(--header-h);
  align-self: start;
  height: calc(100vh - var(--header-h));
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 22px 14px 60px;
}
.sidebar::-webkit-scrollbar { width: 9px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 2px solid var(--sidebar); }

.nav-group { margin-bottom: 6px; }
.nav-cat {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border: none; background: none; cursor: pointer;
  font-family: var(--font-sans); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3);
  border-radius: var(--radius-sm); text-align: left;
}
.nav-cat:hover { color: var(--ink); }
.nav-cat .cat-ico { width: 16px; height: 16px; color: var(--brand); flex-shrink: 0; }
.nav-cat .chev { margin-left: auto; width: 14px; height: 14px; transition: transform .2s; color: var(--ink-3); }
.nav-group.collapsed .chev { transform: rotate(-90deg); }
.nav-group.collapsed .nav-items { display: none; }

.nav-items { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 8px; padding-left: 13px; border-left: 1px solid var(--line); margin-left: 17px; }
.nav-link {
  display: block; padding: 6px 11px; border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--ink-2); cursor: pointer; line-height: 1.4;
  transition: background .12s, color .12s;
}
.nav-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-link.active { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }

.nav-hint { display: none; }

/* ============================ CONTENT ============================ */
.content { min-width: 0; padding: 38px 60px 120px; }
.article { max-width: 760px; margin: 0 auto; display: none; }
.article.active { display: block; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--ink-3); font-family: var(--font-mono); margin-bottom: 20px; }
.breadcrumb span { white-space: nowrap; }
.breadcrumb svg { width: 13px; height: 13px; opacity: 0.6; }
.breadcrumb .crumb-here { color: var(--ink-2); }

.article h1 {
  font-size: 38px; line-height: 1.12; font-weight: 600; letter-spacing: -0.025em;
  margin: 0 0 14px; color: var(--ink); text-wrap: balance;
}
.article .lede { font-size: 18.5px; line-height: 1.55; color: var(--ink-2); margin: 0 0 14px; text-wrap: pretty; }

.article h2 {
  font-size: 25px; font-weight: 600; letter-spacing: -0.018em; line-height: 1.25;
  margin: 52px 0 14px; padding-top: 8px; color: var(--ink); scroll-margin-top: 80px;
}
.article h2:first-of-type { margin-top: 34px; }
.article h3 {
  font-size: 18px; font-weight: 600; margin: 34px 0 10px; color: var(--ink);
  scroll-margin-top: 80px; letter-spacing: -0.01em;
}
.article p { margin: 0 0 16px; color: var(--ink-2); text-wrap: pretty; }
.article ul, .article ol { margin: 0 0 18px; padding-left: 22px; color: var(--ink-2); }
.article li { margin-bottom: 7px; }
.article li::marker { color: var(--ink-3); }
.article strong { color: var(--ink); font-weight: 600; }
.article hr { border: none; border-top: 1px solid var(--line); margin: 44px 0; }

.article code:not(pre code) {
  font-family: var(--font-mono); font-size: 0.86em; color: var(--brand-strong);
  background: var(--brand-soft); border: 1px solid var(--brand-line);
  padding: 1px 6px; border-radius: 5px; white-space: nowrap;
}

/* Section divider label */
.eyebrow {
  font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--brand);
  margin: 0 0 10px;
}

/* Lede meta row */
.meta-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 20px 0 8px; padding-bottom: 26px; border-bottom: 1px solid var(--line); }

.badge {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  padding: 3px 9px; border-radius: 100px; display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid transparent; white-space: nowrap;
}
.badge.pro { color: #fff; background: var(--pro); box-shadow: 0 1px 4px oklch(0.55 0.135 247 / 0.4); }
[data-theme="dark"] .badge.pro { color: oklch(0.18 0.01 257); }
.badge.free { color: var(--ink-2); background: var(--surface-2); border-color: var(--line); }
.badge.time { color: var(--ink-3); background: transparent; border: none; padding-left: 0; }
.badge.time svg { width: 14px; height: 14px; }

/* ====== Callouts ====== */
.callout {
  display: flex; gap: 13px; padding: 15px 17px; border-radius: var(--radius);
  margin: 22px 0; border: 1px solid var(--line); background: var(--surface-2);
  font-size: 14.5px; line-height: 1.6;
}
.callout .co-ico { flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px; }
.callout .co-body { min-width: 0; }
.callout .co-body > *:last-child { margin-bottom: 0; }
.callout .co-title { font-weight: 600; color: var(--ink); margin: 0 0 3px; font-size: 14px; }
.callout p { margin-bottom: 8px; color: var(--ink-2); }
.callout.note { background: var(--brand-soft); border-color: var(--brand-line); }
.callout.note .co-ico, .callout.note .co-title { color: var(--brand-strong); }
.callout.tip { background: var(--tip-bg); border-color: color-mix(in oklch, var(--tip) 35%, transparent); }
.callout.tip .co-ico, .callout.tip .co-title { color: var(--tip); }
.callout.warn { background: var(--warn-bg); border-color: color-mix(in oklch, var(--warn) 40%, transparent); }
.callout.warn .co-ico, .callout.warn .co-title { color: var(--warn); }
.callout.danger { background: var(--danger-bg); border-color: color-mix(in oklch, var(--danger) 40%, transparent); }
.callout.danger .co-ico, .callout.danger .co-title { color: var(--danger); }

/* ====== Steps ====== */
.steps { list-style: none; counter-reset: step; padding: 0; margin: 24px 0; }
.steps > li {
  position: relative; padding: 0 0 24px 46px; margin: 0; counter-increment: step;
}
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: -2px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-family: var(--font-mono);
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .steps > li::before { color: oklch(0.18 0.01 257); }
.steps > li::after {
  content: ""; position: absolute; left: 15px; top: 32px; bottom: 4px; width: 1.5px;
  background: var(--line); 
}
.steps > li:last-child::after { display: none; }
.steps > li .step-title { font-weight: 600; color: var(--ink); display: block; margin-bottom: 4px; }
.steps > li > *:last-child { margin-bottom: 0; }

/* ====== Image placeholders / figures ====== */
figure { margin: 26px 0; }
.shot {
  position: relative; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); background:
    repeating-linear-gradient(135deg, var(--surface-2) 0 11px, var(--surface) 11px 22px);
  display: grid; place-items: center; cursor: zoom-in;
  transition: border-color .15s, box-shadow .15s;
}
.shot:hover { border-color: var(--brand-line); box-shadow: var(--shadow-md); }
.shot::before {
  content: attr(data-label); font-family: var(--font-mono); font-size: 12.5px;
  color: var(--ink-3); background: var(--surface); padding: 7px 13px;
  border-radius: 100px; border: 1px solid var(--line); max-width: 80%; text-align: center;
}
.shot .shot-tag {
  position: absolute; top: 10px; left: 10px; font-family: var(--font-mono); font-size: 10.5px;
  color: var(--ink-3); background: color-mix(in oklch, var(--surface) 80%, transparent);
  border: 1px solid var(--line); padding: 2px 8px; border-radius: 5px; backdrop-filter: blur(4px);
}
.shot .shot-zoom {
  position: absolute; top: 10px; right: 10px; width: 26px; height: 26px; border-radius: 6px;
  background: color-mix(in oklch, var(--surface) 80%, transparent); border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--ink-3); opacity: 0; transition: opacity .15s; backdrop-filter: blur(4px);
}
.shot:hover .shot-zoom { opacity: 1; }
.shot.r16-9 { aspect-ratio: 16/9; }
.shot.r16-10 { aspect-ratio: 16/10; }
.shot.r4-3 { aspect-ratio: 4/3; }
.shot.r21-9 { aspect-ratio: 21/9; }
figcaption { font-size: 13px; color: var(--ink-3); margin-top: 9px; text-align: center; font-style: italic; }
.fig-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 26px 0; }
.fig-row figure { margin: 0; }

/* ====== Code blocks ====== */
.code {
  position: relative; margin: 22px 0; border-radius: var(--radius);
  background: oklch(0.22 0.012 257); border: 1px solid oklch(0.3 0.012 257); overflow: hidden;
}
.code-head {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  background: oklch(0.26 0.013 257); border-bottom: 1px solid oklch(0.3 0.012 257);
}
.code-head .dot { width: 9px; height: 9px; border-radius: 50%; }
.code-head .file { font-family: var(--font-mono); font-size: 12px; color: oklch(0.7 0.01 250); margin-left: 4px; }
.code-head .copy {
  margin-left: auto; font-family: var(--font-mono); font-size: 11.5px; color: oklch(0.72 0.01 250);
  background: oklch(0.3 0.012 257); border: 1px solid oklch(0.36 0.012 257); border-radius: 5px;
  padding: 3px 9px; cursor: pointer; display: flex; align-items: center; gap: 5px; transition: all .15s;
}
.code-head .copy:hover { background: oklch(0.36 0.012 257); color: #fff; }
.code-head .copy svg { width: 12px; height: 12px; }
.code pre { margin: 0; padding: 15px 16px; overflow-x: auto; }
.code code { font-family: var(--font-mono); font-size: 13px; line-height: 1.7; color: oklch(0.88 0.01 250); }
.code .c-cmd { color: oklch(0.82 0.12 162); }
.code .c-cmt { color: oklch(0.6 0.02 250); font-style: italic; }
.code .c-key { color: oklch(0.78 0.13 247); }
.code .c-num { color: oklch(0.8 0.12 62); }

/* ====== Tables ====== */
.table-wrap { margin: 22px 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-3); background: var(--surface-2); padding: 11px 16px; border-bottom: 1px solid var(--line);
}
tbody td { padding: 11px 16px; border-bottom: 1px solid var(--line-2); color: var(--ink-2); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td code, th code { font-family: var(--font-mono); font-size: 12.5px; color: var(--brand-strong); }

/* ====== kbd ====== */
kbd {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 7px; box-shadow: var(--shadow-sm);
}

/* ====== Feature cards (home) ====== */
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 28px 0; }
.feat-card {
  display: block; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.feat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--brand-line); text-decoration: none; }
.feat-card .fc-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-strong); display: grid; place-items: center; margin-bottom: 13px; }
.feat-card .fc-ico svg { width: 19px; height: 19px; }
.feat-card h3 { margin: 0 0 5px; font-size: 16px; }
.feat-card p { margin: 0; font-size: 13.5px; color: var(--ink-3); line-height: 1.5; }

/* Article footer nav */
.article-foot {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 60px;
  padding-top: 28px; border-top: 1px solid var(--line);
}
.foot-link {
  display: flex; flex-direction: column; gap: 3px; padding: 14px 18px; border: 1px solid var(--line);
  border-radius: var(--radius); cursor: pointer; transition: border-color .15s, background .15s;
}
.foot-link:hover { border-color: var(--brand-line); background: var(--brand-soft); text-decoration: none; }
.foot-link.next { text-align: right; align-items: flex-end; }
.foot-link .fl-dir { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.foot-link .fl-title { font-size: 15px; font-weight: 600; color: var(--brand-strong); }
.foot-link.placeholder { visibility: hidden; }

/* ============================ TOC ============================ */
.toc {
  position: sticky; top: var(--header-h); align-self: start;
  height: calc(100vh - var(--header-h)); overflow-y: auto;
  padding: 40px 22px 60px; border-left: 1px solid var(--line);
}
.toc-title { font-family: var(--font-mono); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-bottom: 13px; }
.toc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.toc-list a { display: block; padding: 5px 12px; font-size: 13px; color: var(--ink-3); border-left: 2px solid var(--line-2); margin-left: -2px; line-height: 1.4; transition: color .12s, border-color .12s; }
.toc-list a:hover { color: var(--ink); text-decoration: none; }
.toc-list a.sub { padding-left: 24px; font-size: 12.5px; }
.toc-list a.active { color: var(--brand-strong); border-left-color: var(--brand); font-weight: 600; }

/* ============================ LIGHTBOX ============================ */
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: oklch(0.15 0.01 257 / 0.82);
  backdrop-filter: blur(6px); display: none; place-items: center; padding: 5vh 5vw;
}
.lightbox.show { display: grid; animation: fade .2s; }
.lightbox-inner {
  width: min(1100px, 92vw); aspect-ratio: 16/9; border-radius: 12px; position: relative;
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 16px, var(--surface) 16px 32px);
  border: 1px solid var(--line); display: grid; place-items: center; box-shadow: var(--shadow-lg);
}
.lightbox-inner::before { content: attr(data-label); font-family: var(--font-mono); font-size: 15px; color: var(--ink-3); background: var(--surface); padding: 10px 18px; border-radius: 100px; border: 1px solid var(--line); }
.lightbox-close { position: absolute; top: -44px; right: 0; color: #fff; background: none; border: none; cursor: pointer; display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 13px; }
.lightbox-close svg { width: 22px; height: 22px; }

/* progress bar */
.progress { position: fixed; top: 0; left: 0; height: 2px; background: var(--brand); z-index: 60; width: 0; transition: width .1s; }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 1180px) {
  :root { --toc-w: 0px; }
  .toc { display: none; }
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .content { padding: 34px 44px 110px; }
}
@media (max-width: 900px) {
  .menu-toggle { display: grid; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: var(--header-h); left: 0; bottom: 0; width: 300px; z-index: 45;
    transform: translateX(-105%); transition: transform .25s ease; box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  .nav-scrim { position: fixed; inset: var(--header-h) 0 0; background: oklch(0.15 0.01 257 / 0.4); z-index: 44; opacity: 0; pointer-events: none; transition: opacity .25s; }
  body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  .content { padding: 28px 22px 90px; }
  .ver-badge { display: none; }
  .brand-text span { display: none; }
}
@media (max-width: 560px) {
  .article h1 { font-size: 30px; }
  .article .lede { font-size: 16.5px; }
  .card-grid, .fig-row, .article-foot { grid-template-columns: 1fr; }
  .search { flex-basis: 140px; }
  .search .s-kbd { display: none; }
}

/* ============================================================
   MANUAL ADDITIONS — local fonts, real images, legacy markup,
   language selector, real-image lightbox. (Repetier-Server)
   ============================================================ */

/* ---- Language selector (header) ---- */
.lang-wrap { position: relative; flex-shrink: 0; }
.lang-btn {
  height: 38px; display: inline-flex; align-items: center; gap: 7px;
  padding: 0 11px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--ink-2); cursor: pointer;
  font-family: var(--font-sans); font-size: 13px; transition: background .15s, color .15s, border-color .15s;
}
.lang-btn:hover { background: var(--brand-soft); color: var(--brand-strong); border-color: var(--brand-line); }
.lang-btn svg { width: 16px; height: 16px; }
.lang-btn .lang-code { font-family: var(--font-mono); text-transform: uppercase; font-size: 12px; }
.lang-btn .chev { width: 13px; height: 13px; opacity: .7; }
.lang-menu {
  position: absolute; top: 44px; right: 0; min-width: 160px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 60;
}
.lang-menu.show { display: block; }
.lang-menu a {
  display: flex; align-items: center; gap: 9px; padding: 8px 11px; border-radius: var(--radius-sm);
  font-size: 14px; color: var(--ink-2); cursor: pointer;
}
.lang-menu a:hover { background: var(--brand-soft); color: var(--brand-strong); text-decoration: none; }
.lang-menu a.active { color: var(--brand-strong); font-weight: 600; }
.lang-menu a .lc { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; color: var(--ink-3); margin-left: auto; }

/* ---- Content loading / empty state ---- */
.content-loading, .content-empty {
  max-width: 760px; margin: 80px auto; text-align: center; color: var(--ink-3); font-size: 15px;
}
.content-loading .spin {
  width: 26px; height: 26px; margin: 0 auto 14px; border: 2.5px solid var(--line);
  border-top-color: var(--brand); border-radius: 50%; animation: rs-spin .7s linear infinite;
}
@keyframes rs-spin { to { transform: rotate(360deg); } }

/* ---- Real images (converted from legacy manual) ---- */
.article figure.manual-fig { margin: 26px 0; text-align: center; }
.article img.manual-img, .article figure.manual-fig img {
  display: block; max-width: 100%; height: auto; margin: 16px auto;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-2); cursor: zoom-in; transition: border-color .15s, box-shadow .15s;
}
.article img.manual-img:hover, .article figure.manual-fig img:hover {
  border-color: var(--brand-line); box-shadow: var(--shadow-md);
}
.article figure.manual-fig img { margin: 0 auto; }
/* inline-flow images inside list items keep their own spacing */
.article li img.manual-img { margin: 10px 0; }

/* ---- Legacy <pre><code> blocks (plain code, no design header) ---- */
.article pre {
  position: relative; margin: 22px 0; padding: 15px 44px 15px 16px; overflow-x: auto;
  background: oklch(0.22 0.012 257); border: 1px solid oklch(0.3 0.012 257);
  border-radius: var(--radius); -webkit-overflow-scrolling: touch;
}
.article pre code {
  font-family: var(--font-mono); font-size: 13px; line-height: 1.7;
  color: oklch(0.88 0.01 250); background: none; border: none; padding: 0;
  white-space: pre; display: inline;
}
.article pre .pre-copy {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 6px;
  display: grid; place-items: center; cursor: pointer;
  background: oklch(0.3 0.012 257); border: 1px solid oklch(0.36 0.012 257); color: oklch(0.75 0.01 250);
  transition: background .15s, color .15s;
}
.article pre .pre-copy:hover { background: oklch(0.36 0.012 257); color: #fff; }
.article pre .pre-copy svg { width: 14px; height: 14px; }
.article pre .pre-copy.done { color: var(--tip); }

/* Light theme: the block above is dark-on-dark here (text without a <code> child
   inherits the light body ink), so give it a light card look instead. */
[data-theme="light"] .article pre {
  background: var(--surface-2); border-color: var(--line);
}
[data-theme="light"] .article pre,
[data-theme="light"] .article pre code { color: var(--ink); }
[data-theme="light"] .article pre .pre-copy {
  background: var(--surface); border-color: var(--line); color: var(--ink-3);
}
[data-theme="light"] .article pre .pre-copy:hover { background: var(--line); color: var(--ink); }

/* ---- Icon fonts (Font Awesome / Repetier) used inside content ---- */
.article .fa { color: var(--brand); }
.article h2 .fa, .article h3 .fa, .article h4 .fa { margin-right: 7px; }
.article .rs { color: var(--brand); }
.article strong .fa, .article a .fa { color: inherit; }

/* legacy helper classes from old manual still present in some snippets */
.article .label { display:inline-block; padding:2px 7px; border-radius:5px; font-family:var(--font-mono); font-size:12px; background:var(--surface-2); border:1px solid var(--line); color:var(--ink-2); }

/* ---- Article h4 (legacy depth) ---- */
.article h4 { font-size: 15.5px; font-weight: 600; margin: 24px 0 8px; color: var(--ink); letter-spacing: -0.005em; scroll-margin-top: 80px; }

/* ---- Real-image lightbox ---- */
.lightbox-inner.has-img {
  background: none; border: none; aspect-ratio: auto; box-shadow: none;
  width: auto; max-width: 92vw;
}
.lightbox-inner.has-img::before { content: none; }
.lightbox-inner img { display: block; max-width: 92vw; max-height: 86vh; border-radius: 12px; box-shadow: var(--shadow-lg); background: var(--surface); }

/* ============================ PRINT ============================ */
/* Print only the article, in plain black-on-white (no grey shades),
   independent of the chosen theme. */
@media print {
  html, html[data-theme="dark"] {
    --bg: #fff; --surface: #fff; --surface-2: #fff;
    --ink: #000; --ink-2: #000; --ink-3: #000;
    --brand: #000; --brand-strong: #000;
    background: #fff;
  }
  body { background: #fff; color: #000; }

  /* Drop all chrome — header, sidebars, navigation and the prev/next
     footer make no sense on paper. */
  .progress, .header, .nav-scrim, .sidebar, .toc,
  .article-foot, .lightbox { display: none !important; }

  /* Single full-width reading column. */
  .layout { display: block; padding-top: 0; min-height: 0; }
  .content { padding: 0; }

  /* Force black text everywhere in the article — no grey gradients. */
  .article, .article p, .article li, .article ul, .article ol,
  .article h1, .article h2, .article h3, .article h4,
  .article strong, .article .lede, .article a,
  .breadcrumb, .breadcrumb .crumb-here, .eyebrow,
  .callout, .callout p, .callout .co-title, .steps > li .step-title {
    color: #000 !important;
  }
  a { color: #000 !important; text-decoration: none; }

  /* Inline code: black on white, keep a thin outline for legibility. */
  .article code:not(pre code) {
    color: #000 !important; background: #fff !important; border: 1px solid #999;
  }

  /* Code cards / blocks: invert from dark theme to printable black-on-white. */
  .code, .code-head, .code pre, .code code,
  .code .c-cmd, .code .c-cmt, .code .c-key, .code-head .file,
  .article pre, .article pre code {
    background: #fff !important; color: #000 !important;
  }
  .code, .article pre { border: 1px solid #999 !important; }
  .code-head { border-bottom: 1px solid #999 !important; }
  .code-head .dot, .code-head .copy, .article pre .pre-copy { display: none !important; }

  /* Keep figures, callouts and code from splitting across pages. */
  .article h1, .article h2, .article h3, .article h4 { break-after: avoid; }
  .article pre, .code, .callout, .shot, figure { break-inside: avoid; }
}
