/* CLEM Help: the guide's stylesheet. The palette is the app's (src/renderer/index.css):
   dark by default, light under <html data-theme="light">; with no choice saved, the
   operating system's preference picks one (assets/help.js sets data-theme early). */

@font-face {
  font-family: "Roboto Condensed";
  src: url("RobotoCondensed-Regular.ttf");
  font-display: swap;
}

:root {
  --c-page: #2e3349;
  --c-panel: #181e36;
  --c-sidebar: #181e36;
  --c-line: #454d6d;
  --c-line-soft: #3a4160;
  --c-text: #d0d3e1;
  --c-strong: #ffffff;
  --c-muted: #8c92ad;
  --c-code-bg: #232842;
  --c-code: #e8eaf3;
  --c-hover: #3a4060;
  --c-accent: #7cc7ff;
  --c-accent-strong: #a9dbff;
  --c-var: #ffcb6b;
  --c-ok: #2ea043;
  --c-warn: #f0c36a;
  --c-error: #ff8080;
  --c-tip-bg: rgba(46, 160, 67, 0.12);
  --c-note-bg: rgba(124, 199, 255, 0.10);
  --c-warn-bg: rgba(240, 195, 106, 0.12);
  --c-mark: rgba(255, 203, 107, 0.28);
  --c-shadow: rgba(0, 0, 0, 0.35);
  --method-get: #6bdc8f;
  --method-post: #f2b46d;
  --method-put: #7cc7ff;
  --method-patch: #c792ea;
  --method-delete: #ff8080;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --c-page: #ffffff;
  --c-panel: #f4f5fa;
  --c-sidebar: #f7f8fc;
  --c-line: #c9cee0;
  --c-line-soft: #e3e6f0;
  --c-text: #2e3349;
  --c-strong: #181e36;
  --c-muted: #6b7190;
  --c-code-bg: #f4f5fa;
  --c-code: #2e3349;
  --c-hover: #eceef6;
  --c-accent: #1d6fb8;
  --c-accent-strong: #15528a;
  --c-var: #b45309;
  --c-ok: #2f855a;
  --c-warn: #b7791f;
  --c-error: #d64545;
  --c-tip-bg: rgba(47, 133, 90, 0.08);
  --c-note-bg: rgba(29, 111, 184, 0.07);
  --c-warn-bg: rgba(183, 121, 31, 0.09);
  --c-mark: rgba(180, 83, 9, 0.16);
  --c-shadow: rgba(24, 30, 54, 0.14);
  --method-get: #15803d;
  --method-post: #b45309;
  --method-put: #1d6fb8;
  --method-patch: #7c3aed;
  --method-delete: #c53030;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--c-page);
  color: var(--c-text);
  font: 16px/1.65 -apple-system, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--c-accent); text-decoration: none; }
a:hover { color: var(--c-accent-strong); text-decoration: underline; }

/* ------------------------------------------------------------------ top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 56px;
  padding: 0 16px;
  background: var(--c-sidebar);
  border-bottom: 1px solid var(--c-line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--c-strong); font-family: "Roboto Condensed", sans-serif; font-size: 20px; white-space: nowrap; }
.brand:hover { text-decoration: none; color: var(--c-strong); }
.brand img { width: 30px; height: 30px; }
.brand .brandSub { color: var(--c-muted); font-size: 16px; }
.topbar .spacer { flex: 1; }
.menuToggle, .themeToggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--c-line);
  border-radius: 6px;
  background: transparent;
  color: var(--c-text);
  font-size: 17px;
  cursor: pointer;
}
.menuToggle:hover, .themeToggle:hover { background: var(--c-hover); color: var(--c-strong); }
.menuToggle { display: none; }

.searchBox { position: relative; width: min(360px, 40vw); }
.searchBox input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--c-line);
  border-radius: 6px;
  background: var(--c-page);
  color: var(--c-strong);
  font: inherit;
  font-size: 15px;
}
.searchBox input:focus { outline: 2px solid var(--c-accent); outline-offset: -1px; }
.searchBox::before { content: "⌕"; position: absolute; left: 11px; top: 4px; color: var(--c-muted); font-size: 19px; pointer-events: none; }
.searchResults {
  position: absolute;
  top: 42px;
  right: 0;
  width: min(520px, calc(100vw - 24px));
  max-height: 70vh;
  overflow: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--c-panel);
  border: 1px solid var(--c-line);
  border-radius: 8px;
  box-shadow: 0 10px 30px var(--c-shadow);
}
.searchResults[hidden] { display: none; }
.searchResults a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--c-text); }
.searchResults a:hover, .searchResults a.active { background: var(--c-hover); text-decoration: none; }
.searchResults .rTitle { color: var(--c-strong); font-weight: 600; }
.searchResults .rPage { color: var(--c-muted); font-size: 13px; }
.searchResults .rText { display: block; color: var(--c-muted); font-size: 14px; line-height: 1.45; }
.searchResults mark { background: var(--c-mark); color: inherit; border-radius: 2px; }
.searchResults .rNone { padding: 10px; color: var(--c-muted); }

/* ------------------------------------------------------------------ layout */
.layout { display: flex; align-items: flex-start; }

