/* =========================================================================
   PIVlab website — stylesheet (pages built with _layouts/default.html)
   Same colours as the manual (manual/assets/css/style.css).
   Light/dark theme via <html data-theme="light|dark">, set by the inline
   script in the layout (follows the system, or the toggle button).
   ========================================================================= */

:root {
  --hero-bg: #515151;
  --lime: #c3d400;
  --lime-dark: #9aab00;
  --btn-bg: #ffe788;
  --btn-border: #e6e507;
  --accent: #8a6d0a;          /* links: readable gold */
  --accent-strong: #6f5700;
  --page-bg: #ecece6;
  --card-bg: #fbfbfb;
  --card-border: #cbcbcb;
  --bg-soft: #f3f3ea;
  --text: #2b2b2b;
  --text-soft: #67635a;
  --border: #e2e1d3;
  --code-bg: #f0efe6;
  --callout-bg: #fbf6dc;
  --callout-border: #d9b849;
  --beta-bg: #edf8e9;
  --shadow: 0 1px 3px rgba(30,30,20,.10), 0 8px 24px rgba(30,30,20,.08);
  --bar-h: 52px;
  --maxw: 1180px;
  --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"] {
  --hero-bg: #4a4a4a;
  --accent: #d9b849;
  --accent-strong: #e7cf7d;
  --page-bg: #101310;
  --card-bg: #171b14;
  --card-border: #2d3226;
  --bg-soft: #1f2419;
  --text: #e2e2d3;
  --text-soft: #a3a190;
  --border: #2d3226;
  --code-bg: #1f2418;
  --callout-bg: #262513;
  --callout-border: #a88f2c;
  --beta-bg: #17261a;
  --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(--bar-h) + 16px); }
