/* DerZ documentation */
:root {
  --brand: #038f5c;
  --brand-dark: #02734a;
  --brand-soft: #e7f5ef;
  --ink: #1f2a37;
  --ink-2: #4b5563;
  --ink-3: #6b7280;
  --line: #e5e7eb;
  --bg: #ffffff;
  --bg-2: #f7f9fa;
  --side-w: 290px;
  --top-h: 60px;
  --note: #2563eb;
  --note-bg: #eff6ff;
  --tip: #038f5c;
  --tip-bg: #ecfdf5;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top-h) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.7 "Signika", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
html { scrollbar-width: thin; scrollbar-color: var(--brand) #eef2f1; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: #eef2f1; }
::-webkit-scrollbar-thumb { background: var(--brand); border-radius: 10px; border: 2px solid #eef2f1; }
::-webkit-scrollbar-thumb:hover { background: var(--brand-dark); }
.search-results { scrollbar-width: thin; }
a:hover { text-decoration: underline; }
code, kbd { font-family: "JetBrains Mono", Consolas, monospace; font-size: .86em; }
code { background: var(--bg-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }
kbd { display: inline-block; min-width: 24px; text-align: center; padding: 1px 7px; border: 1px solid #cfd5dc; border-bottom-width: 3px; border-radius: 6px; background: #fff; color: var(--ink); }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--top-h); z-index: 30;
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: rgba(255,255,255,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--ink); width: calc(var(--side-w) - 40px); }
.topbar .brand img { height: 36px; }
.topbar .brand span { font-size: 13px; font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 2px 9px; border-radius: 20px; }
.topbar .search { flex: 1; max-width: 460px; position: relative; }
.topbar .search input {
  width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 20px; padding: 0 14px 0 38px;
  font: inherit; font-size: 14px; background: var(--bg-2); outline: none;
}
.topbar .search input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px var(--brand-soft); }
.topbar .search i { position: absolute; left: 14px; top: 11px; color: var(--ink-3); font-size: 14px; }
.topbar .links { margin-left: auto; display: flex; gap: 18px; font-size: 14px; font-weight: 700; }
.topbar .links a { color: var(--ink-2); }
.menu-btn { display: none; border: 0; background: none; font-size: 20px; color: var(--ink); cursor: pointer; padding: 6px; }
.search-results {
  position: absolute; top: 44px; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(0,0,0,.12); max-height: 60vh; overflow: auto; display: none;
}
.search-results.open { display: block; }
.search-results a { display: block; padding: 9px 14px; color: var(--ink); border-bottom: 1px solid var(--line); font-size: 14px; }
.search-results a small { display: block; color: var(--ink-3); font-size: 12px; }
.search-results a:hover, .search-results a.active { background: var(--brand-soft); text-decoration: none; }
.search-results .empty { padding: 12px 14px; color: var(--ink-3); font-size: 14px; }

/* ---------- sidebar (as the DerZ app sidebar) ---------- */
.sidebar {
  position: fixed; top: var(--top-h); bottom: 0; left: 0; width: var(--side-w); z-index: 20;
  overflow-y: auto; padding: 4px 5px 40px 0; background: #fff; border-right: 1px solid var(--line);
  font-size: 13.5px;
  scrollbar-width: thin; scrollbar-color: transparent transparent;
}
.sidebar:hover { scrollbar-color: var(--brand) transparent; }
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: transparent; border-radius: 4px; }
.sidebar:hover::-webkit-scrollbar-thumb { background: var(--brand); }
.sidebar .group { border-bottom: 1px solid #e8e8e8; }
.sidebar .group > a {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 40px 9px 18px;
  color: #0e0e0e; font-weight: 600; transition: background-color .2s, box-shadow .2s;
}
.sidebar .group > a:hover, .sidebar .group.open > a { background: #fafafa; text-decoration: none; }
.sidebar .group > a.active { box-shadow: 3px 0 0 var(--brand) inset; }
.sidebar .group > a i.ic {
  flex: none; width: 30px; height: 30px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center;
  background: #fff; color: #02361c; font-size: 14px; box-shadow: -3px 4px 20px rgba(0,0,0,.1); transition: color .2s;
}
.sidebar .group > a.active i.ic { color: var(--brand); }
/* + / − like the app, the vertical bar folds away when open */
.sidebar .pm { position: absolute; right: 16px; top: 50%; width: 10px; height: 10px; margin-top: -5px; }
.sidebar .pm::before, .sidebar .pm::after { content: ""; position: absolute; background: #abb4be; border-radius: 1px; transition: transform .3s ease, background-color .2s; }
.sidebar .pm::before { left: 0; right: 0; top: 4px; height: 2px; }
.sidebar .pm::after { top: 0; bottom: 0; left: 4px; width: 2px; }
.sidebar .group.open .pm::after { transform: scaleY(0); }
.sidebar .group > a:hover .pm::before, .sidebar .group > a:hover .pm::after { background: var(--brand); }
/* children: slide open / closed */
.sidebar .sub { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s ease; }
.sidebar .group.open > .sub { grid-template-rows: 1fr; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar .sub > ul { min-height: 0; overflow: hidden; background: #f6f6f6; box-shadow: 0 -3px 3px -3px rgba(0,0,0,.1) inset; }
.sidebar .sub > ul > li:first-child { margin-top: 8px; }
.sidebar .sub > ul > li:last-child { margin-bottom: 8px; }
.sidebar li a { display: block; padding: 6px 15px 6px 34px; color: #0e0e0e; font-weight: 500; position: relative; transition: color .2s, background-color .2s; }
.sidebar li a::before { content: ""; position: absolute; left: 22px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: #c4ccd3; transition: background-color .2s; }
.sidebar li li a { padding-left: 50px; font-size: 12.5px; color: #555; }
.sidebar li li a::before { left: 38px; width: 4px; height: 4px; margin-top: -2px; }
.sidebar li a:hover { background: #fff; color: var(--brand); text-decoration: none; }
.sidebar li a.active { color: var(--brand); font-weight: 600; background: #fff; }
.sidebar li a.active::before, .sidebar li a:hover::before { background: var(--brand); }

/* ---------- content ---------- */
.main { margin-left: var(--side-w); padding: calc(var(--top-h) + 28px) 48px 80px; }
.content { max-width: 980px; margin: 0 auto; }
.chapter { padding-top: 12px; margin-bottom: 56px; }
.chapter + .chapter { border-top: 1px solid var(--line); padding-top: 44px; }
.eyebrow { color: var(--brand); font-weight: 800; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 4px; }
h1 { font-size: 34px; line-height: 1.2; margin: 0 0 12px; letter-spacing: -.01em; }
h2 { font-size: 26px; line-height: 1.25; margin: 0 0 10px; display: flex; align-items: center; gap: 12px; }
h2 .h-ic { width: 42px; height: 42px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-size: 18px; flex: none; }
h3 { font-size: 20px; margin: 38px 0 8px; padding-top: 4px; }
h4 { font-size: 16px; margin: 26px 0 6px; color: var(--ink); }
h2 a.anchor, h3 a.anchor, h4 a.anchor { opacity: 0; font-size: .7em; margin-left: 6px; color: var(--ink-3); }
h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor { opacity: 1; }
p { margin: 0 0 14px; color: var(--ink-2); }
.lead { font-size: 18px; color: var(--ink-2); }
ul.list, ol.steps { color: var(--ink-2); padding-left: 22px; margin: 0 0 16px; }
ul.list li, ol.steps li { margin-bottom: 6px; }
ol.steps { counter-reset: s; list-style: none; padding-left: 0; }
ol.steps > li { counter-increment: s; position: relative; padding-left: 40px; min-height: 28px; }
ol.steps > li::before {
  content: counter(s); position: absolute; left: 0; top: 1px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center;
}
b, strong { color: var(--ink); }
.ui { font-weight: 700; color: var(--ink); background: #f1f5f4; border: 1px solid #dfe7e4; border-radius: 6px; padding: 0 6px; white-space: nowrap; font-size: .93em; }
.path { font-size: 13px; font-weight: 700; color: var(--ink-3); margin: -2px 0 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.path i { font-size: 10px; }
.path span { background: var(--bg-2); border: 1px solid var(--line); padding: 1px 9px; border-radius: 20px; }

/* figures */
figure.shot { margin: 18px 0 24px; }
figure.shot a { display: block; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: 0 10px 28px rgba(16,24,40,.08); background: #fff; }
figure.shot img { display: block; width: 100%; height: auto; transition: transform .25s; }
figure.shot a:hover img { transform: scale(1.01); }
figure.shot figcaption { font-size: 13px; color: var(--ink-3); margin-top: 8px; text-align: center; }
.shots-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.shots-2 figure.shot { margin: 8px 0; }

/* callouts */
.callout { display: flex; gap: 12px; border-radius: var(--radius); padding: 12px 16px; margin: 16px 0 20px; font-size: 15px; border: 1px solid; }
.callout i { margin-top: 5px; }
.callout p { margin: 0; color: inherit; }
.callout.note { background: var(--note-bg); border-color: #bfdbfe; color: #1e3a8a; }
.callout.tip { background: var(--tip-bg); border-color: #a7f3d0; color: #065f46; }
.callout.warn { background: var(--warn-bg); border-color: #fde68a; color: #78350f; }
.callout b { color: inherit; }

/* tables */
.tbl-wrap { overflow-x: auto; margin: 12px 0 22px; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--bg-2); font-weight: 800; color: var(--ink); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 700; color: var(--ink); white-space: nowrap; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin: 18px 0 26px; }
.card { display: block; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: #fff; color: var(--ink); transition: border-color .2s, box-shadow .2s, transform .2s; }
.card:hover { text-decoration: none; border-color: var(--brand); box-shadow: 0 8px 22px rgba(3,143,92,.12); transform: translateY(-2px); }
.card i { font-size: 20px; color: var(--brand); margin-bottom: 8px; display: block; }
.card b { display: block; margin-bottom: 2px; }
.card small { color: var(--ink-3); font-size: 13px; line-height: 1.5; display: block; }

.hero { background: linear-gradient(135deg, #f0faf5 0%, #fff 60%); border: 1px solid var(--line); border-radius: 16px; padding: 34px 36px; margin-bottom: 30px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle, rgba(3,143,92,.16), transparent 70%); }
.hero .badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.hero .badges span { font-size: 13px; font-weight: 700; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 4px 12px; color: var(--ink-2); }
.hero .badges i { color: var(--brand); margin-right: 5px; }

.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 28px; }
.pager a { flex: 1; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; color: var(--ink); font-weight: 700; }
.pager a small { display: block; color: var(--ink-3); font-weight: 600; font-size: 12px; }
.pager a.next { text-align: right; }
.pager a:hover { border-color: var(--brand); text-decoration: none; }

footer.foot { margin-top: 60px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

.to-top { position: fixed; right: 22px; bottom: 22px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; cursor: pointer; box-shadow: 0 6px 16px rgba(3,143,92,.35); opacity: 0; pointer-events: none; transition: opacity .2s; }
.to-top.show { opacity: 1; pointer-events: auto; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(10,20,16,.86); display: none; align-items: center; justify-content: center; padding: 30px; cursor: zoom-out; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox .cap { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #e5e7eb; font-size: 14px; }
mark { background: #fef08a; padding: 0 2px; border-radius: 3px; }

.backdrop { display: none; }

@media (max-width: 1100px) {
  .main { padding-left: 28px; padding-right: 28px; }
}
@media (max-width: 900px) {
  .menu-btn { display: block; }
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar .brand { width: auto; }
  .topbar .brand span, .topbar .links { display: none; }
  .sidebar { transform: translateX(-100%); transition: transform .3s ease; box-shadow: 0 0 40px rgba(0,0,0,.15); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; animation: fade .3s ease; position: fixed; inset: var(--top-h) 0 0 0; background: rgba(0,0,0,.3); z-index: 15; }
  .main { margin-left: 0; padding: calc(var(--top-h) + 18px) 16px 60px; }
  h1 { font-size: 27px; } h2 { font-size: 22px; } h3 { font-size: 18px; }
  .hero { padding: 24px 20px; }
  .shots-2 { grid-template-columns: 1fr; }
  td:first-child { white-space: normal; }
}
@media print {
  .topbar, .sidebar, .to-top, .pager { display: none !important; }
  .main { margin: 0; padding: 0; }
  figure.shot { break-inside: avoid; }
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