.sidebar {
  position: sticky;
  top: 56px;
  flex: none;
  width: 280px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 18px 12px 40px;
  background: var(--c-sidebar);
  border-right: 1px solid var(--c-line);
}
.sidebar h2 { margin: 18px 10px 6px; color: var(--c-muted); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.sidebar h2:first-child { margin-top: 0; }
.sidebar ul { margin: 0; padding: 0; list-style: none; }
.sidebar a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--c-text); font-size: 15px; line-height: 1.4; }
.sidebar a:hover { background: var(--c-hover); color: var(--c-strong); text-decoration: none; }
.sidebar a.current { background: var(--c-hover); color: var(--c-strong); box-shadow: inset 3px 0 0 var(--c-accent); }

.content { flex: 1; min-width: 0; padding: 36px 48px 80px; }
.article { max-width: 860px; margin: 0 auto; }

.toc {
  position: sticky;
  top: 76px;
  flex: none;
  width: 220px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  margin: 36px 16px 0 0;
  font-size: 14px;
}
.toc[hidden] { display: none; }
.toc h2 { margin: 0 0 8px; color: var(--c-muted); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.toc ul { margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--c-line); }
.toc a { display: block; padding: 3px 0 3px 12px; color: var(--c-muted); line-height: 1.4; }
.toc a:hover, .toc a.current { color: var(--c-strong); text-decoration: none; }
.toc a.current { box-shadow: inset 2px 0 0 var(--c-accent); }

/* ------------------------------------------------------------------ text */
h1, h2, h3, h4 { color: var(--c-strong); font-family: "Roboto Condensed", -apple-system, "Segoe UI", sans-serif; font-weight: 400; line-height: 1.25; }
h1 { margin: 0 0 10px; font-size: 38px; }
h2 { margin: 48px 0 12px; padding-top: 8px; font-size: 27px; border-top: 1px solid var(--c-line-soft); }
h3 { margin: 30px 0 8px; font-size: 21px; }
h4 { margin: 22px 0 6px; font-size: 17px; }
h2 .anchor, h3 .anchor { margin-left: 8px; color: var(--c-muted); opacity: 0; font-size: 0.8em; }
h2:hover .anchor, h3:hover .anchor { opacity: 1; }
p, ul, ol { margin: 0 0 14px; }
li { margin: 4px 0; }
.lead { margin-bottom: 26px; color: var(--c-muted); font-size: 19px; line-height: 1.55; }
strong { color: var(--c-strong); font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--c-line-soft); margin: 32px 0; }

/* UI names (buttons, tabs, fields) and $variables */
.ui {
  padding: 1px 6px;
  border: 1px solid var(--c-line);
  border-radius: 4px;
  background: var(--c-panel);
  color: var(--c-strong);
  font-size: 0.92em;
  white-space: nowrap;
}
.var { color: var(--c-var); font-family: Consolas, "Cascadia Mono", Menlo, monospace; font-size: 0.93em; }
kbd {
  display: inline-block;
  min-width: 22px;
  padding: 0 6px;
  border: 1px solid var(--c-line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--c-panel);
  color: var(--c-strong);
  font: 0.85em/1.6 Consolas, "Cascadia Mono", Menlo, monospace;
  text-align: center;
}

code { padding: 1px 5px; border-radius: 4px; background: var(--c-code-bg); color: var(--c-code); font: 0.9em Consolas, "Cascadia Mono", Menlo, monospace; }
pre {
  position: relative;
  margin: 0 0 18px;
  padding: 14px 16px;
  overflow-x: auto;
  border: 1px solid var(--c-line-soft);
  border-radius: 8px;
  background: var(--c-code-bg);
  color: var(--c-code);
  font: 14px/1.55 Consolas, "Cascadia Mono", Menlo, monospace;
  tab-size: 2;
}
pre code { padding: 0; background: none; font-size: inherit; }
/* License texts (licenses.html): prose, so wrap instead of scrolling sideways. */
pre.licenseText { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
pre[data-label]::before { content: attr(data-label); display: block; margin: -4px 0 8px; color: var(--c-muted); font: 12px/1.4 -apple-system, "Segoe UI", sans-serif; letter-spacing: 0.05em; text-transform: uppercase; }
.copyBtn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 9px;
  border: 1px solid var(--c-line);
  border-radius: 5px;
  background: var(--c-panel);
  color: var(--c-muted);
  font: 12px/1.6 -apple-system, "Segoe UI", sans-serif;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
pre:hover .copyBtn, .copyBtn:focus { opacity: 1; }
.copyBtn:hover { color: var(--c-strong); }

/* tables */
.tableWrap { margin: 0 0 18px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--c-line-soft); text-align: left; vertical-align: top; }
th { color: var(--c-strong); font-weight: 600; border-bottom-color: var(--c-line); }
td code { white-space: nowrap; }