body {
  margin: 0; font-family: var(--sans); color: var(--text); background: var(--page-bg);
  font-size: 16px; line-height: 1.65; -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
.skip-link { position: absolute; left: -999px; top: 0; background: #fff; padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* ------------------------------------------------------------------ Header */
.hero {
  position: relative; display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; min-height: 150px; padding: 14px 24px;
  background-color: var(--hero-bg);
  background-image: url(../images/header.jpg);
  background-repeat: no-repeat; background-position: left center; background-size: auto 100%;
}
.hero-logo { display: block; align-self: stretch; width: 210px; flex: none; }
.hero-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.hero-tagline {
  margin: 0; color: #f3f3f3; font-size: 22px; font-weight: 600; letter-spacing: .2px;
  text-shadow: 0 2px 0 rgba(0,0,0,.35); text-align: right;
}
.downloads { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.downloads-label {
  color: #e6ee7c; font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; margin-right: 4px;
}
.dl-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--btn-border); background: var(--btn-bg); color: #333;
  padding: 7px 12px; border-radius: 4px; font-size: 13px; font-weight: 700; line-height: 1.2;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 1px 1px rgba(0,0,0,.15);
}
.dl-btn:hover { background: #fff1b8; text-decoration: none; }
.dl-btn.gh { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.35); color: #f3f3f3; }
.dl-btn.gh:hover { background: rgba(255,255,255,.22); }
.dl-btn svg { width: 14px; height: 14px; fill: currentColor; flex: none; }
/* Beta button (added by beta.js while a pre-release exists): green, inviting to try the newest version */
.dl-btn.beta { background: #a6e39a; border-color: #4fae4a; }
.dl-btn.beta:hover { background: #c4efba; }

/* Lime menu bar (sticky) */
.action-bar {
  position: sticky; top: 0; z-index: 40; min-height: var(--bar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  background: var(--lime); border-bottom: 1px solid var(--lime-dark);
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.menu { display: flex; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; gap: 2px; }
.menu a {
  display: block; padding: 6px 10px; border-radius: 5px; color: #1d2410;
  font-size: 14.5px; font-weight: 600; white-space: nowrap;
}
.menu a:hover { background: rgba(255,255,255,.35); text-decoration: none; }
.menu a.active { background: #fff; color: #1d2410; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.burger {
  display: none; align-items: center; gap: 6px; background: none; border: 1px solid rgba(0,0,0,.3);
  border-radius: 6px; color: #1d2410; font: 600 14px var(--sans); padding: 6px 10px; cursor: pointer;
}
.theme-toggle {
  flex: none; background: none; border: 1px solid rgba(0,0,0,.3); color: #1d2410;
  width: 34px; height: 34px; border-radius: 6px; cursor: pointer; font-size: 15px;
}
.theme-toggle:hover { border-color: #1d2410; }
.site-mark {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  background: url(../../manual/assets/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: 260px; flex: none; }
.search input {
  width: 100%; padding: 7px 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(255,255,255,.5); }
.search-panel {
  display: none; position: absolute; top: calc(100% + 6px); right: 0; width: min(440px, 92vw);
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); max-height: 70vh; overflow-y: auto; z-index: 50;
}
.search-panel.open { display: block; }
.search-group { padding: 8px 14px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-soft); }
.search-hit { display: flex; flex-direction: column; padding: 8px 14px; border-top: 1px solid var(--border); }
.search-hit:hover, .search-hit.sel { 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 */
.page {
  display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 24px;
  max-width: var(--maxw); margin: 24px auto 0; padding: 0 20px; align-items: start;
}
.page.no-toc { grid-template-columns: minmax(0, 1fr); max-width: 980px; }
.card-main {
  background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,.09); padding: 30px 40px 44px; min-width: 0;
}
.toc-rail { position: sticky; top: calc(var(--bar-h) + 20px); max-height: calc(100vh - var(--bar-h) - 40px); overflow-y: auto; }
.toc-title { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-soft); margin: 0 0 8px; font-weight: 700; }
.toc-rail ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--card-border); }
.toc-rail a {
  display: block; padding: 4px 12px; margin-left: -1px; font-size: 13px; line-height: 1.4;
  color: var(--text-soft); border-left: 2px solid transparent;
}
.toc-rail a:hover { color: var(--text); text-decoration: none; }
.toc-rail a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }

.breadcrumb { font-size: 13px; color: var(--text-soft); margin: 0 0 14px; }
.breadcrumb .sep { margin: 0 7px; opacity: .6; }

/* ------------------------------------------------------------------- Prose */
.prose { max-width: 820px; }
.prose h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
.prose h2 { font-size: 1.4rem; line-height: 1.3; margin: 2em 0 .6em; padding-top: .5em; border-top: 1px solid var(--border); }
.prose h1 + h2, .prose > h2:first-child { border-top: none; margin-top: .6em; }
.prose h3 { font-size: 1.12rem; margin: 1.6em 0 .5em; }
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { margin: 0 0 1.1em; padding-left: 1.4em; }
.prose li { margin: .3em 0; }
.prose li > ul, .prose li > ol { margin: .3em 0; }
.prose .lead { font-size: 1.12rem; color: var(--text-soft); }
.prose img { border-radius: 4px; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.prose table { border-collapse: collapse; margin: 1.2em 0; font-size: .95em; }
.prose th, .prose td { text-align: left; padding: 8px 14px; border-bottom: 1px solid var(--border); }
.prose th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-soft); }
code { font-family: var(--mono); font-size: .88em; background: var(--code-bg); padding: 2px 6px; border-radius: 5px; overflow-wrap: anywhere; }
pre { background: var(--code-bg); padding: 12px 16px; border-radius: var(--radius); overflow-x: auto; }
pre code { background: none; padding: 0; overflow-wrap: normal; }

/* Blockquote = highlighted hint box ("> **Important:** ...") */
.prose blockquote {
  margin: 1.4em 0; padding: 12px 16px; border: 1px solid var(--callout-border); border-left-width: 4px;
  border-radius: var(--radius); background: var(--callout-bg);
}
.prose blockquote p:last-child { margin-bottom: 0; }

/* Numbered steps (all ordered lists on camera pages) */
.steps ol { counter-reset: step; list-style: none; padding-left: 0; }
.steps ol > li { position: relative; padding-left: 40px; margin: .8em 0; counter-increment: step; }
.steps ol > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; border-radius: 50%; background: var(--lime); color: #1d2410;
  font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}

