/* =========================================================================
   PIVlab Manual — stylesheet
   Light/dark theming via CSS variables on <html data-theme="…">.
   ========================================================================= */

:root {
  /* PIVlab.de identity: dark header, lime-green bar, white page, gold links */
  --brand-dark: #12160f;      /* near-black header (holds the colourful logo) */
  --brand-dark-2: #1d251a;    /* subtle header gradient end */
  --lime: #c3d400;            /* signature lime-green download bar */
  --lime-dark: #9aab00;       /* darker lime for borders / hovers */
  --gold: #c9a11f;            /* PIVlab.de link/accent gold */
  --gold-strong: #8a6d0a;     /* readable gold for text links */

  --accent: #8a6d0a;          /* links, active states — readable gold */
  --accent-strong: #6f5700;
  --bg: #ffffff;
  --bg-soft: #f7f7f0;
  --bg-sidebar: #f1f2e8;
  --text: #2b2b2b;
  --text-soft: #67635a;
  --border: #e2e1d3;
  --code-bg: #f0efe6;
  --shadow: 0 1px 3px rgba(30,30,20,.10), 0 8px 24px rgba(30,30,20,.08);
  --header-h: 56px;
  --sidebar-w: 264px;
  --toc-w: 220px;
  --maxw: 820px;
  --radius: 8px;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
html[data-theme="dark"] {
  --brand-dark: #10140e;
  --brand-dark-2: #171d14;
  --lime: #c3d400;
  --lime-dark: #9aab00;
  --gold: #d9b849;
  --gold-strong: #e2c66a;

  --accent: #d9b849;          /* lighter gold for links on dark */
  --accent-strong: #e7cf7d;
  --bg: #14170f;
  --bg-soft: #1c2016;
  --bg-sidebar: #181c12;
  --text: #e2e2d3;
  --text-soft: #9c9a89;
  --border: #2d3226;
  --code-bg: #1f2418;
  --shadow: 0 1px 3px rgba(0,0,0,.45), 0 8px 24px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0; font-family: var(--sans); color: var(--text);
  background: var(--bg); font-size: 16px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ----------------------------------------------------------------- Site header */
/* Two-tier header, mirroring pivlab.de: a dark hero band carrying the logo
   artwork (non-sticky, scrolls away) above a sticky lime action bar. */
.hero {
  display: block; position: relative; height: 84px; overflow: hidden;
  /* Logo artwork pinned left, no-repeat; flat fill picks up exactly where it
     ends and continues to the right edge of the bar. */
  background-color: #515151;
  background-image: url(../img/header-hero.png);
  background-repeat: no-repeat;
  background-position: left center;
  background-size: auto 100%;
}
.hero:hover { text-decoration: none; }
.hero-title {
  position: absolute; right: 24px; bottom: 14px; font-size: 15px; font-weight: 600;
  letter-spacing: .2px; color: rgba(255,255,255,.78); text-shadow: 0 1px 0 rgba(0,0,0,.4);
}
.action-bar {
  position: sticky; top: 0; z-index: 40; height: var(--header-h);
  display: flex; align-items: center; gap: 14px; padding: 0 20px;
  background: var(--lime); border-bottom: 1px solid var(--lime-dark);
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.burger {
  display: none; background: none; border: none; color: var(--brand-dark);
  font-size: 22px; cursor: pointer; padding: 4px 6px;
}
.gh-link {
  border: 1px solid #E6E507; background: #FFE788; padding: 7px 14px; border-radius: 4px;
  color: #333; font-size: 13px; font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 1px 1px rgba(0,0,0,.1);
}
.gh-link:hover { background: #ffeca0; text-decoration: none; }
.theme-toggle {
  background: none; border: 1px solid rgba(0,0,0,.3); color: var(--brand-dark);
  width: 34px; height: 34px; border-radius: 6px; cursor: pointer; font-size: 15px;
}
.theme-toggle:hover { border-color: var(--brand-dark); }
.site-mark {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  background: url(../img/optolution-mark.png) center / cover no-repeat;
  box-shadow: 0 0 0 2px rgba(0,0,0,.08);
}

/* ------------------------------------------------------------------- Search */
.search { position: relative; margin-left: auto; width: min(360px, 40vw); }
.search input {
  width: 100%; padding: 8px 12px; border: 1px solid rgba(0,0,0,.3); border-radius: 8px;
  background: rgba(255,255,255,.92); color: #1c2530; font-size: 14px; font-family: inherit;
}
.search input::placeholder { color: #6b6752; }
.search input:focus { outline: none; border-color: var(--lime-dark); background: #fff; box-shadow: 0 0 0 3px rgba(195,212,0,.30); }
.search-panel {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); overflow: hidden; max-height: 60vh; overflow-y: auto;
}
.search-panel.open { display: block; }
.search-hit { display: flex; flex-direction: column; padding: 9px 14px; border-bottom: 1px solid var(--border); }
.search-hit:last-child { border-bottom: none; }
.search-hit:hover { background: var(--bg-soft); text-decoration: none; }
.search-hit-title { font-weight: 600; color: var(--text); font-size: 14px; }
.search-hit-section { font-size: 12px; color: var(--text-soft); }
.search-empty { padding: 14px; color: var(--text-soft); font-size: 14px; }

/* ------------------------------------------------------------------ Layout */
.layout {
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  align-items: start; max-width: 1360px; margin: 0 auto;
}
.sidebar {
  position: sticky; top: var(--header-h); align-self: start;
  height: calc(100vh - var(--header-h)); overflow-y: auto;
  padding: 22px 14px 40px; border-right: 1px solid var(--border);
  background: var(--bg-sidebar);
}
.nav-group { margin-bottom: 20px; }
.nav-group-title {
  margin: 0 0 6px; padding: 0 10px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px; color: var(--text-soft);
}
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; margin: 1px 0; border-radius: 6px; font-size: 14px;
  color: var(--text-soft); border-left: 2px solid transparent;
}
.nav-link:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.nav-link.active {
  color: var(--accent); background: var(--bg-soft); font-weight: 600;
  border-left-color: var(--lime-dark);
}
.nav-link.soon { color: var(--text-soft); opacity: .55; cursor: default; }
.nav-link.soon:hover { background: none; }
.badge {
  font-size: 9px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700;
  background: var(--border); color: var(--text-soft); padding: 2px 5px; border-radius: 4px;
}

/* --------------------------------------------------------------------- Main */
.main { padding: 34px 44px 60px; min-width: 0; }
.breadcrumb { font-size: 13px; color: var(--text-soft); margin-bottom: 18px; }
.breadcrumb .sep { margin: 0 7px; opacity: .6; }
.breadcrumb .current { color: var(--text); }

#doc { max-width: var(--maxw); }
#doc h1 { font-size: 2.1rem; line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.02em; }
#doc h2 {
  font-size: 1.45rem; margin: 2.2em 0 .6em; padding-top: .3em;
  border-top: 1px solid var(--border);
}
#doc h2:first-of-type { border-top: none; }
#doc h3 { font-size: 1.12rem; margin: 1.8em 0 .5em; }
#doc p { margin: 0 0 1.1em; }
#doc ul, #doc ol { margin: 0 0 1.2em; padding-left: 1.4em; }
#doc li { margin: .35em 0; }
#doc strong { color: var(--text); }
#doc .lead { font-size: 1.15rem; color: var(--text-soft); margin-bottom: 1.6em; }

/* UI label / key chips */
.ui { font-weight: 600; color: var(--text); }
kbd {
  font-family: var(--mono); font-size: .82em; background: var(--code-bg);
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px;
  padding: 1px 6px; color: var(--text);
}
code {
  font-family: var(--mono); font-size: .88em; background: var(--code-bg);
  padding: 2px 6px; border-radius: 5px;
}

/* Figures */
figure { margin: 1.6em 0; }
figure img {
  max-width: 100%; height: auto; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); display: block;
}
figure.inline-panel img { max-width: 300px; }
figcaption { font-size: 13px; color: var(--text-soft); margin-top: .6em; }

/* Annotated screenshot: an SVG overlay aligned on top of an image. The wrapper
   matches the image's box exactly, so viewBox coordinates map 1:1 to pixels. */
.annot { position: relative; display: block; line-height: 0; }
.annot img { display: block; width: 100%; }
.annot svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
/* Numbered legend under an annotated figure */
.legend { list-style: none; margin: .6em 0 0; padding: 0; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 2px 18px; font-size: 13px; }
.legend li { display: flex; align-items: baseline; gap: 7px; color: var(--text-soft); }
.legend .n { flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; background: var(--lime); color: var(--brand-dark);
  font-size: 11px; font-weight: 800; align-self: center; }
.legend b { color: var(--text); font-weight: 600; }

/* Callouts */
.note, .tip, .warn {
  border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--radius);
  padding: 12px 16px; margin: 1.4em 0; background: var(--bg-soft); font-size: .96em;
}
.note { border-left-color: var(--accent); }
.tip  { border-left-color: #3aab6d; }
.warn { border-left-color: #d9902a; }
.note strong, .tip strong, .warn strong { display: block; margin-bottom: 2px; }

/* Two-column: text beside a panel screenshot */
.split { display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: start; }
.split figure { margin: .3em 0; }
.split figure img { max-width: 250px; }
@media (max-width: 720px) { .split { grid-template-columns: 1fr; } }

/* Steps list */
ol.steps { counter-reset: step; list-style: none; padding-left: 0; }
ol.steps > li {
  position: relative; padding-left: 40px; margin: .9em 0; counter-increment: step;
}
ol.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; border-radius: 50%; background: var(--lime); color: var(--brand-dark);
  font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}

/* Definition-style reference table */
table.ref { border-collapse: collapse; width: 100%; margin: 1.4em 0; font-size: .95em; }
table.ref th, table.ref td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.ref th { color: var(--text-soft); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
table.ref td:first-child { white-space: nowrap; font-weight: 600; }

/* --------------------------------------------------------------------- TOC */
.toc-rail {
  position: sticky; top: var(--header-h); align-self: start;
  height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 34px 16px;
}
.toc-title { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-soft); margin: 0 0 8px; font-weight: 700; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc li { margin: 0; }
.toc li.h3 a { padding-left: 22px; font-size: 12.5px; }
.toc a {
  display: block; padding: 4px 12px; margin-left: -1px; font-size: 13px;
  color: var(--text-soft); border-left: 2px solid transparent;
}
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }

/* -------------------------------------------------------------------- Pager */
.pager { display: flex; justify-content: space-between; gap: 16px; margin: 40px 0 0; max-width: var(--maxw); }
.pager-link {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 18px;
  border: 1px solid var(--border); border-radius: var(--radius); min-width: 160px;
}
.pager-link:hover { border-color: var(--accent); text-decoration: none; }
.pager-link.next { text-align: right; margin-left: auto; }
.pager-dir { font-size: 12px; color: var(--text-soft); }
.pager-label { font-weight: 600; color: var(--text); }

.site-footer {
  margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-soft); max-width: var(--maxw);
}

/* Landing page cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin: 1.8em 0; }
.card {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 18px;
  background: var(--bg-soft); display: block; color: var(--text);
}
.card:hover { border-color: var(--accent); text-decoration: none; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.card p { margin: 0; font-size: .9em; color: var(--text-soft); }
.card.soon { opacity: .55; }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 1100px) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc-rail { display: none; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .burger { display: block; }
  .sidebar {
    position: fixed; top: var(--header-h); left: 0; width: 82%; max-width: 320px;
    transform: translateX(-102%); transition: transform .22s ease; z-index: 45;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 26px 20px 50px; }
  .search { width: auto; flex: 1; }
  .hero { height: 60px; }
  .hero-title { display: none; }
  .site-mark { display: none; }
}