/* call-outs */
.callout { margin: 0 0 18px; padding: 12px 16px; border-left: 4px solid var(--c-accent); border-radius: 0 8px 8px 0; background: var(--c-note-bg); }
.callout > :last-child { margin-bottom: 0; }
.callout::before { display: block; margin-bottom: 2px; color: var(--c-strong); font-weight: 600; content: "Note"; }
.callout.tip { border-left-color: var(--c-ok); background: var(--c-tip-bg); }
.callout.tip::before { content: "Tip"; }
.callout.warn { border-left-color: var(--c-warn); background: var(--c-warn-bg); }
.callout.warn::before { content: "Watch out"; }

/* numbered walkthroughs */
ol.steps { counter-reset: step; padding: 0; list-style: none; }
ol.steps > li { position: relative; margin: 0 0 16px; padding-left: 44px; }
ol.steps > li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--c-accent);
  color: var(--c-page);
  font-weight: 700;
  font-size: 14px;
  line-height: 28px;
  text-align: center;
}

/* screenshots: one image per theme; the other is display:none (and lazy, so not loaded) */
figure.shot { margin: 8px 0 24px; }
figure.shot img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  box-shadow: 0 6px 24px var(--c-shadow);
  cursor: zoom-in;
}
figure.shot figcaption { margin-top: 8px; color: var(--c-muted); font-size: 14px; }
.shot-light { display: none !important; }
:root[data-theme="light"] .shot-light { display: block !important; }
:root[data-theme="light"] .shot-dark { display: none !important; }

.lightbox { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(8, 10, 20, 0.86); cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }

/* example flow box */
.example {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin: 0 0 22px;
  padding: 14px 16px;
  border: 1px solid var(--c-line);
  border-radius: 10px;
  background: var(--c-panel);
}
.example::before { content: "▶"; flex: none; width: 32px; height: 32px; border-radius: 8px; background: var(--c-ok); color: #fff; font-size: 14px; line-height: 32px; text-align: center; }
.example > div > :last-child { margin-bottom: 0; }
.example .exTitle { margin: 0 0 4px; color: var(--c-strong); font-weight: 600; }

/* method badges in step lists */
.method { display: inline-block; min-width: 54px; padding: 0 6px; border: 1px solid var(--c-line); border-radius: 4px; background: var(--c-panel); font: 12px/20px Consolas, "Cascadia Mono", monospace; text-align: center; }
.method.get { color: var(--method-get); }
.method.post { color: var(--method-post); }
.method.put { color: var(--method-put); }
.method.patch { color: var(--method-patch); }
.method.delete { color: var(--method-delete); }

/* home page cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin: 0 0 26px; }
.card { display: block; padding: 16px; border: 1px solid var(--c-line); border-radius: 10px; background: var(--c-panel); color: var(--c-text); }
.card:hover { border-color: var(--c-accent); text-decoration: none; color: var(--c-text); }
.card strong { display: block; margin-bottom: 4px; font-size: 17px; }
.card span { color: var(--c-muted); font-size: 14px; line-height: 1.5; }

/* prev / next */
.pager { display: flex; justify-content: space-between; gap: 14px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--c-line-soft); }
.pager a { flex: 1; max-width: 48%; padding: 12px 14px; border: 1px solid var(--c-line); border-radius: 8px; color: var(--c-strong); }
.pager a:hover { border-color: var(--c-accent); text-decoration: none; }
.pager a span { display: block; color: var(--c-muted); font-size: 13px; }
.pager .next { margin-left: auto; text-align: right; }
.footer { margin-top: 36px; color: var(--c-muted); font-size: 13px; }

/* ------------------------------------------------------------------ narrow screens */
@media (max-width: 1240px) {
  .toc { display: none; }
}
@media (max-width: 900px) {
  .menuToggle { display: inline-flex; }
  .brand .brandSub { display: none; }
  .sidebar { position: fixed; left: 0; top: 56px; z-index: 15; transform: translateX(-100%); transition: transform 0.2s; box-shadow: 0 0 30px var(--c-shadow); }
  body.menuOpen .sidebar { transform: none; }
  .content { padding: 24px 16px 60px; }
  h1 { font-size: 31px; }
  .topbar .spacer { display: none; }
  .searchBox { width: auto; flex: 1; min-width: 0; }
  .searchResults { position: fixed; top: 60px; left: 12px; right: 12px; width: auto; }
  .pager { flex-direction: column; }
  .pager a { max-width: none; }
}

@media print {
  .topbar, .sidebar, .toc, .pager, .copyBtn { display: none !important; }
  .content { padding: 0; }
}