/* Camera facts box */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px; margin: 0 0 1.6em; padding: 14px 18px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); font-size: .95em; }
.facts dt { font-weight: 600; color: var(--text-soft); }
.facts dd { margin: 0; }

/* Switch (Standalone / MATLAB toolbox, Euresys / BitFlow), built by site.js */
.switch { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; margin: .4em 0 .6em;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 9px; }
.switch button {
  border: 0; background: none; color: var(--text-soft); font: 600 14px var(--sans);
  padding: 7px 14px; border-radius: 6px; cursor: pointer;
}
.switch button:hover { color: var(--text); }
.switch button[aria-selected="true"] { background: var(--card-bg); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.switch-panel { border-left: 3px solid var(--lime); padding: 2px 0 2px 16px; margin-bottom: 1.2em; }
.switch-panel > h3:first-child, .switch-panel > h4:first-child { display: none; }
.switch-panel .switch-panel { border-left-color: var(--border); }

/* Cards (wiki tiles, camera overview, download options) */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 1em 0 1.8em; }
.card {
  display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; color: var(--text);
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius);
}
a.card:hover { border-color: var(--accent); box-shadow: var(--shadow); text-decoration: none; }
.card h3 { margin: 0; font-size: 1.05rem; color: var(--text); }
.card p { margin: 0; font-size: .92em; color: var(--text-soft); }
.card img { border-radius: 4px; margin-bottom: 6px; }
/* Camera overview: product photo on a white field (photos have white backgrounds) */
.card-photo {
  display: flex; align-items: center; justify-content: center; height: 150px; margin: -16px -18px 10px;
  background: #fff; border-radius: var(--radius) var(--radius) 0 0; border-bottom: 1px solid var(--border); overflow: hidden;
}
.card-photo img { max-height: 134px; max-width: 90%; width: auto; margin: 0; border-radius: 0; object-fit: contain; }
.card-photo svg { width: 72px; height: 54px; fill: #c9c9bd; }
.card-photo svg .lens { fill: #fff; stroke: #c9c9bd; stroke-width: 3; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--card-bg); border: 1px solid var(--border); color: var(--text-soft); }
.group-title { font-size: 12px !important; text-transform: uppercase; letter-spacing: .7px; color: var(--text-soft);
  border-top: none !important; margin: 1.8em 0 .2em !important; padding-top: 0 !important; }

/* Big download buttons (home + downloads page) */
.get { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 1.2em 0 1.6em; }
.get a {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border-radius: var(--radius);
  background: var(--btn-bg); border: 1px solid var(--btn-border); color: #333;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 1px 2px rgba(0,0,0,.12);
}
.get a:hover { background: #fff1b8; text-decoration: none; }
.get strong { font-size: 1.05rem; }
.get span { font-size: .88em; color: #5d5a4b; }

/* Text with a narrow screenshot beside it (home page "Complete") */
.media-side { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 24px; align-items: start; margin-bottom: 1em; }
.media-side img { width: 220px; border: 1px solid var(--border); border-radius: 4px; }
@media (max-width: 760px) { .media-side { grid-template-columns: 1fr; } .media-side img { width: 200px; } }

/* FAQ on the home page */
.faq h3 { font-size: 1.02rem; margin: 1.2em 0 .3em; }
.faq p { margin: 0 0 .6em; }

/* Beta box below the download buttons (filled by beta.js) */
.beta-box {
  margin: -0.4em 0 1.6em; padding: 12px 16px; border: 1px solid #4fae4a; border-left-width: 4px;
  border-radius: var(--radius); background: var(--beta-bg);
}
.beta-box p { margin: 0 0 .4em; }
.beta-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 6px; }
.beta-btn {
  display: inline-block; padding: 7px 12px; border-radius: 4px; font-weight: 700; font-size: 14px; color: #333;
  background: #a6e39a; border: 1px solid #4fae4a;
}
.beta-btn:hover { background: #c4efba; text-decoration: none; }

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

/* Click-to-load YouTube video */
.video { margin: 1em 0 1.6em; }
.video-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius); cursor: pointer; color: #f3f3f3;
  /* thumbnail (--thumb, set by site.js from assets/images/videos/<id>.jpg), darkened towards the bottom for the title */
  background:
    linear-gradient(to bottom, rgba(0,0,0,.05) 35%, rgba(0,0,0,.78) 100%),
    var(--thumb, none) center / cover no-repeat,
    linear-gradient(135deg, #1d251a 0%, #2b2f28 55%, #4a4a4a 100%);
  font-family: var(--sans); padding: 16px 16px 14px; text-shadow: 0 1px 3px rgba(0,0,0,.8);
}
.video-btn .video-title { position: absolute; left: 16px; right: 16px; bottom: 34px; }
.video-btn .video-note { position: absolute; left: 16px; right: 16px; bottom: 12px; }
.video-btn > * { position: relative; }
.video-play { width: 68px; height: 48px; border-radius: 12px; background: #d22; display: flex; align-items: center; justify-content: center; }
.video-play::after { content: ""; border-style: solid; border-width: 10px 0 10px 17px; border-color: transparent transparent transparent #fff; margin-left: 4px; }
.video-btn:hover .video-play { background: #f00; }
.video-title { font-size: 17px; font-weight: 600; text-align: center; }
.video-note { font-size: 12px; opacity: .85; text-align: center; }
.video-note a { color: #e6ee7c; }
.video iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius); display: block; }

/* Short looping animation (MP4, GIF as fallback) */
video.anim { display: block; max-width: 100%; height: auto; border-radius: 4px; margin: 0 0 1em; }
.shots video.anim { border: 1px solid var(--border); margin: 0; }

/* Screenshots */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.shots figure { margin: 0; }
.shots img { display: block; border: 1px solid var(--border); border-radius: 4px; }
.shots figcaption { font-size: 13px; color: var(--text-soft); margin-top: 4px; }

/* ------------------------------------------------------------------ Footer */
.site-footer {
  max-width: var(--maxw); margin: 28px auto 0; padding: 18px 20px 36px; font-size: 13px; color: var(--text-soft);
  display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: space-between;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }

/* -------------------------------------------------------------- Responsive */
@media (max-width: 1200px) {
  .page { grid-template-columns: minmax(0, 1fr); max-width: 980px; }
  .toc-rail { display: none; }
}
@media (max-width: 1080px) {
  .burger { display: inline-flex; }
  .menu {
    display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--lime); border-bottom: 1px solid var(--lime-dark); padding: 6px 12px 12px;
    box-shadow: 0 6px 12px rgba(0,0,0,.18);
  }
  .menu.open { display: flex; }
  .menu a { padding: 10px 12px; font-size: 15px; }
  .search { flex: 1; width: auto; max-width: 380px; }
}
@media (max-width: 760px) {
  .hero { flex-direction: column; align-items: stretch; min-height: 0; padding: 10px 14px 12px; background-size: auto 92px; background-position: left top; }
  .hero-logo { width: 140px; height: 76px; align-self: flex-start; }
  .hero-side { align-items: stretch; }
  .hero-tagline { display: none; }
  .downloads { justify-content: flex-start; }
  .dl-btn { padding: 6px 9px; font-size: 12.5px; }
  .action-bar { padding: 0 12px; gap: 8px; }
  /* results span the whole bar (positioned against .action-bar), not only the narrow search box */
  .search { position: static; }
  .search-panel { left: 10px; right: 10px; width: auto; top: calc(100% + 4px); }
  .site-mark { display: none; }
  .page { margin-top: 12px; padding: 0 10px; }
  .card-main { padding: 20px 16px 30px; }
  .prose h1 { font-size: 1.6rem; }
  .facts { grid-template-columns: 1fr; }
  .facts dd { margin-bottom: 6px; }
}
